GeneratedMesh class
Base classes
- class DefaultRefCounted
- The default implementation of a reference counted class.
Constructors, destructors, conversion operators
- GeneratedMesh(int numVertices = 0, int numTriangles = 0, D3DPRIMITIVETYPE primitiveType = D3DPRIMITIVETYPE::D3DPT_TRIANGLELIST)
- ~GeneratedMesh() virtual
Public functions
- auto GetVertexCount() const -> int
- Returns how many vertices there are in this mesh.
- auto GetIndexCount() const -> int
- Returns how many indices there are in this mesh.
- auto GetTriangleCount() const -> int
- Returns how many triangles this mesh has.
- auto AddVertex(const Vertex& vertex) -> int
- Adds a new vertex to this mesh, increasing the vertex count by one.
- auto SetVertex(int index, const Vertex& vertex) -> void
- Sets the data of a particular vertex in the mesh.
- auto GetVertex(int index) const -> Vertex
- Returns the vertex data of the vertex at the specified index.
- auto ModifyVertex(int index) -> Vertex&
- auto SetTriangle(int tindex, int i, int j, int k) -> void
- Sets the indices of a triangle, this can be used if the number of triangles has been specified beforehand in the constructor.
- auto AddTriangle(int i, int j, int k) -> int
- Adds a triangle into this mesh, given its 3 vertex indices.
- auto GetTriangle(int tindex, int& i, int& j, int& k) const -> void
- Used to get the indices of the triangle identified by
tindex
, which is the value returned by AddTriangle() -
auto AddMaterial(uint32_
t materialID, int start = 0, int indexCount = -1, int minVertex = 0) -> int - Assigns a material to a portion of this mesh.
- auto GetMaterialCount() const -> int
- Returns the amount of materials assigned to this mesh.
- auto ClearMaterials() -> void
- Removes all materials from the mesh. Nothing will be rendered after this.
-
auto GetMaterial(int index,
uint32_
t& materialID, int& start, int& indexCount, int& minVertex) const -> void - Gets the information about a material assigned to this mesh.
- auto GetMaterial(int index) const -> Material*
-
auto SetTexture(int materialIndex,
int samplerIndex,
RenderWare::
Raster* raster, int compiledStateIndex = 0) -> void - Changes a texture for one of the materials used in this mesh.
-
auto GetTexture(int materialIndex,
int samplerIndex,
int compiledStateIndex = 0) const -> RenderWare::
Raster* - Returns the raster texture that is being used for a certain material in this mesh.
-
auto GetTransform(int materialIndex) -> const Math::
Matrix4& - Returns the 4x4 matrix transformation that gets applied to a certain material of this mesh.
-
auto SetTransform(int materialIndex,
const Math::
Matrix4& transform) -> void - Sets the 4x4 matrix transformation that gets applied to a certain material of this mesh.
-
auto GetColor(int materialIndex) -> const Math::
ColorRGBA& - Returns the color that gets applied to a certain material of this mesh.
-
auto SetColor(int materialIndex,
const Math::
ColorRGBA& color) -> void - Sets the color that gets applied to a certain material of this mesh.
-
auto GetBoundingBox() -> Math::
BoundingBox - auto SubmitGeometry() -> void
- auto UnloadGeometry() -> void
- auto Render() -> void
Protected variables
-
RenderWare::
VertexBuffer mVertexBuffer -
RenderWare::
IndexBuffer mIndexBuffer -
RenderWare::
VertexDescription<sizeof(Vertex::ELEMENTS)/sizeof(RenderWare:: VertexElement)> mVertexDesc - eastl::vector<Vertex> mVertices
-
eastl::vector<uint16_
t> mIndices -
eastl::vector<RenderWare::
Mesh> mMeshes - eastl::vector<MaterialPtr> mMaterials
-
eastl::vector<Math::
ColorRGBA> mColors -
eastl::vector<Math::
Matrix4> mTransforms -
Math::
BoundingBox mBounds - bool mBoundsValid
Function documentation
int Graphics:: GeneratedMesh<_1>:: GetIndexCount() const
Returns how many indices there are in this mesh.
The triangle count will be this quantity divided by 3.
int Graphics:: GeneratedMesh<_1>:: GetTriangleCount() const
Returns how many triangles this mesh has.
The triangle count is just the index count divided by 3.
void Graphics:: GeneratedMesh<_1>:: GetTriangle(int tindex,
int& i,
int& j,
int& k) const
Used to get the indices of the triangle identified by tindex
, which is the value returned by AddTriangle()
Parameters | |
---|---|
tindex | Index of the triangle, as returned by AddTriangle() |
i | |
j | |
k |
int Graphics:: GeneratedMesh<_1>:: AddMaterial(uint32_ t materialID,
int start = 0,
int indexCount = -1,
int minVertex = 0)
Assigns a material to a portion of this mesh.
The material is only assigned to the triangles made with the indices between start
and start + indexCount
; with the default parameters, the material will be assigned to all the mesh. minVertex
is used for performance purposes, and is the lowest vertex index that will have the material.
The method returns the index of this material, which can be used to later assign textures.
int Graphics:: GeneratedMesh<_1>:: GetMaterialCount() const
Returns the amount of materials assigned to this mesh.
This can be used to iterate them using GetMaterial().
void Graphics:: GeneratedMesh<_1>:: GetMaterial(int index,
uint32_ t& materialID,
int& start,
int& indexCount,
int& minVertex) const
Gets the information about a material assigned to this mesh.
Parameters | |
---|---|
index | The index of the material, between 0 and GetMaterialCount() |
materialID out | The ID of the material. |
start out | |
indexCount out | |
minVertex out |
For a given material index, it gets the parameters with which it was assigned.
void Graphics:: GeneratedMesh<_1>:: SetTexture(int materialIndex,
int samplerIndex,
RenderWare:: Raster* raster,
int compiledStateIndex = 0)
Changes a texture for one of the materials used in this mesh.
Parameters | |
---|---|
materialIndex | The index of the material to change, as returned by AddMaterial(). |
samplerIndex | The index of the sampler where the texture will be assigned. |
raster | The raster object to assign. |
compiledStateIndex | For materials that have more than one compiled state, which one will be changed. |
The raster
object will NOT be memory managed by this mesh.
RenderWare:: Raster* Graphics:: GeneratedMesh<_1>:: GetTexture(int materialIndex,
int samplerIndex,
int compiledStateIndex = 0) const
Returns the raster texture that is being used for a certain material in this mesh.
Parameters | |
---|---|
materialIndex | The index of the material, as returned by AddMaterial(). |
samplerIndex | The index of the sampler of the texture inside the material. |
compiledStateIndex | For materials that have more than one compiled state. |
Returns | The raster texture used in the material. |
const Math:: Matrix4& Graphics:: GeneratedMesh<_1>:: GetTransform(int materialIndex)
Returns the 4x4 matrix transformation that gets applied to a certain material of this mesh.
Parameters | |
---|---|
materialIndex | The index of the material, as returned by AddMaterial(). |
Returns | The 4x4 matrix transformation |
By default it's the identity, that is, no transform.
void Graphics:: GeneratedMesh<_1>:: SetTransform(int materialIndex,
const Math:: Matrix4& transform)
Sets the 4x4 matrix transformation that gets applied to a certain material of this mesh.
Parameters | |
---|---|
materialIndex | The index of the material, as returned by AddMaterial(). |
transform | |
Returns | The 4x4 matrix transformation |
By default it's the identity, that is, no transform.
const Math:: ColorRGBA& Graphics:: GeneratedMesh<_1>:: GetColor(int materialIndex)
Returns the color that gets applied to a certain material of this mesh.
Parameters | |
---|---|
materialIndex | The index of the material, as returned by AddMaterial(). |
Returns | The material color. |
By default it's white.
void Graphics:: GeneratedMesh<_1>:: SetColor(int materialIndex,
const Math:: ColorRGBA& color)
Sets the color that gets applied to a certain material of this mesh.
Parameters | |
---|---|
materialIndex | The index of the material, as returned by AddMaterial(). |
color | |
Returns | The material color. |
By default it's white.