2
0
kimkulling 5 жил өмнө
parent
commit
b295fda22c

+ 3 - 3
code/MDL/HalfLife/HL1MDLLoader.cpp

@@ -833,9 +833,9 @@ void HL1MDLLoader::read_meshes() {
                                         tricmds[faceIdx + 2] });
                             } else {
                                 mesh_faces.push_back(HL1MeshFace{
-                                        tricmds[i],
-                                        tricmds[i + 1],
-                                        tricmds[i + 2] });
+                                        tricmds[faceIdx],
+                                        tricmds[faceIdx + 1],
+                                        tricmds[faceIdx + 2] });
                             }
                         }
                     }

+ 6 - 2
code/glTF/glTFAsset.inl

@@ -1271,10 +1271,14 @@ inline void Asset::ReadBinaryHeader(IOStream &stream) {
 
 inline void Asset::Load(const std::string &pFile, bool isBinary) {
     mCurrentAssetDir.clear();
-    std::string::size_type pos = std::max(pFile.rfind('/'), pFile.rfind('\\'));
+
+    int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
+    if (pos != int(std::string::npos)) mCurrentAssetDir = pFile.substr(0, pos + 1);
+
+/*    std::string::size_type pos = std::max(pFile.rfind('/'), pFile.rfind('\\'));
     if (pos != std::string::npos) {
         mCurrentAssetDir = pFile.substr(0, pos + 1);
-    }
+    }*/
 
     shared_ptr<IOStream> stream(OpenFile(pFile.c_str(), "rb", true));
     if (!stream) {

+ 4 - 6
code/glTF2/glTF2Asset.inl

@@ -940,7 +940,7 @@ inline bool GetAttribTargetVector(Mesh::Primitive &p, const int targetIndex, con
 inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) {
     Value *curName = FindMember(pJSON_Object, "name");
     if (nullptr != curName) {
-        this->name = curName->GetString();
+        name = curName->GetString();
     }
 
     /****************** Mesh primitives ******************/
@@ -951,7 +951,7 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) {
             Value &primitive = (*curPrimitives)[i];
 
             Primitive &prim = this->primitives[i];
-            prim.mode = MemberOrDefault(*curPrimitives, "mode", PrimitiveMode_TRIANGLES);
+            prim.mode = MemberOrDefault(primitive, "mode", PrimitiveMode_TRIANGLES);
 
             if (Value *attrs = FindObject(primitive, "attributes")) {
                 for (Value::MemberIterator it = attrs->MemberBegin(); it != attrs->MemberEnd(); ++it) {
@@ -1328,10 +1328,8 @@ inline void Asset::ReadBinaryHeader(IOStream &stream, std::vector<char> &sceneDa
 
 inline void Asset::Load(const std::string &pFile, bool isBinary) {
     mCurrentAssetDir.clear();
-    std::string::size_type pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
-    if (pos != std::string::npos ) {
-        mCurrentAssetDir = pFile.substr(0, pos + 1l);
-    }
+    int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
+    if (pos != int(std::string::npos)) mCurrentAssetDir = pFile.substr(0, pos + 1);
 
     shared_ptr<IOStream> stream(OpenFile(pFile.c_str(), "rb", true));
     if (!stream) {

+ 1 - 2
code/glTF2/glTF2AssetWriter.inl

@@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
 
 Copyright (c) 2006-2020, assimp team
 
-
 All rights reserved.
 
 Redistribution and use of this software in source and binary forms,
@@ -766,7 +765,7 @@ namespace glTF2 {
         }
 
         Value *dict = FindArray(*container, d.mDictId);
-        if (nullptr != dict) {
+        if (nullptr == dict) {
             container->AddMember(StringRef(d.mDictId), Value().SetArray().Move(), mDoc.GetAllocator());
             dict = FindArray(*container, d.mDictId);
             if (nullptr == dict) {