OGRE 2.1
Object-Oriented Graphics Rendering Engine
|
Defines a part of a complete mesh. More...
#include <OgreSubMesh2.h>
Classes | |
struct | SourceData |
Public Types | |
typedef FastArray< unsigned short > | IndexMap |
typedef FastArray< SourceData > | SourceDataArray |
typedef vector< VertexBoneAssignment >::type | VertexBoneAssignmentVec |
Public Member Functions | |
SubMesh () | |
~SubMesh () | |
void | _buildBoneAssignmentsFromVertexData (uint8 const *vertexData) |
Populates mBoneAssignments by reading the vertex data. | |
void | _buildBoneAssignmentsFromVertexData (void) |
Populates mBoneAssignments by reading the vertex data. | |
void | _buildBoneIndexMap (void) |
Builds mBlendIndexToBoneIndexMap based on mBoneAssignments. | |
void | _compileBoneAssignments (void) |
Call this function if you've manually called addBoneAssignment to setup bones for vertices. | |
void | _prepareForShadowMapping (bool forceSameBuffers) |
void | addBoneAssignment (const VertexBoneAssignment &vertBoneAssign) |
Assigns a vertex to a bone with a given weight, for skeletal animation. | |
void | arrangeEfficient (bool halfPos, bool halfTexCoords, bool qTangents) |
Converts this SubMesh to an efficient arrangement. | |
void | clearBoneAssignments (void) |
Removes all bone assignments for this mesh. | |
SubMesh * | clone (Mesh *parentMesh=0, int vertexBufferType=-1, int indexBufferType=-1) |
Makes a copy of this submesh object and gives it a new name. | |
void | createPoses (const float **positionData, const float **normalData, size_t numPoses, size_t numVertices, const String *names=0, bool halfPrecision=true) |
Fills the pose animation buffer with the given poseData. | |
void | dearrangeToInefficient (void) |
Reverts the effects from arrangeEfficient by converting all 16-bit half float back to 32-bit float; and QTangents to Normal, Tangent + Reflection representation, which are more compatible for doing certain operations vertex operations in the CPU. | |
const VertexBoneAssignmentVec & | getBoneAssignments () |
Gets a const reference to the list of bone assignments. | |
String | getMaterialName (void) const |
uint16 | getNumPoses () |
bool | getPoseHalfPrecision () |
size_t | getPoseIndex (const Ogre::String &name) |
bool | getPoseNormals () |
TexBufferPacked * | getPoseTexBuffer () |
void | importFromV1 (v1::SubMesh *subMesh, bool halfPos, bool halfTexCoords, bool qTangents, bool halfPose) |
Imports a v1 SubMesh @See Mesh::importV1. Automatically performs what arrangeEfficient does. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info | |
void * | operator new (size_t sz, void *ptr) |
placement operator new | |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info | |
void | setMaterialName (const String &name) |
Static Public Member Functions | |
static char * | _arrangeEfficient (SourceDataArray srcData, const VertexElement2Vec &vertexElements, uint32 vertexCount) |
Generic form that does the actual job for both v1 and v2 objects. | |
static char * | _arrangeEfficient (v1::SubMesh *subMesh, bool halfPos, bool halfTexCoords, bool qTangents, VertexElement2Vec *outVertexElements, size_t vaoPassIdx) |
Rearranges the buffers to be efficiently rendered in Ogre 2.1 with Hlms Takes a v1 SubMesh and returns a pointer with the data interleaved, and a VertexElement2Vec with the new vertex format. | |
static char * | _dearrangeEfficient (char const *RESTRICT_ALIAS srcData, uint32 numElements, const VertexElement2Vec &vertexElements, VertexElement2Vec *outVertexElements) |
Generic form that does the actual job for both v1 and v2 objects. | |
static void | destroyVaos (VertexArrayObjectArray &vaos, VaoManager *vaoManager, bool destroyIndexBuffer=true) |
Public Attributes | |
IndexMap | mBlendIndexToBoneIndexMap |
Dedicated index map for translate blend index to bone index. | |
String | mMaterialName |
Name of the material this SubMesh uses. | |
Mesh * | mParent |
Reference to parent Mesh (not a smart pointer so child does not keep parent alive). | |
VertexArrayObjectArray | mVao [NumVertexPass] |
VAO to render the submesh. | |
Friends | |
class | Mesh |
class | MeshSerializerImpl |
Defines a part of a complete mesh.
Ogre::SubMesh::SubMesh | ( | ) |
Ogre::SubMesh::~SubMesh | ( | ) |
|
static |
Generic form that does the actual job for both v1 and v2 objects.
Takes an array of pointers to source each vertex element, and returns a pointer with the valid data.
srcData | Array that points to the source data for every vertex element. VES_TANGENT and VES_BINORMAL must be at the end if converting to QTangents. The pointer in SourceData::data must already be offsetted. |
vertexElements | The vertex format we're converting to. |
vertexCount | Number of vertices |
|
static |
Rearranges the buffers to be efficiently rendered in Ogre 2.1 with Hlms Takes a v1 SubMesh and returns a pointer with the data interleaved, and a VertexElement2Vec with the new vertex format.
halfPos | @See Mesh::importV1 |
halfTexCoords | @See Mesh::importV1 |
qTangents | @See Mesh::importV1 |
outVertexElements | [out] Description of the buffer in the new v2 system. |
Populates mBoneAssignments by reading the vertex data.
This version accepts an external buffer in case you already have the vertex data on CPU (instead of having to bring it back from GPU)
vertexData | Vertex data with blend indices and weights. |
Populates mBoneAssignments by reading the vertex data.
See the other overload.
Builds mBlendIndexToBoneIndexMap based on mBoneAssignments.
mBlendIndexToBoneIndexMap is necessary for enabling skeletal animation.
Call this function if you've manually called addBoneAssignment to setup bones for vertices.
WARNING: Will destroy LODs.
|
static |
Generic form that does the actual job for both v1 and v2 objects.
srcData | Single pointer with interleaved data. |
numElements | Number of vertices. |
vertexElements | Vertex format of the original vertex buffer. |
outVertexElements | [out] Vertex format of the new converted vertex buffer. |
void Ogre::SubMesh::addBoneAssignment | ( | const VertexBoneAssignment & | vertBoneAssign | ) |
Assigns a vertex to a bone with a given weight, for skeletal animation.
Converts this SubMesh to an efficient arrangement.
@See Mesh::importV1 for an explanation on the parameters.
SubMesh * Ogre::SubMesh::clone | ( | Mesh * | parentMesh = 0 , |
int | vertexBufferType = -1 , |
||
int | indexBufferType = -1 |
||
) |
Makes a copy of this submesh object and gives it a new name.
newName | The name to give the clone. |
parentMesh | Optional mesh to make the parent of the newly created clone. If you leave this blank, the clone will be parented to the same Mesh as the original. |
vertexBufferType | See BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned. |
indexBufferType | See BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned. |
void Ogre::SubMesh::createPoses | ( | const float ** | positionData, |
const float ** | normalData, | ||
size_t | numPoses, | ||
size_t | numVertices, | ||
const String * | names = 0 , |
||
bool | halfPrecision = true |
||
) |
Fills the pose animation buffer with the given poseData.
positionData | Array with a pointer to a block of data for each pose, and each pose should contain (x,y,z) offsets for each vertex in sequence. The size of each block of data must be equals to numVertices * 3 * sizeof(float) or else a buffer overrun shall occur. |
normalData | Similar to positionData however should contain normal offsets and can be nullptr if morphing normals is not desired and it will also save memory. |
numPoses | Number of poses. |
numVertices | Number of vertices |
names | Array containing the name of each pose or null. If not null must contain numPoses elements. |
halfPrecision | True if you want the pose buffer to have pixel format PF_FLOAT16_RGBA which uses significantly less memory. Otherwise it is created with pixel format PF_FLOAT32_RGBA. Rarely the extra precision is needed. |
Reverts the effects from arrangeEfficient by converting all 16-bit half float back to 32-bit float; and QTangents to Normal, Tangent + Reflection representation, which are more compatible for doing certain operations vertex operations in the CPU.
|
static |
|
inline |
Gets a const reference to the list of bone assignments.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Ogre::SubMesh::importFromV1 | ( | v1::SubMesh * | subMesh, |
bool | halfPos, | ||
bool | halfTexCoords, | ||
bool | qTangents, | ||
bool | halfPose | ||
) |
Imports a v1 SubMesh @See Mesh::importV1. Automatically performs what arrangeEfficient does.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
operator new, with debug line info
placement operator new
|
inlineinherited |
|
inlineinherited |
array operator new, with debug line info
|
friend |
IndexMap Ogre::SubMesh::mBlendIndexToBoneIndexMap |
Dedicated index map for translate blend index to bone index.
Mesh* Ogre::SubMesh::mParent |
Reference to parent Mesh (not a smart pointer so child does not keep parent alive).
VertexArrayObjectArray Ogre::SubMesh::mVao[NumVertexPass] |
VAO to render the submesh.
One per LOD level. Each LOD may or may not share the vertex and index buffers the other levels [0] = Used for regular rendering [1] = Used for shadow map caster passes Note that mVao[1] = mVao[0] is valid. But if they're not exactly the same VertexArrayObject pointers, then they won't share any pointer.