[WIP] Use float instead of ai_real in Material API

- closes https://github.com/assimp/assimp/issues/4685
kimkulling/use_float_for_material_parameters_issue-4685
Kim Kulling 2022-08-18 09:43:04 +02:00 committed by GitHub
parent a0f375162d
commit d6244d20f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 6 deletions

View File

@ -89,7 +89,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat,
const char *pKey, const char *pKey,
unsigned int type, unsigned int type,
unsigned int index, unsigned int index,
ai_real *pOut, float *pOut,
unsigned int *pMax) { unsigned int *pMax) {
ai_assert(pOut != nullptr); ai_assert(pOut != nullptr);
ai_assert(pMat != nullptr); ai_assert(pMat != nullptr);
@ -110,7 +110,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat,
} }
for (unsigned int a = 0; a < iWrite; ++a) { for (unsigned int a = 0; a < iWrite; ++a) {
pOut[a] = static_cast<ai_real>(reinterpret_cast<float *>(prop->mData)[a]); pOut[a] = (prop->mData)[a];
} }
if (pMax) { if (pMax) {
@ -136,7 +136,6 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat,
iWrite = prop->mDataLength / sizeof(int32_t); iWrite = prop->mDataLength / sizeof(int32_t);
if (pMax) { if (pMax) {
iWrite = std::min(*pMax, iWrite); iWrite = std::min(*pMax, iWrite);
;
} }
for (unsigned int a = 0; a < iWrite; ++a) { for (unsigned int a = 0; a < iWrite; ++a) {
pOut[a] = static_cast<ai_real>(reinterpret_cast<int32_t *>(prop->mData)[a]); pOut[a] = static_cast<ai_real>(reinterpret_cast<int32_t *>(prop->mData)[a]);
@ -144,9 +143,7 @@ aiReturn aiGetMaterialFloatArray(const aiMaterial *pMat,
if (pMax) { if (pMax) {
*pMax = iWrite; *pMax = iWrite;
} }
} } else { // a string ... read floats separated by spaces
// a string ... read floats separated by spaces
else {
if (pMax) { if (pMax) {
iWrite = *pMax; iWrite = *pMax;
} }