mirror of
https://github.com/leozide/leocad
synced 2024-11-17 07:47:55 +01:00
Fixed bounding box calculation of parts without triangles.
This commit is contained in:
parent
188860f90d
commit
5d06035187
1 changed files with 6 additions and 0 deletions
|
@ -1424,6 +1424,7 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
|||
|
||||
lcVertex* DstVerts = (lcVertex*)Mesh->mVertexData;
|
||||
lcVector3 Min(FLT_MAX, FLT_MAX, FLT_MAX), Max(-FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||
bool UpdatedBoundingBox = false;
|
||||
|
||||
for (int MeshDataIdx = 0; MeshDataIdx < LC_NUM_MESHDATA_TYPES; MeshDataIdx++)
|
||||
{
|
||||
|
@ -1443,6 +1444,8 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
|||
if (Section->mPrimitiveType != LC_MESH_TRIANGLES)
|
||||
continue;
|
||||
|
||||
UpdatedBoundingBox = true;
|
||||
|
||||
for (quint32 Index : Section->mIndices)
|
||||
{
|
||||
lcVector3 Position = lcVector3LDrawToLeoCAD(Vertices[Index].Position);
|
||||
|
@ -1452,6 +1455,9 @@ lcMesh* lcPiecesLibrary::CreateMesh(PieceInfo* Info, lcLibraryMeshData& MeshData
|
|||
}
|
||||
}
|
||||
|
||||
if (!UpdatedBoundingBox)
|
||||
Min = Max = lcVector3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
lcVertexTextured* DstTexturedVerts = (lcVertexTextured*)DstVerts;
|
||||
|
||||
for (int MeshDataIdx = 0; MeshDataIdx < LC_NUM_MESHDATA_TYPES; MeshDataIdx++)
|
||||
|
|
Loading…
Reference in a new issue