C# Class Nez.Mesh

basic class that can be used to create simple meshes. For more advanced usage subclass and override what is needed. The general gist of usage is the following: - call setVertPositions - call setTriangles to set the triangle indices - call recalculateBounds to prepare the Mesh for rendering and culling
Inheritance: RenderableComponent
ファイルを表示 Open project: prime31/Nez

Public Methods

Method Description
onAddedToEntity ( ) : void
recalculateBounds ( bool recalculateUVs ) : Mesh

recalculates the bounds and optionally sets the UVs. The UVs are setup to map the texture in a best fit fashion.

render ( Graphics graphics, Camera camera ) : void
setColor ( Microsoft.Xna.Framework.Color color ) : Mesh

sets the color for all of the verts

setColorForAllVerts ( Microsoft.Xna.Framework.Color color ) : Mesh

helper that sets the color for all verts

setColorForVert ( int vertIndex, Microsoft.Xna.Framework.Color color ) : Mesh

sets the vertex color for a single vert

setTexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : Mesh

sets the texture. Pass in null to unset the texture.

setTriangles ( int triangles ) : Mesh

sets the triangle indices for rendering

setVertPositions ( Vector2 positions ) : Mesh

sets the vert positions. If the positions array does not match the verts array size the verts array will be recreated.

setVertPositions ( Microsoft.Xna.Framework.Vector3 positions ) : Mesh

sets the vert positions. If the positions array does not match the verts array size the verts array will be recreated.

setVertexColorEnabled ( bool shouldEnableVertexColors ) : Mesh

sets whether vertex colors will be used by the shader

Method Details

onAddedToEntity() public method

public onAddedToEntity ( ) : void
return void

recalculateBounds() public method

recalculates the bounds and optionally sets the UVs. The UVs are setup to map the texture in a best fit fashion.
public recalculateBounds ( bool recalculateUVs ) : Mesh
recalculateUVs bool If set to true recalculate U vs.
return Mesh

render() public method

public render ( Graphics graphics, Camera camera ) : void
graphics Graphics
camera Camera
return void

setColor() public method

sets the color for all of the verts
public setColor ( Microsoft.Xna.Framework.Color color ) : Mesh
color Microsoft.Xna.Framework.Color Color.
return Mesh

setColorForAllVerts() public method

helper that sets the color for all verts
public setColorForAllVerts ( Microsoft.Xna.Framework.Color color ) : Mesh
color Microsoft.Xna.Framework.Color Color.
return Mesh

setColorForVert() public method

sets the vertex color for a single vert
public setColorForVert ( int vertIndex, Microsoft.Xna.Framework.Color color ) : Mesh
vertIndex int Vert index.
color Microsoft.Xna.Framework.Color Color.
return Mesh

setTexture() public method

sets the texture. Pass in null to unset the texture.
public setTexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture ) : Mesh
texture Microsoft.Xna.Framework.Graphics.Texture2D Texture.
return Mesh

setTriangles() public method

sets the triangle indices for rendering
public setTriangles ( int triangles ) : Mesh
triangles int Triangles.
return Mesh

setVertPositions() public method

sets the vert positions. If the positions array does not match the verts array size the verts array will be recreated.
public setVertPositions ( Vector2 positions ) : Mesh
positions Microsoft.Xna.Framework.Vector2 Positions.
return Mesh

setVertPositions() public method

sets the vert positions. If the positions array does not match the verts array size the verts array will be recreated.
public setVertPositions ( Microsoft.Xna.Framework.Vector3 positions ) : Mesh
positions Microsoft.Xna.Framework.Vector3 Positions.
return Mesh

setVertexColorEnabled() public method

sets whether vertex colors will be used by the shader
public setVertexColorEnabled ( bool shouldEnableVertexColors ) : Mesh
shouldEnableVertexColors bool If set to true should enable vertex colors.
return Mesh