gamnit :: Mesh :: defaultinit
# Mesh with all geometry data
#
# May be created via `Plane`, `Cube` or `UVSphere`,
# or loaded from the assets folder indirectly with a `Model`.
#
# ~~~
# import gamnit::depth
#
# var plane = new Plane
# var cube = new Cube
# var sphere = new UVSphere(1.0, 32, 16)
# ~~~
class Mesh
# Number for vertices
fun n_vertices: Int do return vertices.length / 3
# Vertices relative coordinates, 3 floats per vertex
var vertices = new Array[Float] is lazy, writable
# Indices to draw triangles with `glDrawElements`
#
# If `not_empty`, use `glDrawElements`, otherwise use `glDrawArrays`.
var indices = new Array[Int] is lazy, writable
private var indices_c = new CUInt16Array.from(indices) is lazy, writable
# Normals, 3 floats per vertex
var normals = new Array[Float] is lazy, writable
# Coordinates on the texture, 2 floats per vertex
var texture_coords = new Array[Float] is lazy, writable
# `GLDrawMode` used to display this mesh, defaults to `gl_TRIANGLES`
fun draw_mode: GLDrawMode do return gl_TRIANGLES
end
lib/gamnit/depth/depth_core.nit:174,1--209,3