Terrain Engine 2D  1.10
A 2D Block Engine
TerrainEngine2D.BlockGridMesh Class Reference

A grid based mesh for rendering the world blocks More...

Public Member Functions

 BlockGridMesh (Mesh mesh, int gridSize, float zBlockDistance, bool dynamic, int numLayers, bool useColors=false)
 Constructor for setting up the Block Grid Mesh More...
 
 BlockGridMesh (Mesh mesh, int width, int height, float zBlockDistance, bool dynamic, int numLayers, bool useColors=false)
 Constructor for setting up the Block Grid Mesh More...
 
void CreateBlock (int x, int y, float z, Vector2 texturePosition, byte layer, float tileUnitX, float tileUnitY, float width, float height)
 Create a default block More...
 
void CreateBlock (int x, int y, float z, Vector2 texturePosition, byte layer, float tileUnitX, float tileUnitY, float width, float height, Color color)
 Create a default block with color More...
 
void CreateOverlapBlock (int x, int y, float z, byte bitmask, Vector2 texturePosition, byte layer, float tileUnitX, float tileUnitY, bool blendSquaresOverlap)
 Create a overlap block More...
 
void UpdateMesh ()
 Updates the mesh with the new mesh properties More...
 
Mesh GetMesh ()
 Gets the block grid mesh More...
 
bool IsMaterialLayer (int layer)
 Check if a layer requires a material by index More...
 

Detailed Description

A grid based mesh for rendering the world blocks

Constructor & Destructor Documentation

◆ BlockGridMesh() [1/2]

TerrainEngine2D.BlockGridMesh.BlockGridMesh ( Mesh  mesh,
int  gridSize,
float  zBlockDistance,
bool  dynamic,
int  numLayers,
bool  useColors = false 
)

Constructor for setting up the Block Grid Mesh

Parameters
meshThe mesh to use for this block grid
gridSizeThe size of the mesh (1 side length)/param>
Parameters
zBlockDistanceThe z distance between blocks
dynamicWhether the mesh will be constantly changing
numLayersNumber of layers in the mesh
useColorsWhether colors are used

◆ BlockGridMesh() [2/2]

TerrainEngine2D.BlockGridMesh.BlockGridMesh ( Mesh  mesh,
int  width,
int  height,
float  zBlockDistance,
bool  dynamic,
int  numLayers,
bool  useColors = false 
)

Constructor for setting up the Block Grid Mesh

Parameters
meshThe mesh to use for this block grid
widthThe width of the mesh/param>
Parameters
heightThe height of the mesh/param>
Parameters
zBlockDistanceThe z distance between blocks
dynamicWhether the mesh will be constantly changing
numLayersNumber of layers in the mesh
useColorsWhether colors are used

Member Function Documentation

◆ CreateBlock() [1/2]

void TerrainEngine2D.BlockGridMesh.CreateBlock ( int  x,
int  y,
float  z,
Vector2  texturePosition,
byte  layer,
float  tileUnitX,
float  tileUnitY,
float  width,
float  height 
)

Create a default block

Parameters
xX coordinate
yY coordinate
zZ order
texturePositionPosition of the texture
layerThe layer of the block
tileUnitXRatio of the block width to total texture width
tileUnitYRatio of the block height to total texture height
widthWidth of the block (in block units)
heightHeight of the block (in block units)

◆ CreateBlock() [2/2]

void TerrainEngine2D.BlockGridMesh.CreateBlock ( int  x,
int  y,
float  z,
Vector2  texturePosition,
byte  layer,
float  tileUnitX,
float  tileUnitY,
float  width,
float  height,
Color  color 
)

Create a default block with color

Parameters
xX coordinate
yY coordinate
zZ order
texturePositionPosition of the texture
layerThe layer of the block
tileUnitXRatio of the block width to total texture width
tileUnitYRatio of the block height to total texture height
widthWidth of the block (in block units)
heightHeight of the block (in block units)
colorColor of the block

◆ CreateOverlapBlock()

void TerrainEngine2D.BlockGridMesh.CreateOverlapBlock ( int  x,
int  y,
float  z,
byte  bitmask,
Vector2  texturePosition,
byte  layer,
float  tileUnitX,
float  tileUnitY,
bool  blendSquaresOverlap 
)

Create a overlap block

Parameters
xX coordinate
yY coordinate
zZ order
bitmaskBitmask of the block
texturePositionPosition of the texture
layerThe layer of the block
tileUnitXRatio of the block width to total texture width
tileUnitYRatio of the block height to total texture height

param name="blendSquaresOverlap">The blend squares will overlap the edge textures instead of replace them (optimization - much less vertices)

◆ GetMesh()

Mesh TerrainEngine2D.BlockGridMesh.GetMesh ( )

Gets the block grid mesh

Returns
Returns the mesh

◆ IsMaterialLayer()

bool TerrainEngine2D.BlockGridMesh.IsMaterialLayer ( int  layer)

Check if a layer requires a material by index

Parameters
layerThe layer index
Returns
Returns true if the layer requires a material

◆ UpdateMesh()

void TerrainEngine2D.BlockGridMesh.UpdateMesh ( )

Updates the mesh with the new mesh properties


The documentation for this class was generated from the following file: