# Ifc: update color conversion routines to always work with single precision.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1142 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/head
aramis_acg 2012-02-02 22:42:11 +00:00
parent bfb8fd8483
commit 4fcf61c31f
2 changed files with 12 additions and 12 deletions

View File

@ -257,24 +257,24 @@ IfcFloat ConvertSIPrefix(const std::string& prefix)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertColor(IfcColor4& out, const IfcColourRgb& in) void ConvertColor(aiColor4D& out, const IfcColourRgb& in)
{ {
out.r = in.Red; out.r = static_cast<float>( in.Red );
out.g = in.Green; out.g = static_cast<float>( in.Green );
out.b = in.Blue; out.b = static_cast<float>( in.Blue );
out.a = 1.f; out.a = static_cast<float>( 1.f );
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertColor(IfcColor4& out, const IfcColourOrFactor& in,ConversionData& conv,const IfcColor4* base) void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base)
{ {
if (const EXPRESS::REAL* const r = in.ToPtr<EXPRESS::REAL>()) { if (const EXPRESS::REAL* const r = in.ToPtr<EXPRESS::REAL>()) {
out.r = out.g = out.b = *r; out.r = out.g = out.b = *r;
if(base) { if(base) {
out.r *= base->r; out.r *= static_cast<float>( base->r );
out.g *= base->g; out.g *= static_cast<float>( base->g );
out.b *= base->b; out.b *= static_cast<float>( base->b );
out.a = base->a; out.a = static_cast<float>( base->a );
} }
else out.a = 1.0; else out.a = 1.0;
} }

View File

@ -176,8 +176,8 @@ struct TempMesh
// conversion routines for common IFC entities, implemented in IFCUtil.cpp // conversion routines for common IFC entities, implemented in IFCUtil.cpp
void ConvertColor(IfcColor4& out, const IfcColourRgb& in); void ConvertColor(aiColor4D& out, const IfcColourRgb& in);
void ConvertColor(IfcColor4& out, const IfcColourOrFactor& in,ConversionData& conv,const IfcColor4* base); void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base);
void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in); void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in);
void ConvertDirection(IfcVector3& out, const IfcDirection& in); void ConvertDirection(IfcVector3& out, const IfcDirection& in);
void ConvertVector(IfcVector3& out, const IfcVector& in); void ConvertVector(IfcVector3& out, const IfcVector& in);