fix more warnings.
parent
4a3ecbea14
commit
c2bfbdacf4
|
@ -342,6 +342,20 @@ struct Texture {
|
||||||
mTextureBlend = get_qnan();
|
mTextureBlend = get_qnan();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Texture(Texture &&other) AI_NO_EXCEPT :
|
||||||
|
mTextureBlend(std::move(other.mTextureBlend)),
|
||||||
|
mMapName(std::move(mMapName)),
|
||||||
|
mOffsetU(std::move(mOffsetU)),
|
||||||
|
mOffsetV(std::move(mOffsetV)),
|
||||||
|
mScaleU(std::move(mScaleU)),
|
||||||
|
mScaleV(std::move(mScaleV)),
|
||||||
|
mRotation(std::move(mRotation)),
|
||||||
|
mMapMode(std::move(mMapMode)),
|
||||||
|
bPrivate(std::move(bPrivate)),
|
||||||
|
iUVSrc(std::move(iUVSrc)) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//! Specifies the blend factor for the texture
|
//! Specifies the blend factor for the texture
|
||||||
ai_real mTextureBlend;
|
ai_real mTextureBlend;
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ protected:
|
||||||
void* value = node->mMetaData->mValues[i].mData;
|
void* value = node->mMetaData->mValues[i].mData;
|
||||||
|
|
||||||
Write<aiString>(&chunk, key);
|
Write<aiString>(&chunk, key);
|
||||||
Write<uint16_t>(&chunk, type);
|
Write<uint16_t>(&chunk, (uint16_t) type);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AI_BOOL:
|
case AI_BOOL:
|
||||||
|
@ -553,13 +553,14 @@ protected:
|
||||||
const aiFace& f = mesh->mFaces[i];
|
const aiFace& f = mesh->mFaces[i];
|
||||||
|
|
||||||
static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
|
static_assert(AI_MAX_FACE_INDICES <= 0xffff, "AI_MAX_FACE_INDICES <= 0xffff");
|
||||||
Write<uint16_t>(&chunk,f.mNumIndices);
|
Write<uint32_t>(&chunk,f.mNumIndices);
|
||||||
|
|
||||||
for (unsigned int a = 0; a < f.mNumIndices;++a) {
|
for (unsigned int a = 0; a < f.mNumIndices;++a) {
|
||||||
if (mesh->mNumVertices < (1u<<16)) {
|
if (mesh->mNumVertices < (1u<<16)) {
|
||||||
Write<uint16_t>(&chunk,f.mIndices[a]);
|
Write<uint32_t>(&chunk,f.mIndices[a]);
|
||||||
}
|
} else {
|
||||||
else Write<unsigned int>(&chunk,f.mIndices[a]);
|
Write<unsigned int>(&chunk, f.mIndices[a]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,36 +155,37 @@ AI_WONT_RETURN void B3DImporter::Fail( string str ){
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
int B3DImporter::ReadByte(){
|
int B3DImporter::ReadByte(){
|
||||||
if( _pos<_buf.size() ) {
|
if (_pos > _buf.size()) {
|
||||||
return _buf[_pos++];
|
Fail("EOF");
|
||||||
}
|
}
|
||||||
|
|
||||||
Fail( "EOF" );
|
return _buf[_pos++];
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
int B3DImporter::ReadInt(){
|
int B3DImporter::ReadInt(){
|
||||||
if( _pos+4<=_buf.size() ){
|
if (_pos + 4 > _buf.size()) {
|
||||||
int n;
|
Fail("EOF");
|
||||||
memcpy(&n, &_buf[_pos], 4);
|
|
||||||
_pos+=4;
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
Fail( "EOF" );
|
|
||||||
return 0;
|
int n;
|
||||||
|
memcpy(&n, &_buf[_pos], 4);
|
||||||
|
_pos+=4;
|
||||||
|
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
float B3DImporter::ReadFloat(){
|
float B3DImporter::ReadFloat() {
|
||||||
if( _pos+4<=_buf.size() ){
|
if (_pos + 4 > _buf.size()) {
|
||||||
float n;
|
Fail("EOF");
|
||||||
memcpy(&n, &_buf[_pos], 4);
|
}
|
||||||
_pos+=4;
|
|
||||||
return n;
|
float n;
|
||||||
}
|
memcpy(&n, &_buf[_pos], 4);
|
||||||
Fail( "EOF" );
|
_pos+=4;
|
||||||
return 0.0f;
|
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -214,6 +215,9 @@ aiQuaternion B3DImporter::ReadQuat(){
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
string B3DImporter::ReadString(){
|
string B3DImporter::ReadString(){
|
||||||
|
if (_pos > _buf.size()) {
|
||||||
|
Fail("EOF");
|
||||||
|
}
|
||||||
string str;
|
string str;
|
||||||
while( _pos<_buf.size() ){
|
while( _pos<_buf.size() ){
|
||||||
char c=(char)ReadByte();
|
char c=(char)ReadByte();
|
||||||
|
@ -222,7 +226,6 @@ string B3DImporter::ReadString(){
|
||||||
}
|
}
|
||||||
str+=c;
|
str+=c;
|
||||||
}
|
}
|
||||||
Fail( "EOF" );
|
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +250,7 @@ void B3DImporter::ExitChunk(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
unsigned B3DImporter::ChunkSize(){
|
size_t B3DImporter::ChunkSize(){
|
||||||
return _stack.back()-_pos;
|
return _stack.back()-_pos;
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -355,8 +358,8 @@ void B3DImporter::ReadVRTS(){
|
||||||
Fail( "Bad texcoord data" );
|
Fail( "Bad texcoord data" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int sz=12+(_vflags&1?12:0)+(_vflags&2?16:0)+(_tcsets*_tcsize*4);
|
int sz = 12+(_vflags&1?12:0)+(_vflags&2?16:0)+(_tcsets*_tcsize*4);
|
||||||
int n_verts=ChunkSize()/sz;
|
size_t n_verts = ChunkSize()/sz;
|
||||||
|
|
||||||
int v0=static_cast<int>(_vertices.size());
|
int v0=static_cast<int>(_vertices.size());
|
||||||
_vertices.resize( v0+n_verts );
|
_vertices.resize( v0+n_verts );
|
||||||
|
@ -377,14 +380,14 @@ void B3DImporter::ReadVRTS(){
|
||||||
ReadQuat(); //skip v 4bytes...
|
ReadQuat(); //skip v 4bytes...
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i=0;i<_tcsets;++i ){
|
for( int j=0;j<_tcsets;++j ){
|
||||||
float t[4]={0,0,0,0};
|
float t[4]={0,0,0,0};
|
||||||
for( int j=0;j<_tcsize;++j ){
|
for( int k=0;k<_tcsize;++k ){
|
||||||
t[j]=ReadFloat();
|
t[k]=ReadFloat();
|
||||||
}
|
}
|
||||||
t[1]=1-t[1];
|
t[1] = 1 - t[1];
|
||||||
if( !i ) {
|
if( !j ) {
|
||||||
v.texcoords=aiVector3D( t[0],t[1],t[2] );
|
v.texcoords = aiVector3D( t[0],t[1],t[2] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,7 +411,7 @@ void B3DImporter::ReadTRIS(int v0) {
|
||||||
mesh->mNumFaces = 0;
|
mesh->mNumFaces = 0;
|
||||||
mesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
mesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
||||||
|
|
||||||
int n_tris = ChunkSize() / 12;
|
size_t n_tris = ChunkSize() / 12;
|
||||||
aiFace *face = mesh->mFaces = new aiFace[n_tris];
|
aiFace *face = mesh->mFaces = new aiFace[n_tris];
|
||||||
|
|
||||||
for (int i = 0; i < n_tris; ++i) {
|
for (int i = 0; i < n_tris; ++i) {
|
||||||
|
@ -463,7 +466,7 @@ void B3DImporter::ReadBONE(int id) {
|
||||||
Vertex &v = _vertices[vertex];
|
Vertex &v = _vertices[vertex];
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
if (!v.weights[i]) {
|
if (!v.weights[i]) {
|
||||||
v.bones[i] = id;
|
v.bones[i] = static_cast<unsigned char>(id);
|
||||||
v.weights[i] = weight;
|
v.weights[i] = weight;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -547,24 +550,24 @@ aiNode *B3DImporter::ReadNODE( aiNode *parent ){
|
||||||
vector<aiNode*> children;
|
vector<aiNode*> children;
|
||||||
|
|
||||||
while( ChunkSize() ){
|
while( ChunkSize() ){
|
||||||
string t=ReadChunk();
|
const string chunk = ReadChunk();
|
||||||
if( t=="MESH" ){
|
if (chunk == "MESH") {
|
||||||
unsigned int n= static_cast<unsigned int>(_meshes.size());
|
unsigned int n= static_cast<unsigned int>(_meshes.size());
|
||||||
ReadMESH();
|
ReadMESH();
|
||||||
for( unsigned int i=n;i<static_cast<unsigned int>(_meshes.size());++i ){
|
for( unsigned int i=n;i<static_cast<unsigned int>(_meshes.size());++i ){
|
||||||
meshes.push_back( i );
|
meshes.push_back( i );
|
||||||
}
|
}
|
||||||
}else if( t=="BONE" ){
|
} else if (chunk == "BONE") {
|
||||||
ReadBONE( nodeid );
|
ReadBONE( nodeid );
|
||||||
}else if( t=="ANIM" ){
|
} else if (chunk == "ANIM") {
|
||||||
ReadANIM();
|
ReadANIM();
|
||||||
}else if( t=="KEYS" ){
|
} else if (chunk == "KEYS") {
|
||||||
if( !nodeAnim ){
|
if( !nodeAnim ){
|
||||||
nodeAnim.reset(new aiNodeAnim);
|
nodeAnim.reset(new aiNodeAnim);
|
||||||
nodeAnim->mNodeName=node->mName;
|
nodeAnim->mNodeName=node->mName;
|
||||||
}
|
}
|
||||||
ReadKEYS( nodeAnim.get() );
|
ReadKEYS( nodeAnim.get() );
|
||||||
}else if( t=="NODE" ){
|
} else if (chunk == "NODE") {
|
||||||
aiNode *child=ReadNODE( node );
|
aiNode *child=ReadNODE( node );
|
||||||
children.push_back( child );
|
children.push_back( child );
|
||||||
}
|
}
|
||||||
|
@ -613,12 +616,12 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
|
||||||
}
|
}
|
||||||
|
|
||||||
while( ChunkSize() ){
|
while( ChunkSize() ){
|
||||||
string t=ReadChunk();
|
const string chunk = ReadChunk();
|
||||||
if( t=="TEXS" ){
|
if (chunk == "TEXS") {
|
||||||
ReadTEXS();
|
ReadTEXS();
|
||||||
}else if( t=="BRUS" ){
|
} else if (chunk == "BRUS") {
|
||||||
ReadBRUS();
|
ReadBRUS();
|
||||||
}else if( t=="NODE" ){
|
} else if (chunk == "NODE") {
|
||||||
ReadNODE( 0 );
|
ReadNODE( 0 );
|
||||||
}
|
}
|
||||||
ExitChunk();
|
ExitChunk();
|
||||||
|
@ -656,48 +659,51 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
|
||||||
|
|
||||||
vector< vector<aiVertexWeight> > vweights( _nodes.size() );
|
vector< vector<aiVertexWeight> > vweights( _nodes.size() );
|
||||||
|
|
||||||
for( int i=0;i<n_verts;i+=3 ){
|
for (int vertIdx = 0; vertIdx < n_verts; vertIdx += 3) {
|
||||||
for( int j=0;j<3;++j ){
|
for (int faceIndex = 0; faceIndex < 3; ++faceIndex) {
|
||||||
Vertex &v=_vertices[face->mIndices[j]];
|
Vertex &v = _vertices[face->mIndices[faceIndex]];
|
||||||
|
|
||||||
*mv++=v.vertex;
|
*mv++=v.vertex;
|
||||||
if( mn ) *mn++=v.normal;
|
if( mn ) *mn++=v.normal;
|
||||||
if( mc ) *mc++=v.texcoords;
|
if( mc ) *mc++=v.texcoords;
|
||||||
|
|
||||||
face->mIndices[j]=i+j;
|
face->mIndices[faceIndex] = vertIdx + faceIndex;
|
||||||
|
|
||||||
for( int k=0;k<4;++k ){
|
for( int k=0;k<4;++k ){
|
||||||
if( !v.weights[k] ) break;
|
if( !v.weights[k] )
|
||||||
|
break;
|
||||||
|
|
||||||
int bone=v.bones[k];
|
int bone = v.bones[k];
|
||||||
float weight=v.weights[k];
|
float weight = v.weights[k];
|
||||||
|
|
||||||
vweights[bone].push_back( aiVertexWeight(i+j,weight) );
|
vweights[bone].push_back(aiVertexWeight(vertIdx + faceIndex, weight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++face;
|
++face;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<aiBone*> bones;
|
vector<aiBone*> bones;
|
||||||
for(size_t i=0;i<vweights.size();++i ){
|
for (size_t weightIndx = 0; weightIndx < vweights.size(); ++weightIndx) {
|
||||||
vector<aiVertexWeight> &weights=vweights[i];
|
vector<aiVertexWeight> &weights = vweights[weightIndx];
|
||||||
if( !weights.size() ) continue;
|
if (!weights.size()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
aiBone *bone=new aiBone;
|
aiBone *bone = new aiBone;
|
||||||
bones.push_back( bone );
|
bones.push_back( bone );
|
||||||
|
|
||||||
aiNode *bnode=_nodes[i];
|
aiNode *bnode = _nodes[weightIndx];
|
||||||
|
|
||||||
bone->mName=bnode->mName;
|
bone->mName = bnode->mName;
|
||||||
bone->mNumWeights= static_cast<unsigned int>(weights.size());
|
bone->mNumWeights = static_cast<unsigned int>(weights.size());
|
||||||
bone->mWeights=to_array( weights );
|
bone->mWeights = to_array( weights );
|
||||||
|
|
||||||
aiMatrix4x4 mat=bnode->mTransformation;
|
aiMatrix4x4 mat = bnode->mTransformation;
|
||||||
while( bnode->mParent ){
|
while( bnode->mParent ){
|
||||||
bnode=bnode->mParent;
|
bnode=bnode->mParent;
|
||||||
mat=bnode->mTransformation * mat;
|
mat=bnode->mTransformation * mat;
|
||||||
}
|
}
|
||||||
bone->mOffsetMatrix=mat.Inverse();
|
bone->mOffsetMatrix = mat.Inverse();
|
||||||
}
|
}
|
||||||
mesh->mNumBones= static_cast<unsigned int>(bones.size());
|
mesh->mNumBones= static_cast<unsigned int>(bones.size());
|
||||||
mesh->mBones=to_array( bones );
|
mesh->mBones=to_array( bones );
|
||||||
|
|
|
@ -82,7 +82,7 @@ private:
|
||||||
std::string ReadString();
|
std::string ReadString();
|
||||||
std::string ReadChunk();
|
std::string ReadChunk();
|
||||||
void ExitChunk();
|
void ExitChunk();
|
||||||
unsigned ChunkSize();
|
size_t ChunkSize();
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T *to_array( const std::vector<T> &v );
|
T *to_array( const std::vector<T> &v );
|
||||||
|
@ -112,10 +112,10 @@ private:
|
||||||
|
|
||||||
void ReadBB3D( aiScene *scene );
|
void ReadBB3D( aiScene *scene );
|
||||||
|
|
||||||
unsigned _pos;
|
size_t _pos;
|
||||||
// unsigned _size;
|
// unsigned _size;
|
||||||
std::vector<unsigned char> _buf;
|
std::vector<unsigned char> _buf;
|
||||||
std::vector<unsigned> _stack;
|
std::vector<size_t> _stack;
|
||||||
|
|
||||||
std::vector<std::string> _textures;
|
std::vector<std::string> _textures;
|
||||||
std::vector<std::unique_ptr<aiMaterial> > _materials;
|
std::vector<std::unique_ptr<aiMaterial> > _materials;
|
||||||
|
|
|
@ -146,7 +146,7 @@ aiScene* BaseImporter::ReadFile(Importer* pImp, const std::string& pFile, IOSyst
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void BaseImporter::SetupProperties(const Importer* pImp)
|
void BaseImporter::SetupProperties(const Importer* )
|
||||||
{
|
{
|
||||||
// the default implementation does nothing
|
// the default implementation does nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ using namespace Assimp;
|
||||||
# define CHAR_BIT 8
|
# define CHAR_BIT 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#pragma warning(disable : 4127)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructs a spatially sorted representation from the given position array.
|
// Constructs a spatially sorted representation from the given position array.
|
||||||
SpatialSort::SpatialSort( const aiVector3D* pPositions, unsigned int pNumPositions,
|
SpatialSort::SpatialSort( const aiVector3D* pPositions, unsigned int pNumPositions,
|
||||||
|
|
|
@ -332,8 +332,7 @@ unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,
|
||||||
aiMaterialProperty* prop = pMat->mProperties[i];
|
aiMaterialProperty* prop = pMat->mProperties[i];
|
||||||
|
|
||||||
if ( prop /* just a sanity check ... */
|
if ( prop /* just a sanity check ... */
|
||||||
&& 0 == strcmp( prop->mKey.data, _AI_MATKEY_TEXTURE_BASE )
|
&& 0 == strcmp(prop->mKey.data, _AI_MATKEY_TEXTURE_BASE) && static_cast < aiTextureType>(prop->mSemantic) == type) {
|
||||||
&& prop->mSemantic == type) {
|
|
||||||
|
|
||||||
max = std::max(max,prop->mIndex+1);
|
max = std::max(max,prop->mIndex+1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ bool ArmaturePopulate::IsActive(unsigned int pFlags) const {
|
||||||
return (pFlags & aiProcess_PopulateArmatureData) != 0;
|
return (pFlags & aiProcess_PopulateArmatureData) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArmaturePopulate::SetupProperties(const Importer *pImp) {
|
void ArmaturePopulate::SetupProperties(const Importer *) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ void ArmaturePopulate::BuildNodeList(const aiNode *current_node,
|
||||||
// A bone stack allows us to have multiple armatures, with the same bone names
|
// A bone stack allows us to have multiple armatures, with the same bone names
|
||||||
// A bone stack allows us also to retrieve bones true transform even with
|
// A bone stack allows us also to retrieve bones true transform even with
|
||||||
// duplicate names :)
|
// duplicate names :)
|
||||||
void ArmaturePopulate::BuildBoneStack(aiNode *current_node,
|
void ArmaturePopulate::BuildBoneStack(aiNode *,
|
||||||
const aiNode *root_node,
|
const aiNode *root_node,
|
||||||
const aiScene *scene,
|
const aiScene *scene,
|
||||||
const std::vector<aiBone *> &bones,
|
const std::vector<aiBone *> &bones,
|
||||||
|
|
|
@ -238,7 +238,7 @@ bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
||||||
// FIX: check whether we can reuse the SpatialSort of a previous step
|
// FIX: check whether we can reuse the SpatialSort of a previous step
|
||||||
SpatialSort* vertexFinder = NULL;
|
SpatialSort* vertexFinder = NULL;
|
||||||
SpatialSort _vertexFinder;
|
SpatialSort _vertexFinder;
|
||||||
float posEpsilon;
|
float posEpsilon = 10e-6f;
|
||||||
if (shared)
|
if (shared)
|
||||||
{
|
{
|
||||||
std::vector<std::pair<SpatialSort,float> >* avf;
|
std::vector<std::pair<SpatialSort,float> >* avf;
|
||||||
|
|
|
@ -99,8 +99,8 @@ void UpdateMeshReferences(aiNode* node, const std::vector<unsigned int>& meshMap
|
||||||
}
|
}
|
||||||
// just let the members that are unused, that's much cheaper
|
// just let the members that are unused, that's much cheaper
|
||||||
// than a full array realloc'n'copy party ...
|
// than a full array realloc'n'copy party ...
|
||||||
if(!(node->mNumMeshes = out)) {
|
node->mNumMeshes = out;
|
||||||
|
if ( 0 == out ) {
|
||||||
delete[] node->mMeshes;
|
delete[] node->mMeshes;
|
||||||
node->mMeshes = NULL;
|
node->mMeshes = NULL;
|
||||||
}
|
}
|
||||||
|
@ -122,9 +122,8 @@ void FindInvalidDataProcess::Execute( aiScene* pScene) {
|
||||||
|
|
||||||
// Process meshes
|
// Process meshes
|
||||||
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) {
|
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) {
|
||||||
|
int result = ProcessMesh(pScene->mMeshes[a]);
|
||||||
int result;
|
if (0 == result ) {
|
||||||
if ((result = ProcessMesh( pScene->mMeshes[a]))) {
|
|
||||||
out = true;
|
out = true;
|
||||||
|
|
||||||
if (2 == result) {
|
if (2 == result) {
|
||||||
|
@ -141,8 +140,8 @@ void FindInvalidDataProcess::Execute( aiScene* pScene) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process animations
|
// Process animations
|
||||||
for (unsigned int a = 0; a < pScene->mNumAnimations;++a) {
|
for (unsigned int animIdx = 0; animIdx < pScene->mNumAnimations; ++animIdx) {
|
||||||
ProcessAnimation( pScene->mAnimations[a]);
|
ProcessAnimation(pScene->mAnimations[animIdx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -132,11 +132,9 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
|
||||||
// need to build a clean list of bones, too
|
// need to build a clean list of bones, too
|
||||||
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
|
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
|
||||||
{
|
{
|
||||||
for (unsigned int a = 0; a < pcMesh->mBones[i]->mNumWeights;a++)
|
for (unsigned int boneIdx = 0; boneIdx < pcMesh->mBones[i]->mNumWeights; ++boneIdx) {
|
||||||
{
|
const aiVertexWeight &w = pcMesh->mBones[i]->mWeights[boneIdx];
|
||||||
const aiVertexWeight& w = pcMesh->mBones[i]->mWeights[a];
|
if(pcFace->mIndices[q] == w.mVertexId) {
|
||||||
if(pcFace->mIndices[q] == w.mVertexId)
|
|
||||||
{
|
|
||||||
aiVertexWeight wNew;
|
aiVertexWeight wNew;
|
||||||
wNew.mVertexId = iIndex;
|
wNew.mVertexId = iIndex;
|
||||||
wNew.mWeight = w.mWeight;
|
wNew.mWeight = w.mWeight;
|
||||||
|
@ -157,17 +155,17 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
|
||||||
pvBitangents[iIndex] = pcMesh->mBitangents[pcFace->mIndices[q]];
|
pvBitangents[iIndex] = pcMesh->mBitangents[pcFace->mIndices[q]];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int p = 0;
|
unsigned int pp = 0;
|
||||||
while (pcMesh->HasTextureCoords(p))
|
while (pcMesh->HasTextureCoords(pp))
|
||||||
{
|
{
|
||||||
apvTextureCoords[p][iIndex] = pcMesh->mTextureCoords[p][pcFace->mIndices[q]];
|
apvTextureCoords[pp][iIndex] = pcMesh->mTextureCoords[pp][pcFace->mIndices[q]];
|
||||||
++p;
|
++pp;
|
||||||
}
|
}
|
||||||
p = 0;
|
pp = 0;
|
||||||
while (pcMesh->HasVertexColors(p))
|
while (pcMesh->HasVertexColors(pp))
|
||||||
{
|
{
|
||||||
apvColorSets[p][iIndex] = pcMesh->mColors[p][pcFace->mIndices[q]];
|
apvColorSets[pp][iIndex] = pcMesh->mColors[pp][pcFace->mIndices[q]];
|
||||||
++p;
|
++pp;
|
||||||
}
|
}
|
||||||
pcFace->mIndices[q] = iIndex;
|
pcFace->mIndices[q] = iIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode *nd, std::list<aiNode *> &n
|
||||||
|
|
||||||
// copy all mesh references in one array
|
// copy all mesh references in one array
|
||||||
if (out_meshes) {
|
if (out_meshes) {
|
||||||
unsigned int *meshes = new unsigned int[out_meshes + join_master->mNumMeshes], *tmp = meshes;
|
unsigned int *meshIdxs = new unsigned int[out_meshes + join_master->mNumMeshes], *tmp = meshIdxs;
|
||||||
for (unsigned int n = 0; n < join_master->mNumMeshes; ++n) {
|
for (unsigned int n = 0; n < join_master->mNumMeshes; ++n) {
|
||||||
*tmp++ = join_master->mMeshes[n];
|
*tmp++ = join_master->mMeshes[n];
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode *nd, std::list<aiNode *> &n
|
||||||
delete join_node; // bye, node
|
delete join_node; // bye, node
|
||||||
}
|
}
|
||||||
delete[] join_master->mMeshes;
|
delete[] join_master->mMeshes;
|
||||||
join_master->mMeshes = meshes;
|
join_master->mMeshes = meshIdxs;
|
||||||
join_master->mNumMeshes += out_meshes;
|
join_master->mNumMeshes += out_meshes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,19 +330,23 @@ void SortByPTypeProcess::Execute( aiScene* pScene) {
|
||||||
ai_assert(outFaces == out->mFaces + out->mNumFaces);
|
ai_assert(outFaces == out->mFaces + out->mNumFaces);
|
||||||
|
|
||||||
// now generate output bones
|
// now generate output bones
|
||||||
for (unsigned int q = 0; q < mesh->mNumBones;++q)
|
for (unsigned int q = 0; q < mesh->mNumBones; ++q) {
|
||||||
if (!tempBones[q].empty())++out->mNumBones;
|
if (!tempBones[q].empty()) {
|
||||||
|
++out->mNumBones;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (out->mNumBones)
|
if (out->mNumBones) {
|
||||||
{
|
|
||||||
out->mBones = new aiBone*[out->mNumBones];
|
out->mBones = new aiBone*[out->mNumBones];
|
||||||
for (unsigned int q = 0, real = 0; q < mesh->mNumBones;++q)
|
for (unsigned int q = 0, boneIdx = 0; q < mesh->mNumBones;++q)
|
||||||
{
|
{
|
||||||
TempBoneInfo& in = tempBones[q];
|
TempBoneInfo& in = tempBones[q];
|
||||||
if (in.empty())continue;
|
if (in.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
aiBone* srcBone = mesh->mBones[q];
|
aiBone* srcBone = mesh->mBones[q];
|
||||||
aiBone* bone = out->mBones[real] = new aiBone();
|
aiBone *bone = out->mBones[boneIdx] = new aiBone();
|
||||||
|
|
||||||
bone->mName = srcBone->mName;
|
bone->mName = srcBone->mName;
|
||||||
bone->mOffsetMatrix = srcBone->mOffsetMatrix;
|
bone->mOffsetMatrix = srcBone->mOffsetMatrix;
|
||||||
|
@ -352,7 +356,7 @@ void SortByPTypeProcess::Execute( aiScene* pScene) {
|
||||||
|
|
||||||
::memcpy(bone->mWeights,&in[0],bone->mNumWeights*sizeof(aiVertexWeight));
|
::memcpy(bone->mWeights,&in[0],bone->mNumWeights*sizeof(aiVertexWeight));
|
||||||
|
|
||||||
++real;
|
++boneIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +368,7 @@ void SortByPTypeProcess::Execute( aiScene* pScene) {
|
||||||
delete mesh;
|
delete mesh;
|
||||||
|
|
||||||
// avoid invalid pointer
|
// avoid invalid pointer
|
||||||
pScene->mMeshes[i] = NULL;
|
pScene->mMeshes[i] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outMeshes.empty())
|
if (outMeshes.empty())
|
||||||
|
|
|
@ -419,7 +419,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||||
num = 0;
|
num = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
curOut -= (max-num); /* undo all previous work */
|
/*curOut -= (max-num); // undo all previous work
|
||||||
for (tmp = 0; tmp < max-2; ++tmp) {
|
for (tmp = 0; tmp < max-2; ++tmp) {
|
||||||
aiFace& nface = *curOut++;
|
aiFace& nface = *curOut++;
|
||||||
|
|
||||||
|
@ -433,7 +433,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
||||||
|
|
||||||
}
|
}
|
||||||
num = 0;
|
num = 0;
|
||||||
break;
|
break;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
aiFace& nface = *curOut++;
|
aiFace& nface = *curOut++;
|
||||||
|
|
|
@ -612,7 +612,7 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial,
|
||||||
bool bNoSpecified = true;
|
bool bNoSpecified = true;
|
||||||
for (unsigned int i = 0; i < pMaterial->mNumProperties;++i) {
|
for (unsigned int i = 0; i < pMaterial->mNumProperties;++i) {
|
||||||
aiMaterialProperty* prop = pMaterial->mProperties[i];
|
aiMaterialProperty* prop = pMaterial->mProperties[i];
|
||||||
if (prop->mSemantic != type) {
|
if (static_cast<aiTextureType>(prop->mSemantic) != type) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue