Ogre Procedural
0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
|
This is ogre-procedural's temporary mesh buffer. More...
#include <ProceduralTriangleBuffer.h>
Classes | |
struct | Section |
struct | Vertex |
Public Member Functions | |
TriangleBuffer () | |
void | append (const TriangleBuffer &other) |
Section | beginSection (std::string sectionName="") |
void | endSection (Section §ion) |
Section | getFullSection () |
std::vector< Vertex > & | getVertices () |
Gets a modifiable reference to vertices. More... | |
const std::vector< Vertex > & | getVertices () const |
Gets a non-modifiable reference to vertices. More... | |
std::vector< int > & | getIndices () |
Gets a modifiable reference to vertices. More... | |
const std::vector< int > & | getIndices () const |
Gets a non-modifiable reference to indices. More... | |
void | rebaseOffset () |
Rebase index offset : call that function before you add a new mesh to the triangle buffer. More... | |
Ogre::MeshPtr | transformToMesh (const std::string &name, const Ogre::String &group="General") const |
Builds an Ogre Mesh from this buffer. More... | |
TriangleBuffer & | vertex (const Vertex &v) |
Adds a new vertex to the buffer. More... | |
TriangleBuffer & | vertex (const Ogre::Vector3 &position, const Ogre::Vector3 &normal, const Ogre::Vector2 &uv) |
Adds a new vertex to the buffer. More... | |
TriangleBuffer & | position (const Ogre::Vector3 &pos) |
Adds a new vertex to the buffer. More... | |
TriangleBuffer & | position (Ogre::Real x, Ogre::Real y, Ogre::Real z) |
Adds a new vertex to the buffer. More... | |
TriangleBuffer & | normal (const Ogre::Vector3 &normal) |
Sets the normal of the current vertex. More... | |
TriangleBuffer & | textureCoord (float u, float v) |
Sets the texture coordinates of the current vertex. More... | |
TriangleBuffer & | textureCoord (const Ogre::Vector2 &vec) |
Sets the texture coordinates of the current vertex. More... | |
TriangleBuffer & | index (int i) |
Adds an index to the index buffer. More... | |
TriangleBuffer & | triangle (int i1, int i2, int i3) |
Adds a triangle to the index buffer. More... | |
TriangleBuffer & | applyTransform (const Ogre::Matrix4 &matrix) |
Applies a matrix to transform all vertices inside the triangle buffer. More... | |
TriangleBuffer & | translate (const Ogre::Vector3 &amount) |
Applies the translation immediately to all the points contained in that triangle buffer. More... | |
TriangleBuffer & | translate (Ogre::Real x, Ogre::Real y, Ogre::Real z) |
Applies the translation immediately to all the points contained in that triangle buffer. More... | |
TriangleBuffer & | rotate (Ogre::Quaternion quat) |
Applies the rotation immediately to all the points contained in that triangle buffer. More... | |
TriangleBuffer & | scale (const Ogre::Vector3 &scale) |
Applies an immediate scale operation to that triangle buffer. More... | |
TriangleBuffer & | scale (Ogre::Real x, Ogre::Real y, Ogre::Real z) |
Applies an immediate scale operation to that triangle buffer. More... | |
TriangleBuffer & | invertNormals () |
Applies normal inversion on the triangle buffer. More... | |
void | estimateVertexCount (unsigned int vertexCount) |
Gives an estimation of the number of vertices need for this triangle buffer. More... | |
void | estimateIndexCount (unsigned int indexCount) |
Gives an estimation of the number of indices needed for this triangle buffer. More... | |
Protected Attributes | |
std::vector< int > | mIndices |
std::vector< Vertex > | mVertices |
int | globalOffset |
int | mEstimatedVertexCount |
int | mEstimatedIndexCount |
Vertex * | mCurrentVertex |
std::map< std::string, Section > | mSections |
This is ogre-procedural's temporary mesh buffer.
It stores all the info needed to build an Ogre Mesh, yet is intented to be more flexible, since there is no link towards hardware.
Procedural::TriangleBuffer::TriangleBuffer | ( | ) |
void Procedural::TriangleBuffer::append | ( | const TriangleBuffer & | other | ) |
TriangleBuffer& Procedural::TriangleBuffer::applyTransform | ( | const Ogre::Matrix4 & | matrix | ) |
Applies a matrix to transform all vertices inside the triangle buffer.
Section Procedural::TriangleBuffer::beginSection | ( | std::string | sectionName = "" | ) |
void Procedural::TriangleBuffer::endSection | ( | Section & | section | ) |
void Procedural::TriangleBuffer::estimateIndexCount | ( | unsigned int | indexCount | ) |
Gives an estimation of the number of indices needed for this triangle buffer.
If this function is called several times, it means an extra indices count, not an absolute measure.
void Procedural::TriangleBuffer::estimateVertexCount | ( | unsigned int | vertexCount | ) |
Gives an estimation of the number of vertices need for this triangle buffer.
If this function is called several times, it means an extra vertices count, not an absolute measure.
Section Procedural::TriangleBuffer::getFullSection | ( | ) |
References Procedural::TriangleBuffer::Section::buffer, Procedural::TriangleBuffer::Section::mFirstIndex, Procedural::TriangleBuffer::Section::mFirstVertex, Procedural::TriangleBuffer::Section::mLastIndex, Procedural::TriangleBuffer::Section::mLastVertex, and Procedural::TriangleBuffer::Section::mSectionName.
std::vector<int>& Procedural::TriangleBuffer::getIndices | ( | ) |
Gets a modifiable reference to vertices.
const std::vector<int>& Procedural::TriangleBuffer::getIndices | ( | ) | const |
Gets a non-modifiable reference to indices.
std::vector<Vertex>& Procedural::TriangleBuffer::getVertices | ( | ) |
Gets a modifiable reference to vertices.
const std::vector<Vertex>& Procedural::TriangleBuffer::getVertices | ( | ) | const |
Gets a non-modifiable reference to vertices.
TriangleBuffer& Procedural::TriangleBuffer::index | ( | int | i | ) |
Adds an index to the index buffer.
Index is relative to the latest rebaseOffset().
TriangleBuffer& Procedural::TriangleBuffer::invertNormals | ( | ) |
Applies normal inversion on the triangle buffer.
References std::swap().
TriangleBuffer& Procedural::TriangleBuffer::normal | ( | const Ogre::Vector3 & | normal | ) |
Sets the normal of the current vertex.
References Procedural::TriangleBuffer::Vertex::mNormal.
Referenced by Procedural::MeshGenerator< TorusGenerator >::addPoint().
TriangleBuffer& Procedural::TriangleBuffer::position | ( | const Ogre::Vector3 & | pos | ) |
Adds a new vertex to the buffer.
References v.
Referenced by Procedural::MeshGenerator< TorusGenerator >::addPoint().
TriangleBuffer& Procedural::TriangleBuffer::position | ( | Ogre::Real | x, |
Ogre::Real | y, | ||
Ogre::Real | z | ||
) |
Adds a new vertex to the buffer.
References v.
void Procedural::TriangleBuffer::rebaseOffset | ( | ) |
Rebase index offset : call that function before you add a new mesh to the triangle buffer.
TriangleBuffer& Procedural::TriangleBuffer::rotate | ( | Ogre::Quaternion | quat | ) |
Applies the rotation immediately to all the points contained in that triangle buffer.
quat | the rotation quaternion to apply |
References Ogre::Quaternion::normalise().
TriangleBuffer& Procedural::TriangleBuffer::scale | ( | const Ogre::Vector3 & | scale | ) |
Applies an immediate scale operation to that triangle buffer.
scale | Scale vector |
TriangleBuffer& Procedural::TriangleBuffer::scale | ( | Ogre::Real | x, |
Ogre::Real | y, | ||
Ogre::Real | z | ||
) |
Applies an immediate scale operation to that triangle buffer.
x | X scale component |
y | Y scale component |
z | Z scale component |
TriangleBuffer& Procedural::TriangleBuffer::textureCoord | ( | const Ogre::Vector2 & | vec | ) |
Sets the texture coordinates of the current vertex.
References Procedural::TriangleBuffer::Vertex::mUV.
TriangleBuffer& Procedural::TriangleBuffer::textureCoord | ( | float | u, |
float | v | ||
) |
Sets the texture coordinates of the current vertex.
References Procedural::TriangleBuffer::Vertex::mUV, u, and v.
Referenced by Procedural::MeshGenerator< TorusGenerator >::addPoint().
Ogre::MeshPtr Procedural::TriangleBuffer::transformToMesh | ( | const std::string & | name, |
const Ogre::String & | group = "General" |
||
) | const |
Builds an Ogre Mesh from this buffer.
Referenced by Procedural::MeshGenerator< TorusGenerator >::realizeMesh().
TriangleBuffer& Procedural::TriangleBuffer::translate | ( | const Ogre::Vector3 & | amount | ) |
Applies the translation immediately to all the points contained in that triangle buffer.
amount | translation vector |
TriangleBuffer& Procedural::TriangleBuffer::translate | ( | Ogre::Real | x, |
Ogre::Real | y, | ||
Ogre::Real | z | ||
) |
Applies the translation immediately to all the points contained in that triangle buffer.
References translate().
TriangleBuffer& Procedural::TriangleBuffer::triangle | ( | int | i1, |
int | i2, | ||
int | i3 | ||
) |
Adds a triangle to the index buffer.
Index is relative to the latest rebaseOffset().
TriangleBuffer& Procedural::TriangleBuffer::vertex | ( | const Ogre::Vector3 & | position, |
const Ogre::Vector3 & | normal, | ||
const Ogre::Vector2 & | uv | ||
) |
Adds a new vertex to the buffer.
References v.
TriangleBuffer& Procedural::TriangleBuffer::vertex | ( | const Vertex & | v | ) |
Adds a new vertex to the buffer.
References v.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by append().
|
protected |