diff --git a/code/AssetLib/M3D/m3d.h b/code/AssetLib/M3D/m3d.h index 2d5b73a720..b82137d362 100644 --- a/code/AssetLib/M3D/m3d.h +++ b/code/AssetLib/M3D/m3d.h @@ -5578,9 +5578,9 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size } else out--; break; - case m3dpf_uint8: *out++ = m->prop[i].value.num; break; + case m3dpf_uint8: *out++ = (uint8_t)m->prop[i].value.num; break; case m3dpf_uint16: - *((uint16_t *)out) = m->prop[i].value.num; + *((uint16_t *)out) = (uint16_t)m->prop[i].value.num; out += 2; break; case m3dpf_uint32: @@ -5655,7 +5655,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size face[i].data.normal[1] == M3D_UNDEF || face[i].data.normal[2] == M3D_UNDEF) ? 0 : 2); - *out++ = k; + *out++ = (uint8_t)k; for (j = 0; j < 3; j++) { out = _m3d_addidx(out, vi_s, vrtxidx[face[i].data.vertex[j]]); if (k & 1) diff --git a/code/AssetLib/glTF/glTFExporter.cpp b/code/AssetLib/glTF/glTFExporter.cpp index b85affc083..110d2be4a9 100644 --- a/code/AssetLib/glTF/glTFExporter.cpp +++ b/code/AssetLib/glTF/glTFExporter.cpp @@ -536,10 +536,12 @@ void glTFExporter::ExportMeshes() // Variables needed for compression. BEGIN. // Indices, not pointers - because pointer to buffer is changing while writing to it. +#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC size_t idx_srcdata_begin = 0; // Index of buffer before writing mesh data. Also, index of begin of coordinates array in buffer. size_t idx_srcdata_normal = SIZE_MAX;// Index of begin of normals array in buffer. SIZE_MAX - mean that mesh has no normals. - std::vector idx_srcdata_tc;// Array of indices. Every index point to begin of texture coordinates array in buffer. size_t idx_srcdata_ind;// Index of begin of coordinates indices array in buffer. +#endif + std::vector idx_srcdata_tc;// Array of indices. Every index point to begin of texture coordinates array in buffer. bool comp_allow;// Point that data of current mesh can be compressed. // Variables needed for compression. END. @@ -609,13 +611,17 @@ void glTFExporter::ExportMeshes() /******************* Vertices ********************/ // If compression is used then you need parameters of uncompressed region: begin and size. At this step "begin" is stored. +#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC if(comp_allow) idx_srcdata_begin = b->byteLength; +#endif Ref v = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mVertices, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); if (v) p.attributes.position.push_back(v); /******************** Normals ********************/ +#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC if(comp_allow && (aim->mNormals != 0)) idx_srcdata_normal = b->byteLength;// Store index of normals array. +#endif Ref n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); if (n) p.attributes.normal.push_back(n); @@ -640,7 +646,9 @@ void glTFExporter::ExportMeshes() } /*************** Vertices indices ****************/ +#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC idx_srcdata_ind = b->byteLength;// Store index of indices array. +#endif if (aim->mNumFaces > 0) { std::vector indices;