Class VertexFlags
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Special class to handle the vertex flagging in a very nicely compressed space.
Bit 0-7: Glow level
Bit 8-10: Z-Offset
Bit 11: Reflective bit
Bit 12: Lod 0 Bit
Bit 13-24: X/Y/Z Normals
Bit 25, 26, 27, 28: Wind mode
Bit 29, 30, 31: Wind data (also sometimes used for other data, e.g. reflection mode if Reflective bit is set, or additional water surface data if this is a water block)
[JsonObject(MemberSerialization.OptIn)]
public class VertexFlags
- Inheritance
-
VertexFlags
- Inherited Members
- Extension Methods
Examples
"vertexFlagsByType": {
"metalblock-new-*": {
"reflective": true,
"windDataByType": {
"*-gold": 1,
"*": 1
}
}
},
Constructors
VertexFlags()
public VertexFlags()
VertexFlags(int)
public VertexFlags(int flags)
Parameters
flags
int
Fields
ClearNormalBitMask
public const int ClearNormalBitMask = -33546241
Field Value
ClearWindBitsMask
public const int ClearWindBitsMask = 33554431
Field Value
ClearWindDataBitsMask
public const int ClearWindDataBitsMask = 536870911
Field Value
ClearWindModeBitsMask
public const int ClearWindModeBitsMask = -503316481
Field Value
ClearZOffsetMask
public const int ClearZOffsetMask = -1793
Field Value
GlowLevelBitMask
Bit 0..7
public const int GlowLevelBitMask = 255
Field Value
LiquidExposedToSkyBitMask
public const int LiquidExposedToSkyBitMask = 536870912
Field Value
LiquidFullAlphaBitMask
public const int LiquidFullAlphaBitMask = 268435456
Field Value
LiquidIsLavaBitMask
public const int LiquidIsLavaBitMask = 33554432
Field Value
LiquidWeakFoamBitMask
public const int LiquidWeakFoamBitMask = 67108864
Field Value
LiquidWeakWaveBitMask
public const int LiquidWeakWaveBitMask = 134217728
Field Value
Lod0BitMask
Bit 12
public const int Lod0BitMask = 4096
Field Value
NormalBitMask
Bit 13..24
public const int NormalBitMask = 33546240
Field Value
NormalBitPos
public const int NormalBitPos = 13
Field Value
ReflectiveBitMask
Bit 11. Note if this is set to 1, then WindData has a different meaning,
public const int ReflectiveBitMask = 2048
Field Value
WindBitsMask
Bit 26..31
public const int WindBitsMask = -33554432
Field Value
WindDataBitsMask
Bit 29..31 Note that WindData is sometimes used for other purposes if WindMode == 0, for example it can hold reflections data, see EnumReflectiveMode.
Also worth noting that WindMode and WindData have totally different meanings for liquid water
public const int WindDataBitsMask = -536870912
Field Value
WindDataBitsPos
public const int WindDataBitsPos = 29
Field Value
WindModeBitsMask
Bit 25..28
public const int WindModeBitsMask = 503316480
Field Value
WindModeBitsPos
public const int WindModeBitsPos = 25
Field Value
ZOffsetBitMask
Bit 8..10
public const int ZOffsetBitMask = 1792
Field Value
ZOffsetBitPos
public const int ZOffsetBitPos = 8
Field Value
Properties
All
Sets all the vertex flags from one integer.
[JsonProperty]
public int All { get; set; }
Property Value
GlowLevel
[JsonProperty]
public byte GlowLevel { get; set; }
Property Value
Lod0
[JsonProperty]
public bool Lod0 { get; set; }
Property Value
Normal
[JsonProperty]
public short Normal { get; set; }
Property Value
Reflective
[JsonProperty]
public bool Reflective { get; set; }
Property Value
WindData
[JsonProperty]
public byte WindData { get; set; }
Property Value
WindMode
[JsonProperty]
public EnumWindBitMode WindMode { get; set; }
Property Value
ZOffset
[JsonProperty]
public byte ZOffset { get; set; }
Property Value
Methods
Clone()
Clones this set of vertex flags.
public VertexFlags Clone()
Returns
PackNormal(double, double, double)
Creates an already bit shifted normal
public static int PackNormal(double x, double y, double z)
Parameters
Returns
PackNormal(Vec3d)
Creates an already bit shifted normal
public static int PackNormal(Vec3d normal)
Parameters
normal
Vec3d
Returns
PackNormal(Vec3f)
Creates an already bit shifted normal
public static int PackNormal(Vec3f normal)
Parameters
normal
Vec3f
Returns
PackNormal(Vec3i)
Creates an already bit shifted normal
public static int PackNormal(Vec3i normal)
Parameters
normal
Vec3i
Returns
ReplaceWindData(ref int, int)
public static void ReplaceWindData(ref int flags, int windData)
Parameters
SetWindData(ref int, int)
public static void SetWindData(ref int flags, int windData)
Parameters
SetWindMode(ref int, int)
public static void SetWindMode(ref int flags, int windMode)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
UnpackNormal(int, double[])
public static void UnpackNormal(int vertexFlags, double[] intoDouble)
Parameters
UnpackNormal(int, float[])
public static void UnpackNormal(int vertexFlags, float[] intoFloats)