Class Mesh
Represents a 3D mesh with vertex and index data,
supporting rendering and triangle iteration.
The Mesh class stores vertex positions, normals,
texture coordinates, and triangle indices.
It supports bounding box calculation, normal generation,
OpenGL VAO/VBO management, and implements the Drawable
and TriangleSet interfaces.
Constructors
| Name | Description |
this
(owner)
|
Constructs a mesh with the given owner.
|
Fields
| Name | Type | Description |
boundingBox
|
dlib.geometry.aabb.AABB | Axis-aligned bounding box for the mesh.
|
canRender
|
bool | True if OpenGL buffers are prepared and mesh can be rendered.
|
dataReady
|
bool | True if mesh data is ready for rendering.
|
eao
|
uint | OpenGL element array object for indices.
|
indices
|
uint[3][] | Array of triangle indices (each element is a uint[3]).
|
nbo
|
uint | OpenGL vertex buffer object for normals.
|
normals
|
dlib.math.vector.Vector!(float,3)[] | Array of vertex normals.
|
tbo
|
uint | OpenGL vertex buffer object for texture coordinates.
|
texcoords
|
dlib.math.vector.Vector!(float,2)[] | Array of texture coordinates.
|
vao
|
uint | OpenGL vertex array object.
|
vbo
|
uint | OpenGL vertex buffer object for positions.
|
vertices
|
dlib.math.vector.Vector!(float,3)[] | Array of vertex positions.
|
Methods
| Name | Description |
calcBoundingBox
()
|
Calculates the axis-aligned bounding box for the mesh.
|
generateNormals
()
|
Generates smooth vertex normals for the mesh based on triangle geometry.
Overwrites the normals array with computed normals.
|
getTriangle
(faceIndex)
|
Returns the triangle at the specified face index.
|
opApply
(dg)
|
Iterates over all triangles in the mesh.
|
prepareVAO
()
|
Prepares OpenGL VAO and VBOs for rendering the mesh.
Uploads vertex, normal, texcoord, and index data to the GPU.
Sets up attribute pointers and enables rendering.
|
render
(state)
|
Renders the mesh using the provided graphics pipeline state.
|