lv_gltf_model_node.h
API reference for lv_gltf_model_node.h
Functions
lv_gltf_model_node_set_position_x
Set the X position of a glTF model node. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_position_x(lv_gltf_model_node_t *node, float x)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
x | float | The X position value |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_position_y
Set the Y position of a glTF model node. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_position_y(lv_gltf_model_node_t *node, float y)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
y | float | The Y position value |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_position_z
Set the Z position of a glTF model node. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_position_z(lv_gltf_model_node_t *node, float z)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
z | float | The Z position value |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_rotation_x
Set the rotation of a glTF model node around the X axis. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_rotation_x(lv_gltf_model_node_t *node, float x)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
x | float | The rotation around the X axis, in radians |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_rotation_y
Set the rotation of a glTF model node around the Y axis. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_rotation_y(lv_gltf_model_node_t *node, float y)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
y | float | The rotation around the Y axis, in radians |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_rotation_z
Set the rotation of a glTF model node around the Z axis. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_rotation_z(lv_gltf_model_node_t *node, float z)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
z | float | The rotation around the Z axis, in radians |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_scale_x
Set the X scale of a glTF model node. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_scale_x(lv_gltf_model_node_t *node, float x)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
x | float | The X scale value |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_scale_y
Set the Y scale of a glTF model node. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_scale_y(lv_gltf_model_node_t *node, float y)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
y | float | The Y scale value |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_set_scale_z
Set the Z scale of a glTF model node. The operation is queued and applied on the next rendering phase.
lv_result_t lv_gltf_model_node_set_scale_z(lv_gltf_model_node_t *node, float z)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
z | float | The Z scale value |
Returns: lv_result_t — LV_RESULT_OK if the operation is queued successfully, LV_RESULT_INVALID if there is no more memory to queue the operation
lv_gltf_model_node_get_by_index
Get a glTF model node by its index.
lv_gltf_model_node_t * lv_gltf_model_node_get_by_index(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 | The index of the node to retrieve, must be less than the node count |
Returns: lv_gltf_model_node_t * — Pointer to the glTF model node
lv_gltf_model_node_get_by_numeric_path
Get a glTF model node by its numeric path.
lv_gltf_model_node_t * lv_gltf_model_node_get_by_numeric_path(lv_gltf_model_t *model, const char *num_path)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | Pointer to the glTF model structure |
num_path | const char * | The numeric path string of the node to retrieve (eg. ".0") |
Returns: lv_gltf_model_node_t * — Pointer to the glTF model node, or NULL if not found
lv_gltf_model_node_get_by_path
Get a glTF model node by its path.
lv_gltf_model_node_t * lv_gltf_model_node_get_by_path(lv_gltf_model_t *model, const char *path)| Name | Type | Description |
|---|---|---|
model | lv_gltf_model_t * | Pointer to the glTF model structure |
path | const char * | The path string of the node to retrieve |
Returns: lv_gltf_model_node_t * — Pointer to the glTF model node, or NULL if not found
lv_gltf_model_node_get_path
Get the path of a glTF model node.
const char * lv_gltf_model_node_get_path(lv_gltf_model_node_t *node)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
Returns: const char * — The path string of the node
lv_gltf_model_node_get_ip
Get the IP (internal pointer/identifier) of a glTF model node.
const char * lv_gltf_model_node_get_ip(lv_gltf_model_node_t *node)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
Returns: const char * — The IP string of the node
lv_gltf_model_get_node_count
Get the number of nodes in the glTF model.
Nodes form the scene graph hierarchy and can contain transformations, meshes, cameras, or other nodes as children. They define the spatial relationships between objects in the scene.
size_t lv_gltf_model_get_node_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 nodes in the model
lv_gltf_model_node_get_local_position
Get the local position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback.
Local position is relative to the node's parent.
This function is only valid when called from an event callback registered. See lv_gltf_model_node_add_event_cb() and lv_gltf_model_node_add_event_cb_with_world_position()
lv_result_t lv_gltf_model_node_get_local_position(lv_event_t *e, lv_3dpoint_t *result)| Name | Type | Description |
|---|---|---|
e | lv_event_t * | Pointer to the event structure from the callback |
result | lv_3dpoint_t * | Pointer to lv_3dpoint_t structure to store the position (x, y, z) |
Returns: lv_result_t — LV_RESULT_OK if successful, LV_RESULT_INVALID on failure
lv_gltf_model_node_get_world_position
Get the world position of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback registered with world position enabled.
World position is the absolute position in global scene coordinates.
This function requires the event callback to be registered with lv_gltf_model_node_add_event_cb_with_world_position() as it involves complex matrix calculations that are computed on-demand.
lv_result_t lv_gltf_model_node_get_world_position(lv_event_t *e, lv_3dpoint_t *result)| Name | Type | Description |
|---|---|---|
e | lv_event_t * | Pointer to the event structure from the callback |
result | lv_3dpoint_t * | Pointer to lv_3dpoint_t structure to store the position (x, y, z) |
Returns: lv_result_t — LV_RESULT_OK if successful, LV_RESULT_INVALID on failure
lv_gltf_model_node_get_scale
Get the scale of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback.
Returns the scale factors for each axis.
This function is only valid when called from an event callback registered. See lv_gltf_model_node_add_event_cb() and lv_gltf_model_node_add_event_cb_with_world_position()
lv_result_t lv_gltf_model_node_get_scale(lv_event_t *e, lv_3dpoint_t *result)| Name | Type | Description |
|---|---|---|
e | lv_event_t * | Pointer to the event structure from the callback |
result | lv_3dpoint_t * | Pointer to lv_3dpoint_t structure to store the scale (x, y, z) |
Returns: lv_result_t — LV_RESULT_OK if successful, LV_RESULT_INVALID on failure
lv_gltf_model_node_get_euler_rotation
Get the Euler rotation of a glTF model node. Must be called from within an LV_EVENT_VALUE_CHANGED callback.
Returns rotation as Euler angles in radians (x, y, z).
This function is only valid when called from an event callback registered. See lv_gltf_model_node_add_event_cb() and lv_gltf_model_node_add_event_cb_with_world_position()
lv_result_t lv_gltf_model_node_get_euler_rotation(lv_event_t *e, lv_3dpoint_t *result)| Name | Type | Description |
|---|---|---|
e | lv_event_t * | Pointer to the event structure from the callback |
result | lv_3dpoint_t * | Pointer to lv_3dpoint_t structure to store the rotation in radians (x, y, z) |
Returns: lv_result_t — LV_RESULT_OK if successful, LV_RESULT_INVALID on failure
lv_gltf_model_node_add_event_cb
Add an event callback to a glTF model node.
lv_event_dsc_t * lv_gltf_model_node_add_event_cb(lv_gltf_model_node_t *node, lv_event_cb_t cb, lv_event_code_t filter_list, void *user_data)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
cb | lv_event_cb_t | The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data. |
filter_list | lv_event_code_t | Event code filter for the callback |
user_data | void * | User data to pass to the callback May be NULL. |
Returns: lv_event_dsc_t * — Pointer to the event descriptor, or NULL if allocation failed
lv_gltf_model_node_add_event_cb_with_world_position
Add an event callback to a glTF model node with world position computation enabled. Use this only when world position is needed, as computing it is an expensive operation.
lv_event_dsc_t * lv_gltf_model_node_add_event_cb_with_world_position(lv_gltf_model_node_t *node, lv_event_cb_t cb, lv_event_code_t filter_list, void *user_data)| Name | Type | Description |
|---|---|---|
node | lv_gltf_model_node_t * | Pointer to the glTF model node structure |
cb | lv_event_cb_t | The event callback function to add. Use lv_event_get_param() to retrieve lv_gltf_node_data_t with the node's data. |
filter_list | lv_event_code_t | Event code filter for the callback |
user_data | void * | User data to pass to the callback May be NULL. |
Returns: lv_event_dsc_t * — Pointer to the event descriptor, or NULL if allocation failed
Macros
LV_GLTF_ANIM_SPEED_TENTH
#define LV_GLTF_ANIM_SPEED_TENTH 100LV_GLTF_ANIM_SPEED_QUARTER
#define LV_GLTF_ANIM_SPEED_QUARTER 250LV_GLTF_ANIM_SPEED_HALF
#define LV_GLTF_ANIM_SPEED_HALF 500LV_GLTF_ANIM_SPEED_NORMAL
#define LV_GLTF_ANIM_SPEED_NORMAL 1000LV_GLTF_ANIM_SPEED_2X
#define LV_GLTF_ANIM_SPEED_2X 2000LV_GLTF_ANIM_SPEED_3X
#define LV_GLTF_ANIM_SPEED_3X 3000LV_GLTF_ANIM_SPEED_4X
#define LV_GLTF_ANIM_SPEED_4X 4000LV_GLTF_DEFAULT_CAMERA
#define LV_GLTF_DEFAULT_CAMERA 0Dependencies
Last updated on