A convenience buffer that stores vertices and indices of a mesh to be generated. More...
#include <trianglebuffer.h>
Public Types | |
typedef SectionContainer::const_iterator | ConstSectionIterator |
Const Iterator type for Section instances stored in this class. | |
typedef std::vector< BufferSection > | SectionContainer |
Basic container type for Section storage in this class. | |
typedef SectionContainer::iterator | SectionIterator |
Iterator type for Section instances stored in this class. | |
Public Member Functions | |
TriangleBuffer () | |
Class constructor. | |
~TriangleBuffer () | |
Class destructor. | |
TriangleBuffer & | AddIndex (const Integer Index) |
Adds an index to the index buffer. More... | |
TriangleBuffer & | AddTriangle (const Integer Index1, const Integer Index2, const Integer Index3) |
Adds a triangle to the index buffer. More... | |
TriangleBuffer & | AddVertex (const Vertex &Vert) |
Adds a premade Vertex to the buffer. More... | |
TriangleBuffer & | AddVertex (const Vector3 &Loc, const Vector3 &Norm, const Vector2 &UV) |
Adds a new vertex to the buffer. More... | |
TriangleBuffer & | AddVertex (const Vector3 &Loc) |
Adds a new vertex to the buffer. More... | |
TriangleBuffer & | AddVertex (const Real X, const Real Y, const Real Z) |
Adds a new vertex to the buffer. More... | |
void | AppendBuffer (const TriangleBuffer &Other) |
Appends the contents of another buffer to this buffer. More... | |
void | AppendBufferAsSection (const TriangleBuffer &Other, const String &MatName="", const String &MatGroup="", const Whole RenderOp=Graphics::RO_TriangleList) |
Appends the contents of another buffer to this buffer as a separate section of the Mesh. More... | |
TriangleBuffer & | ApplyTransform (const Matrix4x4 &Mat) |
Applies a matrix to transform all vertices inside this triangle buffer. More... | |
void | BeginSection (const String &MatName="", const String &MatGroup="", const Whole RenderOp=Graphics::RO_TriangleList) |
Gets a BufferSection that can be appended to the end of this buffer. More... | |
void | EndSection () |
Sets a BufferSection as the end section of this buffer. More... | |
void | EstimateIndexCount (const Whole IndexCount) |
Gives an estimation of the number of indices needed for this triangle buffer. More... | |
void | EstimateVertexCount (const Whole VertexCount) |
Gives an estimation of the number of vertices need for this triangle buffer. More... | |
Mesh * | GenerateMesh (const String &MeshName, const String &MeshGroup, const String &MatName="", const String &MatGroup="") const |
Builds a Mesh from this buffer. More... | |
IndexContainer & | GetIndices () |
Gets a modifiable reference to Indices. More... | |
const IndexContainer & | GetIndices () const |
Gets a non-modifiable reference to Indices. More... | |
SectionContainer & | GetSections () |
Gets a modifiable reference to Sections. More... | |
const SectionContainer & | GetSections () const |
Gets a non-modifiable reference to Sections. More... | |
VertexContainer & | GetVertices () |
Gets a modifiable reference to Vertices. More... | |
const VertexContainer & | GetVertices () const |
Gets a non-modifiable reference to Vertices. More... | |
TriangleBuffer & | InvertNormals () |
Applies normal inversion on this triangle buffer. More... | |
Boole | IsUsingSections () const |
Gets whether or not this buffer is divided into sections. More... | |
Boole | IsWorkingOnSection () const |
Gets whether or not a section has been started and not yet closed. More... | |
void | RebaseOffset () |
Rebase index offset. More... | |
TriangleBuffer & | RotateVertices (const Quaternion &Rot) |
Applies the rotation immediately to all the points contained in this triangle buffer. More... | |
TriangleBuffer & | ScaleVertices (const Vector3 &Scale) |
Applies an immediate scale operation to this triangle buffer. More... | |
TriangleBuffer & | ScaleVertices (const Real X, const Real Y, const Real Z) |
Applies an immediate scale operation to this triangle buffer. More... | |
TriangleBuffer & | SetNormal (const Vector3 &Norm) |
Sets the normal of the current vertex. More... | |
TriangleBuffer & | SetTextureCoord (const Real U, const Real V) |
Sets the texture coordinates of the current vertex. More... | |
TriangleBuffer & | SetTextureCoord (const Vector2 &UV) |
Sets the texture coordinates of the current vertex. More... | |
TriangleBuffer & | TranslateVertices (const Vector3 &Trans) |
Applies the translation immediately to all the points contained in this triangle buffer. More... | |
TriangleBuffer & | TranslateVertices (const Real X, const Real Y, const Real Z) |
Applies the translation immediately to all the points contained in this triangle buffer. More... | |
Protected Attributes | |
BufferSection | CurrentSection |
Temporary storage for the current section being worked on. More... | |
Vertex * | CurrentVertex |
Convenience pointer to the Vertex currently being manipulated. More... | |
Integer | EstimatedIndexCount |
The user estimated Index count for this buffer. More... | |
Integer | EstimatedVertexCount |
The user estimated Vertex count for this buffer. More... | |
Integer | GlobalOffset |
Offset used to set where buffer/mesh appends begin. More... | |
IndexContainer | Indices |
Container storing all of the Indices in this buffer. More... | |
SectionContainer | Sections |
Container storing all of the sections of this buffer. More... | |
VertexContainer | Vertices |
Container storing all of the Vertices in this buffer. More... | |
A convenience buffer that stores vertices and indices of a mesh to be generated.
This buffer is different from native Graphics buffers in that it both has a combined API for the manipulation of vertices and indices and it doesn't create a cooresponding buffer in video card memory. This buffer exists solely in system memory and nothing is allocated on the video card until a mesh is generated.
Definition at line 197 of file trianglebuffer.h.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::AddIndex | ( | const Integer | Index | ) |
Adds an index to the index buffer.
Index | The Index to be added. |
Definition at line 374 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::AddTriangle | ( | const Integer | Index1, |
const Integer | Index2, | ||
const Integer | Index3 | ||
) |
Adds a triangle to the index buffer.
Index1 | The first point of the triangle to be added. |
Index2 | The second point of the triangle to be added. |
Index3 | The third point of the triangle to be added. |
Definition at line 380 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::AddVertex | ( | const Vertex & | Vert | ) |
Adds a premade Vertex to the buffer.
Vert | The premade Vertex to be appended to this buffer. |
Definition at line 252 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::AddVertex | ( | const Vector3 & | Loc, |
const Vector3 & | Norm, | ||
const Vector2 & | UV | ||
) |
Adds a new vertex to the buffer.
Loc | The location to set the new Vertex at, in local space. |
Norm | The facing direction of the new Vertex, in local space. |
UV | The texture coordinate to set for the new Vertex. |
Definition at line 259 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::AddVertex | ( | const Vector3 & | Loc | ) |
Adds a new vertex to the buffer.
Loc | The location to set the new Vertex at, in local space. |
Definition at line 270 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::AddVertex | ( | const Real | X, |
const Real | Y, | ||
const Real | Z | ||
) |
Adds a new vertex to the buffer.
X | The location of the new Vertex on the X axis, in local space. |
Y | The location of the new Vertex on the Y axis, in local space. |
Z | The location of the new Vertex on the Z axis, in local space. |
Definition at line 279 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::AppendBuffer | ( | const TriangleBuffer & | Other | ) |
Appends the contents of another buffer to this buffer.
Other | The other TriangleBuffer to append to this. |
Definition at line 95 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::AppendBufferAsSection | ( | const TriangleBuffer & | Other, |
const String & | MatName = "" , |
||
const String & | MatGroup = "" , |
||
const Whole | RenderOp = Graphics::RO_TriangleList |
||
) |
Appends the contents of another buffer to this buffer as a separate section of the Mesh.
Other | The other TriangleBuffer to append to this. |
MatName | The name of the material to be used with this section. |
MatGroup | The asset group where the Material can be found. |
RenderOp | The render operation describing how the Vertices should be treated for assembling the Mesh. See Graphics::RenderOperation enum for more information. |
Definition at line 105 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::ApplyTransform | ( | const Matrix4x4 & | Mat | ) |
Applies a matrix to transform all vertices inside this triangle buffer.
Mat | A full transform to be applied to each Vertex in this buffer. |
Definition at line 306 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::BeginSection | ( | const String & | MatName = "" , |
const String & | MatGroup = "" , |
||
const Whole | RenderOp = Graphics::RO_TriangleList |
||
) |
Gets a BufferSection that can be appended to the end of this buffer.
MatName | The name of the material to be used with this section. |
MatGroup | The asset group where the Material can be found. |
RenderOp | The render operation describing how the Vertices should be treated for assembling the Mesh. See Graphics::RenderOperation enum for more information. |
Definition at line 208 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::EndSection | ( | ) |
Sets a BufferSection as the end section of this buffer.
Sect | The BufferSection to set as the end of the buffer. |
Definition at line 232 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::EstimateIndexCount | ( | const Whole | IndexCount | ) |
Gives an estimation of the number of indices needed for this triangle buffer.
IndexCount | The amount of additional Indexes to allocate for. |
Definition at line 178 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::EstimateVertexCount | ( | const Whole | VertexCount | ) |
Gives an estimation of the number of vertices need for this triangle buffer.
VertexCount | The amount of additional Vertices to allocate for. |
Definition at line 172 of file trianglebuffer.cpp.
Mesh * Mezzanine::Graphics::Procedural::TriangleBuffer::GenerateMesh | ( | const String & | MeshName, |
const String & | MeshGroup, | ||
const String & | MatName = "" , |
||
const String & | MatGroup = "" |
||
) | const |
Builds a Mesh from this buffer.
MeshName | The name to give to the generated Mesh. |
MeshGroup | The asset group to place the mesh in. |
MatName | The name of the Material to apply to the Mesh. This is only used if the buffer isn't using sections. |
MatGroup | The asset group where the Material can be found. This is only used if the buffer isn't using sections. |
Definition at line 112 of file trianglebuffer.cpp.
IndexContainer & Mezzanine::Graphics::Procedural::TriangleBuffer::GetIndices | ( | ) |
Gets a modifiable reference to Indices.
Definition at line 199 of file trianglebuffer.cpp.
const IndexContainer & Mezzanine::Graphics::Procedural::TriangleBuffer::GetIndices | ( | ) | const |
Gets a non-modifiable reference to Indices.
Definition at line 202 of file trianglebuffer.cpp.
TriangleBuffer::SectionContainer & Mezzanine::Graphics::Procedural::TriangleBuffer::GetSections | ( | ) |
Gets a modifiable reference to Sections.
Definition at line 187 of file trianglebuffer.cpp.
const TriangleBuffer::SectionContainer & Mezzanine::Graphics::Procedural::TriangleBuffer::GetSections | ( | ) | const |
Gets a non-modifiable reference to Sections.
Definition at line 190 of file trianglebuffer.cpp.
VertexContainer & Mezzanine::Graphics::Procedural::TriangleBuffer::GetVertices | ( | ) |
Gets a modifiable reference to Vertices.
Definition at line 193 of file trianglebuffer.cpp.
const VertexContainer & Mezzanine::Graphics::Procedural::TriangleBuffer::GetVertices | ( | ) | const |
Gets a non-modifiable reference to Vertices.
Definition at line 196 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::InvertNormals | ( | ) |
Applies normal inversion on this triangle buffer.
Definition at line 356 of file trianglebuffer.cpp.
Boole Mezzanine::Graphics::Procedural::TriangleBuffer::IsUsingSections | ( | ) | const |
Gets whether or not this buffer is divided into sections.
Definition at line 243 of file trianglebuffer.cpp.
Boole Mezzanine::Graphics::Procedural::TriangleBuffer::IsWorkingOnSection | ( | ) | const |
Gets whether or not a section has been started and not yet closed.
Definition at line 246 of file trianglebuffer.cpp.
void Mezzanine::Graphics::Procedural::TriangleBuffer::RebaseOffset | ( | ) |
Rebase index offset.
Definition at line 184 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::RotateVertices | ( | const Quaternion & | Rot | ) |
Applies the rotation immediately to all the points contained in this triangle buffer.
Rot | The amount of rotation to be applied to each Vertex. |
Definition at line 331 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::ScaleVertices | ( | const Vector3 & | Scale | ) |
Applies an immediate scale operation to this triangle buffer.
Scale | The amount of scaling to be applied to each Vertex. |
Definition at line 342 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::ScaleVertices | ( | const Real | X, |
const Real | Y, | ||
const Real | Z | ||
) |
Applies an immediate scale operation to this triangle buffer.
X | The amount to scale the contents of this buffer on the X axis. |
Y | The amount to scale the contents of this buffer on the Y axis. |
Z | The amount to scale the contents of this buffer on the Z axis. |
Definition at line 351 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::SetNormal | ( | const Vector3 & | Norm | ) |
Sets the normal of the current vertex.
Norm | The facing direction to set for the current Vertex. |
Definition at line 288 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::SetTextureCoord | ( | const Real | U, |
const Real | V | ||
) |
Sets the texture coordinates of the current vertex.
U | The U component of texture UV component to set for the current Vertex. |
V | The V component of texture UV component to set for the current Vertex. |
Definition at line 294 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::SetTextureCoord | ( | const Vector2 & | UV | ) |
Sets the texture coordinates of the current vertex.
UV | The texture coordinate to set for the current Vertex. |
Definition at line 300 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::TranslateVertices | ( | const Vector3 & | Trans | ) |
Applies the translation immediately to all the points contained in this triangle buffer.
Trans | The amount of movement to be applied on each axis. |
Definition at line 317 of file trianglebuffer.cpp.
TriangleBuffer & Mezzanine::Graphics::Procedural::TriangleBuffer::TranslateVertices | ( | const Real | X, |
const Real | Y, | ||
const Real | Z | ||
) |
Applies the translation immediately to all the points contained in this triangle buffer.
X | The amount of movement to be applied to each Vertex in this buffer on the X axis. |
Y | The amount of movement to be applied to each Vertex in this buffer on the Y axis. |
Z | The amount of movement to be applied to each Vertex in this buffer on the Z axis. |
Definition at line 326 of file trianglebuffer.cpp.
|
protected |
Temporary storage for the current section being worked on.
Definition at line 218 of file trianglebuffer.h.
|
protected |
Convenience pointer to the Vertex currently being manipulated.
Definition at line 221 of file trianglebuffer.h.
|
protected |
The user estimated Index count for this buffer.
Definition at line 227 of file trianglebuffer.h.
|
protected |
The user estimated Vertex count for this buffer.
Definition at line 224 of file trianglebuffer.h.
|
protected |
Offset used to set where buffer/mesh appends begin.
Definition at line 230 of file trianglebuffer.h.
|
protected |
Container storing all of the Indices in this buffer.
Definition at line 215 of file trianglebuffer.h.
|
protected |
Container storing all of the sections of this buffer.
Definition at line 209 of file trianglebuffer.h.
|
protected |
Container storing all of the Vertices in this buffer.
Definition at line 212 of file trianglebuffer.h.