Table of Contents

Class CubeMeshUtil

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll
public class CubeMeshUtil
Inheritance
CubeMeshUtil
Derived
Inherited Members
Extension Methods

Fields

BaseCubeVertexIndices

Can be used for any face if offseted correctly

public static int[] BaseCubeVertexIndices

Field Value

int[]

CloudSideShadings

Top, Front/Left, Back/Right, Bottom

public static float[] CloudSideShadings

Field Value

float[]

CubeFaceIndices

Cube face indices, in order: North, East, South, West, Up, Down.

public static byte[] CubeFaceIndices

Field Value

byte[]

CubeUvCoords

UV Coords for every Vertex in a cube

public static int[] CubeUvCoords

Field Value

int[]

CubeVertexIndices

Indices for every triangle in a cube

public static int[] CubeVertexIndices

Field Value

int[]

CubeVertices

XYZ Vertex positions for every vertex in a cube. Origin is the cube middle point.

public static int[] CubeVertices

Field Value

int[]

DefaultBlockSideShadings

Top, Front/Left, Back/Right, Bottom

public static float[] DefaultBlockSideShadings

Field Value

float[]

DefaultBlockSideShadingsByFacing

Shadings by Blockfacing index

public static float[] DefaultBlockSideShadingsByFacing

Field Value

float[]

Methods

GetCube()

Returns a default 2x2x2 cube with xyz,uv,rgba and indices set - ready for upload to the graphics card

public static MeshData GetCube()

Returns

MeshData

GetCube(float, float, float, Vec3f)

Same as GetCubeModelData but can define scale and translation. Scale is applied first.

public static MeshData GetCube(float scaleX, float scaleY, float scaleZ, Vec3f translate)

Parameters

scaleX float
scaleY float
scaleZ float
translate Vec3f

Returns

MeshData

GetCube(float, float, Vec3f)

Same as GetCubeModelData but can define scale and translation. Scale is applied first.

public static MeshData GetCube(float scaleH, float scaleV, Vec3f translate)

Parameters

scaleH float
scaleV float
translate Vec3f

Returns

MeshData

GetCubeFace(BlockFacing)

Gets the face of a given cube.

public static MeshData GetCubeFace(BlockFacing face)

Parameters

face BlockFacing

The face you want to fetch in cardinal directions.

Returns

MeshData

The mesh data for the cube's given face.

GetCubeFace(BlockFacing, float, float, Vec3f)

Gets the face of a given cube.

public static MeshData GetCubeFace(BlockFacing face, float scaleH, float scaleV, Vec3f translate)

Parameters

face BlockFacing

The face you want to fetch in cardinal directions.

scaleH float

The horizontal scale.

scaleV float

The vertical scale.

translate Vec3f

The translation desired.

Returns

MeshData

The mesh data for the given parameters.

GetCubeOnlyScaleXyz(float, float, Vec3f)

Same as GetCubeModelData but can define scale and translation. Scale is applied first.

public static MeshData GetCubeOnlyScaleXyz(float scaleH, float scaleV, Vec3f translate)

Parameters

scaleH float
scaleV float
translate Vec3f

Returns

MeshData

GetShadedCubeRGBA(int, float[], bool)

Returns a rgba byte array to be used for default shading on a standard cube, can supply the shading levels

public static byte[] GetShadedCubeRGBA(int baseColor, float[] blockSideShadings, bool smoothShadedSides)

Parameters

baseColor int
blockSideShadings float[]
smoothShadedSides bool

Returns

byte[]

GetShadedCubeRGBA(int[], bool)

Returns a rgba byte array to be used for default shading on a standard cube

public static byte[] GetShadedCubeRGBA(int[] colorSides, bool smoothShadedSides)

Parameters

colorSides int[]
smoothShadedSides bool

Returns

byte[]

ScaleCubeMesh(MeshData, float, float, float, Vec3f)

Scales a mesh retrieced by GetCube()

public static MeshData ScaleCubeMesh(MeshData modelData, float scaleX, float scaleY, float scaleZ, Vec3f translate)

Parameters

modelData MeshData
scaleX float
scaleY float
scaleZ float
translate Vec3f

Returns

MeshData

SetXyzFacesAndPacketNormals(MeshData)

public static void SetXyzFacesAndPacketNormals(MeshData mesh)

Parameters

mesh MeshData