From 0ce1777bf3ede032782840c713847fee1fb5fc5e Mon Sep 17 00:00:00 2001 From: Per Hultqvist Date: Mon, 11 Nov 2024 16:46:28 +0100 Subject: [PATCH] New example models/mesh_picking --- examples/models/mesh_generation/main.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/models/mesh_generation/main.go b/examples/models/mesh_generation/main.go index 555277c..1181011 100644 --- a/examples/models/mesh_generation/main.go +++ b/examples/models/mesh_generation/main.go @@ -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