mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-02 03:53:50 +00:00
Fixes primitive assignment. AppMesh::primitives in this case is a purely collada/dts concept and is not indices or faces. Any mesh with more than 2^16 vertices should be split into multiple primitives to avoid indexing across a 16 bit boundary. Mesh division into primitives has not been implemented for assimp yet.
This commit is contained in:
parent
2658debeb0
commit
08431347ea
1 changed files with 8 additions and 9 deletions
|
|
@ -132,7 +132,7 @@ void AssimpAppMesh::lockMesh(F32 t, const MatrixF& objOffset)
|
|||
}
|
||||
|
||||
U32 numFaces = mMeshData->mNumFaces;
|
||||
primitives.reserve(numFaces);
|
||||
//primitives.reserve(numFaces);
|
||||
|
||||
//Fetch the number of indices
|
||||
U32 indicesCount = 0;
|
||||
|
|
@ -143,19 +143,18 @@ void AssimpAppMesh::lockMesh(F32 t, const MatrixF& objOffset)
|
|||
|
||||
indices.reserve(indicesCount);
|
||||
|
||||
// Create TSMesh primitive
|
||||
primitives.increment();
|
||||
TSDrawPrimitive& primitive = primitives.last();
|
||||
primitive.start = 0;
|
||||
primitive.matIndex = (TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed) | (S32)mMeshData->mMaterialIndex;
|
||||
primitive.numElements = indicesCount;
|
||||
|
||||
for ( U32 n = 0; n < mMeshData->mNumFaces; ++n)
|
||||
{
|
||||
const struct aiFace* face = &mMeshData->mFaces[n];
|
||||
if ( face->mNumIndices == 3 )
|
||||
{
|
||||
// Create TSMesh primitive
|
||||
primitives.increment();
|
||||
TSDrawPrimitive& primitive = primitives.last();
|
||||
primitive.start = indices.size();
|
||||
primitive.matIndex = (TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed) | (S32)mMeshData->mMaterialIndex;
|
||||
//primitive.numElements = face->mNumIndices;//3;
|
||||
primitive.numElements = 3;
|
||||
|
||||
if (Con::getBoolVariable("$Assimp::FlipNormals", true))
|
||||
{
|
||||
U32 indexCount = face->mNumIndices;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue