lv_gltf_model.h
API reference for lv_gltf_model.h
Functions
lv_gltf_model_set_animation_speed
Set the animation speed ratio
The actual ratio is the value parameter / LV_GLTF_ANIM_SPEED_NORMAL Values greater than LV_GLTF_ANIM_SPEED_NORMAL will speed-up the animation Values less than LV_GLTF_ANIM_SPEED_NORMAL will slow down the animation
void lv_gltf_model_set_animation_speed(lv_gltf_model_t *model, uint32_t value)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | pointer to a glTF model |
value | uint32_t | speed-up ratio of the animation |
lv_gltf_model_set_animation_time
Set the animation current time
The time is in milliseconds with the animation speed ratio applied. Values greater than the duration of the current animation are clamped to it.
void lv_gltf_model_set_animation_time(lv_gltf_model_t *model, uint32_t millis)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | pointer to a glTF model |
millis | uint32_t | the new playback time in milliseconds |
lv_gltf_model_set_animation_ratio
Set the animation current playback ratio
void lv_gltf_model_set_animation_ratio(lv_gltf_model_t *model, float ratio)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | pointer to a glTF model |
ratio | float | position in the animation, from 0.0 (first keyframe) to 1.0 (last keyframe). Values outside of this range are clamped. |
lv_gltf_model_get_image_count
Get the number of images in the glTF model.
Images in glTF are used as sources for textures and can be stored either as external files or embedded as base64-encoded model within the glTF file.
size_t lv_gltf_model_get_image_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of images in the model
lv_gltf_model_get_texture_count
Get the number of textures in the glTF model.
Textures define how images are sampled and applied to materials. Each texture references an image and may specify sampling parameters like filtering and wrapping modes.
size_t lv_gltf_model_get_texture_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of textures in the model
lv_gltf_model_get_material_count
Get the number of materials in the glTF model.
Materials define the visual appearance of mesh primitives, including properties like base color, metallic/roughness values, normal maps, and other surface characteristics.
size_t lv_gltf_model_get_material_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of materials in the model
lv_gltf_model_get_camera_count
Get the number of cameras in the glTF model.
Cameras define viewpoints within the 3D scene and can be either perspective or orthographic. They are typically attached to nodes in the scene graph.
size_t lv_gltf_model_get_camera_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of cameras in the model
lv_gltf_model_get_mesh_count
Get the number of meshes in the glTF model.
Meshes contain the geometric model for 3D objects, including vertex positions, normals, texture coordinates, and indices. Each mesh can have multiple primitives with different materials.
size_t lv_gltf_model_get_mesh_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of meshes in the model
lv_gltf_model_get_scene_count
Get the number of scenes in the glTF model.
Scenes define the root nodes of the scene graph. A glTF file can contain multiple scenes, though typically only one is designated as the default scene to be displayed.
size_t lv_gltf_model_get_scene_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of scenes in the model
lv_gltf_model_get_animation_count
Get the number of animations in the glTF model.
Animations define keyframe-based motion for nodes in the scene, including transformations like translation, rotation, and scaling over time.
size_t lv_gltf_model_get_animation_count(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | Pointer to the glTF model data structure |
Returns: size_t — Number of animations in the model
lv_gltf_model_get_animation
Get the current selected animation. To see if it's playing see lv_gltf_model_is_animation_paused
size_t lv_gltf_model_get_animation(lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | Pointer to the glTF model structure |
lv_gltf_model_get_animation_speed
Get the animation speed ratio
The actual ratio is the return value / LV_GLTF_ANIM_SPEED_NORMAL
uint32_t lv_gltf_model_get_animation_speed(const lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | const lv_gltf_model_t * | pointer to a glTF model |
lv_gltf_data_load_from_file
Load a glTF model from a file
lv_gltf_model_t * lv_gltf_data_load_from_file(const char *file_path, lv_gltf_model_loader_t *loader)| Name | Type | Description |
|---|---|---|
file_path | const char * | path to the glTF file to load |
loader | lv_gltf_model_loader_t * | pointer to the glTF model loader instance May be NULL. |
Returns: lv_gltf_model_t * — pointer to the loaded glTF model, or NULL on failure
If loader is NULL, an internal loader will be created and managed automatically
lv_gltf_data_load_from_bytes
Load a glTF model from a byte array
lv_gltf_model_t * lv_gltf_data_load_from_bytes(const uint8_t *data, size_t data_size, lv_gltf_model_loader_t *loader)| Name | Type | Description |
|---|---|---|
data | const uint8_t * | pointer to the glTF data buffer |
data_size | size_t | size of the data buffer in bytes |
loader | lv_gltf_model_loader_t * | pointer to the glTF model loader instance May be NULL. |
Returns: lv_gltf_model_t * — pointer to the loaded glTF model, or NULL on failure
If loader is NULL, an internal loader will be created and managed automatically
lv_gltf_model_delete
Delete a glTF model
void lv_gltf_model_delete(lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | the gltf model to delete May be NULL. |
lv_gltf_model_play_animation
Select and start playing an animation.
lv_result_t lv_gltf_model_play_animation(lv_gltf_model_t *model, size_t index)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | Pointer to the glTF model structure |
index | size_t | Animation number to start playing |
Returns: lv_result_t — LV_RESULT_OK if the animation was started else LV_RESULT_INVALID
lv_gltf_model_pause_animation
Pause the current animation.
void lv_gltf_model_pause_animation(lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | Pointer to the glTF model structure |
lv_gltf_model_is_animation_paused
Check if an animation is currently being played.
bool lv_gltf_model_is_animation_paused(lv_gltf_model_t *model)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | Pointer to the glTF model structure |
Dependencies
Last updated on