Read the Value, not the Attribute
Correct some mistakes made when moving to pugixml from IrrXML Fixes #4179
This commit is contained in:
@@ -924,6 +924,8 @@ void ColladaParser::ReadMaterial(XmlNode &node, Collada::Material &pMaterial) {
|
||||
void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
|
||||
XmlNodeIterator xmlIt(node, XmlNodeIterator::PreOrderMode);
|
||||
XmlNode currentNode;
|
||||
// TODO: Check the current technique and skip over unsupported extra techniques
|
||||
|
||||
while (xmlIt.getNext(currentNode)) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName == "spot") {
|
||||
@@ -949,33 +951,34 @@ void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
|
||||
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b);
|
||||
SkipSpacesAndLineEnd(&content);
|
||||
} else if (currentName == "constant_attenuation") {
|
||||
XmlParser::getRealAttribute(currentNode, "constant_attenuation", pLight.mAttConstant);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mAttConstant);
|
||||
} else if (currentName == "linear_attenuation") {
|
||||
XmlParser::getRealAttribute(currentNode, "linear_attenuation", pLight.mAttLinear);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mAttLinear);
|
||||
} else if (currentName == "quadratic_attenuation") {
|
||||
XmlParser::getRealAttribute(currentNode, "quadratic_attenuation", pLight.mAttQuadratic);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mAttQuadratic);
|
||||
} else if (currentName == "falloff_angle") {
|
||||
XmlParser::getRealAttribute(currentNode, "falloff_angle", pLight.mFalloffAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle);
|
||||
} else if (currentName == "falloff_exponent") {
|
||||
XmlParser::getRealAttribute(currentNode, "falloff_exponent", pLight.mFalloffExponent);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffExponent);
|
||||
}
|
||||
// FCOLLADA extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "outer_cone") {
|
||||
XmlParser::getRealAttribute(currentNode, "outer_cone", pLight.mOuterAngle);
|
||||
} else if (currentName == "penumbra_angle") { // ... and this one is even deprecated
|
||||
XmlParser::getRealAttribute(currentNode, "penumbra_angle", pLight.mPenumbraAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
|
||||
} else if (currentName == "penumbra_angle") { // this one is deprecated, now calculated using outer_cone
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mPenumbraAngle);
|
||||
} else if (currentName == "intensity") {
|
||||
XmlParser::getRealAttribute(currentNode, "intensity", pLight.mIntensity);
|
||||
} else if (currentName == "falloff") {
|
||||
XmlParser::getRealAttribute(currentNode, "falloff", pLight.mOuterAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mIntensity);
|
||||
}
|
||||
else if (currentName == "falloff") {
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
|
||||
} else if (currentName == "hotspot_beam") {
|
||||
XmlParser::getRealAttribute(currentNode, "hotspot_beam", pLight.mFalloffAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle);
|
||||
}
|
||||
// OpenCOLLADA extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "decay_falloff") {
|
||||
XmlParser::getRealAttribute(currentNode, "decay_falloff", pLight.mOuterAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1109,7 +1112,7 @@ void ColladaParser::ReadEffectProfileCommon(XmlNode &node, Collada::Effect &pEff
|
||||
// GOOGLEEARTH/OKINO extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "double_sided")
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), pEffect.mDoubleSided);
|
||||
XmlParser::getValueAsBool(currentNode, pEffect.mDoubleSided);
|
||||
|
||||
// FCOLLADA extensions
|
||||
// -------------------------------------------------------
|
||||
@@ -1121,9 +1124,9 @@ void ColladaParser::ReadEffectProfileCommon(XmlNode &node, Collada::Effect &pEff
|
||||
// MAX3D extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "wireframe") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), pEffect.mWireframe);
|
||||
XmlParser::getValueAsBool(currentNode, pEffect.mWireframe);
|
||||
} else if (currentName == "faceted") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), pEffect.mFaceted);
|
||||
XmlParser::getValueAsBool(currentNode, pEffect.mFaceted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1142,23 +1145,23 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
|
||||
// MAYA extensions
|
||||
// -------------------------------------------------------
|
||||
if (currentName == "wrapU") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mWrapU);
|
||||
XmlParser::getValueAsBool(currentNode, out.mWrapU);
|
||||
} else if (currentName == "wrapV") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mWrapV);
|
||||
XmlParser::getValueAsBool(currentNode, out.mWrapV);
|
||||
} else if (currentName == "mirrorU") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mMirrorU);
|
||||
XmlParser::getValueAsBool(currentNode, out.mMirrorU);
|
||||
} else if (currentName == "mirrorV") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mMirrorV);
|
||||
XmlParser::getValueAsBool(currentNode, out.mMirrorV);
|
||||
} else if (currentName == "repeatU") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.x);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.x);
|
||||
} else if (currentName == "repeatV") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.y);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.y);
|
||||
} else if (currentName == "offsetU") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.x);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.x);
|
||||
} else if (currentName == "offsetV") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.y);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.y);
|
||||
} else if (currentName == "rotateUV") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mRotation);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mRotation);
|
||||
} else if (currentName == "blend_mode") {
|
||||
std::string v;
|
||||
XmlParser::getValueAsString(currentNode, v);
|
||||
@@ -1178,14 +1181,14 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
|
||||
// OKINO extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "weighting") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mWeighting);
|
||||
} else if (currentName == "mix_with_previous_layer") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mMixWithPrevious);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mMixWithPrevious);
|
||||
}
|
||||
// MAX3D extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "amount") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mWeighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user