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
Afficher le fichier Open project: prime31/Nez

Méthodes publiques

Méthode 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 méthode

public onAddedToEntity ( ) : void
Résultat void

recalculateBounds() public méthode

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.
Résultat Mesh

render() public méthode

public render ( Graphics graphics, Camera camera ) : void
graphics Graphics
camera Camera
Résultat void

setColor() public méthode

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

setColorForAllVerts() public méthode

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

setColorForVert() public méthode

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.
Résultat Mesh

setTexture() public méthode

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.
Résultat Mesh

setTriangles() public méthode

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

setVertPositions() public méthode

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.
Résultat Mesh

setVertPositions() public méthode

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.
Résultat Mesh

setVertexColorEnabled() public méthode

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.
Résultat Mesh