From d6244d20f323e14b049b77e2be2aafb0d20fe087 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 18 Aug 2022 09:43:04 +0200 Subject: [PATCH] [WIP] Use float instead of ai_real in Material API - closes https://github.com/assimp/assimp/issues/4685 --- code/Material/MaterialSystem.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/code/Material/MaterialSystem.cpp b/code/Material/MaterialSystem.cpp index b2f738959..38fc18538 100644 --- a/code/Material/MaterialSystem.cpp +++ b/code/Material/MaterialSystem.cpp @@ -89,7 +89,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat, const char *pKey, unsigned int type, unsigned int index, - ai_real *pOut, + float *pOut, unsigned int *pMax) { ai_assert(pOut != nullptr); ai_assert(pMat != nullptr); @@ -110,7 +110,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat, } for (unsigned int a = 0; a < iWrite; ++a) { - pOut[a] = static_cast(reinterpret_cast(prop->mData)[a]); + pOut[a] = (prop->mData)[a]; } if (pMax) { @@ -136,7 +136,6 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat, iWrite = prop->mDataLength / sizeof(int32_t); if (pMax) { iWrite = std::min(*pMax, iWrite); - ; } for (unsigned int a = 0; a < iWrite; ++a) { pOut[a] = static_cast(reinterpret_cast(prop->mData)[a]); @@ -144,9 +143,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat, if (pMax) { *pMax = iWrite; } - } - // a string ... read floats separated by spaces - else { + } else { // a string ... read floats separated by spaces if (pMax) { iWrite = *pMax; }