New example models/mesh_picking

This commit is contained in:
Per Hultqvist 2024-11-11 16:46:28 +01:00
parent 0e82ab3a0d
commit 0ce1777bf3

View file

@ -105,22 +105,28 @@ func main() {
}
rl.UnloadTexture(texture)
clearCustomMesh(models)
clearCustomMesh(models[8])
for i := 0; i < numModels; i++ {
//if i == 8 {
//meshes := unsafe.Slice(models[i].Meshes, models[i].MeshCount)
//for m := range meshes {
// rl.UnloadMesh(&meshes[m])
//}
//}
rl.UnloadModel(models[i])
}
rl.CloseWindow()
}
func clearCustomMesh(models []rl.Model) {
func clearCustomMesh(model rl.Model) {
// For some reason the custom model
// (id = 8) panics when unloading it.
// So we clear the mesh for it manually
// here.
models[8].Meshes.Vertices = nil
models[8].Meshes.Normals = nil
models[8].Meshes.Texcoords = nil
model.Meshes.Vertices = nil
model.Meshes.Normals = nil
model.Meshes.Texcoords = nil
}
// GenMeshCustom generates a simple triangle mesh from code