From 2a580c5518feee80d5823e8346f562a92c0f3472 Mon Sep 17 00:00:00 2001 From: ulfjorensen Date: Thu, 25 Oct 2012 10:28:40 +0000 Subject: [PATCH] - fixed/changed/worked on issue 3580054 - XFile materials don't have ambient colours, but emissive git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1322 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/ColladaParser.cpp | 7 ++++--- code/XFileImporter.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 49b5eb755..195d0d7ca 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -1369,10 +1369,11 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler) int attrTex = GetAttribute( "texture"); pSampler.mName = mReader->getAttributeValue( attrTex); - // get name of UV source channel + // get name of UV source channel. Specification demands it to be there, but some exporters + // don't write it. It will be the default UV channel in case it's missing. attrTex = TestAttribute( "texcoord"); - if( attrTex >= 0 ) - pSampler.mUVChannel = mReader->getAttributeValue( attrTex); + if( attrTex >= 0 ) + pSampler.mUVChannel = mReader->getAttributeValue( attrTex); //SkipElement(); } else if( IsElement( "technique")) diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index b763489f5..d636e6954 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -52,7 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace Assimp; static const aiImporterDesc desc = { - "Collada Importer", + "Direct3D XFile Importer", "", "", "", @@ -594,8 +594,9 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vectorAddProperty( &shadeMode, 1, AI_MATKEY_SHADING_MODEL); // material colours - // FIX: Setup this as ambient not as emissive color - mat->AddProperty( &oldMat.mEmissive, 1, AI_MATKEY_COLOR_AMBIENT); + // Unclear: there's no ambient colour, but emissive. What to put for ambient? + // Probably nothing at all, let the user select a suitable default. + mat->AddProperty( &oldMat.mEmissive, 1, AI_MATKEY_COLOR_EMISSIVE); mat->AddProperty( &oldMat.mDiffuse, 1, AI_MATKEY_COLOR_DIFFUSE); mat->AddProperty( &oldMat.mSpecular, 1, AI_MATKEY_COLOR_SPECULAR); mat->AddProperty( &oldMat.mSpecularExponent, 1, AI_MATKEY_SHININESS);