URL: https://graphicscomputing.fr/cgp/reference/mesh_drawable/
Description: Mesh stored on the GPU (VBOs, shader, texture, model transform), ready to be drawn.

# mesh_drawable

Mesh stored on the GPU (VBOs, shader, texture, model transform), ready to be drawn.

Fields:

- `opengl_shader_structure default_shader` - Static shader shared by all mesh_drawable and used by default in initialize_data_on_gpu, loaded from shaders/mesh/mesh.vert.glsl and mesh.frag.glsl by the application.
- `opengl_texture_image_structure default_texture` - Static 1x1 white RGBA texture shared by all mesh_drawable and used by default in initialize_data_on_gpu.
- `opengl_shader_structure shader` - Shader program used to draw this drawable, which must be valid (non-zero id) at draw time.
- `opengl_texture_image_structure texture` - Main texture bound to texture unit 0 and sent to the uniform image_texture at draw time.
- `std::map<std::string,opengl_texture_image_structure> supplementary_texture` - Additional textures for multi-texturing, keyed by uniform name and bound to texture units 1, 2, ... in the order of the map at draw time.
- `opengl_vbo_structure vbo_position` - VBO storing the vertex positions, bound to shader location 0.
- `opengl_vbo_structure vbo_normal` - VBO storing the vertex normals, bound to shader location 1.
- `opengl_vbo_structure vbo_color` - VBO storing the vertex colors, bound to shader location 2.
- `opengl_vbo_structure vbo_uv` - VBO storing the vertex texture coordinates, bound to shader location 3.
- `std::vector<opengl_vbo_structure> supplementary_vbo` - Optional extra VBOs (per-vertex or per-instance), where the element k is bound to shader location k+4.
- `opengl_ebo_structure ebo_connectivity` - EBO storing the triangle indices used by the indexed draw call.
- `GLuint vao` - OpenGL id of the Vertex Array Object describing the VBO layout, 0 when not initialized.
- `affine model` - Model transform of the drawable (translation, rotation, scaling, scaling_xyz), reset to identity by initialize_data_on_gpu and clear.
- `affine_rts hierarchy_transform_model` - Global transform set by hierarchy_mesh_drawable::update_local_to_global_coordinates, applied first in the model matrix sent to the shader.
- `mat4 supplementary_model_matrix` - Generic 4x4 matrix inserted between hierarchy_transform_model and model in the model matrix, identity by default and reset by initialize_data_on_gpu.
- `material_mesh_drawable_phong material` - Phong material (color, alpha, shading coefficients, texture settings) sent to the uniform struct material at draw time.

Functions taking it:

- `void draw(mesh_drawable const& drawable, environment_generic_structure const& environment = environment_generic_structure(), int instance_count = 1, bool expected_uniforms = true, uniform_generic_structure const& additional_uniforms = uniform_generic_structure(), GLenum draw_mode = GL_TRIANGLES, material_mesh_drawable_phong const* material_override = nullptr)` - Draw a mesh_drawable with its shader, textures, model and material, plus the environment and optional additional uniforms, possibly instanced or with an overriding material.
- `void draw_wireframe(mesh_drawable const& drawable, environment_generic_structure const& environment = environment_generic_structure(), vec3 const& color = {0,0,1}, int instance_count = 1, bool expected_uniforms = true, uniform_generic_structure const& additional_uniforms = uniform_generic_structure())` - Draw the triangle edges of a mesh_drawable in a flat color, slightly offset toward the camera (no effect with Emscripten/WebGL).
