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");
205 template<
typename color_t>
208 static_assert(is_color<color_t>::value,
"color_t must be one of the color types defined in Color.h");
272 void* ram1_buffer,
size_t ram1_size,
273 void* ram2_buffer,
size_t ram2_size,
274 const char* copy_order =
"PLMI",
275 size_t* ram1_used =
nullptr,
276 size_t* ram2_used =
nullptr);
283 void* ram_buffer,
size_t ram_size,
284 const char* copy_order =
"PLMI",
285 size_t* ram_used =
nullptr);
288#if defined(ARDUINO_TEENSY41)
319 bool copy_payload =
false,
320 bool copy_meshlets =
false,
321 bool copy_materials =
false,
322 bool copy_textures =
true,
323 size_t* extmem_used =
nullptr);
339#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:207
const MeshMaterial3Dv2< color_t > * materials
Material array.
Definition: Mesh3Dv2.h:215
const char * name
Mesh name, or nullptr.
Definition: Mesh3Dv2.h:221
uint16_t nb_meshlets
Number of meshlets in the mesh.
Definition: Mesh3Dv2.h:212
fBox3 bounding_box
Global object bounding box.
Definition: Mesh3Dv2.h:219
uint16_t nb_materials
Number of materials. Must be <= 256 because meshlet material indices are uint8_t.
Definition: Mesh3Dv2.h:213
int32_t id
Version/id. Expected to be 2162 for Mesh3Dv2.
Definition: Mesh3Dv2.h:210
const uint32_t * payload
32-bit aligned meshlet payload blob.
Definition: Mesh3Dv2.h:217
const Meshlet3Dv2 * meshlets
Meshlet header array.
Definition: Mesh3Dv2.h:216
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:97
uint8_t nb_normals
Number of local normals.
Definition: Mesh3Dv2.h:107
uint8_t nb_vertices
Number of local vertices. With the uint8_t face stream format, this must be <= 128.
Definition: Mesh3Dv2.h:106
uint32_t payload_offset32
Offset of this meshlet payload in Mesh3Dv2::payload, in 32-bit words.
Definition: Mesh3Dv2.h:104
uint8_t material_index
Index in Mesh3Dv2::materials.
Definition: Mesh3Dv2.h:109
uint16_t sphere_radius
Quantized bounding sphere radius.
Definition: Mesh3Dv2.h:101
int16_t sphere_center[3]
Quantized bounding sphere center relative to the global bounding-box center.
Definition: Mesh3Dv2.h:98
int16_t cone_cos
Signed-normalized cone cosine. Values <= -32767 disable meshlet cone culling.
Definition: Mesh3Dv2.h:102
uint8_t nb_texcoords
Number of local texture coordinates.
Definition: Mesh3Dv2.h:108
int16_t cone_dir[3]
Signed-normalized quantized visibility cone direction.
Definition: Mesh3Dv2.h:99
Color in R,G,B float format.
Definition: Color.h:2407