diff --git a/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp b/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp index 3376f4d9e..2cfa22530 100644 --- a/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp +++ b/code/AssetLib/IFC/IFCReaderGen1_2x3.cpp @@ -45,6 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "IFCReaderGen_2x3.h" +#if _MSC_VER +# pragma warning(push) +# pragma warning(disable : 4702) +#endif // _MSC_VER + namespace Assimp { using namespace ::Assimp::IFC; @@ -3165,4 +3170,8 @@ template <> size_t GenericFill(const DB& db, const LI } // ! STEP } // ! Assimp +#if _MSC_VER +# pragma warning(pop) +#endif // _MSC_VER + #endif diff --git a/code/AssetLib/IFC/IFCReaderGen2_2x3.cpp b/code/AssetLib/IFC/IFCReaderGen2_2x3.cpp index e6687014d..c58c7c42f 100644 --- a/code/AssetLib/IFC/IFCReaderGen2_2x3.cpp +++ b/code/AssetLib/IFC/IFCReaderGen2_2x3.cpp @@ -43,6 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "IFCReaderGen_2x3.h" +#if _MSC_VER +# pragma warning(push) +# pragma warning(disable : 4702) +#endif // _MSC_VER + namespace Assimp { using namespace IFC; using namespace ::Assimp::IFC::Schema_2x3; @@ -1915,4 +1920,8 @@ template <> size_t GenericFill(const DB& db, const LIST& } // ! STEP } // ! Assimp +#if _MSC_VER +# pragma warning(pop) +#endif // _MSC_VER + #endif diff --git a/code/AssetLib/M3D/m3d.h b/code/AssetLib/M3D/m3d.h index fb980b9c4..905ff5095 100644 --- a/code/AssetLib/M3D/m3d.h +++ b/code/AssetLib/M3D/m3d.h @@ -686,7 +686,11 @@ typedef struct } _m3dstbi__result_info; #define STBI_ASSERT(v) -#define STBI_NOTUSED(v) (void)sizeof(v) +#ifdef _MSC_VER +#define STBI_NOTUSED(v) (void)(v) +#else +#define STBI_NOTUSED(v) (void)sizeof(v) +#endif #define STBI__BYTECAST(x) ((unsigned char)((x)&255)) #define STBI_MALLOC(sz) M3D_MALLOC(sz) #define STBI_REALLOC(p, newsz) M3D_REALLOC(p, newsz) @@ -699,10 +703,6 @@ _inline static unsigned char _m3dstbi__get8(_m3dstbi__context *s) { return 0; } -_inline static int _m3dstbi__at_eof(_m3dstbi__context *s) { - return s->img_buffer >= s->img_buffer_end; -} - static void _m3dstbi__skip(_m3dstbi__context *s, int n) { if (n < 0) { s->img_buffer = s->img_buffer_end; @@ -4347,7 +4347,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size char vc_s, vi_s, si_s, ci_s, ti_s, bi_s, nb_s, sk_s, fc_s, hi_s, fi_s; char *sn = NULL, *sl = NULL, *sa = NULL, *sd = NULL; unsigned char *out = NULL, *z = NULL, weights[M3D_NUMBONE], *norm = NULL; - unsigned int i, j, k, l, n, len, chunklen, *length; + unsigned int i = 0, j = 0, k = 0, l = 0, n = 0, len = 0, chunklen = 0, *length = NULL; M3D_FLOAT scale = (M3D_FLOAT)0.0, min_x, max_x, min_y, max_y, min_z, max_z; M3D_INDEX last, *vrtxidx = NULL, *mtrlidx = NULL, *tmapidx = NULL, *skinidx = NULL; uint32_t idx, numcmap = 0, *cmap = NULL, numvrtx = 0, maxvrtx = 0, numtmap = 0, maxtmap = 0, numproc = 0; @@ -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) @@ -6149,7 +6149,7 @@ public: #endif /* M3D_CPPWRAPPER */ -#ifdef _MSC_VER +#if _MSC_VER > 1920 && !defined(__clang__) # pragma warning(pop) #endif /* _MSC_VER */ diff --git a/code/AssetLib/glTF/glTFExporter.cpp b/code/AssetLib/glTF/glTFExporter.cpp index be9dddef7..1951167c6 100644 --- a/code/AssetLib/glTF/glTFExporter.cpp +++ b/code/AssetLib/glTF/glTFExporter.cpp @@ -542,10 +542,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. @@ -615,13 +617,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); @@ -646,7 +652,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; diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index e45b53006..763a6ac37 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -804,7 +804,7 @@ struct CustomExtension : public Object { Nullable> mValues; operator bool() const { - return Size(); + return Size() != 0; } size_t Size() const {