Correct value for mColorAmbient for COLLADA files

pull/587/head
rdb 2015-07-05 14:30:27 +02:00
parent cf4cb6caef
commit 1eef4c387f
3 changed files with 17 additions and 1 deletions

View File

@ -333,8 +333,16 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
out->mAttenuationLinear = srcLight->mAttLinear; out->mAttenuationLinear = srcLight->mAttLinear;
out->mAttenuationQuadratic = srcLight->mAttQuadratic; out->mAttenuationQuadratic = srcLight->mAttQuadratic;
// collada doesn't differenciate between these color types
out->mColorDiffuse = out->mColorSpecular = out->mColorAmbient = srcLight->mColor*srcLight->mIntensity; out->mColorDiffuse = out->mColorSpecular = out->mColorAmbient = srcLight->mColor*srcLight->mIntensity;
if (out->mType == aiLightSource_AMBIENT) {
out->mColorDiffuse = out->mColorSpecular = aiColor3D(0, 0, 0);
out->mColorAmbient = srcLight->mColor*srcLight->mIntensity;
}
else {
// collada doesn't differentiate between these color types
out->mColorDiffuse = out->mColorSpecular = srcLight->mColor*srcLight->mIntensity;
out->mColorAmbient = aiColor3D(0, 0, 0);
}
// convert falloff angle and falloff exponent in our representation, if given // convert falloff angle and falloff exponent in our representation, if given
if (out->mType == aiLightSource_SPOT) { if (out->mType == aiLightSource_SPOT) {

View File

@ -69,6 +69,13 @@ limitations under the License.
<intensity>1.000000</intensity> <intensity>1.000000</intensity>
</technique> </technique>
</light> </light>
<light id="ambientLight-lib" name="ambientLight">
<technique_common>
<ambient>
<color>0.1 0.1 0.2</color>
</ambient>
</technique_common>
</light>
<light id="pointLightShape1-lib" name="pointLightShape1"> <light id="pointLightShape1-lib" name="pointLightShape1">
<technique_common> <technique_common>
<point> <point>
@ -175,6 +182,7 @@ limitations under the License.
<rotate sid="rotateY">0 1 0 0</rotate> <rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate> <rotate sid="rotateX">1 0 0 0</rotate>
<instance_light url="#light-lib"/> <instance_light url="#light-lib"/>
<instance_light url="#ambientLight-lib"/>
</node> </node>
<node id="Box" name="Box"> <node id="Box" name="Box">
<rotate sid="rotateZ">0 0 1 0</rotate> <rotate sid="rotateZ">0 0 1 0</rotate>

Binary file not shown.