SET(GIT_COMMIT_HASH 0)
ENDIF(NOT GIT_COMMIT_HASH)
+OPTION(ASSIMP_DOUBLE_PRECISION
+ "Set to ON to enable double precision processing"
+ OFF
+)
+
+IF(ASSIMP_DOUBLE_PRECISION)
+ ADD_DEFINITIONS(-DAI_DOUBLE_PRECISION)
+ENDIF(ASSIMP_DOUBLE_PRECISION)
+
configure_file(
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
# ${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in
// ------------------------------------------------------------------------------------------------
// Importer::SetPropertyFloat
-ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, float value)
+ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, ai_real value)
{
ASSIMP_BEGIN_EXCEPTION_REGION();
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
- SetGenericProperty<float>(pp->floats,szName,value);
+ SetGenericProperty<ai_real>(pp->floats,szName,value);
ASSIMP_END_EXCEPTION_REGION(void);
}
// ------------------------------------------------------------------------------------------------
// Set a configuration property
-bool ExportProperties :: SetPropertyFloat(const char* szName, float iValue)
+bool ExportProperties :: SetPropertyFloat(const char* szName, ai_real iValue)
{
- return SetGenericProperty<float>(mFloatProperties, szName,iValue);
+ return SetGenericProperty<ai_real>(mFloatProperties, szName,iValue);
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
// Get a configuration property
-float ExportProperties :: GetPropertyFloat(const char* szName,
- float iErrorReturn /*= 10e10*/) const
+ai_real ExportProperties :: GetPropertyFloat(const char* szName,
+ ai_real iErrorReturn /*= 10e10*/) const
{
- return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn);
+ return GetGenericProperty<ai_real>(mFloatProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
// Has a configuration property
bool ExportProperties :: HasPropertyFloat(const char* szName) const
{
- return HasGenericProperty<float>(mFloatProperties, szName);
+ return HasGenericProperty<ai_real>(mFloatProperties, szName);
};
// ------------------------------------------------------------------------------------------------
void GenVertexNormalsProcess::SetupProperties(const Importer* pImp)
{
// Get the current value of the AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE property
- configMaxAngle = pImp->GetPropertyFloat(AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE,175.f);
- configMaxAngle = AI_DEG_TO_RAD(std::max(std::min(configMaxAngle,175.0f),0.0f));
+ configMaxAngle = pImp->GetPropertyFloat(AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE,(ai_real)175.0);
+ configMaxAngle = AI_DEG_TO_RAD(std::max(std::min(configMaxAngle,(ai_real)175.0),(ai_real)0.0));
}
// ------------------------------------------------------------------------------------------------
}
// Allocate the array to hold the output normals
- const float qnan = std::numeric_limits<float>::quiet_NaN();
+ const float qnan = std::numeric_limits<ai_real>::quiet_NaN();
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
// Compute per-face normals but store them per-vertex
// check whether we can reuse the SpatialSort of a previous step.
SpatialSort* vertexFinder = NULL;
SpatialSort _vertexFinder;
- float posEpsilon = 1e-5f;
+ ai_real posEpsilon = 1e-5;
if (shared) {
- std::vector<std::pair<SpatialSort,float> >* avf;
+ std::vector<std::pair<SpatialSort,ai_real> >* avf;
shared->GetProperty(AI_SPP_SPATIAL_SORT,avf);
if (avf)
{
- std::pair<SpatialSort,float>& blubb = avf->operator [] (meshIndex);
+ std::pair<SpatialSort,ai_real>& blubb = avf->operator [] (meshIndex);
vertexFinder = &blubb.first;
posEpsilon = blubb.second;
}
// Slower code path if a smooth angle is set. There are many ways to achieve
// the effect, this one is the most straightforward one.
else {
- const float fLimit = std::cos(configMaxAngle);
+ const ai_real fLimit = std::cos(configMaxAngle);
for (unsigned int i = 0; i < pMesh->mNumVertices;++i) {
// Get all vertices that share this one ...
vertexFinder->FindPositions( pMesh->mVertices[i] , posEpsilon, verticesFound);
aiVector3D vr = pMesh->mNormals[i];
- float vrlen = vr.Length();
+ ai_real vrlen = vr.Length();
aiVector3D pcNor;
for (unsigned int a = 0; a < verticesFound.size(); ++a) {
// setter for configMaxAngle
- inline void SetMaxSmoothAngle(float f)
+ inline void SetMaxSmoothAngle(ai_real f)
{
configMaxAngle =f;
}
private:
/** Configuration option: maximum smoothing angle, in radians*/
- float configMaxAngle;
+ ai_real configMaxAngle;
};
} // end of namespace Assimp
#endif // !!AI_GENVERTEXNORMALPROCESS_H_INC
-
// ------------------------------------------------------------------------------------------------
// Set a configuration property
-bool Importer::SetPropertyFloat(const char* szName, float iValue)
+bool Importer::SetPropertyFloat(const char* szName, ai_real iValue)
{
bool exising;
ASSIMP_BEGIN_EXCEPTION_REGION();
- exising = SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue);
+ exising = SetGenericProperty<ai_real>(pimpl->mFloatProperties, szName,iValue);
ASSIMP_END_EXCEPTION_REGION(bool);
return exising;
}
// ------------------------------------------------------------------------------------------------
// Get a configuration property
-float Importer::GetPropertyFloat(const char* szName,
- float iErrorReturn /*= 10e10*/) const
+ai_real Importer::GetPropertyFloat(const char* szName,
+ ai_real iErrorReturn /*= 10e10*/) const
{
- return GetGenericProperty<float>(pimpl->mFloatProperties,szName,iErrorReturn);
+ return GetGenericProperty<ai_real>(pimpl->mFloatProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
void PlyExporter::WriteMeshVerts(const aiMesh* m, unsigned int components)
{
- static const float inf = std::numeric_limits<float>::infinity();
+ static const ai_real inf = std::numeric_limits<ai_real>::infinity();
// If a component (for instance normal vectors) is present in at least one mesh in the scene,
// then default values are written for meshes that do not contain this component.
// find the dominant axis
aiVector3D d = max-min;
- const float div = std::max(d.x,std::max(d.y,d.z))*0.5f;
+ const ai_real div = std::max(d.x,std::max(d.y,d.z))*0.5;
d = min+d*0.5f;
for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
DefaultLogger::get()->info(buffer);
}
}
-
}
// -------------------------------------------------------------------------------
-float ComputePositionEpsilon(const aiMesh* pMesh)
+ai_real ComputePositionEpsilon(const aiMesh* pMesh)
{
- const float epsilon = 1e-4f;
+ const ai_real epsilon = 1e-4;
// calculate the position bounds so we have a reliable epsilon to check position differences against
aiVector3D minVec, maxVec;
}
// -------------------------------------------------------------------------------
-float ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num)
+ai_real ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num)
{
ai_assert( NULL != pMeshes );
- const float epsilon = 1e-4f;
+ const ai_real epsilon = 1e-4;
// calculate the position bounds so we have a reliable epsilon to check position differences against
aiVector3D minVec, maxVec, mi, ma;
* @param pColor1 First color
* @param pColor2 second color
* @return Quadratic color difference */
-inline float GetColorDifference( const aiColor4D& pColor1, const aiColor4D& pColor2)
+inline ai_real GetColorDifference( const aiColor4D& pColor1, const aiColor4D& pColor2)
{
const aiColor4D c (pColor1.r - pColor2.r, pColor1.g - pColor2.g, pColor1.b - pColor2.b, pColor1.a - pColor2.a);
return c.r*c.r + c.g*c.g + c.b*c.b + c.a*c.a;
// -------------------------------------------------------------------------------
// Compute a good epsilon value for position comparisons on a mesh
-float ComputePositionEpsilon(const aiMesh* pMesh);
+ai_real ComputePositionEpsilon(const aiMesh* pMesh);
// -------------------------------------------------------------------------------
// Compute a good epsilon value for position comparisons on a array of meshes
-float ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num);
+ai_real ComputePositionEpsilon(const aiMesh* const* pMeshes, size_t num);
// -------------------------------------------------------------------------------
void Execute( aiScene* pScene)
{
- typedef std::pair<SpatialSort, float> _Type;
+ typedef std::pair<SpatialSort, ai_real> _Type;
DefaultLogger::get()->debug("Generate spatially-sorted vertex cache");
std::vector<_Type>* p = new std::vector<_Type>(pScene->mNumMeshes);