Merge pull request #3372 from lsliegeo/nff_ai_real

NFF importer double precision support
pull/3374/head
Kim Kulling 2020-08-16 13:56:33 +02:00 committed by GitHub
commit 51a417ce6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -96,7 +96,7 @@ const aiImporterDesc *NFFImporter::GetInfo() const {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#define AI_NFF_PARSE_FLOAT(f) \ #define AI_NFF_PARSE_FLOAT(f) \
SkipSpaces(&sz); \ SkipSpaces(&sz); \
if (!::IsLineEnd(*sz)) sz = fast_atoreal_move<float>(sz, (float &)f); if (!::IsLineEnd(*sz)) sz = fast_atoreal_move<ai_real>(sz, (ai_real &)f);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#define AI_NFF_PARSE_TRIPLE(v) \ #define AI_NFF_PARSE_TRIPLE(v) \
@ -233,7 +233,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
// camera parameters // camera parameters
aiVector3D camPos, camUp(0.f, 1.f, 0.f), camLookAt(0.f, 0.f, 1.f); aiVector3D camPos, camUp(0.f, 1.f, 0.f), camLookAt(0.f, 0.f, 1.f);
float angle = 45.f; ai_real angle = 45.f;
aiVector2D resolution; aiVector2D resolution;
bool hasCam = false; bool hasCam = false;
@ -262,7 +262,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
// check whether this is the NFF2 file format // check whether this is the NFF2 file format
if (TokenMatch(buffer, "nff", 3)) { if (TokenMatch(buffer, "nff", 3)) {
const float qnan = get_qnan(); const ai_real qnan = get_qnan();
const aiColor4D cQNAN = aiColor4D(qnan, 0.f, 0.f, 1.f); const aiColor4D cQNAN = aiColor4D(qnan, 0.f, 0.f, 1.f);
const aiVector3D vQNAN = aiVector3D(qnan, 0.f, 0.f); const aiVector3D vQNAN = aiVector3D(qnan, 0.f, 0.f);
@ -706,7 +706,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
} }
// 'f' - shading information block // 'f' - shading information block
else if (TokenMatch(sz, "f", 1)) { else if (TokenMatch(sz, "f", 1)) {
float d; ai_real d;
// read the RGB colors // read the RGB colors
AI_NFF_PARSE_TRIPLE(s.color); AI_NFF_PARSE_TRIPLE(s.color);
@ -856,7 +856,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
// read the two center points and the respective radii // read the two center points and the respective radii
aiVector3D center1, center2; aiVector3D center1, center2;
float radius1 = 0.f, radius2 = 0.f; ai_real radius1 = 0.f, radius2 = 0.f;
AI_NFF_PARSE_TRIPLE(center1); AI_NFF_PARSE_TRIPLE(center1);
AI_NFF_PARSE_FLOAT(radius1); AI_NFF_PARSE_FLOAT(radius1);
@ -874,7 +874,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
curMesh.dir = center2 - center1; curMesh.dir = center2 - center1;
curMesh.center = center1 + curMesh.dir / (ai_real)2.0; curMesh.center = center1 + curMesh.dir / (ai_real)2.0;
float f; ai_real f;
if ((f = curMesh.dir.Length()) < 10e-3f) { if ((f = curMesh.dir.Length()) < 10e-3f) {
ASSIMP_LOG_ERROR("NFF: Cone height is close to zero"); ASSIMP_LOG_ERROR("NFF: Cone height is close to zero");
continue; continue;

View File

@ -113,14 +113,14 @@ private:
{} {}
aiColor3D color,diffuse,specular,ambient,emissive; aiColor3D color,diffuse,specular,ambient,emissive;
float refracti; ai_real refracti;
std::string texFile; std::string texFile;
// For NFF2 // For NFF2
bool twoSided; bool twoSided;
bool shaded; bool shaded;
float opacity, shininess; ai_real opacity, shininess;
std::string name; std::string name;
@ -155,7 +155,7 @@ private:
{} {}
aiVector3D position; aiVector3D position;
float intensity; ai_real intensity;
aiColor3D color; aiColor3D color;
}; };