Merge pull request #4697 from assimp/kimkulling/patch-issue-4676

[WIP] Use ai_Real to write correct accuracy
pull/4700/head
Kim Kulling 2022-08-18 19:04:28 +02:00 committed by GitHub
commit 04997ccbf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -130,7 +130,7 @@ inline size_t Write<double>(IOStream *stream, const double &f) {
// Serialize a vec3 // Serialize a vec3
template <> template <>
inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) { inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
size_t t = Write<float>(stream, v.x); size_t t = Write<ai_real>(stream, v.x);
t += Write<float>(stream, v.y); t += Write<float>(stream, v.y);
t += Write<float>(stream, v.z); t += Write<float>(stream, v.z);
@ -141,7 +141,7 @@ inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
// Serialize a color value // Serialize a color value
template <> template <>
inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) { inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
size_t t = Write<float>(stream, v.r); size_t t = Write<ai_real>(stream, v.r);
t += Write<float>(stream, v.g); t += Write<float>(stream, v.g);
t += Write<float>(stream, v.b); t += Write<float>(stream, v.b);
@ -152,7 +152,7 @@ inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
// Serialize a color value // Serialize a color value
template <> template <>
inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) { inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
size_t t = Write<float>(stream, v.r); size_t t = Write<ai_real>(stream, v.r);
t += Write<float>(stream, v.g); t += Write<float>(stream, v.g);
t += Write<float>(stream, v.b); t += Write<float>(stream, v.b);
t += Write<float>(stream, v.a); t += Write<float>(stream, v.a);
@ -164,7 +164,7 @@ inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
// Serialize a quaternion // Serialize a quaternion
template <> template <>
inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) { inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) {
size_t t = Write<float>(stream, v.w); size_t t = Write<ai_real>(stream, v.w);
t += Write<float>(stream, v.x); t += Write<float>(stream, v.x);
t += Write<float>(stream, v.y); t += Write<float>(stream, v.y);
t += Write<float>(stream, v.z); t += Write<float>(stream, v.z);
@ -190,7 +190,7 @@ template <>
inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) { inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) {
for (unsigned int i = 0; i < 4; ++i) { for (unsigned int i = 0; i < 4; ++i) {
for (unsigned int i2 = 0; i2 < 4; ++i2) { for (unsigned int i2 = 0; i2 < 4; ++i2) {
Write<float>(stream, m[i][i2]); Write<ai_real>(stream, m[i][i2]);
} }
} }