Merge remote-tracking branch 'origin'

Conflicts:
	code/C4DImporter.cpp
	code/OgreImporter.h
This commit is contained in:
abma
2015-04-16 01:03:00 +02:00
95 changed files with 32460 additions and 9658 deletions

View File

@@ -66,7 +66,7 @@ ColladaParser::ColladaParser( IOSystem* pIOHandler, const std::string& pFile)
{
mRootNode = NULL;
mUnitSize = 1.0f;
mUpDirection = UP_Z;
mUpDirection = UP_Y;
// We assume the newest file format by default
mFormat = FV_1_5_n;
@@ -231,10 +231,10 @@ void ColladaParser::ReadAssetInfo()
const char* content = GetTextContent();
if( strncmp( content, "X_UP", 4) == 0)
mUpDirection = UP_X;
else if( strncmp( content, "Y_UP", 4) == 0)
mUpDirection = UP_Y;
else
else if( strncmp( content, "Z_UP", 4) == 0)
mUpDirection = UP_Z;
else
mUpDirection = UP_Y;
// check element end
TestClosing( "up_axis");
@@ -823,6 +823,7 @@ void ColladaParser::ReadMaterialLibrary()
if( mReader->isEmptyElement())
return;
std::map<std::string, int> names;
while( mReader->read())
{
if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
@@ -833,8 +834,32 @@ void ColladaParser::ReadMaterialLibrary()
int attrID = GetAttribute( "id");
std::string id = mReader->getAttributeValue( attrID);
std::string name;
int attrName = TestAttribute("name");
if (attrName >= 0)
name = mReader->getAttributeValue( attrName);
// create an entry and store it in the library under its ID
ReadMaterial(mMaterialLibrary[id] = Material());
mMaterialLibrary[id] = Material();
if( !name.empty())
{
std::map<std::string, int>::iterator it = names.find( name);
if( it != names.end())
{
std::ostringstream strStream;
strStream << ++it->second;
name.append( " " + strStream.str());
}
else
{
names[name] = 0;
}
mMaterialLibrary[id].mName = name;
}
ReadMaterial( mMaterialLibrary[id]);
} else
{
// ignore the rest
@@ -1391,6 +1416,9 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler)
if( attrTex >= 0 )
pSampler.mUVChannel = mReader->getAttributeValue( attrTex);
//SkipElement();
// as we've read texture, the color needs to be 1,1,1,1
pColor = aiColor4D(1.f, 1.f, 1.f, 1.f);
}
else if( IsElement( "technique"))
{
@@ -1942,6 +1970,10 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
// now here the actual fun starts - these are the indices to construct the mesh data from
actualPrimitives += ReadPrimitives(pMesh, perIndexData, numPrimitives, vcount, primType);
}
}
else if (IsElement("extra"))
{
SkipElement("extra");
} else
{
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <%s>") % mReader->getNodeName() % elementName));
@@ -1956,9 +1988,11 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
}
}
// small sanity check
if (primType != Prim_TriFans && primType != Prim_TriStrips)
#ifdef ASSIMP_BUILD_DEBUG
if (primType != Prim_TriFans && primType != Prim_TriStrips) {
ai_assert(actualPrimitives == numPrimitives);
}
#endif
// only when we're done reading all <p> tags (and thus know the final vertex count) can we commit the submesh
subgroup.mNumFaces = actualPrimitives;