Support instance_image in Collada 1.5 files

The <instance_image> tag in sampler2D elements is not expected by
ColladaParser. This patch parses the instance_image element and
gets the image ID.
pull/692/head
Danke Xie 2015-11-19 03:41:26 -08:00 committed by Danke Xie
parent 916cfb9d53
commit 24b68b1e3d
1 changed files with 14 additions and 1 deletions

View File

@ -1509,7 +1509,7 @@ void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam)
// don't care for remaining stuff // don't care for remaining stuff
SkipElement( "surface"); SkipElement( "surface");
} }
else if( IsElement( "sampler2D")) else if( IsElement( "sampler2D") && (FV_1_4_n == mFormat || FV_1_3_n == mFormat))
{ {
// surface ID is given inside <source> tags // surface ID is given inside <source> tags
TestOpening( "source"); TestOpening( "source");
@ -1520,6 +1520,19 @@ void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam)
// don't care for remaining stuff // don't care for remaining stuff
SkipElement( "sampler2D"); SkipElement( "sampler2D");
}
else if( IsElement( "sampler2D"))
{
// surface ID is given inside <instance_image> tags
TestOpening( "instance_image");
int attrURL = GetAttribute("url");
const char* url = mReader->getAttributeValue( attrURL);
if( url[0] != '#')
ThrowException( "Unsupported URL format in instance_image");
url++;
pParam.mType = Param_Sampler;
pParam.mReference = url;
SkipElement( "sampler2D");
} else } else
{ {
// ignore unknown element // ignore unknown element