| TGX 1.1.2 A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.

Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS > Class Template Reference

Class for drawing 3D objects onto a `Image` [MAIN CLASS FOR THE 3D API]. More...

`#include <Renderer3D.h>`

## Public Member Functions
TGX_NOINLINE | Renderer3D (const iVec2 &viewportSize={0, 0}, Image< color_t > *im=nullptr, ZBUFFER_t *zbuffer=nullptr)
| Constructor. More...
Global settings.
Methods use to query and set the global parameters of the renderer: viewport size, zbuffer, projection type...
void | setViewportSize (int lx, int ly)
| Set the size of the viewport. More...
void | setViewportSize (const iVec2 &viewport_dim)
| Set the size of the viewport. More...
void | setImage (Image< color_t > *im)
| Set the image that will be drawn onto. More...
void | setOffset (int ox, int oy)
| Set the offset of the image relative to the viewport. More...
void | setOffset (const iVec2 &offset)
| Set the offset of the image relative to the viewport. More...
void | setProjectionMatrix (const fMat4 &M)
| Set the projection matrix. More...
fMat4 | getProjectionMatrix () const
| Return the current projection matrix. More...
void | useOrthographicProjection ()
| Set projection mode to orthographic (ie no z-divide). More...
void | usePerspectiveProjection ()
| Set projection mode to perspective (ie with z-divide). More...
void | setOrtho (float left, float right, float bottom, float top, float zNear, float zFar)
| Set the projection matrix as an orthographic matrix. More...
void | setFrustum (float left, float right, float bottom, float top, float zNear, float zFar)
| Set the projection matrix as a perspective matrix. More...
void | setPerspective (float fovy, float aspect, float zNear, float zFar)
| Set the projection matrix as a perspective matrix. More...
void | setCulling (int w)
| Set the face culling strategy. More...
void | setZbuffer (ZBUFFER_t *zbuffer)
| Set the z-buffer. More...
void | clearZbuffer ()
| Clear the Zbuffer. More...
void | setShaders (Shader shaders)
| Set the shaders to use for subsequent drawing operations. More...
void | setTextureWrappingMode (Shader wrap_mode)
| Set the wrap mode when for texturing. More...
void | setTextureQuality (Shader quality)
| Set the texturing quality. More...
Model related methods.
Methods related to properties specific to the model being drawn: position, material properties...
void | setModelMatrix (const fMat4 &M)
| Set the model transformation matrix. More...
fMat4 | getModelMatrix () const
| Return the model transformation matrix. More...
void | setModelPosScaleRot (const fVec3 &center=fVec3{ 0, 0, 0 }, const fVec3 &scale=fVec3(1, 1, 1), float rot_angle=0, const fVec3 &rot_dir=fVec3{ 0, 1, 0 })
| Set the model transformation matrix to move an object to a given location, scale and rotation. More...
fVec4 | modelToNDC (fVec3 P)
| Convert from model coordinates to normalized device coordinates (NDC). More...
iVec2 | modelToImage (fVec3 P)
| Convert from model coordinates to the corresponding image pixel. More...
void | setMaterialColor (RGBf color)
| Set the object material color. More...
void | setMaterialAmbiantStrength (float strenght=0.1f)
| Set how much the object material reflects the ambient light. More...
void | setMaterialDiffuseStrength (float strenght=0.6f)
| Set how much the object material reflects the diffuse light. More...
void | setMaterialSpecularStrength (float strenght=0.5f)
| Set how much the object material reflects the specular light. More...
void | setMaterialSpecularExponent (int exponent=16)
| Set the object specular exponent. More...
void | setMaterial (RGBf color, float ambiantStrength, float diffuseStrength, float specularStrength, int specularExponent)
| Set all the object material properties at once. More...
Drawing solid geometric primitives.
Methods for drawing meshes, triangles and quads. Remarks Normal vectors are mandatory when using Gouraud shading and must be normalized (unit length). Texture dimension must be power of two when using flag `SHADER_TEXTURE_WRAP_POW2`. Triangles and quads must be given in the correct winding order. The 4 vertices of a quad must be co-planar. The fastest method to display 'static' geometry is to use the drawMesh() method. Other methods are slower and should be reserved for 'dynamic' geometry. Do not forget to clear the z-buffer with `clearZbuffer()` at the beggining of each new frame.
void | drawMesh (const Mesh3D< color_t > *mesh, bool use_mesh_material=true, bool draw_chained_meshes=true)
| Draw a Mesh3D object. More...
void | drawMesh (const Mesh3Dv2< color_t > *mesh, bool use_mesh_material=true)
| Draw a Mesh3Dv2 object. More...
void | drawTriangle (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const fVec3 *N1=nullptr, const fVec3 *N2=nullptr, const fVec3 *N3=nullptr, const fVec2 *T1=nullptr, const fVec2 *T2=nullptr, const fVec2 *T3=nullptr, const Image< color_t > *texture=nullptr)
| Draw a single triangle. More...
void | drawTriangleWithVertexColor (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const RGBf &col1, const RGBf &col2, const RGBf &col3, const fVec3 *N1=nullptr, const fVec3 *N2=nullptr, const fVec3 *N3=nullptr)
| Draw a single triangle with a given colors on each of its vertices. More...
void | drawTriangles (int nb_triangles, const uint16_t *ind_vertices, const fVec3 *vertices, const uint16_t *ind_normals=nullptr, const fVec3 *normals=nullptr, const uint16_t *ind_texture=nullptr, const fVec2 *textures=nullptr, const Image< color_t > *texture_image=nullptr)
| Draw a collection of triangles. More...
void | drawTriangleStrip (int nb_indices, const uint16_t *ind_vertices, const fVec3 *vertices, const uint16_t *ind_normals=nullptr, const fVec3 *normals=nullptr, const uint16_t *ind_texture=nullptr, const fVec2 *textures=nullptr, const Image< color_t > *texture_image=nullptr)
| Draw a triangle strip. More...
void | drawQuad (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const fVec3 &P4, const fVec3 *N1=nullptr, const fVec3 *N2=nullptr, const fVec3 *N3=nullptr, const fVec3 *N4=nullptr, const fVec2 *T1=nullptr, const fVec2 *T2=nullptr, const fVec2 *T3=nullptr, const fVec2 *T4=nullptr, const Image< color_t > *texture=nullptr)
| Draw a single quad. More...
void | drawQuadWithVertexColor (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const fVec3 &P4, const RGBf &col1, const RGBf &col2, const RGBf &col3, const RGBf &col4, const fVec3 *N1=nullptr, const fVec3 *N2=nullptr, const fVec3 *N3=nullptr, const fVec3 *N4=nullptr)
| Draw a single quad with a given colors on each of its four vertices. More...
void | drawQuads (int nb_quads, const uint16_t *ind_vertices, const fVec3 *vertices, const uint16_t *ind_normals=nullptr, const fVec3 *normals=nullptr, const uint16_t *ind_texture=nullptr, const fVec2 *textures=nullptr, const Image< color_t > *texture_image=nullptr)
| Draw a collection of quads. More...
Drawing solid basic shapes.
Methods for drawing cube and spheres.
void | drawCube ()
| Draw the unit cube `[-1,1]^3` in model space. More...
void | drawCube (const fVec2 v_front_ABCD[4], const Image< color_t > *texture_front, const fVec2 v_back_EFGH[4], const Image< color_t > *texture_back, const fVec2 v_top_HADE[4], const Image< color_t > *texture_top, const fVec2 v_bottom_BGFC[4], const Image< color_t > *texture_bottom, const fVec2 v_left_HGBA[4], const Image< color_t > *texture_left, const fVec2 v_right_DCFE[4], const Image< color_t > *texture_right)
| Draw a textured unit cube `[-1,1]^3` in model space. More...
void | drawCube (const Image< color_t > *texture_front, const Image< color_t > *texture_back, const Image< color_t > *texture_top, const Image< color_t > *texture_bottom, const Image< color_t > *texture_left, const Image< color_t > *texture_right)
| draw a textured unit cube [-1,1]^3 (in model space) More...
void | drawSkyBox (const fVec2 v_front_ABCD[4], const Image< color_t > *texture_front, const fVec2 v_back_EFGH[4], const Image< color_t > *texture_back, const fVec2 v_top_HADE[4], const Image< color_t > *texture_top, const fVec2 v_bottom_BGFC[4], const Image< color_t > *texture_bottom, const fVec2 v_left_HGBA[4], const Image< color_t > *texture_left, const fVec2 v_right_DCFE[4], const Image< color_t > *texture_right, float rot_angle_y=0.0f, float reference_height=0.0f, float skybox_radius=32768.0f, Shader texture_quality=SHADER_TEXTURE_NEAREST, Shader texture_mode=SHADER_TEXTURE_CLAMP)
| Draw a textured sky-box around the current camera. More...
void | drawSkyBox (const Image< color_t > *texture_front, const Image< color_t > *texture_back, const Image< color_t > *texture_top, const Image< color_t > *texture_bottom, const Image< color_t > *texture_left, const Image< color_t > *texture_right, float rot_angle_y=0.0f, float reference_height=0.0f, float skybox_radius=32768.0f, Shader texture_quality=SHADER_TEXTURE_NEAREST, Shader texture_mode=SHADER_TEXTURE_CLAMP)
| Draw a textured sky-box using whole images for each face. More...
void | drawSphere (int nb_sectors, int nb_stacks)
| Draw a unit radius sphere centered at the origin `S(0,1)` in model space. More...
void | drawSphere (int nb_sectors, int nb_stacks, const Image< color_t > *texture)
| Draw a textured unit radius sphere centered at the origin S(0,1) in model space. More...
void | drawAdaptativeSphere (float quality=1.0f)
| Draw a unit radius sphere centered at the origin S(0,1) in model space. More...
void | drawAdaptativeSphere (const Image< color_t > *texture, float quality=1.0f)
| Draw a textured unit radius sphere centered at the origin S(0,1) in model space. More...
Drawing wireframe geometric primitives.
Methods for drawing wireframe meshes, triangles and quads. Two versions for each method: Fast drawing: no thickness, no blending, no anti-aliasing. Antialiased drawing: use the explicit `drawWireFrame...AA()` methods for optimized one-pixel antialiased lines, or the full overloads with adjustable thickness + AA. The latter use the general thick-line path and are very slow. Remarks Wireframe methods do not take the scene lighting into account.
void | drawWireFrameMesh (const Mesh3D< color_t > *mesh, bool draw_chained_meshes=true)
| Draw a mesh in wireframe [fast]. More...
void | drawWireFrameMesh (const Mesh3Dv2< color_t > *mesh)
| Draw a Mesh3Dv2 object in wireframe [fast]. More...
void | drawWireFrameMeshAA (const Mesh3D< color_t > *mesh, bool draw_chained_meshes=true)
| Draw a mesh in wireframe [antialiased] with the current material color. More...
void | drawWireFrameMeshAA (const Mesh3Dv2< color_t > *mesh)
| Draw a Mesh3Dv2 object in wireframe [antialiased] with the current material color. More...
void | drawWireFrameMesh (const Mesh3D< color_t > *mesh, bool draw_chained_meshes, float thickness, color_t color, float opacity)
| Draw a mesh in wireframe [adjustable thickness + AA]. More...
void | drawWireFrameMesh (const Mesh3Dv2< color_t > *mesh, float thickness, color_t color, float opacity)
| Draw a Mesh3Dv2 object in wireframe [adjustable thickness + AA]. More...
void | drawWireFrameLine (const fVec3 &P1, const fVec3 &P2)
| Draw a wireframe line segment [fast]. More...
void | drawWireFrameLineAA (const fVec3 &P1, const fVec3 &P2)
| Draw a wireframe line segment [antialiased] with the current material color. More...
void | drawWireFrameLine (const fVec3 &P1, const fVec3 &P2, float thickness, color_t color, float opacity)
| Draw a wireframe line segment [adjustable thickness + AA]. More...
void | drawWireFrameLines (int nb_lines, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw a collection of wireframe line segments [fast]. More...
void | drawWireFrameLinesAA (int nb_lines, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw wireframe line segments [antialiased] with the current material color. More...
void | drawWireFrameLines (int nb_lines, const uint16_t *ind_vertices, const fVec3 *vertices, float thickness, color_t color, float opacity)
| Draw a collection of wireframe line segments [adjustable thickness + AA]. More...
void | drawWireFrameTriangle (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3)
| Draw a wireframe triangle [fast]. More...
void | drawWireFrameTriangleAA (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3)
| Draw a wireframe triangle [antialiased] with the current material color. More...
void | drawWireFrameTriangle (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, float thickness, color_t color, float opacity)
| Draw a wireframe triangle [adjustable thickness + AA]. More...
void | drawWireFrameTriangles (int nb_triangles, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw a collection of wireframe triangles [fast]. More...
void | drawWireFrameTrianglesAA (int nb_triangles, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw wireframe triangles [antialiased] with the current material color. More...
void | drawWireFrameTriangles (int nb_triangles, const uint16_t *ind_vertices, const fVec3 *vertices, float thickness, color_t color, float opacity)
| Draw a collection of wireframe triangles [adjustable thickness + AA]. More...
void | drawWireFrameTriangleStrip (int nb_indices, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw a triangle strip in wireframe [fast]. More...
void | drawWireFrameTriangleStripAA (int nb_indices, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw a triangle strip in wireframe [antialiased] with the current material color. More...
void | drawWireFrameTriangleStrip (int nb_indices, const uint16_t *ind_vertices, const fVec3 *vertices, float thickness, color_t color, float opacity)
| Draw a triangle strip in wireframe [adjustable thickness + AA]. More...
void | drawWireFrameQuad (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const fVec3 &P4)
| Draw a wireframe quad [fast]. More...
void | drawWireFrameQuadAA (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const fVec3 &P4)
| Draw a wireframe quad [antialiased] with the current material color. More...
void | drawWireFrameQuad (const fVec3 &P1, const fVec3 &P2, const fVec3 &P3, const fVec3 &P4, float thickness, color_t color, float opacity)
| Draw a wireframe quad [adjustable thickness + AA]. More...
void | drawWireFrameQuads (int nb_quads, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw a collection of wireframe quads [fast]. More...
void | drawWireFrameQuadsAA (int nb_quads, const uint16_t *ind_vertices, const fVec3 *vertices)
| Draw wireframe quads [antialiased] with the current material color. More...
void | drawWireFrameQuads (int nb_quads, const uint16_t *ind_vertices, const fVec3 *vertices, float thickness, color_t color, float opacity)
| Draw a collection of wireframe quads [adjustable thickness + AA]. More...
Drawing basic shapes in wireframe.
Methods for drawing wireframe cubes and spheres. Two versions for each method: Fast drawing: no thickness, no blending, no anti-aliasing. Antialiased drawing: use the explicit `drawWireFrame...AA()` methods for optimized one-pixel antialiased lines, or the full overloads with adjustable thickness + AA. The latter use the general thick-line path and are very slow. Remarks Wireframe methods do not take the scene lighting into account.
void | drawWireFrameCube ()
| Draw the wireframe cube [0,1]^3 (in model space) [fast]. More...
void | drawWireFrameCubeAA ()
| Draw the wireframe cube [0,1]^3 [antialiased] with the current material color. More...
void | drawWireFrameCube (float thickness, color_t color, float opacity)
| Draw the wireframe cube [0,1]^3 (in model space) [adjustable thickness + AA]. More...
void | drawWireFrameSphere (int nb_sectors, int nb_stacks)
| Draw a wireframe unit radius sphere centered at the origin (in model space) [fast]. More...
void | drawWireFrameSphereAA (int nb_sectors, int nb_stacks)
| Draw a wireframe unit radius sphere [antialiased] with the current material color. More...
void | drawWireFrameSphere (int nb_sectors, int nb_stacks, float thickness, color_t color, float opacity)
| Draw a wireframe unit radius sphere centered at the origin (in model space) [adjustable thickness + AA]. More...
void | drawWireFrameAdaptativeSphere (float quality=1.0f)
| Draw a wireframe unit radius sphere centered at the origin (in model space) [fast]. More...
void | drawWireFrameAdaptativeSphereAA (float quality=1.0f)
| Draw an adaptive wireframe sphere [antialiased] with the current material color. More...
void | drawWireFrameAdaptativeSphere (float quality, float thickness, color_t color, float opacity)
| Draw a wireframe unit radius sphere centered at the origin (in model space) [adjustable thickness + AA]. More...
Drawing 3D point clouds
Methods for drawing pixels and dots. Remarks the methods do not take the scene lighting into account.
void | drawPixel (const fVec3 &pos)
| Draw a single pixel at a given position in model space. More...
void | drawPixel (const fVec3 &pos, color_t color, float opacity)
| Draw a single pixel at a given position in model space. More...
void | drawPixels (int nb_pixels, const fVec3 *pos_list)
| Draw a list of pixels at given positions in model space. More...
void | drawPixels (int nb_pixels, const fVec3 *pos_list, const int *colors_ind, const color_t *colors, const int *opacities_ind, const float *opacities)
| Draw a list of pixels at given positions in model space with different colors and opacities. More...
void | drawDot (const fVec3 &pos, int r)
| Draw a dot/circle at a given position in model space. More...
void | drawDot (const fVec3 &pos, int r, color_t color, float opacity)
| Draw a dot/circle at a given position in model space. More...
void | drawDots (int nb_dots, const fVec3 *pos_list, const int radius)
| Draw a list of dots/circles at given positions in model space. More...
void | drawDots (int nb_dots, const fVec3 *pos_list, const int *radius_ind, const int *radius, const int *colors_ind, const color_t *colors, const int *opacities_ind, const float *opacities)
| Draw a list of dots/circles at given positions in model space. More...

## Scene related methods.
Methods related to properties specific to the scene: camera position, lighting...
void | setViewMatrix (const fMat4 &M)
| Set the view transformation matrix. More...
fMat4 | getViewMatrix () const
| Return the current view matrix. More...
void | setLookAt (float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
| Set the view matrix so that the camera is looking at a given direction. More...
void | setLookAt (const fVec3 eye, const fVec3 center, const fVec3 up)
| Set the view matrix so that the camera is looking at a given direction. More...
fVec4 | worldToNDC (fVec3 P)
| Convert from world coordinates to normalized device coordinates (NDC). More...
iVec2 | worldToImage (fVec3 P)
| Convert from world coordinates to the corresponding image pixel. More...
void | setLightAmbiant (const RGBf &color)
| Set the scene ambiant light color. More...
void | setLightDirection (const fVec3 &direction)
| Set the light source direction of the main directional light of the scene. More...
void | setLightDiffuse (const RGBf &color)
| Set the diffuse light color of the main directional light of the scene. More...
void | setLightSpecular (const RGBf &color)
| Set the specular light color of the main directional light of the scene. More...
void | setLight (const fVec3 direction, const RGBf &ambiantColor, const RGBf &diffuseColor, const RGBf &specularColor)
| Set all lighting parameters of the main directional light of the scene at once. More...
void | setDirectionalLightCount (int count)
| Set the number of active directional lights. More...
int | directionalLightCount () const
| Return the number of active directional lights.
void | setDirectionalLightAmbiant (const RGBf &color)
| Set the global ambiant light shared by all directional lights. More...
void | setDirectionalLightDirection (int index, const fVec3 &direction)
| Set the direction of one directional light. More...
void | setDirectionalLightDiffuse (int index, const RGBf &color)
| Set the diffuse color of one directional light. More...
void | setDirectionalLightSpecular (int index, const RGBf &color)
| Set the specular color of one directional light. More...
void | setDirectionalLight (int index, const fVec3 &direction, const RGBf &diffuseColor, const RGBf &specularColor)
| Configure one directional light at once. More...
static constexpr int | maxDirectionalLightCount ()
| Return the compile-time directional-light capacity.

## Detailed Description

template<typename color_t, Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>
class tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >

Class for drawing 3D objects onto a `Image` [MAIN CLASS FOR THE 3D API].

A Renderer3D objects creates a "virtual viewport" and provides a set of methods to manage a scene and draw 3D primitives onto this viewport which is then mapped to a `tgx::Image`.

Template Parameters

  LOADED_SHADERS | list of all shaders that may be used. By default, all shaders are enabled but it is possible to select only a subset of shaders to improve rendering speed and decrease memory usage significantly. Must be a `|` combination of the following flags: `SHADER_PERSPECTIVE`: enable perspective projection `SHADER_ORTHO`: enable orthographic projection `SHADER_NOZBUFFER`: enable rendering without using a z-buffer `SHADER_ZBUFFER`: enable rendering with a z-buffer `SHADER_UNLIT`: enable unlit shading `SHADER_FLAT`: enable flat shading `SHADER_GOURAUD`: enable Gouraud shading `SHADER_NOTEXTURE`: enable rendering without texturing `SHADER_TEXTURE_NEAREST`: enable rendering with texturing using point sampling `SHADER_TEXTURE_BILINEAR`: enable rendering with texturing using bilinear sampling `SHADER_TEXTURE_WRAP_POW2`: texture can use 'wrap around' mode with dimensions of texture being power of two. `SHADER_TEXTURE_CLAMP`: texture can use 'clamping to edge' mode.
  ZBUFFER_t | : Type used for storing z-buffer values. Must be either `float` or `uint16_t`. The z-buffer must be as large as the image (but can be smaller than the viewport when using an offset). `float`: higher quality but requires 4 bytes per pixel. `uint16_t` : lower quality (z-fighting may occur) but only 2 bytes per pixel.
  MAX_DIRECTIONAL_LIGHTS | : Maximum number of directional lights supported by this renderer. The default value `1` preserves the historical one-light rendering path. Instantiate with a value larger than 1 to use the advanced directional-light API.
  MAX_SPOT_LIGHTS | : Reserved for future spotlight support. Spotlights are not rendered yet.

Remarks

1. If a drawing call is made that requires a shader that was not enabled in the template parameter `LOADED_SHADERS` or if the Renderer3D object state is not valid (e.g. incorrect image size, enabled but missing z-buffer...) then the operation will fail silently. In particular, if drawing without a Z-buffer is performed, the flag `SHADER_NOZBUFFER` must be set in LOADED_SHADERS. Similarly, if drawing without texturing is performed, the flag `SHADER_NOTEXTURE` must be set in LOADED_SHADERS.
2. Z-buffer testing is enabled as soon as a valid z-buffer is provided (with `Renderer3D::setZbuffer()`). Do not forget to erase the z-buffer with `Renderer3D::clearZbuffer()` at the start of a new frame.
3. Normal vectors are mandatory when using Gouraud shading and must always be normalized (unit length) !
4. Texture dimensions must be powers of two when flag `SHADER_TEXTURE_WRAP_POW2` is set.
5. Back-face culling is set with `Renderer3D::setCulling()`. Triangles and quads must then be provided in the chosen winding order.
6. It is more efficient to use methods that draw several primitives at once rather than issuing multiple commands for drawing triangle/quads. For static geometry, `Renderer3D::drawMesh()` should be used whenever possible instead of `Renderer3D::drawQuads()`, `Renderer3D::drawTriangles()`...
7. Wireframe drawing has a fast aliased path and a one-pixel antialiased path. Full overloads with adjustable thickness + AA use the general thick-line path and can be very slow.

## Constructor & Destructor Documentation

## ◆ Renderer3D()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

TGX_NOINLINE tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::Renderer3D | ( | const iVec2 & | viewportSize = `{0, 0}`,
|  | Image< color_t > * | im = `nullptr`,
|  | ZBUFFER_t * | zbuffer = `nullptr`
| ) |  |

Constructor.

Some parameters may be set right way (but they may be also set independantly later).

Parameters

  viewportSize | (Optional) Size of the viewport. See `setViewportSize()`.
  im | (Optional) the destination image. See `setImage()`.
  zbuffer | (Optional) the Z-buffer. See `setZbuffer()`.

## Member Function Documentation

## ◆ setViewportSize() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setViewportSize | ( | int | lx,
|  | int | ly
| ) |  |

Set the size of the viewport.

The normalized coordinates in `[-1,1]x[-1,1]` are mapped to `[0,lx-1]x[0,ly-1]` just before rasterization.

It is possible to use a viewport larger than the image drawn onto by using an offset for the image inside the viewport in order to perform 'tile rendering'. See `setOffset()`.

the maximum viewport size depends on `TGX_RASTERIZE_SUBPIXEL_BITS` which specifies the sub-pixel precision value used by the 3D rasterizer:

subpixel bits | max viewport size LX*LY
--- | ---
8 | 2048 x 2048
6 | 4096 x 4096
4 | 8192 x 8192
2 | 16384 x 16384

Parameters

  lx,ly | The viewport size.

## ◆ setViewportSize() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setViewportSize | ( | const iVec2 & | viewport_dim | ) |

Set the size of the viewport.

Same as `setViewportSize(int lx, int ly)`.

Parameters

  viewport_dim | The viewport size.

## ◆ setImage()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setImage | ( | Image< color_t > * | im | ) |

Set the image that will be drawn onto.

Remarks
  - The image can be smaller than the viewport. In this case, use `setOffset()` to select the portion of the viewport that will be drawn.
  - Passing `nullptr` remove the current image (and disables all drawing operation until a new image is inserted).

Parameters

  im | the image to draw onto for subsequent renderings.

## ◆ setOffset() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setOffset | ( | int | ox,
|  | int | oy
| ) |  |

Set the offset of the image relative to the viewport.

If the image has size `(sx,sy)`, then during rasterization the portion `[ox, ox + sx[x[oy, oy+sy[` of the viewport will be drawn onto the image.

By changing the offset and redrawing several times it it possible to use an image smaller than the viewport (and also save on zbuffer space).

For example, to draw a 320x240 viewport with limited amount of memory. One can use an image of size 160x120 (37.5kb) and a z-buffer of the same size (35Kb for uint16_t) and then call the drawing method 4 times with offsets (0,0), (0,120), (160,0) and (160,120) and upload the resulting images at their correct positions on the screen between each rendering.

0warning Do not forget to clear the z-buffer after changing the offset !

Parameters

  ox,oy | Offset of the image inside the viewport.

## ◆ setOffset() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setOffset | ( | const iVec2 & | offset | ) |

Set the offset of the image relative to the viewport.

Same as `setOffset(int ox, int oy)`.

Parameters

  offset | Offset of the image inside the viewport.

## ◆ setProjectionMatrix()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setProjectionMatrix | ( | const fMat4 & | M | ) |

Set the projection matrix.

This is the matrix that is used to project coordinate from 'view space' to normalized device coordinates (NDC).

Call this method to set a "custom" projection matrix. For the usual perspective and orthographic matrices, use instead setFrustum(), setPerspective(), setOrtho().

Parameters

  M | the projection matrix to use (an internal copy is made).

Remarks
  - When using perspective projection, the projection matrix must store `-z` into the `w` component.
  - In view space, the camera is assumed to be centered at the origin, looking looking toward the negative Z axis with the Y axis pointing up (as in opengl).

See also
  getProjectionMatrix()

## ◆ getProjectionMatrix()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

fMat4 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::getProjectionMatrix | ( |  | ) | const

Return the current projection matrix.

Returns
  A copy of the current projection matrix.

## ◆ useOrthographicProjection()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::useOrthographicProjection | ( |  | ) |

Set projection mode to orthographic (ie no z-divide).

Remarks
  This method is called automatically after `setOrtho()` so it needs only be called, when applicable, after `setProjectionMatrix()`.

## ◆ usePerspectiveProjection()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::usePerspectiveProjection | ( |  | ) |

Set projection mode to perspective (ie with z-divide).

Remarks
  This method is called automatically after `setPerspective()` or `setFrustum()` so it needs only be called, when applicable, after `setProjectionMatrix()`.

## ◆ setOrtho()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setOrtho | ( | float | left,
|  | float | right,
|  | float | bottom,
|  | float | top,
|  | float | zNear,
|  | float | zFar
| ) |  |

Set the projection matrix as an orthographic matrix.

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml

This method automatically switches to orthographic projection mode by calling useOrthographicProjection().

Remarks
  In view space, the camera is assumed to be centered at the origin, looking looking toward the negative Z axis with the Y axis pointing up (as in opengl).

Parameters

  left,right | coordinates for the left and right vertical clipping planes
  bottom,top | coordinates for the bottom and top horizontal clipping planes.
  zNear,zFar | distances to the nearer and farther depth clipping planes.

See also
  setFrustum(), setPerspective(), , Mat4::setOrtho()

## ◆ setFrustum()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setFrustum | ( | float | left,
|  | float | right,
|  | float | bottom,
|  | float | top,
|  | float | zNear,
|  | float | zFar
| ) |  |

Set the projection matrix as a perspective matrix.

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml

This method automatically switches to perspective projection mode by calling usePerspectiveProjection().

Remarks
  In view space, the camera is assumed to be centered at the origin, looking looking toward the negative Z axis with the Y axis pointing up (as in opengl).

Parameters

  left,right | coordinates for the left and right vertical clipping planes
  bottom,top | coordinates for the bottom and top horizontal clipping planes.
  zNear,zFar | distances to the nearer and farther depth clipping planes.

See also
  setOrtho(), setPerspective(), Mat4::setFrustum()

## ◆ setPerspective()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setPerspective | ( | float | fovy,
|  | float | aspect,
|  | float | zNear,
|  | float | zFar
| ) |  |

Set the projection matrix as a perspective matrix.

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml

This method automatically switches to perspective projection mode by calling usePerspectiveProjection().

Remarks
  In view space, the camera is assumed to be centered at the origin, looking looking toward the negative Z axis with the Y axis pointing up (as in opengl).

Parameters

  fovy | field of view angle, in degrees, in the y direction.
  aspect | aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
  zNear | distance from the viewer to the near clipping plane.
  zFar | distance from the viewer to the far clipping plane.

See also
  setFrustum(), setOrtho(), Mat4::setPerspective()

## ◆ setCulling()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setCulling | ( | int | w | ) |

Set the face culling strategy.

Parameters

  w | Culling direction `w>0`: Vertices in front faces are ordered counter-clockwise [default]. Clockwise faces are culled. `w<0`: Vertices in front faces are ordered clockwise. Counter-clockwise faces are culled. `w=0`: Disables face culling: both clockwise and counter-clockwise faces are drawn.

Remarks
  1. When face culling is enabled (`w != 0`), and when Gouraud shading is active, the normal vectors supplied for the vertices must be the normal vectors for the front side of the triangle.
  2. When face culling is disabled (`w = 0`). Both faces of a triangle are drawn so there is no more notion of 'front' and 'back' face. In this case, when using Gouraud shading, by convention, the normal vector supplied must be those corresponding to the counter-clockwise face being shown (whatever this means since these normals vector are attached to vertices and not faces anyway, but still...)

## ◆ setZbuffer()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setZbuffer | ( | ZBUFFER_t * | zbuffer | ) |

Set the z-buffer.

Warning
  The zbuffer must be large enough to be used with the image that is being drawn onto. This means that we must have length at least `image.width()*image.height()`.

Parameters

  zbuffer | pointer to the z-buffer to use from now one (replace the previous one if any) or nullptr.

Remarks
  1. Setting a valid zbuffer automatically turns on z-buffer depth test.
  2. Removing the z-buffer (by setting it to `nullptr`) turns off the z-buffer depth test.

## ◆ clearZbuffer()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::clearZbuffer | ( |  | ) |

Clear the Zbuffer.

This method must be called before drawing a new frame to erase the previous zbuffer.

Remarks
  The z-buffer is intentionally not cleared between draw() calls to enable rendering of multiple objects on the same scene.

## ◆ setShaders()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setShaders | ( | Shader | shaders | ) |

Set the shaders to use for subsequent drawing operations.

Parameters

  shaders | flags to use (or'ed together with `|`).

See enum tgx::Shader for a complete list of flags.

Main flags

- `SHADER_UNLIT`: Use material color or texture color directly, without any lighting computation.
- `SHADER_FLAT`: Use flat shading (i.e. uniform color on faces). This is the fastest drawing method but it usually gives poor results when combined with texturing. Lighting transitions between bright to dark aera may appear to flicker when using color with low resolution such as RGB565.
- `SHADER_GOURAUD`: Use gouraud shading (linear interpolation of vertex colors) This results in smoother color transitions and works well with texturing but is more CPU intensive.
- `SHADER_TEXTURE`: enable texture mapping. A texture must be stored in an Image<color_t> object.
  - wrap mode can be set with setTextureWrappingMode() or passing along either `SHADER_TEXTURE_WRAP_POW2` or `SHADER_TEXTURE_CLAMP`.
  - drawing quality can be set with setTextureQuality() or by passing along either `SHADER_TEXTURE_NEAREST` or `SHADER_TEXTURE_BILINEAR`.

Remarks
  1. If a shader flag is set with SetShaders() but is disabled in the template parameter LOADED_SHADER, then the drawing calls will silently fail (draw nothing).
  2. `SHADER_UNLIT` skips lighting: textured pixels use the texture color directly and untextured pixels use the current material color.
  3. The color on the face (for flat shading) or on the vertices (for gouraud shading) is computed according to Phong's lighting https://en.wikipedia.org/wiki/Phong_reflection_model.
  4. Texture mapping is 'perspective correct'. With `SHADER_FLAT` or `SHADER_GOURAUD`, the texture color is combined with the lighting. With `SHADER_UNLIT`, the texture color is copied directly.
  5. Large textures stored in flash memory may be VERY slow to access when the texture is not read linearly, which happens for some triangle orientations and can make the cache ineffective. This problem can be somewhat mitigated by:
     - splitting large textured triangles into smaller ones: then each triangle only accesses a small part of the texture. This helps cache locality a lot (this is why models with thousands of faces may display faster than a simple textured cube in some cases).
     - moving the image into RAM if possible. Even moving the texture from FLASH to EXTMEM (if available) will usually give a great speed boost !

## ◆ setTextureWrappingMode()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setTextureWrappingMode | ( | Shader | wrap_mode | ) |

Set the wrap mode when for texturing.

Parameters

  wrap_mode | Wrapping mode flag: `SHADER_TEXTURE_WRAP_POW2`: Wrap around (repeat) the texture. This is the fastest mode but the texture size must be a power of two along each dimension. `SHADER_TEXTURE_CLAMP`: Clamp to the edge. A bit slower than above but the texture can be any size.

## ◆ setTextureQuality()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setTextureQuality | ( | Shader | quality | ) |

Set the texturing quality.

Parameters

  quality | Texture quality flag: `SHADER_TEXTURE_NEAREST`: Use simple point sampling when texturing (fastest method). `SHADER_TEXTURE_BILINEAR`: Use bilinear interpolation when texturing (slower but higher quality).

## ◆ setViewMatrix()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setViewMatrix | ( | const fMat4 & | M | ) |

Set the view transformation matrix.

This matrix is used to transform vertices from 'world coordinates' to 'view coordinates' (ie from the point of view of the camera).

Changing this matrix changes the position of the camera in the world space.

Remarks
  In view space (i.e. after transformation), the camera is assumed to be centered at the origin, looking toward the negative Z axis with the Y axis pointing up (as in opengl).

Parameters

  M | the view matrix to use (a copy is made).

See also
  getViewMatrix(), setLookAt()

## ◆ getViewMatrix()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

fMat4 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::getViewMatrix | ( |  | ) | const

Return the current view matrix.

Returns
  a copy of the view matrix.

See also
  setViewMatrix(), setLookAt()

## ◆ setLookAt() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLookAt | ( | float | eyeX,
|  | float | eyeY,
|  | float | eyeZ,
|  | float | centerX,
|  | float | centerY,
|  | float | centerZ,
|  | float | upX,
|  | float | upY,
|  | float | upZ
| ) |  |

Set the view matrix so that the camera is looking at a given direction.

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml

Parameters

  eyeX,eyeY,eyeZ | position of the camera in world space coords.
  centerX,centerY,centerZ | point the camera is looking toward in world space coords.
  upX,upY,upZ | vector that tells the up direction for the camera (in world space coords).

See also
  setViewMatrix(), getViewMatrix(), Mat4::setLookAt()

## ◆ setLookAt() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLookAt | ( | const fVec3 | eye,
|  | const fVec3 | center,
|  | const fVec3 | up
| ) |  |

Set the view matrix so that the camera is looking at a given direction.

https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml

Parameters

  eye | position of the camera in world space coords.
  center | point the camera is looking toward in world space coords.
  up | vector that tells the up direction for the camera (in world space coords).

See also
  setViewMatrix(), getViewMatrix(), Mat4::setLookAt()

## ◆ worldToNDC()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

fVec4 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::worldToNDC | ( | fVec3 | P | ) |

Convert from world coordinates to normalized device coordinates (NDC).

Parameters

  P | Point in the world coordinate system.

Returns
  the coordinates of `P` on the standard viewport `[-1,1]^2` according to the current position of the camera.

Remarks
  - the model matrix is not taken into account here.
  - the `w` value returned can be used for depth testing.

## ◆ worldToImage()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

iVec2 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::worldToImage | ( | fVec3 | P | ) |

Convert from world coordinates to the corresponding image pixel.

Parameters

  P | Point in the world coordinate system.

Returns
  the coordinates of the associated pixel on the image.

Remarks
  - The position returned may be outside of the image !
  - Returns (0,0) if no image is inserted.

## ◆ setLightAmbiant()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLightAmbiant | ( | const RGBf & | color | ) |

Set the scene ambiant light color.

See Phong's lighting model: https://en.wikipedia.org/wiki/Phong_reflection_model.

Ambiant lighting is global and shared by all directional lights.

Parameters

  color | color for the global ambiant light.

See also
  setLight(), setLightDirection(), setLightDiffuse(), setLightSpecular(), setDirectionalLightAmbiant()

## ◆ setLightDirection()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLightDirection | ( | const fVec3 & | direction | ) |

Set the light source direction of the main directional light of the scene.

See Phong's lighting model: https://en.wikipedia.org/wiki/Phong_reflection_model.

When using multiple directional lights (MAX_DIRECTIONAL_LIGHTS >1), the method controls directional light 0 hence is equivalent to `setDirectionalLightDirection(0, direction)`.

Parameters

  direction | The direction the light points toward, given in world coordinates.

See also
  setLight(), setLightAmbiant(), setLightDiffuse(), setLightSpecular(), setDirectionalLightDirection()

## ◆ setLightDiffuse()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLightDiffuse | ( | const RGBf & | color | ) |

Set the diffuse light color of the main directional light of the scene.

See Phong's lighting model: https://en.wikipedia.org/wiki/Phong_reflection_model.

When using multiple directional lights (MAX_DIRECTIONAL_LIGHTS >1), the method controls directional light 0 hence is equivalent to `setDirectionalLightDiffuse(0, color)`.

Parameters

  color | color for the diffuse light.

See also
  setLight(), setLightDirection(), setLightAmbiant(), setLightSpecular(), setDirectionalLightDiffuse()

## ◆ setLightSpecular()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLightSpecular | ( | const RGBf & | color | ) |

Set the specular light color of the main directional light of the scene.

See Phong's lighting model: https://en.wikipedia.org/wiki/Phong_reflection_model.

When using multiple directional lights (MAX_DIRECTIONAL_LIGHTS >1), the method controls directional light 0 hence is equivalent to `setDirectionalLightSpecular(0, color)`.

Parameters

  color | color for the specular light.

See also
  setLight(), setLightDirection(), setLightAmbiant(), setLightDiffuse(), setDirectionalLightSpecular()

## ◆ setLight()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setLight | ( | const fVec3 | direction,
|  | const RGBf & | ambiantColor,
|  | const RGBf & | diffuseColor,
|  | const RGBf & | specularColor
| ) |  |

Set all lighting parameters of the main directional light of the scene at once.

See Phong's lighting model: https://en.wikipedia.org/wiki/Phong_reflection_model.

When using multiple directional lights (MAX_DIRECTIONAL_LIGHTS >1), the method controls directional light 0 hence is equivalent to calling `setDirectionalLight(0, direction, diffuseColor, specularColor)` with the same ambiant color for all directional lights.

Parameters

  direction | direction the light source points toward.
  ambiantColor | light ambiant color.
  diffuseColor | light diffuse color.
  specularColor | light specular color.

See also
  setLightDirection(), setLightAmbiant(), setLightDiffuse(), setLightSpecular(), setDirectionalLight()

## ◆ setDirectionalLightCount()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setDirectionalLightCount | ( | int | count | ) |

Set the number of active directional lights.

The count is clamped to `[0, MAX_DIRECTIONAL_LIGHTS]`. A count of 0 disables diffuse and specular directional lighting and leaves only the global ambiant term.

Extra directional lights affect rendering only when the renderer is instantiated with `MAX_DIRECTIONAL_LIGHTS > 1`. No shader flag is required for multi-directional lighting.

Parameters

  count | number of active directional lights.

## ◆ setDirectionalLightAmbiant()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setDirectionalLightAmbiant | ( | const RGBf & | color | ) |

Set the global ambiant light shared by all directional lights.

The ambiant lighting is shared by all directional lights.

This method is equivalent to `setLightAmbiant()`.

Parameters

  color | color for the ambiant light.

## ◆ setDirectionalLightDirection()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setDirectionalLightDirection | ( | int | index,
|  | const fVec3 & | direction
| ) |  |

Set the direction of one directional light.

Directions are expressed in world coordinates and use the same convention as `setLightDirection()`: the vector is the direction the light points toward. Directional light 0 is the default light.

Parameters

  index | index of the directional light in `[0, MAX_DIRECTIONAL_LIGHTS - 1]`.
  direction | direction the light points toward.

## ◆ setDirectionalLightDiffuse()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setDirectionalLightDiffuse | ( | int | index,
|  | const RGBf & | color
| ) |  |

Set the diffuse color of one directional light.

Directional light 0 is the default light (also controlled by `setLightDiffuse()`).

Parameters

  index | index of the directional light in `[0, MAX_DIRECTIONAL_LIGHTS - 1]`.
  color | diffuse color.

## ◆ setDirectionalLightSpecular()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setDirectionalLightSpecular | ( | int | index,
|  | const RGBf & | color
| ) |  |

Set the specular color of one directional light.

Directional light 0 is the default light (aslo controlled by `setLightSpecular()`).

Parameters

  index | index of the directional light in `[0, MAX_DIRECTIONAL_LIGHTS - 1]`.
  color | specular color.

## ◆ setDirectionalLight()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setDirectionalLight | ( | int | index,
|  | const fVec3 & | direction,
|  | const RGBf & | diffuseColor,
|  | const RGBf & | specularColor
| ) |  |

Configure one directional light at once.

This method does not change the global ambiant term and does not change the active light count. Use `setDirectionalLightCount()` to choose how many lights are rendered.

Parameters

  index | index of the directional light in `[0, MAX_DIRECTIONAL_LIGHTS - 1]`.
  direction | direction the light points toward.
  diffuseColor | diffuse color.
  specularColor | specular color.

## ◆ setModelMatrix()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setModelMatrix | ( | const fMat4 & | M | ) |

Set the model transformation matrix.

This matrix describes the transformation from local object space to view space. (i.e. the matrix specifies the position of the object in world space).

Parameters

  M | the new model transformation matrix (a copy is made).

See also
  getModelMatrix(), setModelPosScaleRot()

## ◆ getModelMatrix()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

fMat4 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::getModelMatrix | ( |  | ) | const

Return the model transformation matrix.

Returns
  a copy of the current model transformation matrix.

See also
  setModelMatrix(), setModelPosScaleRot()

## ◆ setModelPosScaleRot()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setModelPosScaleRot | ( | const fVec3 & | center = `fVec3{ 0, 0, 0 }`,
|  | const fVec3 & | scale = `fVec3(1, 1, 1)`,
|  | float | rot_angle = `0`,
|  | const fVec3 & | rot_dir = `fVec3{ 0, 1, 0 }`
| ) |  |

Set the model transformation matrix to move an object to a given location, scale and rotation.

The method is such that, if a model is initially centered around the origin in model coordinates, then it will be placed at a given position/scale/rotation in the world coordinates after multiplication by the model transformation matrix.

Transforms are done in the following order:

1. The model is scaled in each direction in model coordinates according to `scale`
2. The model is rotated in model coordinates around direction `rot_dir` and with an angle `rot_angle` (in degrees).
3. The model is translated to position `center` in world coordinates.

Parameters

  center | new center position after transformation.
  scale | scaling factor in each direction.
  rot_angle | rotation angle (in degrees).
  rot_dir | rotation axis.

See also
  getModelMatrix(), setModelMatrix()

## ◆ modelToNDC()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

fVec4 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::modelToNDC | ( | fVec3 | P | ) |

Convert from model coordinates to normalized device coordinates (NDC).

Parameters

  P | Point given in the model coordinate system.

Returns
  the projection of `P` on the standard viewport `[-1,1]^2` according to the current position of the camera.

Remarks
  the .w value can be used for depth testing.

## ◆ modelToImage()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

iVec2 tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::modelToImage | ( | fVec3 | P | ) |

Convert from model coordinates to the corresponding image pixel.

Parameters

  P | Point given in the model coordinate system.

Returns
  the position of the associated pixel on the image.

Remarks
  - The position returned may be outside of the image !
  - Returns (0,0) if no image is inserted.

## ◆ setMaterialColor()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setMaterialColor | ( | RGBf | color | ) |

Set the object material color.

This is the color used to render the object when texturing is not used.

Parameters

  color | The material color.

See also
  setMaterialAmbiantStrength(), setMaterialDiffuseStrength(), setMaterialSpecularStrength(), setMaterialSpecularExponent(), setMaterial()

## ◆ setMaterialAmbiantStrength()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setMaterialAmbiantStrength | ( | float | strenght = `0.1f` | ) |

Set how much the object material reflects the ambient light.

Parameters

  strenght | ambient light reflection strength in [0.0f,1.0f]. Default value 0.1f.

See also
  setMaterialColor(), setMaterialDiffuseStrength(), setMaterialSpecularStrength(), setMaterialSpecularExponent(), setMaterial()

## ◆ setMaterialDiffuseStrength()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setMaterialDiffuseStrength | ( | float | strenght = `0.6f` | ) |

Set how much the object material reflects the diffuse light.

Parameters

  strenght | diffuse light reflection strength in [0.0f,1.0f]. Default value 0.6f.

See also
  setMaterialColor(), setMaterialAmbiantStrength(), setMaterialSpecularStrength(), setMaterialSpecularExponent(), setMaterial()

## ◆ setMaterialSpecularStrength()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setMaterialSpecularStrength | ( | float | strenght = `0.5f` | ) |

Set how much the object material reflects the specular light.

Parameters

  strenght | specular light reflection strength in [0.0f,1.0f]. Default value 0.5f.

See also
  setMaterialColor(), setMaterialAmbiantStrength(), setMaterialDiffuseStrength(), setMaterialSpecularExponent(), setMaterial()

## ◆ setMaterialSpecularExponent()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setMaterialSpecularExponent | ( | int | exponent = `16` | ) |

Set the object specular exponent.

The exponent should be in the range between 0 (no specular lighting) and 100 (very localized/glossy).

Parameters

  exponent | Specular exponent in [0,100]. Default value 16.

See also
  setMaterialColor(), setMaterialAmbiantStrength(), setMaterialDiffuseStrength(), setMaterialSpecularStrength(), setMaterial()

## ◆ setMaterial()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::setMaterial | ( | RGBf | color,
|  | float | ambiantStrength,
|  | float | diffuseStrength,
|  | float | specularStrength,
|  | int | specularExponent
| ) |  |

Set all the object material properties at once.

Parameters

  color | The material color.
  ambiantStrength | The ambient light reflection strength.
  diffuseStrength | The diffuse light reflection strength.
  specularStrength | The specular light reflection strength.
  specularExponent | The specular exponent.

See also
  setMaterialColor(), setMaterialAmbiantStrength(), setMaterialDiffuseStrength(), setMaterialSpecularStrength(), setMaterialSpecularExponent(),

## ◆ drawMesh() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawMesh | ( | const Mesh3D< color_t > * | mesh,
|  | bool | use_mesh_material = `true`,
|  | bool | draw_chained_meshes = `true`
| ) |  |

Draw a Mesh3D object.

Parameters

  mesh | The mesh to draw.
  use_mesh_material | True (default) to use mesh material, otherwise use the current material instead. this flag affects also all the linked meshes if `draw_chained_meshes=true`.
  draw_chained_meshes | True (default) to draw also the chained meshes, in any.

Remarks
  - Drawing a mesh is the most effective way of drawing a 3D object (faster than drawing individual triangles/quads) so it should be the preferred method whenever working with static geometry.
  - The mesh can be located in any memory region (RAM, FLASH...) but using a fast memory will improve rendering speed noticeably. The methods `cacheMesh()` (or `copyMeshEXTMEM()` on Teensy) are available to copy a mesh to a faster memory location before rendering.

## ◆ drawMesh() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawMesh | ( | const Mesh3Dv2< color_t > * | mesh,
|  | bool | use_mesh_material = `true`
| ) |  |

Draw a Mesh3Dv2 object.

Parameters

  mesh | The mesh to draw.
  use_mesh_material | True (default) to use Mesh3Dv2 material colors and coefficients, otherwise use the current renderer material.

Remarks
  Mesh3Dv2 stores geometry in compact meshlets. The renderer first decodes the quantized meshlet sphere/cone metadata, optionally rejects the whole meshlet, then reads and rasterizes the local 16-bit payload only for visible meshlets.

## ◆ drawTriangle()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawTriangle | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const fVec3 * | N1 = `nullptr`,
|  | const fVec3 * | N2 = `nullptr`,
|  | const fVec3 * | N3 = `nullptr`,
|  | const fVec2 * | T1 = `nullptr`,
|  | const fVec2 * | T2 = `nullptr`,
|  | const fVec2 * | T3 = `nullptr`,
|  | const Image< color_t > * | texture = `nullptr`
| ) |  |

Draw a single triangle.

Parameters

  P1,P2,P3 | coordinates (in model space) of the triangle to draw
  N1,N2,N3 | pointers to the normals associated with `P1, P2, P3` or `nullptr` if not using Gouraud shading.
  T1,T2,T3 | pointer to the texture coords. `nullptr` if not using texturing.
  texture | pointer to the texture image or `nullptr` if not using texturing.

Remarks
  - The triangle is drawn with the current color/material.
  - `P1,P2,P3` must be in the correct winding order (c.f. setCulling()).
  - the normals `N1,N2,N3` are mandatory with Gouraud shading and must have unit norm.

## ◆ drawTriangleWithVertexColor()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawTriangleWithVertexColor | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const RGBf & | col1,
|  | const RGBf & | col2,
|  | const RGBf & | col3,
|  | const fVec3 * | N1 = `nullptr`,
|  | const fVec3 * | N2 = `nullptr`,
|  | const fVec3 * | N3 = `nullptr`
| ) |  |

Draw a single triangle with a given colors on each of its vertices.

Parameters

  P1,P2,P3 | coordinates (in model space) of the triangle to draw
  col1,col2,col3 | color at each vertex.
  N1,N2,N3 | pointers to the normals associated with `P1, P2, P3` or `nullptr` if not using Gouraud shading.

Remarks
  - The color inside the triangle is obtained by linear interpolation.
  - `P1,P2,P3` must be in the correct winding order (c.f. setCulling()).
  - the normals `N1,N2,N3` are mandatory with Gouraud shading and must have unit norm.

## ◆ drawTriangles()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawTriangles | ( | int | nb_triangles,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | const uint16_t * | ind_normals = `nullptr`,
|  | const fVec3 * | normals = `nullptr`,
|  | const uint16_t * | ind_texture = `nullptr`,
|  | const fVec2 * | textures = `nullptr`,
|  | const Image< color_t > * | texture_image = `nullptr`
| ) |  |

Draw a collection of triangles.

Parameters

  nb_triangles | number of triangles to draw.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_triangles*3` and each 3 consecutive values represent a triangle.
  vertices | The array of vertices (in model space).
  ind_normals | Array of normal indexes. If specified, the array must have length `nb_triangles*3`.
  normals | The array of normals vectors (in model space).
  ind_texture | array of texture indexes. If specified, the array must have length `nb_triangles*3`.
  textures | The array of texture coords.
  texture_image | The texture image to use or `nullptr` if not used

Remarks
  - If Gouraud shading is enabled, the normal vectors must all have unit norm.
  - If Gouraud shading is disabled, `ind_normals` and `normals` should be set to `nullptr`.
  - If texturing is disabled, `ind_texture`, `textures` and `texture_image` should be set to `nullptr`.
  - If texturing is disabled, the current material color is used to draw the triangles.

## ◆ drawTriangleStrip()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawTriangleStrip | ( | int | nb_indices,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | const uint16_t * | ind_normals = `nullptr`,
|  | const fVec3 * | normals = `nullptr`,
|  | const uint16_t * | ind_texture = `nullptr`,
|  | const fVec2 * | textures = `nullptr`,
|  | const Image< color_t > * | texture_image = `nullptr`
| ) |  |

Draw a triangle strip.

Parameters

  nb_indices | Number of indexes in the strip.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_indices`.
  vertices | The array of vertices (in model space).
  ind_normals | Array of normal indexes. If specified, the array must have length `nb_indices`.
  normals | The array of normals vectors (in model space).
  ind_texture | Array of texture indexes. If specified, the array must have length `nb_indices`.
  textures | The array of texture coords.
  texture_image | The texture image to use or `nullptr` if not used.

Remarks
  - The first triangle is `(0,1,2)`, then winding alternates like OpenGL triangle strips: `(2,1,3)`, `(2,3,4)`, `(4,3,5)`...
  - Repeated vertex indexes create degenerate triangles that are skipped. This can be used to bridge parts of a strip without drawing connecting triangles.
  - If Gouraud shading is enabled, the normal vectors must all have unit norm.
  - If Gouraud shading is disabled, `ind_normals` and `normals` should be set to `nullptr`.
  - If texturing is disabled, `ind_texture`, `textures` and `texture_image` should be set to `nullptr`.
  - If texturing is disabled, the current material color is used to draw the strip.

## ◆ drawQuad()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawQuad | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const fVec3 & | P4,
|  | const fVec3 * | N1 = `nullptr`,
|  | const fVec3 * | N2 = `nullptr`,
|  | const fVec3 * | N3 = `nullptr`,
|  | const fVec3 * | N4 = `nullptr`,
|  | const fVec2 * | T1 = `nullptr`,
|  | const fVec2 * | T2 = `nullptr`,
|  | const fVec2 * | T3 = `nullptr`,
|  | const fVec2 * | T4 = `nullptr`,
|  | const Image< color_t > * | texture = `nullptr`
| ) |  |

Draw a single quad.

The four vertices of the quad must be co-planar !

Parameters

  P1,P2,P3,P4 | coordinates (in model space) of the quad to draw
  N1,N2,N3,N4 | pointers to the normals associated with `P1, P2, P3, P4` or `nullptr` if not using Gouraud shading.
  T1,T2,T3,T4 | pointer to the texture coords. `nullptr` if not using texturing.
  texture | pointer to the texture image or `nullptr` if not using texturing.

Remarks
  - The quad is drawn with the current color/material.
  - `P1,P2,P3,P4` must be in the correct winding order (c.f. setCulling()).
  - the normals `N1,N2,N3,N4` are mandatory with Gouraud shading and must have unit norm.

## ◆ drawQuadWithVertexColor()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawQuadWithVertexColor | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const fVec3 & | P4,
|  | const RGBf & | col1,
|  | const RGBf & | col2,
|  | const RGBf & | col3,
|  | const RGBf & | col4,
|  | const fVec3 * | N1 = `nullptr`,
|  | const fVec3 * | N2 = `nullptr`,
|  | const fVec3 * | N3 = `nullptr`,
|  | const fVec3 * | N4 = `nullptr`
| ) |  |

Draw a single quad with a given colors on each of its four vertices.

The four vertices of the quad must be co-planar !

Parameters

  P1,P2,P3,P4 | coordinates (in model space) of the quad to draw
  col1,col2,col3,col4 | color at each vertex.
  N1,N2,N3,N4 | pointers to the normals associated with `P1, P2, P3, P4` or `nullptr` if not using Gouraud shading.

Remarks
  - The color inside the quad is obtained by linear interpolation.
  - `P1,P2,P3,P4` must be in the correct winding order (c.f. setCulling()).
  - the normals `N1,N2,N3,N4` are mandatory with Gouraud shading and must have unit norm.

## ◆ drawQuads()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawQuads | ( | int | nb_quads,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | const uint16_t * | ind_normals = `nullptr`,
|  | const fVec3 * | normals = `nullptr`,
|  | const uint16_t * | ind_texture = `nullptr`,
|  | const fVec2 * | textures = `nullptr`,
|  | const Image< color_t > * | texture_image = `nullptr`
| ) |  |

Draw a collection of quads.

The four vertices of a quad must always be co-planar !

Parameters

  nb_quads | number of quads to draw.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_quads*4` and each 4 consecutive values represent a quad.
  vertices | The array of vertices (in model space).
  ind_normals | Array of normal indexes. If specified, the array must have length `nb_quads*4`.
  normals | The array of normals vectors (in model space).
  ind_texture | array of texture indexes. If specified, the array must have length `nb_quads*4`.
  textures | The array of texture coords.
  texture_image | The texture image to use or `nullptr` if not used

Remarks
  - If Gouraud shading is enabled, the normal vectors must all have unit norm.
  - If Gouraud shading is disabled, `ind_normals` and `normals` should be set to `nullptr`.
  - If texturing is disabled, `ind_texture`, `textures` and `texture_image` should be set to `nullptr`.
  - If texturing is disabled, the current material color is used to draw the quads.

## ◆ drawCube() [1/3]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawCube | ( |  | ) |

Draw the unit cube `[-1,1]^3` in model space.

Remarks
  The model transform matrix may be used to scale, rotate and position the cube anywhere in world space.

## ◆ drawCube() [2/3]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawCube | ( | const fVec2 | v_front_ABCD[4],
|  | const Image< color_t > * | texture_front,
|  | const fVec2 | v_back_EFGH[4],
|  | const Image< color_t > * | texture_back,
|  | const fVec2 | v_top_HADE[4],
|  | const Image< color_t > * | texture_top,
|  | const fVec2 | v_bottom_BGFC[4],
|  | const Image< color_t > * | texture_bottom,
|  | const fVec2 | v_left_HGBA[4],
|  | const Image< color_t > * | texture_left,
|  | const fVec2 | v_right_DCFE[4],
|  | const Image< color_t > * | texture_right
| ) |  |

Draw a textured unit cube `[-1,1]^3` in model space.

H--------E
| |
| top |
H-------------E | |
/. /| H--------A--------D--------E
/ . top / | | | | |
/ . / | | left | front | right |
A------------D | right | | | |
| . | | G--------B--------C--------F
| G .......|....F | |
| . | / | bottom |
| . front | / | |
|. | / G--------F
B------------C | |
| back |
| |
H--------E

Remarks
  - The model transform matrix may be used to scale, rotate and position the cube anywhere in world space.
  - Each face may use a different texture (or set the image to `nullptr` to disable texturing a face).

Parameters

  v_front_ABCD | texture coords array for the front face in order ABCD
  texture_front | texture for the front face
  v_back_EFGH | texture coords array for the back face in order EFGH
  texture_back | texture for the back face
  v_top_HADE | texture coords array for the top face in order HADE
  texture_top | texture for the top face
  v_bottom_BGFC | texture coords array for the bottom face in order BGFC
  texture_bottom | texture for the bottom face
  v_left_HGBA | texture coords array for the left face in order HGBA
  texture_left | texture for the left face
  v_right_DCFE | texture coords array for the right face in order DCFE
  texture_right | texture for the right face

## ◆ drawCube() [3/3]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawCube | ( | const Image< color_t > * | texture_front,
|  | const Image< color_t > * | texture_back,
|  | const Image< color_t > * | texture_top,
|  | const Image< color_t > * | texture_bottom,
|  | const Image< color_t > * | texture_left,
|  | const Image< color_t > * | texture_right
| ) |  |

draw a textured unit cube [-1,1]^3 (in model space)

H--------E
| |
| top |
H-------------E | |
/. /| H--------A--------D--------E
/ . top / | | | | |
/ . / | | left | front | right |
A------------D | right | | | |
| . | | G--------B--------C--------F
| G .......|....F | |
| . | / | bottom |
| . front | / | |
|. | / G--------F
B------------C | |
| back |
| |
H--------E

Remarks
  - The model transform matrix may be used to scale, rotate and position the cube anywhere in world space.
  - Each face uses a 'whole' image. Set the texture image to `nullptr` to disable texturing a given face.

Parameters

  texture_front | texture for the front face.
  texture_back | texture for the back face.
  texture_top | texture for the top face.
  texture_bottom | texture for the bottom face.
  texture_left | texture for the left face.
  texture_right | texture for the right face.

## ◆ drawSkyBox() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawSkyBox | ( | const fVec2 | v_front_ABCD[4],
|  | const Image< color_t > * | texture_front,
|  | const fVec2 | v_back_EFGH[4],
|  | const Image< color_t > * | texture_back,
|  | const fVec2 | v_top_HADE[4],
|  | const Image< color_t > * | texture_top,
|  | const fVec2 | v_bottom_BGFC[4],
|  | const Image< color_t > * | texture_bottom,
|  | const fVec2 | v_left_HGBA[4],
|  | const Image< color_t > * | texture_left,
|  | const fVec2 | v_right_DCFE[4],
|  | const Image< color_t > * | texture_right,
|  | float | rot_angle_y = `0.0f`,
|  | float | reference_height = `0.0f`,
|  | float | skybox_radius = `32768.0f`,
|  | Shader | texture_quality = `SHADER_TEXTURE_NEAREST`,
|  | Shader | texture_mode = `SHADER_TEXTURE_CLAMP`
| ) |  |

Draw a textured sky-box around the current camera.

This method uses the same unit-cube geometry and face/texture-coordinate conventions as drawCube(), but it renders through a minimal unlit textured path without z-buffer testing/writing and without far-plane clipping. It is intended for sky-box/background rendering and should be called before drawing the z-buffered scene.

Face naming and layout:

H--------E
| |
| top |
H-------------E | |
/. /| H--------A--------D--------E
/ . top / | | | | |
/ . / | | left | front | right |
A------------D | right | | | |
| . | | G--------B--------C--------F
| G .......|....F | |
| . | / | bottom |
| . front | / | |
|. | / G--------F
B------------C | |
| back |
| |
H--------E

Remarks
  - The current model transform, material, culling and shader state are ignored.
  - `rot_angle_y` rotates the sky-box around the world Y axis.
  - `skybox_radius` is the half-size of the cube in world units.
  - `reference_height` is the world-space height of the sky-box vertical center.
  - The renderer ignores the current camera X/Z translation, but uses the current camera height so the sky-box floor/ceiling can stay tied to `reference_height`. Large radii make this vertical parallax very small and make the sky-box look farther away.
  - `nullptr` texture faces are skipped.

Parameters

  v_front_ABCD | texture coords array for the front face in order ABCD.
  texture_front | texture for the front face.
  v_back_EFGH | texture coords array for the back face in order EFGH.
  texture_back | texture for the back face.
  v_top_HADE | texture coords array for the top face in order HADE.
  texture_top | texture for the top face.
  v_bottom_BGFC | texture coords array for the bottom face in order BGFC.
  texture_bottom | texture for the bottom face.
  v_left_HGBA | texture coords array for the left face in order HGBA.
  texture_left | texture for the left face.
  v_right_DCFE | texture coords array for the right face in order DCFE.
  texture_right | texture for the right face.
  rot_angle_y | additional sky-box rotation around the world Y axis, in degrees.
  reference_height | world-space height of the sky-box vertical center.
  skybox_radius | sky-box cube half-size in world units.
  texture_quality | either `SHADER_TEXTURE_NEAREST` or `SHADER_TEXTURE_BILINEAR`.
  texture_mode | either `SHADER_TEXTURE_WRAP_POW2` or `SHADER_TEXTURE_CLAMP`.

## ◆ drawSkyBox() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawSkyBox | ( | const Image< color_t > * | texture_front,
|  | const Image< color_t > * | texture_back,
|  | const Image< color_t > * | texture_top,
|  | const Image< color_t > * | texture_bottom,
|  | const Image< color_t > * | texture_left,
|  | const Image< color_t > * | texture_right,
|  | float | rot_angle_y = `0.0f`,
|  | float | reference_height = `0.0f`,
|  | float | skybox_radius = `32768.0f`,
|  | Shader | texture_quality = `SHADER_TEXTURE_NEAREST`,
|  | Shader | texture_mode = `SHADER_TEXTURE_CLAMP`
| ) |  |

Draw a textured sky-box using whole images for each face.

Texture coordinates are generated with the same convention as drawCube().

## ◆ drawSphere() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawSphere | ( | int | nb_sectors,
|  | int | nb_stacks
| ) |  |

Draw a unit radius sphere centered at the origin `S(0,1)` in model space.

Remarks
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.
  - The mesh created is a UV-sphere with a given number of sectors and stacks.

Parameters

  nb_sectors | number of sectors of the UV sphere.
  nb_stacks | number of stacks of the UV sphere.

## ◆ drawSphere() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawSphere | ( | int | nb_sectors,
|  | int | nb_stacks,
|  | const Image< color_t > * | texture
| ) |  |

Draw a textured unit radius sphere centered at the origin S(0,1) in model space.

Remarks
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.
  - The mesh created is a UV-sphere with a given number of sectors and stacks.
  - The texture is mapped using the Mercator projection.

Parameters

  nb_sectors | number of sectors of the UV sphere.
  nb_stacks | number of stacks of the UV sphere.
  texture | The texture (mapped via Mercator projection)

## ◆ drawAdaptativeSphere() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawAdaptativeSphere | ( | float | quality = `1.0f` | ) |

Draw a unit radius sphere centered at the origin S(0,1) in model space.

Remarks
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.
  - The mesh created is a UV-sphere and the number of sectors and stacks is adjusted automatically according to the apparent size on the screen.

Parameters

  quality | Quality of the mesh. Should be positive, typically between 0.5f and 2.0f. `1` : default quality `>1`: finer mesh. Improve quality but decrease speed. `<1`: coarser mesh. Decrease quality but improve speed.

## ◆ drawAdaptativeSphere() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawAdaptativeSphere | ( | const Image< color_t > * | texture,
|  | float | quality = `1.0f`
| ) |  |

Draw a textured unit radius sphere centered at the origin S(0,1) in model space.

Remarks
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.
  - The mesh created is a UV-sphere and the number of sectors and stacks is adjusted automatically according to the apparent size on the screen.
  - The texture is mapped using the Mercator projection.

Parameters

  texture | The texture image mapped via Mercator projection.
  quality | (Optional) Quality of the mesh. Should be positive, typically between 0.5f and 2.0f. `1` : default quality `>1`: finer mesh. Improve quality but decrease speed. `<1`: coarser mesh. Decrease quality but improve speed.

## ◆ drawWireFrameMesh() [1/4]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameMesh | ( | const Mesh3D< color_t > * | mesh,
|  | bool | draw_chained_meshes = `true`
| ) |  |

Draw a mesh in wireframe [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The mesh is drawn with the current material color (not that of the mesh). This method does not require a zbuffer but back face culling is used if it is enabled.

Parameters

  mesh | The mesh to draw
  draw_chained_meshes | True to draw also the chained meshes.

## ◆ drawWireFrameMesh() [2/4]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameMesh | ( | const Mesh3Dv2< color_t > * | mesh | ) |

Draw a Mesh3Dv2 object in wireframe [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The mesh is drawn with the current material color, not with the Mesh3Dv2 materials.
  - This method does not require a zbuffer but back face culling is used if it is enabled.
  - Meshlet visibility cones are used when `TGX_MESHLET_WIREFRAME_CULL` is enabled.

Parameters

  mesh | The Mesh3Dv2 object to draw.

## ◆ drawWireFrameMeshAA() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameMeshAA | ( | const Mesh3D< color_t > * | mesh,
|  | bool | draw_chained_meshes = `true`
| ) |  |

Draw a mesh in wireframe [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  mesh | The mesh to draw.
  draw_chained_meshes | True to draw also the chained meshes.

## ◆ drawWireFrameMeshAA() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameMeshAA | ( | const Mesh3Dv2< color_t > * | mesh | ) |

Draw a Mesh3Dv2 object in wireframe [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  mesh | The Mesh3Dv2 object to draw.

## ◆ drawWireFrameMesh() [3/4]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameMesh | ( | const Mesh3D< color_t > * | mesh,
|  | bool | draw_chained_meshes,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a mesh in wireframe [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - It is very slow compared with `drawWireFrameMesh()` and `drawWireFrameMeshAA()`.
  - This method does not require a zbuffer but back face culling is used if it is enabled.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  mesh | The mesh to draw
  draw_chained_meshes | True to draw also the chained meshes.
  thickness | thickness of the lines.
  color | color to use.
  opacity | opacity multiplier in [0.0f, 1.0f].

## ◆ drawWireFrameMesh() [4/4]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameMesh | ( | const Mesh3Dv2< color_t > * | mesh,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a Mesh3Dv2 object in wireframe [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - It is very slow compared with `drawWireFrameMesh()` and `drawWireFrameMeshAA()`.
  - This method does not require a zbuffer but back face culling is used if it is enabled.
  - Meshlet visibility cones are used when `TGX_MESHLET_WIREFRAME_CULL` is enabled.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  mesh | The Mesh3Dv2 object to draw.
  thickness | thickness of the lines.
  color | color to use.
  opacity | opacity multiplier in [0.0f, 1.0f].

## ◆ drawWireFrameLine() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameLine | ( | const fVec3 & | P1,
|  | const fVec3 & | P2
| ) |  |

Draw a wireframe line segment [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The line is drawn with the current material color.

Parameters

  P1,P2 | endpoints in model space.

## ◆ drawWireFrameLineAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameLineAA | ( | const fVec3 & | P1,
|  | const fVec3 & | P2
| ) |  |

Draw a wireframe line segment [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  P1,P2 | endpoints in model space.

## ◆ drawWireFrameLine() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameLine | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a wireframe line segment [adjustable thickness + AA].

Remarks
  This method uses the general adjustable thickness + AA line path with explicit color and opacity.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  P1,P2 | endpoints in model space.
  thickness | thickness of the line
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameLines() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameLines | ( | int | nb_lines,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw a collection of wireframe line segments [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The lines are drawn with the current material color.

Parameters

  nb_lines | number of lines to draw
  ind_vertices | array of vertex indices. The length of the array is `nb_lines*2` and each 2 consecutive values represent a line segment.
  vertices | The array of vertices in model space.

## ◆ drawWireFrameLinesAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameLinesAA | ( | int | nb_lines,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw wireframe line segments [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  nb_lines | number of lines to draw.
  ind_vertices | array of vertex indices.
  vertices | The array of vertices in model space.

## ◆ drawWireFrameLines() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameLines | ( | int | nb_lines,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a collection of wireframe line segments [adjustable thickness + AA].

Remarks
  This method uses the general adjustable thickness + AA line path with explicit color and opacity.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  nb_lines | number of lines to draw
  ind_vertices | array of vertex indices. The length of the array is `nb_lines*2` and each 2 consecutive values represent a line segment.
  vertices | The array of vertices in model space.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameTriangle() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangle | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3
| ) |  |

Draw a wireframe triangle [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The lines are drawn with the current material color.
  - This method does not use the z-buffer but backface culling is used if enabled.

Parameters

  P1,P2,P3 | the triangle vertices in model space.

## ◆ drawWireFrameTriangleAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangleAA | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3
| ) |  |

Draw a wireframe triangle [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  P1,P2,P3 | triangle vertices in model space.

## ◆ drawWireFrameTriangle() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangle | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a wireframe triangle [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - This method does not use the z-buffer but backface culling is used if enabled.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  P1,P2,P3 | triangle vertices in model space.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameTriangles() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangles | ( | int | nb_triangles,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw a collection of wireframe triangles [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The lines are drawn with the current material color.
  - This method does not use the z-buffer but backface culling is used if enabled.

Parameters

  nb_triangles | number of triangles to draw.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_triangles*3` and each 3 consecutive values represent a triangle.
  vertices | Array of vertices in model space.

## ◆ drawWireFrameTrianglesAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTrianglesAA | ( | int | nb_triangles,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw wireframe triangles [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  nb_triangles | number of triangles to draw.
  ind_vertices | Array of vertex indexes.
  vertices | Array of vertices in model space.

## ◆ drawWireFrameTriangles() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangles | ( | int | nb_triangles,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a collection of wireframe triangles [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - This method does not use the z-buffer but backface culling is used if enabled.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  nb_triangles | number of triangles to draw.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_triangles*3` and each 3 consecutive values represent a triangle.
  vertices | Array of vertices in model space.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameTriangleStrip() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangleStrip | ( | int | nb_indices,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw a triangle strip in wireframe [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The lines are drawn with the current material color.
  - This method uses the same strip winding convention as `drawTriangleStrip()`.
  - Repeated vertex indexes create degenerate triangles that are skipped.
  - This method does not use the z-buffer but backface culling is used if enabled.

Parameters

  nb_indices | Number of indexes in the strip.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_indices`.
  vertices | Array of vertices in model space.

## ◆ drawWireFrameTriangleStripAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangleStripAA | ( | int | nb_indices,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw a triangle strip in wireframe [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.
  - This method uses the same strip winding convention as `drawTriangleStrip()`.
  - Repeated vertex indexes create degenerate triangles that are skipped.

Parameters

  nb_indices | Number of indexes in the strip.
  ind_vertices | Array of vertex indexes.
  vertices | Array of vertices in model space.

## ◆ drawWireFrameTriangleStrip() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameTriangleStrip | ( | int | nb_indices,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a triangle strip in wireframe [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - This method uses the same strip winding convention as `drawTriangleStrip()`.
  - Repeated vertex indexes create degenerate triangles that are skipped.
  - This method does not use the z-buffer but backface culling is used if enabled.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  nb_indices | Number of indexes in the strip.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_indices`.
  vertices | Array of vertices in model space.
  thickness | Thickness of the lines.
  color | Color to use.
  opacity | Opacity multiplier in [0.0f, 1.0f].

## ◆ drawWireFrameQuad() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameQuad | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const fVec3 & | P4
| ) |  |

Draw a wireframe quad [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The lines are drawn with the current material color.
  - This method does not use the z-buffer but backface culling is used if enabled.
  - The four vertices of each quad must be co-planar.

Parameters

  P1,P2,P3,P4 | the quad vertices in model space.

## ◆ drawWireFrameQuadAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameQuadAA | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const fVec3 & | P4
| ) |  |

Draw a wireframe quad [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  P1,P2,P3,P4 | the quad vertices in model space.

## ◆ drawWireFrameQuad() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameQuad | ( | const fVec3 & | P1,
|  | const fVec3 & | P2,
|  | const fVec3 & | P3,
|  | const fVec3 & | P4,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a wireframe quad [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - This method does not use the z-buffer but backface culling is used if enabled.
  - The four vertices of each quad must be co-planar.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  P1,P2,P3,P4 | the quad vertices in model space.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameQuads() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameQuads | ( | int | nb_quads,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw a collection of wireframe quads [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The lines are drawn with the current material color.
  - This method does not use the z-buffer but backface culling is used if enabled.
  - The four vertices of each quad must be co-planar.

Parameters

  nb_quads | number of quads to draw.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_quads*4` and each 4 consecutive values represent a quad.
  vertices | Array of vertices in model space.

## ◆ drawWireFrameQuadsAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameQuadsAA | ( | int | nb_quads,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices
| ) |  |

Draw wireframe quads [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  nb_quads | number of quads to draw.
  ind_vertices | Array of vertex indexes.
  vertices | Array of vertices in model space.

## ◆ drawWireFrameQuads() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameQuads | ( | int | nb_quads,
|  | const uint16_t * | ind_vertices,
|  | const fVec3 * | vertices,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a collection of wireframe quads [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - This method does not use the z-buffer but backface culling is used if enabled.
  - The four vertices of each quad must be co-planar.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  nb_quads | number of quads to draw.
  ind_vertices | Array of vertex indexes. The length of the array is `nb_quads*4` and each 4 consecutive values represent a quad.
  vertices | Array of vertices in model space.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameCube() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameCube | ( |  | ) |

Draw the wireframe cube [0,1]^3 (in model space) [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The model transform matrix may be used to scale, rotate and position the cube anywhere in world space.

## ◆ drawWireFrameCubeAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameCubeAA | ( |  | ) |

Draw the wireframe cube [0,1]^3 [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

## ◆ drawWireFrameCube() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameCube | ( | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw the wireframe cube [0,1]^3 (in model space) [adjustable thickness + AA].

Remarks
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - The model transform matrix may be used to scale, rotate and position the cube anywhere in world space.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameSphere() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameSphere | ( | int | nb_sectors,
|  | int | nb_stacks
| ) |  |

Draw a wireframe unit radius sphere centered at the origin (in model space) [fast].

Remarks
  - Creates a UV-sphere with a given number of sectors and stacks.
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.

Parameters

  nb_sectors | number of sectors in the UV sphere.
  nb_stacks | number of stacks in the UV sphere.

## ◆ drawWireFrameSphereAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameSphereAA | ( | int | nb_sectors,
|  | int | nb_stacks
| ) |  |

Draw a wireframe unit radius sphere [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  nb_sectors | number of sectors in the UV sphere.
  nb_stacks | number of stacks in the UV sphere.

## ◆ drawWireFrameSphere() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameSphere | ( | int | nb_sectors,
|  | int | nb_stacks,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a wireframe unit radius sphere centered at the origin (in model space) [adjustable thickness + AA].

Remarks
  - Creates a UV-sphere with a given number of sectors and stacks.
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  nb_sectors | number of sectors in the UV sphere.
  nb_stacks | number of stacks in the UV sphere.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawWireFrameAdaptativeSphere() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameAdaptativeSphere | ( | float | quality = `1.0f` | ) |

Draw a wireframe unit radius sphere centered at the origin (in model space) [fast].

Remarks
  - This method uses fast drawing: no thickness, no blending, no anti-aliasing.
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.
  - The mesh created is a UV-sphere and the number of sectors and stacks is adjusted automatically according to the apparent size on the screen.

Parameters

  quality | Quality of the mesh. Should be positive, typically between 0.5f and 2.0f. `1` : default quality `>1`: finer mesh. Improve quality but decrease speed. `<1`: coarser mesh. Decrease quality but improve speed.

## ◆ drawWireFrameAdaptativeSphereAA()

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameAdaptativeSphereAA | ( | float | quality = `1.0f` | ) |

Draw an adaptive wireframe sphere [antialiased] with the current material color.

Remarks
  - This method uses the optimized one-pixel antialiased wireframe path.
  - Use the adjustable thickness + AA overload only when line thickness or opacity is needed.

Parameters

  quality | Quality of the mesh. Should be positive, typically between 0.5f and 2.0f.

## ◆ drawWireFrameAdaptativeSphere() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawWireFrameAdaptativeSphere | ( | float | quality,
|  | float | thickness,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a wireframe unit radius sphere centered at the origin (in model space) [adjustable thickness + AA].

Remarks
  - The model transform matrix may be used to position the sphere anywhere in world space and change it to an ellipsoid.
  - This method uses the general adjustable thickness + AA line path with explicit color and opacity.
  - The mesh created is a UV-sphere and the number of sectors and stacks is adjusted automatically according to the apparent size on the screen.

Warning
  This method is very slow and may be slower than solid drawing.

Parameters

  quality | Quality of the mesh. Should be positive, typically between 0.5f and 2.0f. `1` : default quality `>1`: finer mesh. Improve quality but decrease speed. `<1`: coarser mesh. Decrease quality but improve speed.
  thickness | thickness of the lines
  color | color to use
  opacity | opacity multiplier in [0.0f, 1.0f]

## ◆ drawPixel() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawPixel | ( | const fVec3 & | pos | ) |

Draw a single pixel at a given position in model space.

Remarks
  - Use the material color.
  - The scene lighting is ignored.

Parameters

  pos | Position (in model space).

## ◆ drawPixel() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawPixel | ( | const fVec3 & | pos,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a single pixel at a given position in model space.

Remarks
  - Use blending with a given color and opacity factor.
  - The scene lighting is ignored.

Parameters

  pos | Position (in model space).
  color | color to use.
  opacity | opacity multiplier in `[0.0f, 1.0f]`.

## ◆ drawPixels() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawPixels | ( | int | nb_pixels,
|  | const fVec3 * | pos_list
| ) |  |

Draw a list of pixels at given positions in model space.

Remarks
  - Use the material color for all pixels.
  - The scene lighting is ignored.

Parameters

  nb_pixels | number of pixels to draw.
  pos_list | array of positions (in model space).

## ◆ drawPixels() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawPixels | ( | int | nb_pixels,
|  | const fVec3 * | pos_list,
|  | const int * | colors_ind,
|  | const color_t * | colors,
|  | const int * | opacities_ind,
|  | const float * | opacities
| ) |  |

Draw a list of pixels at given positions in model space with different colors and opacities.

Remarks
  - Use blending with given colors and opacities given by a palette and a list of indices.
  - The scene lighting is ignored.

Parameters

  nb_pixels | number of pixels to draw.
  pos_list | array of positions (in model space).
  colors_ind | array of color indices.
  colors | array of colors.
  opacities_ind | array of opacities indices.
  opacities | array of opacities

## ◆ drawDot() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawDot | ( | const fVec3 & | pos,
|  | int | r
| ) |  |

Draw a dot/circle at a given position in model space.

Remarks
  - Use the the material color.
  - The scene lighting is ignored.

Parameters

  pos | Position in model space.
  r | radius in pixels (integer valued).

## ◆ drawDot() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawDot | ( | const fVec3 & | pos,
|  | int | r,
|  | color_t | color,
|  | float | opacity
| ) |  |

Draw a dot/circle at a given position in model space.

Remarks
  - Use blending with the given color and opacity.
  - The scene lighting is ignored.

Parameters

  pos | Position in model space.
  r | radius in pixels.
  color | color to use.
  opacity | The opacity for blending in [0.0f, 1.0f].

## ◆ drawDots() [1/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawDots | ( | int | nb_dots,
|  | const fVec3 * | pos_list,
|  | const int | radius
| ) |  |

Draw a list of dots/circles at given positions in model space.

Remarks
  - Use the material color and the same radius for every dot.
  - The scene lighting is ignored.

Parameters

  nb_dots | number of dots to draw
  pos_list | array of positions in model space.
  radius | radius in pixels

## ◆ drawDots() [2/2]

template<typename color_t , Shader LOADED_SHADERS = TGX_SHADER_MASK_ALL, typename ZBUFFER_t = float, int MAX_DIRECTIONAL_LIGHTS = 1, int MAX_SPOT_LIGHTS = 0>

void tgx::Renderer3D< color_t, LOADED_SHADERS, ZBUFFER_t, MAX_DIRECTIONAL_LIGHTS, MAX_SPOT_LIGHTS >::drawDots | ( | int | nb_dots,
|  | const fVec3 * | pos_list,
|  | const int * | radius_ind,
|  | const int * | radius,
|  | const int * | colors_ind,
|  | const color_t * | colors,
|  | const int * | opacities_ind,
|  | const float * | opacities
| ) |  |

Draw a list of dots/circles at given positions in model space.

Remarks
  - Use a different radius and colors for every dot.
  - Use blending with given colors and opacities given by a palette and a list of indices.
  - The scene lighting is ignored.

Parameters

  nb_dots | number of dots to draw.
  pos_list | array of positions in model space.
  radius_ind | array of radius indices.
  radius | array of radiuses.
  colors_ind | array of color indices.
  colors | array of colors.
  opacities_ind | array of opacity indices.
  opacities | array of opacities value in [0.0f, 1.0f].

The documentation for this class was generated from the following file:

- src/Renderer3D.h