New example models/mesh_picking

This commit is contained in:
Per Hultqvist 2024-11-11 18:42:02 +01:00
parent e9aa553ec6
commit acf83f1ff9

View file

@ -116,11 +116,11 @@ func main() {
} }
func clearCustomMesh(model rl.Model) { func clearCustomMesh(model rl.Model) {
// Vertices, Normals and Texcoords of your custom mesh are Go slices. // Vertices, Normals and Texcoords of your CUSTOM mesh are Go slices.
// UnloadModel calls UnloadMesh for every mesh and UnloadMesh tries // UnloadModel calls UnloadMesh for every mesh and UnloadMesh tries
// to free your Go slices. The panic happens, because it cannot free // to free your Go slices. This will panic because it cannot free
// Go slices. Free() is a C function and it expects to free C memory // Go slices. Free() is a C function and it expects to free C memory
// and not a Go slice. // and not a Go slice. So clear the slices manually like this.
model.Meshes.Vertices = nil model.Meshes.Vertices = nil
model.Meshes.Normals = nil model.Meshes.Normals = nil
model.Meshes.Texcoords = nil model.Meshes.Texcoords = nil