diff --git a/code/AssetLib/M3D/M3DExporter.cpp b/code/AssetLib/M3D/M3DExporter.cpp index 9583636a1..d26722b17 100644 --- a/code/AssetLib/M3D/M3DExporter.cpp +++ b/code/AssetLib/M3D/M3DExporter.cpp @@ -197,12 +197,15 @@ M3D_INDEX addMaterial(const Assimp::M3DWrapper &m3d, const aiMaterial *mat) { break; case m3dpf_float: if (mat->Get(aiProps[k].pKey, aiProps[k].type, - aiProps[k].index, f) == AI_SUCCESS) + aiProps[k].index, f) == AI_SUCCESS) { + uint32_t f_uint32; + memcpy(&f_uint32, &f, sizeof(uint32_t)); addProp(&m3d->material[mi], m3d_propertytypes[k].id, /* not (uint32_t)f, because we don't want to convert * it, we want to see it as 32 bits of memory */ - *((uint32_t *)&f)); + f_uint32); + } break; case m3dpf_uint8: if (mat->Get(aiProps[k].pKey, aiProps[k].type, diff --git a/code/AssetLib/M3D/m3d.h b/code/AssetLib/M3D/m3d.h index 905ff5095..c25c633ba 100644 --- a/code/AssetLib/M3D/m3d.h +++ b/code/AssetLib/M3D/m3d.h @@ -3590,7 +3590,7 @@ m3d_t *m3d_load(unsigned char *data, m3dread_t readfilecb, m3dfree_t freecb, m3d case 4: f = (float)(*((float *)(data + 0))); break; case 8: f = (float)(*((double *)(data + 0))); break; } - h->cmd[i].arg[k] = *((uint32_t *)&f); + memcpy(&(h->cmd[i].arg[k]), &f, sizeof(uint32_t)); data += model->vc_s; break; case m3dcp_hi_t: data = _m3d_getidx(data, model->hi_s, &h->cmd[i].arg[k]); break;