Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AssetLoader/interface/GLTFBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ Mesh* ModelBuilder::LoadMesh(const GltfModelType& GltfModel,
if (GltfPrimitive.GetIndicesId() >= 0)
{
IndexCount = ConvertIndexData(GltfModel, GltfPrimitive.GetIndicesId(), VertexStart);
// For indexed primitives, the vertex offset is baked into the indices,
VertexStart = 0;
}

int MaterialId = GltfPrimitive.GetMaterialId();
Expand All @@ -461,6 +463,7 @@ Mesh* ModelBuilder::LoadMesh(const GltfModelType& GltfModel,
IndexStart,
IndexCount,
VertexCount,
VertexStart,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since for indexed primitives, start vertex is baked into the index buffer, I suggest setting it to zero to avoid confusion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a line for this

static_cast<Uint32>(MaterialId),
PosMin,
PosMax //
Expand Down
3 changes: 3 additions & 0 deletions AssetLoader/interface/GLTFLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,19 +410,22 @@ struct Primitive
const Uint32 FirstIndex;
const Uint32 IndexCount;
const Uint32 VertexCount;
const Uint32 FirstVertex;
const Uint32 MaterialId;

const BoundBox BB;

Primitive(Uint32 _FirstIndex,
Uint32 _IndexCount,
Uint32 _VertexCount,
Uint32 _FirstVertex,
Uint32 _MaterialId,
const float3& _BBMin,
const float3& _BBMax) :
FirstIndex{_FirstIndex},
IndexCount{_IndexCount},
VertexCount{_VertexCount},
FirstVertex{_FirstVertex},
MaterialId{_MaterialId},
BB{_BBMin, _BBMax}
{
Expand Down
Loading