Fix invalid index buffer format returned by MeshAccessor when model is not yet loaded

#4017
This commit is contained in:
Wojtek Figat
2026-03-24 23:13:50 +01:00
parent 7b3cfd989f
commit e8134803c4
4 changed files with 25 additions and 8 deletions

View File

@@ -349,7 +349,7 @@ void MeshAccelerationStructure::Add(Model* model, int32 lodIndex)
meshData.IndexBuffer.Copy(indexStream.GetData());
meshData.VertexBuffer.Allocate(meshData.Vertices * sizeof(Float3));
positionStream.CopyTo(ToSpan(meshData.VertexBuffer.Get<Float3>(), meshData.Vertices));
meshData.Use16BitIndexBuffer = mesh.Use16BitIndexBuffer();
meshData.Use16BitIndexBuffer = indexStream.GetFormat() == PixelFormat::R16_UInt;
meshData.Bounds = mesh.GetBox();
}
}