Table of Contents

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

int

ClearWindBitsMask

public const int ClearWindBitsMask = 33554431

Field Value

int

ClearWindDataBitsMask

public const int ClearWindDataBitsMask = 536870911

Field Value

int

ClearWindModeBitsMask

public const int ClearWindModeBitsMask = -503316481

Field Value

int

ClearZOffsetMask

public const int ClearZOffsetMask = -1793

Field Value

int

GlowLevelBitMask

Bit 0..7

public const int GlowLevelBitMask = 255

Field Value

int

LiquidExposedToSkyBitMask

public const int LiquidExposedToSkyBitMask = 536870912

Field Value

int

LiquidFullAlphaBitMask

public const int LiquidFullAlphaBitMask = 268435456

Field Value

int

LiquidIsLavaBitMask

public const int LiquidIsLavaBitMask = 33554432

Field Value

int

LiquidWeakFoamBitMask

public const int LiquidWeakFoamBitMask = 67108864

Field Value

int

LiquidWeakWaveBitMask

public const int LiquidWeakWaveBitMask = 134217728

Field Value

int

Lod0BitMask

Bit 12

public const int Lod0BitMask = 4096

Field Value

int

NormalBitMask

Bit 13..24

public const int NormalBitMask = 33546240

Field Value

int

NormalBitPos

public const int NormalBitPos = 13

Field Value

int

ReflectiveBitMask

Bit 11. Note if this is set to 1, then WindData has a different meaning,

public const int ReflectiveBitMask = 2048

Field Value

int

WindBitsMask

Bit 26..31

public const int WindBitsMask = -33554432

Field Value

int

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

int

WindDataBitsPos

public const int WindDataBitsPos = 29

Field Value

int

WindModeBitsMask

Bit 25..28

public const int WindModeBitsMask = 503316480

Field Value

int

WindModeBitsPos

public const int WindModeBitsPos = 25

Field Value

int

ZOffsetBitMask

Bit 8..10

public const int ZOffsetBitMask = 1792

Field Value

int

ZOffsetBitPos

public const int ZOffsetBitPos = 8

Field Value

int

Properties

All

Sets all the vertex flags from one integer.

[JsonProperty]
public int All { get; set; }

Property Value

int

GlowLevel

[JsonProperty]
public byte GlowLevel { get; set; }

Property Value

byte

Lod0

[JsonProperty]
public bool Lod0 { get; set; }

Property Value

bool

Normal

[JsonProperty]
public short Normal { get; set; }

Property Value

short

Reflective

[JsonProperty]
public bool Reflective { get; set; }

Property Value

bool

WindData

[JsonProperty]
public byte WindData { get; set; }

Property Value

byte

WindMode

[JsonProperty]
public EnumWindBitMode WindMode { get; set; }

Property Value

EnumWindBitMode

ZOffset

[JsonProperty]
public byte ZOffset { get; set; }

Property Value

byte

Methods

Clone()

Clones this set of vertex flags.

public VertexFlags Clone()

Returns

VertexFlags

PackNormal(double, double, double)

Creates an already bit shifted normal

public static int PackNormal(double x, double y, double z)

Parameters

x double
y double
z double

Returns

int

PackNormal(Vec3d)

Creates an already bit shifted normal

public static int PackNormal(Vec3d normal)

Parameters

normal Vec3d

Returns

int

PackNormal(Vec3f)

Creates an already bit shifted normal

public static int PackNormal(Vec3f normal)

Parameters

normal Vec3f

Returns

int

PackNormal(Vec3i)

Creates an already bit shifted normal

public static int PackNormal(Vec3i normal)

Parameters

normal Vec3i

Returns

int

ReplaceWindData(ref int, int)

public static void ReplaceWindData(ref int flags, int windData)

Parameters

flags int
windData int

SetWindData(ref int, int)

public static void SetWindData(ref int flags, int windData)

Parameters

flags int
windData int

SetWindMode(ref int, int)

public static void SetWindMode(ref int flags, int windMode)

Parameters

flags int
windMode int

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

vertexFlags int
intoDouble double[]

UnpackNormal(int, float[])

public static void UnpackNormal(int vertexFlags, float[] intoFloats)

Parameters

vertexFlags int
intoFloats float[]