OperateOnVertices iterates over all the vertices and calls the specified callback function with a pointer to each vertex. The vertex pointers can be modified inside the callback and the modifications will be applied to the buffer at each iteration. The callback function returns false to continue or
(cb func(vertex *math32.Vector3) bool)
| 212 | // the modifications will be applied to the buffer at each iteration. |
| 213 | // The callback function returns false to continue or true to break. |
| 214 | func (g *Geometry) OperateOnVertices(cb func(vertex *math32.Vector3) bool) { |
| 215 | |
| 216 | // Get buffer with position vertices |
| 217 | vbo := g.VBO(gls.VertexPosition) |
| 218 | if vbo == nil { |
| 219 | return |
| 220 | } |
| 221 | vbo.OperateOnVectors3(gls.VertexPosition, cb) |
| 222 | |
| 223 | // Geometric properties may have changed |
| 224 | g.boundingBoxValid = false |
| 225 | g.boundingSphereValid = false |
| 226 | g.areaValid = false |
| 227 | g.volumeValid = false |
| 228 | g.rotInertiaValid = false |
| 229 | } |
| 230 | |
| 231 | // ReadVertices iterates over all the vertices and calls |
| 232 | // the specified callback function with the value of each vertex. |
no test coverage detected