OGRE-Next
2.3
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 () |
Populates mBoneAssignments by reading the vertex data. More... | |
void | _buildBoneAssignmentsFromVertexData (uint8 const *vertexData) |
Populates mBoneAssignments by reading the vertex data. More... | |
void | _buildBoneIndexMap () |
Builds mBlendIndexToBoneIndexMap based on mBoneAssignments. More... | |
void | _compileBoneAssignments () |
Call this function if you've manually called addBoneAssignment to setup bones for vertices. More... | |
void | _prepareForShadowMapping (bool forceSameBuffers) |
void | addBoneAssignment (const VertexBoneAssignment &vertBoneAssign) |
Assigns a vertex to a bone with a given weight, for skeletal animation. More... | |
void | arrangeEfficient (bool halfPos, bool halfTexCoords, bool qTangents) |
Converts this SubMesh to an efficient arrangement. More... | |
void | clearBoneAssignments () |
Removes all bone assignments for this mesh. More... | |
SubMesh * | clone (Mesh *parentMesh=0, int vertexBufferType=-1, int indexBufferType=-1) |
Makes a copy of this submesh object and gives it a new name. More... | |
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. More... | |
void | dearrangeToInefficient () |
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. More... | |
const VertexBoneAssignmentVec & | getBoneAssignments () |
Gets a const reference to the list of bone assignments. More... | |
String | getMaterialName () 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. More... | |
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 More... | |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
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 More... | |
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. More... | |
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. More... | |
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. More... | |
static void | destroyVaos (VertexArrayObjectArray &vaos, VaoManager *vaoManager, bool destroyIndexBuffer=true) |
Public Attributes | |
IndexMap | mBlendIndexToBoneIndexMap |
Dedicated index map for translate blend index to bone index. More... | |
String | mMaterialName |
Name of the material this SubMesh uses. More... | |
Mesh * | mParent |
Reference to parent Mesh (not a smart pointer so child does not keep parent alive). More... | |
VertexArrayObjectArray | mVao [NumVertexPass] |
VAO to render the submesh. More... | |
Friends | |
class | Mesh |
class | MeshSerializerImpl |
Defines a part of a complete mesh.
typedef FastArray<unsigned short> Ogre::SubMesh::IndexMap |
typedef vector<VertexBoneAssignment>::type Ogre::SubMesh::VertexBoneAssignmentVec |
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. |
void Ogre::SubMesh::_buildBoneAssignmentsFromVertexData | ( | ) |
Populates mBoneAssignments by reading the vertex data.
See the other overload.
void Ogre::SubMesh::_buildBoneAssignmentsFromVertexData | ( | uint8 const * | vertexData | ) |
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. |
void Ogre::SubMesh::_buildBoneIndexMap | ( | ) |
Builds mBlendIndexToBoneIndexMap based on mBoneAssignments.
mBlendIndexToBoneIndexMap is necessary for enabling skeletal animation.
void Ogre::SubMesh::_compileBoneAssignments | ( | ) |
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::_prepareForShadowMapping | ( | bool | forceSameBuffers | ) |
void Ogre::SubMesh::addBoneAssignment | ( | const VertexBoneAssignment & | vertBoneAssign | ) |
Assigns a vertex to a bone with a given weight, for skeletal animation.
void Ogre::SubMesh::arrangeEfficient | ( | bool | halfPos, |
bool | halfTexCoords, | ||
bool | qTangents | ||
) |
Converts this SubMesh to an efficient arrangement.
@See Mesh::importV1 for an explanation on the parameters.
void Ogre::SubMesh::clearBoneAssignments | ( | ) |
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. |
void Ogre::SubMesh::dearrangeToInefficient | ( | ) |
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 |
|
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 |
|
inlineinherited |
operator new, with debug line info
|
inlineinherited |
placement operator new
|
inlineinherited |
|
inlineinherited |
array operator new, with debug line info
|
inline |
|
friend |
|
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.