Added dummy names to anonymous unions and structs in 3ds
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@47 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
74dfe61c1e
commit
cbbb704198
|
@ -131,20 +131,20 @@ void Dot3DSImporter::CheckIndices(Dot3DS::Mesh* sMesh)
|
||||||
i != sMesh->mFaces.end();++i)
|
i != sMesh->mFaces.end();++i)
|
||||||
{
|
{
|
||||||
// check whether all indices are in range
|
// check whether all indices are in range
|
||||||
if ((*i).i1 >= sMesh->mPositions.size())
|
if ((*i).a.b.i1 >= sMesh->mPositions.size())
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn("Face index overflow in 3DS file (#1)");
|
DefaultLogger::get()->warn("Face index overflow in 3DS file (#1)");
|
||||||
(*i).i1 = sMesh->mPositions.size()-1;
|
(*i).a.b.i1 = sMesh->mPositions.size()-1;
|
||||||
}
|
}
|
||||||
if ((*i).i2 >= sMesh->mPositions.size())
|
if ((*i).a.b.i2 >= sMesh->mPositions.size())
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn("Face index overflow in 3DS file (#2)");
|
DefaultLogger::get()->warn("Face index overflow in 3DS file (#2)");
|
||||||
(*i).i2 = sMesh->mPositions.size()-1;
|
(*i).a.b.i2 = sMesh->mPositions.size()-1;
|
||||||
}
|
}
|
||||||
if ((*i).i3 >= sMesh->mPositions.size())
|
if ((*i).a.b.i3 >= sMesh->mPositions.size())
|
||||||
{
|
{
|
||||||
DefaultLogger::get()->warn("Face index overflow in 3DS file (#3)");
|
DefaultLogger::get()->warn("Face index overflow in 3DS file (#3)");
|
||||||
(*i).i3 = sMesh->mPositions.size()-1;
|
(*i).a.b.i3 = sMesh->mPositions.size()-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -169,20 +169,20 @@ void Dot3DSImporter::MakeUnique(Dot3DS::Mesh* sMesh)
|
||||||
uint32_t iTemp1,iTemp2;
|
uint32_t iTemp1,iTemp2;
|
||||||
|
|
||||||
// position and texture coordinates
|
// position and texture coordinates
|
||||||
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].i3];
|
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].a.b.i3];
|
||||||
vNew2[iBase] = sMesh->mTexCoords[sMesh->mFaces[i].i3];
|
vNew2[iBase] = sMesh->mTexCoords[sMesh->mFaces[i].a.b.i3];
|
||||||
iTemp1 = iBase++;
|
iTemp1 = iBase++;
|
||||||
|
|
||||||
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].i2];
|
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].a.b.i2];
|
||||||
vNew2[iBase] = sMesh->mTexCoords[sMesh->mFaces[i].i2];
|
vNew2[iBase] = sMesh->mTexCoords[sMesh->mFaces[i].a.b.i2];
|
||||||
iTemp2 = iBase++;
|
iTemp2 = iBase++;
|
||||||
|
|
||||||
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].i1];
|
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].a.b.i1];
|
||||||
vNew2[iBase] = sMesh->mTexCoords[sMesh->mFaces[i].i1];
|
vNew2[iBase] = sMesh->mTexCoords[sMesh->mFaces[i].a.b.i1];
|
||||||
sMesh->mFaces[i].i3 = iBase++;
|
sMesh->mFaces[i].a.b.i3 = iBase++;
|
||||||
|
|
||||||
sMesh->mFaces[i].i1 = iTemp1;
|
sMesh->mFaces[i].a.b.i1 = iTemp1;
|
||||||
sMesh->mFaces[i].i2 = iTemp2;
|
sMesh->mFaces[i].a.b.i2 = iTemp2;
|
||||||
|
|
||||||
// handle the face order ...
|
// handle the face order ...
|
||||||
/*if (iTemp1 > iTemp2)
|
/*if (iTemp1 > iTemp2)
|
||||||
|
@ -198,17 +198,17 @@ void Dot3DSImporter::MakeUnique(Dot3DS::Mesh* sMesh)
|
||||||
uint32_t iTemp1,iTemp2;
|
uint32_t iTemp1,iTemp2;
|
||||||
|
|
||||||
// position only
|
// position only
|
||||||
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].i3];
|
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].a.b.i3];
|
||||||
iTemp1 = iBase++;
|
iTemp1 = iBase++;
|
||||||
|
|
||||||
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].i2];
|
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].a.b.i2];
|
||||||
iTemp2 = iBase++;
|
iTemp2 = iBase++;
|
||||||
|
|
||||||
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].i1];
|
vNew[iBase] = sMesh->mPositions[sMesh->mFaces[i].a.b.i1];
|
||||||
sMesh->mFaces[i].i3 = iBase++;
|
sMesh->mFaces[i].a.b.i3 = iBase++;
|
||||||
|
|
||||||
sMesh->mFaces[i].i1 = iTemp1;
|
sMesh->mFaces[i].a.b.i1 = iTemp1;
|
||||||
sMesh->mFaces[i].i2 = iTemp2;
|
sMesh->mFaces[i].a.b.i2 = iTemp2;
|
||||||
|
|
||||||
// handle the face order ...
|
// handle the face order ...
|
||||||
/*if (iTemp1 > iTemp2)
|
/*if (iTemp1 > iTemp2)
|
||||||
|
@ -451,16 +451,16 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
|
||||||
p_pcOut->mFaces[q].mNumIndices = 3;
|
p_pcOut->mFaces[q].mNumIndices = 3;
|
||||||
|
|
||||||
p_pcOut->mFaces[q].mIndices[2] = iBase;
|
p_pcOut->mFaces[q].mIndices[2] = iBase;
|
||||||
p_pcOut->mVertices[iBase] = (*i).mPositions[(*i).mFaces[iIndex].i1];
|
p_pcOut->mVertices[iBase] = (*i).mPositions[(*i).mFaces[iIndex].a.b.i1];
|
||||||
p_pcOut->mNormals[iBase++] = (*i).mNormals[(*i).mFaces[iIndex].i1];
|
p_pcOut->mNormals[iBase++] = (*i).mNormals[(*i).mFaces[iIndex].a.b.i1];
|
||||||
|
|
||||||
p_pcOut->mFaces[q].mIndices[1] = iBase;
|
p_pcOut->mFaces[q].mIndices[1] = iBase;
|
||||||
p_pcOut->mVertices[iBase] = (*i).mPositions[(*i).mFaces[iIndex].i2];
|
p_pcOut->mVertices[iBase] = (*i).mPositions[(*i).mFaces[iIndex].a.b.i2];
|
||||||
p_pcOut->mNormals[iBase++] = (*i).mNormals[(*i).mFaces[iIndex].i2];
|
p_pcOut->mNormals[iBase++] = (*i).mNormals[(*i).mFaces[iIndex].a.b.i2];
|
||||||
|
|
||||||
p_pcOut->mFaces[q].mIndices[0] = iBase;
|
p_pcOut->mFaces[q].mIndices[0] = iBase;
|
||||||
p_pcOut->mVertices[iBase] = (*i).mPositions[(*i).mFaces[iIndex].i3];
|
p_pcOut->mVertices[iBase] = (*i).mPositions[(*i).mFaces[iIndex].a.b.i3];
|
||||||
p_pcOut->mNormals[iBase++] = (*i).mNormals[(*i).mFaces[iIndex].i3];
|
p_pcOut->mNormals[iBase++] = (*i).mNormals[(*i).mFaces[iIndex].a.b.i3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// convert texture coordinates
|
// convert texture coordinates
|
||||||
|
@ -473,15 +473,15 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
|
||||||
{
|
{
|
||||||
unsigned int iIndex2 = aiSplit[p][q];
|
unsigned int iIndex2 = aiSplit[p][q];
|
||||||
|
|
||||||
unsigned int iIndex = (*i).mFaces[iIndex2].i1;
|
unsigned int iIndex = (*i).mFaces[iIndex2].a.b.i1;
|
||||||
aiVector2D& pc = (*i).mTexCoords[iIndex];
|
aiVector2D& pc = (*i).mTexCoords[iIndex];
|
||||||
p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
|
p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
|
||||||
|
|
||||||
iIndex = (*i).mFaces[iIndex2].i2;
|
iIndex = (*i).mFaces[iIndex2].a.b.i2;
|
||||||
pc = (*i).mTexCoords[iIndex];
|
pc = (*i).mTexCoords[iIndex];
|
||||||
p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
|
p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
|
||||||
|
|
||||||
iIndex = (*i).mFaces[iIndex2].i3;
|
iIndex = (*i).mFaces[iIndex2].a.b.i3;
|
||||||
pc = (*i).mTexCoords[iIndex];
|
pc = (*i).mTexCoords[iIndex];
|
||||||
p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
|
p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,17 +62,17 @@ void Dot3DSImporter::GenNormals(Dot3DS::Mesh* sMesh)
|
||||||
Dot3DS::Face& face = sMesh->mFaces[a];
|
Dot3DS::Face& face = sMesh->mFaces[a];
|
||||||
|
|
||||||
// assume it is a triangle
|
// assume it is a triangle
|
||||||
aiVector3D* pV1 = &sMesh->mPositions[face.i1];
|
aiVector3D* pV1 = &sMesh->mPositions[face.a.b.i1];
|
||||||
aiVector3D* pV2 = &sMesh->mPositions[face.i2];
|
aiVector3D* pV2 = &sMesh->mPositions[face.a.b.i2];
|
||||||
aiVector3D* pV3 = &sMesh->mPositions[face.i3];
|
aiVector3D* pV3 = &sMesh->mPositions[face.a.b.i3];
|
||||||
|
|
||||||
aiVector3D pDelta1 = *pV2 - *pV1;
|
aiVector3D pDelta1 = *pV2 - *pV1;
|
||||||
aiVector3D pDelta2 = *pV3 - *pV1;
|
aiVector3D pDelta2 = *pV3 - *pV1;
|
||||||
aiVector3D vNor = pDelta1 ^ pDelta2;
|
aiVector3D vNor = pDelta1 ^ pDelta2;
|
||||||
|
|
||||||
sMesh->mNormals[face.i1] = vNor;
|
sMesh->mNormals[face.a.b.i1] = vNor;
|
||||||
sMesh->mNormals[face.i2] = vNor;
|
sMesh->mNormals[face.a.b.i2] = vNor;
|
||||||
sMesh->mNormals[face.i3] = vNor;
|
sMesh->mNormals[face.a.b.i3] = vNor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the position bounds so we have a reliable epsilon to
|
// calculate the position bounds so we have a reliable epsilon to
|
||||||
|
@ -111,7 +111,7 @@ void Dot3DSImporter::GenNormals(Dot3DS::Mesh* sMesh)
|
||||||
for (unsigned int c = 0; c < 3;++c)
|
for (unsigned int c = 0; c < 3;++c)
|
||||||
{
|
{
|
||||||
|
|
||||||
sSort.FindPositions(sMesh->mPositions[(*i).mIndices[c]],(*i).iSmoothGroup,
|
sSort.FindPositions(sMesh->mPositions[(*i).a.mIndices[c]],(*i).iSmoothGroup,
|
||||||
posEpsilon,poResult);
|
posEpsilon,poResult);
|
||||||
|
|
||||||
aiVector3D vNormals;
|
aiVector3D vNormals;
|
||||||
|
@ -127,7 +127,7 @@ void Dot3DSImporter::GenNormals(Dot3DS::Mesh* sMesh)
|
||||||
vNormals.y /= fDiv;
|
vNormals.y /= fDiv;
|
||||||
vNormals.z /= fDiv;
|
vNormals.z /= fDiv;
|
||||||
vNormals.Normalize();
|
vNormals.Normalize();
|
||||||
avNormals[(*i).mIndices[c]] = vNormals;
|
avNormals[(*i).a.mIndices[c]] = vNormals;
|
||||||
poResult.clear();
|
poResult.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,9 +305,12 @@ public:
|
||||||
/** Helper structure representing a 3ds mesh face */
|
/** Helper structure representing a 3ds mesh face */
|
||||||
struct Face
|
struct Face
|
||||||
{
|
{
|
||||||
Face() : iSmoothGroup(0), i1(0), i2(0), i3(0), bFlipped(false)
|
Face() : iSmoothGroup(0), bFlipped(false)
|
||||||
{
|
{
|
||||||
// let the rest uninitialized for performance
|
// let the rest uninitialized for performance
|
||||||
|
this->a.b.i1 = 0;
|
||||||
|
this->a.b.i2 = 0;
|
||||||
|
this->a.b.i3 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,9 +324,9 @@ struct Face
|
||||||
uint32_t i1;
|
uint32_t i1;
|
||||||
uint32_t i2;
|
uint32_t i2;
|
||||||
uint32_t i3;
|
uint32_t i3;
|
||||||
};
|
} b; // DUMMY NAME
|
||||||
uint32_t mIndices[3];
|
uint32_t mIndices[3];
|
||||||
};
|
} a; // DUMMY NAME
|
||||||
|
|
||||||
//! specifies to which smoothing group the face belongs to
|
//! specifies to which smoothing group the face belongs to
|
||||||
uint32_t iSmoothGroup;
|
uint32_t iSmoothGroup;
|
||||||
|
|
|
@ -983,11 +983,11 @@ void Dot3DSImporter::ParseMeshChunk(int* piRemaining)
|
||||||
while (iNum-- > 0)
|
while (iNum-- > 0)
|
||||||
{
|
{
|
||||||
Dot3DS::Face sFace;
|
Dot3DS::Face sFace;
|
||||||
sFace.i1 = *((uint16_t*)this->mCurrent);
|
sFace.a.b.i1 = *((uint16_t*)this->mCurrent);
|
||||||
this->mCurrent += sizeof(uint16_t);
|
this->mCurrent += sizeof(uint16_t);
|
||||||
sFace.i2 = *((uint16_t*)this->mCurrent);
|
sFace.a.b.i2 = *((uint16_t*)this->mCurrent);
|
||||||
this->mCurrent += sizeof(uint16_t);
|
this->mCurrent += sizeof(uint16_t);
|
||||||
sFace.i3 = *((uint16_t*)this->mCurrent);
|
sFace.a.b.i3 = *((uint16_t*)this->mCurrent);
|
||||||
this->mCurrent += 2*sizeof(uint16_t);
|
this->mCurrent += 2*sizeof(uint16_t);
|
||||||
mMesh.mFaces.push_back(sFace);
|
mMesh.mFaces.push_back(sFace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,18 +73,18 @@ void D3DSSpatialSorter::AddFace(const Dot3DS::Face* pcFace,
|
||||||
ai_assert(NULL != pcFace);
|
ai_assert(NULL != pcFace);
|
||||||
|
|
||||||
// store position by index and distance
|
// store position by index and distance
|
||||||
float distance = vPositions[pcFace->i1] * mPlaneNormal;
|
float distance = vPositions[pcFace->a.b.i1] * mPlaneNormal;
|
||||||
mPositions.push_back( Entry( pcFace->i1, vPositions[pcFace->i1],
|
mPositions.push_back( Entry( pcFace->a.b.i1, vPositions[pcFace->a.b.i1],
|
||||||
distance, pcFace->iSmoothGroup));
|
distance, pcFace->iSmoothGroup));
|
||||||
|
|
||||||
// triangle vertex 2
|
// triangle vertex 2
|
||||||
distance = vPositions[pcFace->i2] * mPlaneNormal;
|
distance = vPositions[pcFace->a.b.i2] * mPlaneNormal;
|
||||||
mPositions.push_back( Entry( pcFace->i2, vPositions[pcFace->i2],
|
mPositions.push_back( Entry( pcFace->a.b.i2, vPositions[pcFace->a.b.i2],
|
||||||
distance, pcFace->iSmoothGroup));
|
distance, pcFace->iSmoothGroup));
|
||||||
|
|
||||||
// triangle vertex 3
|
// triangle vertex 3
|
||||||
distance = vPositions[pcFace->i3] * mPlaneNormal;
|
distance = vPositions[pcFace->a.b.i3] * mPlaneNormal;
|
||||||
mPositions.push_back( Entry( pcFace->i3, vPositions[pcFace->i3],
|
mPositions.push_back( Entry( pcFace->a.b.i3, vPositions[pcFace->a.b.i3],
|
||||||
distance, pcFace->iSmoothGroup));
|
distance, pcFace->iSmoothGroup));
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -286,7 +286,7 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh)
|
||||||
{
|
{
|
||||||
for (unsigned int n = 0; n < 3;++n,++iCurrent)
|
for (unsigned int n = 0; n < 3;++n,++iCurrent)
|
||||||
{
|
{
|
||||||
mPositions[iCurrent] = mesh.mPositions[(*i).mIndices[n]];
|
mPositions[iCurrent] = mesh.mPositions[(*i).a.mIndices[n]];
|
||||||
|
|
||||||
// add texture coordinates
|
// add texture coordinates
|
||||||
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
|
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c)
|
||||||
|
@ -304,20 +304,20 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh)
|
||||||
// add normal vectors
|
// add normal vectors
|
||||||
if (!mesh.mNormals.empty())
|
if (!mesh.mNormals.empty())
|
||||||
{
|
{
|
||||||
mNormals[iCurrent] = mesh.mNormals[(*i).mIndices[n]];
|
mNormals[iCurrent] = mesh.mNormals[(*i).a.mIndices[n]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle bone vertices
|
// handle bone vertices
|
||||||
if ((*i).mIndices[n] < mesh.mBoneVertices.size())
|
if ((*i).a.mIndices[n] < mesh.mBoneVertices.size())
|
||||||
{
|
{
|
||||||
// (sometimes this will cause bone verts to be duplicated
|
// (sometimes this will cause bone verts to be duplicated
|
||||||
// however, I' quite sure Schrompf' JoinVerticesStep
|
// however, I' quite sure Schrompf' JoinVerticesStep
|
||||||
// will fix that again ...)
|
// will fix that again ...)
|
||||||
mBoneVertices[iCurrent] = mesh.mBoneVertices[(*i).mIndices[n]];
|
mBoneVertices[iCurrent] = mesh.mBoneVertices[(*i).a.mIndices[n]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign a new valid index to the face
|
// assign a new valid index to the face
|
||||||
(*i).mIndices[n] = iCurrent;
|
(*i).a.mIndices[n] = iCurrent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, aiScene* pcScene)
|
||||||
|
|
||||||
for (unsigned int t = 0; t < 3;++t)
|
for (unsigned int t = 0; t < 3;++t)
|
||||||
{
|
{
|
||||||
const uint32_t iIndex2 = mesh.mFaces[iIndex].mIndices[t];
|
const uint32_t iIndex2 = mesh.mFaces[iIndex].a.mIndices[t];
|
||||||
|
|
||||||
p_pcOut->mVertices[iBase] = mesh.mPositions[iIndex2];
|
p_pcOut->mVertices[iBase] = mesh.mPositions[iIndex2];
|
||||||
p_pcOut->mNormals[iBase] = mesh.mNormals[iIndex2];
|
p_pcOut->mNormals[iBase] = mesh.mNormals[iIndex2];
|
||||||
|
@ -618,7 +618,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, aiScene* pcScene)
|
||||||
unsigned int iIndex = aiSplit[p][q];
|
unsigned int iIndex = aiSplit[p][q];
|
||||||
for (unsigned int t = 0; t < 3;++t)
|
for (unsigned int t = 0; t < 3;++t)
|
||||||
{
|
{
|
||||||
p_pcOut->mTextureCoords[c][iBase++] = mesh.amTexCoords[c][mesh.mFaces[iIndex].mIndices[t]];
|
p_pcOut->mTextureCoords[c][iBase++] = mesh.amTexCoords[c][mesh.mFaces[iIndex].a.mIndices[t]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// setup the number of valid vertex components
|
// setup the number of valid vertex components
|
||||||
|
@ -636,7 +636,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, aiScene* pcScene)
|
||||||
unsigned int iIndex = aiSplit[p][q];
|
unsigned int iIndex = aiSplit[p][q];
|
||||||
for (unsigned int t = 0; t < 3;++t)
|
for (unsigned int t = 0; t < 3;++t)
|
||||||
{
|
{
|
||||||
p_pcOut->mColors[0][iBase++] = mesh.mVertexColors[mesh.mFaces[iIndex].mIndices[t]];
|
p_pcOut->mColors[0][iBase++] = mesh.mVertexColors[mesh.mFaces[iIndex].a.mIndices[t]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -738,9 +738,9 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, aiScene* pcScene)
|
||||||
p_pcOut->mFaces[iFace].mIndices = new unsigned int[3];
|
p_pcOut->mFaces[iFace].mIndices = new unsigned int[3];
|
||||||
|
|
||||||
// copy indices
|
// copy indices
|
||||||
p_pcOut->mFaces[iFace].mIndices[0] = mesh.mFaces[iFace].mIndices[0];
|
p_pcOut->mFaces[iFace].mIndices[0] = mesh.mFaces[iFace].a.mIndices[0];
|
||||||
p_pcOut->mFaces[iFace].mIndices[1] = mesh.mFaces[iFace].mIndices[1];
|
p_pcOut->mFaces[iFace].mIndices[1] = mesh.mFaces[iFace].a.mIndices[1];
|
||||||
p_pcOut->mFaces[iFace].mIndices[2] = mesh.mFaces[iFace].mIndices[2];
|
p_pcOut->mFaces[iFace].mIndices[2] = mesh.mFaces[iFace].a.mIndices[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy vertex bones
|
// copy vertex bones
|
||||||
|
@ -889,17 +889,17 @@ void ASEImporter::GenerateNormals(ASE::Mesh& mesh)
|
||||||
const ASE::Face& face = mesh.mFaces[a];
|
const ASE::Face& face = mesh.mFaces[a];
|
||||||
|
|
||||||
// assume it is a triangle
|
// assume it is a triangle
|
||||||
aiVector3D* pV1 = &mesh.mPositions[face.i1];
|
aiVector3D* pV1 = &mesh.mPositions[face.a.b.i1];
|
||||||
aiVector3D* pV2 = &mesh.mPositions[face.i2];
|
aiVector3D* pV2 = &mesh.mPositions[face.a.b.i2];
|
||||||
aiVector3D* pV3 = &mesh.mPositions[face.i3];
|
aiVector3D* pV3 = &mesh.mPositions[face.a.b.i3];
|
||||||
|
|
||||||
aiVector3D pDelta1 = *pV2 - *pV1;
|
aiVector3D pDelta1 = *pV2 - *pV1;
|
||||||
aiVector3D pDelta2 = *pV3 - *pV1;
|
aiVector3D pDelta2 = *pV3 - *pV1;
|
||||||
aiVector3D vNor = pDelta1 ^ pDelta2;
|
aiVector3D vNor = pDelta1 ^ pDelta2;
|
||||||
|
|
||||||
mesh.mNormals[face.i1] = vNor;
|
mesh.mNormals[face.a.b.i1] = vNor;
|
||||||
mesh.mNormals[face.i2] = vNor;
|
mesh.mNormals[face.a.b.i2] = vNor;
|
||||||
mesh.mNormals[face.i3] = vNor;
|
mesh.mNormals[face.a.b.i3] = vNor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the position bounds so we have a reliable epsilon to
|
// calculate the position bounds so we have a reliable epsilon to
|
||||||
|
@ -934,7 +934,7 @@ void ASEImporter::GenerateNormals(ASE::Mesh& mesh)
|
||||||
std::vector<unsigned int> poResult;
|
std::vector<unsigned int> poResult;
|
||||||
for (unsigned int c = 0; c < 3;++c)
|
for (unsigned int c = 0; c < 3;++c)
|
||||||
{
|
{
|
||||||
sSort.FindPositions(mesh.mPositions[(*i).mIndices[c]],(*i).iSmoothGroup,
|
sSort.FindPositions(mesh.mPositions[(*i).a.mIndices[c]],(*i).iSmoothGroup,
|
||||||
posEpsilon,poResult);
|
posEpsilon,poResult);
|
||||||
|
|
||||||
aiVector3D vNormals;
|
aiVector3D vNormals;
|
||||||
|
@ -948,7 +948,7 @@ void ASEImporter::GenerateNormals(ASE::Mesh& mesh)
|
||||||
}
|
}
|
||||||
vNormals.x /= fDiv;vNormals.y /= fDiv;vNormals.z /= fDiv;
|
vNormals.x /= fDiv;vNormals.y /= fDiv;vNormals.z /= fDiv;
|
||||||
vNormals.Normalize();
|
vNormals.Normalize();
|
||||||
avNormals[(*i).mIndices[c]] = vNormals;
|
avNormals[(*i).a.mIndices[c]] = vNormals;
|
||||||
poResult.clear();
|
poResult.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1567,7 +1567,7 @@ __EARTHQUAKE_XXL:
|
||||||
if(!SkipSpaces(this->m_szFile,&this->m_szFile))
|
if(!SkipSpaces(this->m_szFile,&this->m_szFile))
|
||||||
BLUBB("Unable to parse *MESH_FACE Element: Unexpected EOL. Vertex index ecpected [#4]")
|
BLUBB("Unable to parse *MESH_FACE Element: Unexpected EOL. Vertex index ecpected [#4]")
|
||||||
|
|
||||||
out.mIndices[iIndex] = strtol10(this->m_szFile,&this->m_szFile);
|
out.a.mIndices[iIndex] = strtol10(this->m_szFile,&this->m_szFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we need to skip the AB, BC, CA blocks.
|
// now we need to skip the AB, BC, CA blocks.
|
||||||
|
|
Loading…
Reference in New Issue