Bugfix : Changed ColladaParser to be non-const in ColladaLoader::BuildMaterials. ( merged from GitHub, thanks to Riku Palomäki ).
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1229 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/5/head
parent
0e5ae5145b
commit
6caf98d945
|
@ -1275,7 +1275,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructs materials from the collada material definitions
|
// Constructs materials from the collada material definitions
|
||||||
void ColladaLoader::BuildMaterials( const ColladaParser& pParser, aiScene* /*pScene*/)
|
void ColladaLoader::BuildMaterials( ColladaParser& pParser, aiScene* /*pScene*/)
|
||||||
{
|
{
|
||||||
newMats.reserve(pParser.mMaterialLibrary.size());
|
newMats.reserve(pParser.mMaterialLibrary.size());
|
||||||
|
|
||||||
|
@ -1283,10 +1283,10 @@ void ColladaLoader::BuildMaterials( const ColladaParser& pParser, aiScene* /*pSc
|
||||||
{
|
{
|
||||||
const Collada::Material& material = matIt->second;
|
const Collada::Material& material = matIt->second;
|
||||||
// a material is only a reference to an effect
|
// a material is only a reference to an effect
|
||||||
ColladaParser::EffectLibrary::const_iterator effIt = pParser.mEffectLibrary.find( material.mEffect);
|
ColladaParser::EffectLibrary::iterator effIt = pParser.mEffectLibrary.find( material.mEffect);
|
||||||
if( effIt == pParser.mEffectLibrary.end())
|
if( effIt == pParser.mEffectLibrary.end())
|
||||||
continue;
|
continue;
|
||||||
const Collada::Effect& effect = effIt->second;
|
Collada::Effect& effect = effIt->second;
|
||||||
|
|
||||||
// create material
|
// create material
|
||||||
aiMaterial* mat = new aiMaterial;
|
aiMaterial* mat = new aiMaterial;
|
||||||
|
@ -1295,7 +1295,7 @@ void ColladaLoader::BuildMaterials( const ColladaParser& pParser, aiScene* /*pSc
|
||||||
|
|
||||||
// store the material
|
// store the material
|
||||||
mMaterialIndexByName[matIt->first] = newMats.size();
|
mMaterialIndexByName[matIt->first] = newMats.size();
|
||||||
newMats.push_back( std::pair<Collada::Effect*, aiMaterial*>(const_cast<Collada::Effect*>(&effect),mat) );
|
newMats.push_back( std::pair<Collada::Effect*, aiMaterial*>( &effect,mat) );
|
||||||
}
|
}
|
||||||
// ScenePreprocessor generates a default material automatically if none is there.
|
// ScenePreprocessor generates a default material automatically if none is there.
|
||||||
// All further code here in this loader works well without a valid material so
|
// All further code here in this loader works well without a valid material so
|
||||||
|
|
|
@ -153,7 +153,7 @@ protected:
|
||||||
void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName);
|
void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName);
|
||||||
|
|
||||||
/** Constructs materials from the collada material definitions */
|
/** Constructs materials from the collada material definitions */
|
||||||
void BuildMaterials( const ColladaParser& pParser, aiScene* pScene);
|
void BuildMaterials( ColladaParser& pParser, aiScene* pScene);
|
||||||
|
|
||||||
/** Fill materials from the collada material definitions */
|
/** Fill materials from the collada material definitions */
|
||||||
void FillMaterials( const ColladaParser& pParser, aiScene* pScene);
|
void FillMaterials( const ColladaParser& pParser, aiScene* pScene);
|
||||||
|
|
Loading…
Reference in New Issue