workaround for ASSIMP_DOUBLE_PRECISION compile errors
changed float types to ai_real types as needed addresses issue #3682pull/3683/head
parent
315362862a
commit
111752cff0
|
@ -335,7 +335,7 @@ void ColladaParser::ReadAssetInfo(XmlNode &node) {
|
||||||
const std::string ¤tName = currentNode.name();
|
const std::string ¤tName = currentNode.name();
|
||||||
if (currentName == "unit") {
|
if (currentName == "unit") {
|
||||||
mUnitSize = 1.f;
|
mUnitSize = 1.f;
|
||||||
XmlParser::getFloatAttribute(currentNode, "meter", mUnitSize);
|
XmlParser::getRealAttribute(currentNode, "meter", mUnitSize);
|
||||||
} else if (currentName == "up_axis") {
|
} else if (currentName == "up_axis") {
|
||||||
std::string v;
|
std::string v;
|
||||||
if (!XmlParser::getValueAsString(currentNode, v)) {
|
if (!XmlParser::getValueAsString(currentNode, v)) {
|
||||||
|
@ -957,33 +957,33 @@ void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
|
||||||
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b);
|
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b);
|
||||||
SkipSpacesAndLineEnd(&content);
|
SkipSpacesAndLineEnd(&content);
|
||||||
} else if (currentName == "constant_attenuation") {
|
} else if (currentName == "constant_attenuation") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "constant_attenuation", pLight.mAttConstant);
|
XmlParser::getRealAttribute(currentNode, "constant_attenuation", pLight.mAttConstant);
|
||||||
} else if (currentName == "linear_attenuation") {
|
} else if (currentName == "linear_attenuation") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "linear_attenuation", pLight.mAttLinear);
|
XmlParser::getRealAttribute(currentNode, "linear_attenuation", pLight.mAttLinear);
|
||||||
} else if (currentName == "quadratic_attenuation") {
|
} else if (currentName == "quadratic_attenuation") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "quadratic_attenuation", pLight.mAttQuadratic);
|
XmlParser::getRealAttribute(currentNode, "quadratic_attenuation", pLight.mAttQuadratic);
|
||||||
} else if (currentName == "falloff_angle") {
|
} else if (currentName == "falloff_angle") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "falloff_angle", pLight.mFalloffAngle);
|
XmlParser::getRealAttribute(currentNode, "falloff_angle", pLight.mFalloffAngle);
|
||||||
} else if (currentName == "falloff_exponent") {
|
} else if (currentName == "falloff_exponent") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "falloff_exponent", pLight.mFalloffExponent);
|
XmlParser::getRealAttribute(currentNode, "falloff_exponent", pLight.mFalloffExponent);
|
||||||
}
|
}
|
||||||
// FCOLLADA extensions
|
// FCOLLADA extensions
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
else if (currentName == "outer_cone") {
|
else if (currentName == "outer_cone") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "outer_cone", pLight.mOuterAngle);
|
XmlParser::getRealAttribute(currentNode, "outer_cone", pLight.mOuterAngle);
|
||||||
} else if (currentName == "penumbra_angle") { // ... and this one is even deprecated
|
} else if (currentName == "penumbra_angle") { // ... and this one is even deprecated
|
||||||
XmlParser::getFloatAttribute(currentNode, "penumbra_angle", pLight.mPenumbraAngle);
|
XmlParser::getRealAttribute(currentNode, "penumbra_angle", pLight.mPenumbraAngle);
|
||||||
} else if (currentName == "intensity") {
|
} else if (currentName == "intensity") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "intensity", pLight.mIntensity);
|
XmlParser::getRealAttribute(currentNode, "intensity", pLight.mIntensity);
|
||||||
} else if (currentName == "falloff") {
|
} else if (currentName == "falloff") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "falloff", pLight.mOuterAngle);
|
XmlParser::getRealAttribute(currentNode, "falloff", pLight.mOuterAngle);
|
||||||
} else if (currentName == "hotspot_beam") {
|
} else if (currentName == "hotspot_beam") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "hotspot_beam", pLight.mFalloffAngle);
|
XmlParser::getRealAttribute(currentNode, "hotspot_beam", pLight.mFalloffAngle);
|
||||||
}
|
}
|
||||||
// OpenCOLLADA extensions
|
// OpenCOLLADA extensions
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
else if (currentName == "decay_falloff") {
|
else if (currentName == "decay_falloff") {
|
||||||
XmlParser::getFloatAttribute(currentNode, "decay_falloff", pLight.mOuterAngle);
|
XmlParser::getRealAttribute(currentNode, "decay_falloff", pLight.mOuterAngle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1162,15 +1162,15 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
|
||||||
} else if (currentName == "mirrorV") {
|
} else if (currentName == "mirrorV") {
|
||||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mMirrorV);
|
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mMirrorV);
|
||||||
} else if (currentName == "repeatU") {
|
} else if (currentName == "repeatU") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.x);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.x);
|
||||||
} else if (currentName == "repeatV") {
|
} else if (currentName == "repeatV") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.y);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.y);
|
||||||
} else if (currentName == "offsetU") {
|
} else if (currentName == "offsetU") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.x);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.x);
|
||||||
} else if (currentName == "offsetV") {
|
} else if (currentName == "offsetV") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.y);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.y);
|
||||||
} else if (currentName == "rotateUV") {
|
} else if (currentName == "rotateUV") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mTransform.mRotation);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mRotation);
|
||||||
} else if (currentName == "blend_mode") {
|
} else if (currentName == "blend_mode") {
|
||||||
std::string v;
|
std::string v;
|
||||||
XmlParser::getValueAsString(currentNode, v);
|
XmlParser::getValueAsString(currentNode, v);
|
||||||
|
@ -1190,14 +1190,14 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
|
||||||
// OKINO extensions
|
// OKINO extensions
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
else if (currentName == "weighting") {
|
else if (currentName == "weighting") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
||||||
} else if (currentName == "mix_with_previous_layer") {
|
} else if (currentName == "mix_with_previous_layer") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mMixWithPrevious);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mMixWithPrevious);
|
||||||
}
|
}
|
||||||
// MAX3D extensions
|
// MAX3D extensions
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
else if (currentName == "amount") {
|
else if (currentName == "amount") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1309,7 +1309,7 @@ void HL1MDLLoader::read_global_info() {
|
||||||
*/
|
*/
|
||||||
void HL1MDLLoader::extract_anim_value(
|
void HL1MDLLoader::extract_anim_value(
|
||||||
const AnimValue_HL1 *panimvalue,
|
const AnimValue_HL1 *panimvalue,
|
||||||
int frame, float bone_scale, float &value) {
|
int frame, float bone_scale, ai_real &value) {
|
||||||
int k = frame;
|
int k = frame;
|
||||||
|
|
||||||
// find span of values that includes the frame we want
|
// find span of values that includes the frame we want
|
||||||
|
|
|
@ -132,7 +132,7 @@ private:
|
||||||
* \param[in,out] value The decompressed anim value at \p frame.
|
* \param[in,out] value The decompressed anim value at \p frame.
|
||||||
*/
|
*/
|
||||||
void extract_anim_value(const AnimValue_HL1 *panimvalue,
|
void extract_anim_value(const AnimValue_HL1 *panimvalue,
|
||||||
int frame, float bone_scale, float &value);
|
int frame, float bone_scale, ai_real &value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Given the number of blend animations, determine the number of blend controllers.
|
* \brief Given the number of blend animations, determine the number of blend controllers.
|
||||||
|
|
|
@ -761,7 +761,7 @@ void PbrtExporter::WriteLights() {
|
||||||
case aiLightSource_AREA: {
|
case aiLightSource_AREA: {
|
||||||
aiVector3D left = light->mDirection ^ light->mUp;
|
aiVector3D left = light->mDirection ^ light->mUp;
|
||||||
// rectangle. center at position, direction is normal vector
|
// rectangle. center at position, direction is normal vector
|
||||||
float dLeft = light->mSize.x / 2, dUp = light->mSize.y / 2;
|
ai_real dLeft = light->mSize.x / 2, dUp = light->mSize.y / 2;
|
||||||
aiVector3D vertices[4] = {
|
aiVector3D vertices[4] = {
|
||||||
light->mPosition - dLeft * left - dUp * light->mUp,
|
light->mPosition - dLeft * left - dUp * light->mUp,
|
||||||
light->mPosition + dLeft * left - dUp * light->mUp,
|
light->mPosition + dLeft * left - dUp * light->mUp,
|
||||||
|
|
|
@ -178,6 +178,26 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ASSIMP_DOUBLE_PRECISION
|
||||||
|
static inline bool getRealAttribute( XmlNode &xmlNode, const char *name, ai_real &val ) {
|
||||||
|
pugi::xml_attribute attr = xmlNode.attribute(name);
|
||||||
|
if (attr.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
val = attr.as_double();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline bool getRealAttribute(XmlNode &xmlNode, const char *name, ai_real &val ) {
|
||||||
|
pugi::xml_attribute attr = xmlNode.attribute(name);
|
||||||
|
if (attr.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
val = attr.as_float();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline bool getFloatAttribute(XmlNode &xmlNode, const char *name, float &val ) {
|
static inline bool getFloatAttribute(XmlNode &xmlNode, const char *name, float &val ) {
|
||||||
pugi::xml_attribute attr = xmlNode.attribute(name);
|
pugi::xml_attribute attr = xmlNode.attribute(name);
|
||||||
if (attr.empty()) {
|
if (attr.empty()) {
|
||||||
|
|
Loading…
Reference in New Issue