VS2015-code analysis: fix finding ( index var type too small ).
parent
fcd1f21231
commit
7468ca5c35
|
@ -407,10 +407,13 @@ size_t IndexData::FaceSize() const
|
||||||
|
|
||||||
// Mesh
|
// Mesh
|
||||||
|
|
||||||
Mesh::Mesh() :
|
Mesh::Mesh()
|
||||||
hasSkeletalAnimations(false),
|
: hasSkeletalAnimations(false)
|
||||||
skeleton(NULL),
|
, skeleton(NULL)
|
||||||
sharedVertexData(NULL)
|
, sharedVertexData(NULL)
|
||||||
|
, subMeshes()
|
||||||
|
, animations()
|
||||||
|
, poses()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,16 +446,22 @@ size_t Mesh::NumSubMeshes() const
|
||||||
return subMeshes.size();
|
return subMeshes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
SubMesh *Mesh::GetSubMesh(uint16_t index) const
|
SubMesh *Mesh::GetSubMesh( size_t index ) const
|
||||||
{
|
{
|
||||||
for(size_t i=0; i<subMeshes.size(); ++i)
|
for ( size_t i = 0; i < subMeshes.size(); ++i ) {
|
||||||
if (subMeshes[i]->index == index)
|
if ( subMeshes[ i ]->index == index ) {
|
||||||
return subMeshes[i];
|
return subMeshes[ i ];
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::ConvertToAssimpScene(aiScene* dest)
|
void Mesh::ConvertToAssimpScene(aiScene* dest)
|
||||||
{
|
{
|
||||||
|
if ( nullptr == dest ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
dest->mNumMeshes = NumSubMeshes();
|
dest->mNumMeshes = NumSubMeshes();
|
||||||
dest->mMeshes = new aiMesh*[dest->mNumMeshes];
|
dest->mMeshes = new aiMesh*[dest->mNumMeshes];
|
||||||
|
@ -463,8 +472,7 @@ void Mesh::ConvertToAssimpScene(aiScene* dest)
|
||||||
dest->mRootNode->mMeshes = new unsigned int[dest->mRootNode->mNumMeshes];
|
dest->mRootNode->mMeshes = new unsigned int[dest->mRootNode->mNumMeshes];
|
||||||
|
|
||||||
// Export meshes
|
// Export meshes
|
||||||
for(size_t i=0; i<dest->mNumMeshes; ++i)
|
for(size_t i=0; i<dest->mNumMeshes; ++i) {
|
||||||
{
|
|
||||||
dest->mMeshes[i] = subMeshes[i]->ConvertToAssimpMesh(this);
|
dest->mMeshes[i] = subMeshes[i]->ConvertToAssimpMesh(this);
|
||||||
dest->mRootNode->mMeshes[i] = i;
|
dest->mRootNode->mMeshes[i] = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,7 +568,10 @@ typedef std::vector<SubMesh*> SubMeshList;
|
||||||
class Mesh
|
class Mesh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Constructor.
|
||||||
Mesh();
|
Mesh();
|
||||||
|
|
||||||
|
/// Destructor.
|
||||||
~Mesh();
|
~Mesh();
|
||||||
|
|
||||||
/// Releases all memory that this data structure owns.
|
/// Releases all memory that this data structure owns.
|
||||||
|
@ -578,7 +581,7 @@ public:
|
||||||
size_t NumSubMeshes() const;
|
size_t NumSubMeshes() const;
|
||||||
|
|
||||||
/// Returns submesh for @c index.
|
/// Returns submesh for @c index.
|
||||||
SubMesh *GetSubMesh(uint16_t index) const;
|
SubMesh *GetSubMesh( size_t index) const;
|
||||||
|
|
||||||
/// Convert mesh to Assimp scene.
|
/// Convert mesh to Assimp scene.
|
||||||
void ConvertToAssimpScene(aiScene* dest);
|
void ConvertToAssimpScene(aiScene* dest);
|
||||||
|
|
Loading…
Reference in New Issue