22#ifndef _TGX_MESH3DV2_H_
23#define _TGX_MESH3DV2_H_
52 template<
typename color_t>
56 static_assert(is_color<color_t>::value,
"color_t must be one of the color types defined in Color.h");
80 template<
typename color_t>
84 static_assert(is_color<color_t>::value,
"color_t must be one of the color types defined in Color.h");
237 template<
typename color_t>
240 static_assert(is_color<color_t>::value,
"color_t must be one of the color types defined in Color.h");
309 void* ram1_buffer,
size_t ram1_size,
310 void* ram2_buffer,
size_t ram2_size,
311 const char* copy_order =
"PLMI",
312 size_t* ram1_used =
nullptr,
313 size_t* ram2_used =
nullptr);
320 void* ram_buffer,
size_t ram_size,
321 const char* copy_order =
"PLMI",
322 size_t* ram_used =
nullptr);
325#if defined(ARDUINO_TEENSY41)
357 bool copy_payload =
false,
358 bool copy_meshlets =
false,
359 bool copy_materials =
false,
360 bool copy_textures =
true,
361 size_t* extmem_used =
nullptr);
377#include "Mesh3Dv2.inl"
Color classes [RGB565, RGB24, RGB32, RGB64, RGBf, HSV].
void freeMeshEXTMEM(Mesh3D< color_t > *mesh)
Delete a mesh allocated with copyMeshEXTMEM().
const Mesh3D< color_t > * cacheMesh(const Mesh3D< color_t > *mesh, void *ram1_buffer, size_t ram1_size, void *ram2_buffer, size_t ram2_size, const char *copy_order="VNTIF", size_t *ram1_used=nullptr, size_t *ram2_used=nullptr)
Creates a cached version of a Mesh3D object by copying selected data arrays into one or two user-supp...
Mesh3D< color_t > * copyMeshEXTMEM(const Mesh3D< color_t > *mesh, bool copy_vertices=false, bool copy_normals=false, bool copy_texcoords=false, bool copy_textures=true, bool copy_faces=false)
Create a copy of a Mesh3D object where selected PROGMEM arrays are copied to EXTMEM.
Utility/miscellaneous functions used throughout the library.
Image class [MAIN CLASS FOR THE 2D API].
Definition: Image.h:145
Compact meshlet-based 3D mesh data structure.
Definition: Mesh3Dv2.h:239
const MeshMaterial3Dv2< color_t > * materials
Material array.
Definition: Mesh3Dv2.h:247
const char * name
Mesh name, or nullptr.
Definition: Mesh3Dv2.h:253
uint16_t nb_meshlets
Number of meshlets in the mesh.
Definition: Mesh3Dv2.h:244
fBox3 bounding_box
Global object bounding box.
Definition: Mesh3Dv2.h:251
uint16_t nb_materials
Number of materials. Must be <= 256 because meshlet material indices are uint8_t.
Definition: Mesh3Dv2.h:245
int32_t id
Version/id. Expected to be 2162 for Mesh3Dv2.
Definition: Mesh3Dv2.h:242
const MeshMaterialExtra3Dv2< color_t > * material_extras
Optional material extension array, or nullptr.
Definition: Mesh3Dv2.h:255
const uint32_t * payload
32-bit aligned meshlet payload blob.
Definition: Mesh3Dv2.h:249
const Meshlet3Dv2 * meshlets
Meshlet header array.
Definition: Mesh3Dv2.h:248
Material definition for a Mesh3Dv2 object.
Definition: Mesh3Dv2.h:54
const Image< color_t > * texture
Optional texture image, or nullptr if the material is not textured.
Definition: Mesh3Dv2.h:58
RGBf color
Default color to use when texturing is disabled.
Definition: Mesh3Dv2.h:60
float ambiant_strength
Object ambient coefficient (how much it reflects the ambient light component). Typical value: 0....
Definition: Mesh3Dv2.h:62
float diffuse_strength
Object diffuse coefficient (how much it reflects the diffuse light component). Typical value: 0....
Definition: Mesh3Dv2.h:63
float specular_strength
Object specular coefficient (how much it reflects the specular light component). Typical value: 0....
Definition: Mesh3Dv2.h:64
int specular_exponent
Specular exponent. 0 to disable specular lighting. Typical value between 4 and 64.
Definition: Mesh3Dv2.h:65
Header for a single meshlet inside a Mesh3Dv2 object.
Definition: Mesh3Dv2.h:121
uint8_t nb_normals
Number of local normals.
Definition: Mesh3Dv2.h:131
uint8_t nb_vertices
Number of local vertices. With the uint8_t face stream format, this must be <= 128.
Definition: Mesh3Dv2.h:130
uint32_t payload_offset32
Offset of this meshlet payload in Mesh3Dv2::payload, in 32-bit words.
Definition: Mesh3Dv2.h:128
uint8_t material_index
Index in Mesh3Dv2::materials.
Definition: Mesh3Dv2.h:133
uint16_t sphere_radius
Quantized bounding sphere radius.
Definition: Mesh3Dv2.h:125
int16_t sphere_center[3]
Quantized bounding sphere center relative to the global bounding-box center.
Definition: Mesh3Dv2.h:122
int16_t cone_cos
Signed-normalized cone cosine. Values <= -32767 disable meshlet cone culling.
Definition: Mesh3Dv2.h:126
uint8_t nb_texcoords
Number of local texture coordinates.
Definition: Mesh3Dv2.h:132
int16_t cone_dir[3]
Signed-normalized quantized visibility cone direction.
Definition: Mesh3Dv2.h:123
Color in R,G,B float format.
Definition: Color.h:2407