Table of Contents

Class MeshDataPool

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

This is a modeldata pool, which can hold 400k vertices, 300k indices but not more than 900 chunks

public class MeshDataPool
Inheritance
MeshDataPool
Inherited Members

Fields

AllocatedTris

How many triangles are allocated.

public int AllocatedTris

Field Value

int

CurrentFragmentation

The current fragmentaton.

public float CurrentFragmentation

Field Value

float

IndicesPoolSize

the amount of indicies for this pool.

public int IndicesPoolSize

Field Value

int

MaxPartsPerPool

The maximum parts for this pool.

public int MaxPartsPerPool

Field Value

int

RenderedTriangles

How many triangles are rendered.

public int RenderedTriangles

Field Value

int

UsedVertices

How many of the vertices are used.

public int UsedVertices

Field Value

int

VerticesPoolSize

The current vertices for this pool.

public int VerticesPoolSize

Field Value

int

indicesGroupsCount

How many index groups are there.

public int indicesGroupsCount

Field Value

int

indicesPosition

the position of the indices.

public int indicesPosition

Field Value

int

indicesSizes

The size of each index.

public int[] indicesSizes

Field Value

int[]

indicesStartsByte

The starting byte for each index.

public int[] indicesStartsByte

Field Value

int[]

verticesPosition

the position of the vertices.

public int verticesPosition

Field Value

int

Methods

AllocateNewPool(ICoreClientAPI, int, int, int, CustomMeshDataPartFloat, CustomMeshDataPartShort, CustomMeshDataPartByte, CustomMeshDataPartInt)

Allocates a new pool for mesh data.

public static MeshDataPool AllocateNewPool(ICoreClientAPI capi, int verticesPoolSize, int indicesPoolSize, int maxPartsPerPool, CustomMeshDataPartFloat customFloats = null, CustomMeshDataPartShort customShorts = null, CustomMeshDataPartByte customBytes = null, CustomMeshDataPartInt customInts = null)

Parameters

capi ICoreClientAPI

The core client API

verticesPoolSize int

The vertices pool size.

indicesPoolSize int

The index pool size.

maxPartsPerPool int

The maximum parts per pool.

customFloats CustomMeshDataPartFloat

The custom floats of the pool.

customShorts CustomMeshDataPartShort
customBytes CustomMeshDataPartByte

The custom bytes of the pool.

customInts CustomMeshDataPartInt

The custom ints of the pool.

Returns

MeshDataPool

The resulting mesh data pool.

CalcFragmentation()

Calculates the current fragmentation of the mesh.

public void CalcFragmentation()

Dispose(ICoreClientAPI)

Disposes of the current mesh pool.

public void Dispose(ICoreClientAPI capi)

Parameters

capi ICoreClientAPI

The core client API

Draw(ICoreClientAPI, FrustumCulling, EnumFrustumCullMode)

Draw the model.

public void Draw(ICoreClientAPI capi, FrustumCulling frustumCuller, EnumFrustumCullMode frustumCullMode)

Parameters

capi ICoreClientAPI

The core client API

frustumCuller FrustumCulling

The area where models can be viewed from the camera.

frustumCullMode EnumFrustumCullMode

The mode of the culling.

FrustumCull(FrustumCulling, EnumFrustumCullMode)

Cleans up the rendering view of the models.

public void FrustumCull(FrustumCulling frustumCuller, EnumFrustumCullMode frustumCullMode)

Parameters

frustumCuller FrustumCulling

The area where models can be viewed from the camera.

frustumCullMode EnumFrustumCullMode

The mode of the culling.

GetFragmentation()

Gets the current fragmentation of the pool.

public float GetFragmentation()

Returns

float

IsEmpty()

Is this an empty pool.

public bool IsEmpty()

Returns

bool

true if the pool is empty.

RemoveLocation(ModelDataPoolLocation)

Attempts to remove the model from the pool if the model exists. Will throw an invalid call or an InvalidOperationException if used improperly.

public void RemoveLocation(ModelDataPoolLocation location)

Parameters

location ModelDataPoolLocation

The location of the model data.

RenderMesh(IRenderAPI)

public void RenderMesh(IRenderAPI render)

Parameters

render IRenderAPI

SetFullyVisible()

public void SetFullyVisible()

TryAdd(ICoreClientAPI, MeshData, Vec3i, int, Sphere)

Attempts to add the new model.

public ModelDataPoolLocation TryAdd(ICoreClientAPI capi, MeshData modeldata, Vec3i modelOrigin, int dimension, Sphere frustumCullSphere)

Parameters

capi ICoreClientAPI

The core client API

modeldata MeshData

The model to add

modelOrigin Vec3i

The origin point of the model.

dimension int
frustumCullSphere Sphere

The culling sphere.

Returns

ModelDataPoolLocation

The location of the model (and the data) in the pool.