SolarLune/tetra3d

Crashing when loading a mesh

eliasdaler opened this issue · 2 comments

Hello
Tetra3D's gltf loader crashes with this message:

panic: runtime error: index out of range [96] with length 96

goroutine 1 [running, locked to thread]:
github.com/solarlune/tetra3d.LoadGLTFData({0xa113e0, 0x76529, 0x76529}, 0xc000689f20)
	<...>/Tetra3d/gltf.go:306 +0x4a45

I've added a part of my model to shapes.blend so that you can reproduce it (hopefully)
It can be found here: https://github.com/eliasdaler/Tetra3d/tree/gltf-crash/examples/shapes

Here's the part that causes the problem:

for triIndex, tri := range newMesh.Triangles {
	tri.Normal = normals[triIndex] // <- here!
}

Adding a Print like this:

fmt.Println(len(normals), len(indices), len(newMesh.Triangles), mesh.Name)

shows this:

96 288 608 Cylinder.003

So, the number of triangles doesn't match number of indices...
Maybe I'm doing something wrong with Blender, so if there's something I need to do with my models, please let me know! :)

Hello, I see what's going on - Tetra doesn't support multiple materials, currently - I'll have to implement that next.

OK, I implemented multiple material support and tested successfully with your object, so this should be resolved now as of v0.6. I'll close this; feel free to reopen if it doesn't work. Thanks!