Table of Contents

Class CustomMeshDataPart<T>

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

Holds arbitrary mesh data for meshes to be used in a shader

public abstract class CustomMeshDataPart<T>

Type Parameters

T

The arbitrary type.

Inheritance
CustomMeshDataPart<T>
Derived
Inherited Members

Constructors

CustomMeshDataPart()

Blank constructor.

public CustomMeshDataPart()

CustomMeshDataPart(int)

Array initialization constructor.

public CustomMeshDataPart(int arraySize)

Parameters

arraySize int

the size of the typed Array.

Fields

BaseOffset

Used as offset when doing a partial update on an existing buffer

public int BaseOffset

Field Value

int

Count

Amout of values currently added

public int Count

Field Value

int

Instanced

For instanced rendering

public bool Instanced

Field Value

bool

InterleaveOffsets

Offset in bytes for each variable

public int[] InterleaveOffsets

Field Value

int[]

InterleaveSizes

Amount of variable components for variable (i.e. 2, 3 for a vec2 and a vec3), valid values are 1, 2, 3 and 4 (limited by glVertexAttribPointer)

public int[] InterleaveSizes

Field Value

int[]

InterleaveStride

Stride - Size in bytes of all values for one vertex

public int InterleaveStride

Field Value

int

StaticDraw

Set to false if you intend to update the buffer very often (i.e. every frame)

public bool StaticDraw

Field Value

bool

Values

The arbitrary data to be uploaded to the graphics card

public T[] Values

Field Value

T[]

Properties

AllocationSize

Size of the array that should be allocated on the graphics card.

public int AllocationSize { get; }

Property Value

int

BufferSize

Size of the Values array

public int BufferSize { get; }

Property Value

int

Methods

Add(T)

Adds a value to the buffer.

public void Add(T value)

Parameters

value T

The value to add.

Add(params T[])

Adds multiple values to the buffer.

public void Add(params T[] values)

Parameters

values T[]

The values being added.

Add4(T)

Adds the same value to the buffer 4 times - coded for performance.

public void Add4(T value)

Parameters

value T

The value to add.

AutoAllocationSize()

Use the element count as the allocation size (default behavior)

public void AutoAllocationSize()

EmptyClone(CustomMeshDataPart<T>)

Sets a value from a given mesh data part.

protected CustomMeshDataPart<T> EmptyClone(CustomMeshDataPart<T> cloned)

Parameters

cloned CustomMeshDataPart<T>

the mesh data part for this type.

Returns

CustomMeshDataPart<T>

GrowBuffer(int)

Grows the buffer with a minimum.

public void GrowBuffer(int growAtLeastBy = 1)

Parameters

growAtLeastBy int

The minimum amount to grow the buffer by.

SetAllocationSize(int)

Lets you define your a self defined size to be allocated on the graphics card. If not called the allocation size will be the count of the Elements in the Array

public void SetAllocationSize(int size)

Parameters

size int

SetFrom(CustomMeshDataPart<T>)

Sets a value from a given mesh data part.

public void SetFrom(CustomMeshDataPart<T> meshdatapart)

Parameters

meshdatapart CustomMeshDataPart<T>

the mesh data part for this type.