Fixed bounding box of models loaded from loose files.

This commit is contained in:
Leonardo Zide
2016-09-25 13:15:43 -07:00
parent 5d24b25aed
commit cde1334e0b
2 changed files with 27 additions and 5 deletions
+21 -4
View File
@@ -1,5 +1,22 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################
*.suo
*.sln
*.vcxproj
*.filters
*.user
*.pdb
*.db
*.psess
*.opendb
*.opensdf
*.sdf
*.suo
*.vspx
*.xcodeproj
build
debug
release
ipch
Makefile
library.bin
leocad_plugin_import.cpp
*.qm
+6 -1
View File
@@ -882,6 +882,7 @@ bool lcPiecesLibrary::LoadPiece(PieceInfo* Info)
bool Loaded = false;
bool SaveCache = false;
bool UpdateBoundingBox = false;
if (Info->mZipFileType != LC_NUM_ZIPFILES && mZipFiles[Info->mZipFileType])
{
@@ -928,13 +929,17 @@ bool lcPiecesLibrary::LoadPiece(PieceInfo* Info)
const char* OldLocale = setlocale(LC_NUMERIC, "C");
Loaded = ReadMeshData(PieceFile, lcMatrix44Identity(), 16, TextureStack, MeshData, LC_MESHDATA_SHARED, false);
setlocale(LC_NUMERIC, OldLocale);
UpdateBoundingBox = true;
}
}
if (!Loaded)
return false;
CreateMesh(Info, MeshData);
lcMesh* Mesh = CreateMesh(Info, MeshData);
if (UpdateBoundingBox)
Info->SetBoundingBox(Mesh->mBoundingBox.Min, Mesh->mBoundingBox.Max);
if (SaveCache)
SaveCachePiece(Info);