![]() |
TGX 1.1.1
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
3D model mesh class. More...
#include "Misc.h"#include "Vec2.h"#include "Vec3.h"#include "Box3.h"#include "Color.h"#include "Image.h"#include <stdint.h>#include "Mesh3D.inl"Go to the source code of this file.
Classes | |
| struct | tgx::Mesh3D< color_t > |
| 3D mesh data structure. More... | |
Functions | |
| template<typename color_t > | |
| const Mesh3D< color_t > * | tgx::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-supplied RAM buffers. More... | |
| template<typename color_t > | |
| const Mesh3D< color_t > * | tgx::cacheMesh (const Mesh3D< color_t > *mesh, void *ram_buffer, size_t ram_size, const char *copy_order="VNTIF", size_t *ram_used=nullptr) |
| Convenience overload of cacheMesh() with a single RAM buffer. | |
| template<typename color_t > | |
| Mesh3D< color_t > * | tgx::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. More... | |
| template<typename color_t > | |
| void | tgx::freeMeshEXTMEM (Mesh3D< color_t > *mesh) |
| Delete a mesh allocated with copyMeshEXTMEM(). More... | |
3D model mesh class.
| const Mesh3D< color_t > * tgx::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-supplied RAM buffers.
This is useful on MCUs where meshes are stored in slow flash/PROGMEM but some RAM is available for faster rendering. The method first copies the linked Mesh3D structures themselves, then tries to copy the requested arrays in the order specified by copy_order. Each allocation first tries the first buffer; if it does not fit there, it tries the second buffer when supplied. If an array does not fit in either buffer, its original pointer is kept.
Copy-order letters:
For example, "VIT" means: copy vertex arrays first, then texture images, then texture-coordinate arrays if there is still room.
| mesh | Pointer to the Mesh3D object to cache. |
| ram1_buffer | Pointer to the first memory buffer, usually the fastest RAM. |
| ram1_size | Size in bytes of the first RAM buffer. |
| ram2_buffer | Optional pointer to a second memory buffer, may be nullptr. |
| ram2_size | Optional size in bytes of the second RAM buffer, or 0 if not supplied. |
| copy_order | Optional C string describing which data should be copied and in which order. Default is "VNTIF". |
| ram1_used | If non-null, receives the number of bytes consumed in ram1_buffer. |
| ram2_used | If non-null, receives the number of bytes consumed in ram2_buffer. |
| Mesh3D< color_t > * tgx::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.
| void tgx::freeMeshEXTMEM | ( | Mesh3D< color_t > * | mesh | ) |
Delete a mesh allocated with copyMeshEXTMEM().
Also deletes linked sub-meshes, if any.