Mesh
A structure mesh contains vector of data (numarray) to represent a triangulated shape with per vertex position, normal, color, and uv-coordinates. The data are stored contiguously on the CPU RAM and can be directly accessed and modified in the code.
struct mesh
numarray<vec3> position
numarray<vec3> normal
numarray<vec3> color
numarray<vec2> uv
numarray<int3> connectivity
numarray<vec3> normal
numarray<vec3> color
numarray<vec2> uv
numarray<int3> connectivity
Data structure of a mesh
(uint3 is a triplet of positive integers)
Code Reference
-
mesh.hpp
11_mesh/mesh/mesh.hpp
Vertex properties access
mesh quad; quad.position = { {0,0,0}, {1,0,0}, {1,1,0}, {0,1,0} }; quad.connectivity = { {0,1,2}, {0,2,3} }; quad.fill_empty_field(); // Fill all the buffers (normals, color, etc) with default values.
Mesh Primitives
Basic triangulated primitives are pre-codedmesh sphere_mesh = mesh_primitive_sphere(); mesh cylinder_mesh = mesh_primitive_cylinder(); mesh cube_mesh = mesh_primitive_cube(); ...