# lv_gltf_model.h (/api/libs/gltf/gltf_data/lv_gltf_model_h)



<ApiSummary functions="16" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (1)&#x22;,&#x22;Getters (9)&#x22;,&#x22;Other (6)&#x22;]">
  <ApiTab value="Setters (1)">
    <ApiMember kind="function" name="lv_gltf_model_set_animation_speed" file="libs/gltf/gltf_data/lv_gltf_model.h" line="162" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L162">
      lv_gltf_model_set_animation_speed [#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

      ```c title=" " lineNumbers=1
      void lv_gltf_model_set_animation_speed(lv_gltf_model_t *model, uint32_t value)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                           | Description                     |
      | ------- | -------------------------------------------------------------- | ------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> | pointer to a glTF model         |
      | `value` | <ApiLink name="uint32_t" />                                    | speed-up ratio of the animation |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (9)">
    <ApiMember kind="function" name="lv_gltf_model_get_image_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="53" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L53">
      lv_gltf_model_get_image_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_image_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of images in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_texture_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="64" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L64">
      lv_gltf_model_get_texture_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_texture_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of textures in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_material_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="75" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L75">
      lv_gltf_model_get_material_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_material_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of materials in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_camera_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="86" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L86">
      lv_gltf_model_get_camera_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_camera_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of cameras in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_mesh_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="98" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L98">
      lv_gltf_model_get_mesh_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_mesh_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of meshes in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_scene_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="109" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L109">
      lv_gltf_model_get_scene_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_scene_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of scenes in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_animation_count" file="libs/gltf/gltf_data/lv_gltf_model.h" line="120" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L120">
      lv_gltf_model_get_animation_count [#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.

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_animation_count(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description                              |
      | ------- | -------------------------------------------------------------------- | ---------------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | Pointer to the glTF model data structure |

      **Returns:** <ApiLink name="size_t" /> — Number of animations in the model
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_animation" file="libs/gltf/gltf_data/lv_gltf_model.h" line="150" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L150">
      lv_gltf_model_get_animation [#lv_gltf_model_get_animation]

      Get the current selected animation. To see if it's playing see `lv_gltf_model_is_animation_paused`

      ```c title=" " lineNumbers=1
      size_t lv_gltf_model_get_animation(lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                           | Description                         |
      | ------- | -------------------------------------------------------------- | ----------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> | Pointer to the glTF model structure |
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_get_animation_speed" file="libs/gltf/gltf_data/lv_gltf_model.h" line="171" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L171">
      lv_gltf_model_get_animation_speed [#lv_gltf_model_get_animation_speed]

      Get the animation speed ratio

      The actual ratio is the return value / LV\_GLTF\_ANIM\_SPEED\_NORMAL

      ```c title=" " lineNumbers=1
      uint32_t lv_gltf_model_get_animation_speed(const lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                                 | Description             |
      | ------- | -------------------------------------------------------------------- | ----------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="const lv_gltf_model_t *" /> | pointer to a glTF model |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (6)">
    <ApiMember kind="function" name="lv_gltf_data_load_from_file" file="libs/gltf/gltf_data/lv_gltf_model.h" line="23" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L23">
      lv_gltf_data_load_from_file [#lv_gltf_data_load_from_file]

      Load a glTF model from a file

      ```c title=" " lineNumbers=1
      lv_gltf_model_t * lv_gltf_data_load_from_file(const char *file_path, lv_gltf_model_loader_t *loader)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                                                         | Description                                                            |
      | ----------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
      | `file_path` | `const char *`                                                               | path to the glTF file to load                                          |
      | `loader`    | <ApiLink name="lv_gltf_model_loader_t" display="lv_gltf_model_loader_t *" /> | pointer to the glTF model loader instance, or NULL to create a new one |

      **Returns:** <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> — pointer to the loaded glTF model, or NULL on failure

      <Callout type="info">
        If loader is NULL, an internal loader will be created and managed automatically
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_data_load_from_bytes" file="libs/gltf/gltf_data/lv_gltf_model.h" line="34" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L34">
      lv_gltf_data_load_from_bytes [#lv_gltf_data_load_from_bytes]

      Load a glTF model from a byte array

      ```c title=" " lineNumbers=1
      lv_gltf_model_t * lv_gltf_data_load_from_bytes(const uint8_t *data, size_t data_size, lv_gltf_model_loader_t *loader)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name        | Type                                                                         | Description                                                            |
      | ----------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
      | `data`      | <ApiLink name="uint8_t" display="const uint8_t *" />                         | pointer to the glTF data buffer                                        |
      | `data_size` | <ApiLink name="size_t" />                                                    | size of the data buffer in bytes                                       |
      | `loader`    | <ApiLink name="lv_gltf_model_loader_t" display="lv_gltf_model_loader_t *" /> | pointer to the glTF model loader instance, or NULL to create a new one |

      **Returns:** <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> — pointer to the loaded glTF model, or NULL on failure

      <Callout type="info">
        If loader is NULL, an internal loader will be created and managed automatically
      </Callout>
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_delete" file="libs/gltf/gltf_data/lv_gltf_model.h" line="42" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L42">
      lv_gltf_model_delete [#lv_gltf_model_delete]

      Delete a glTF model

      ```c title=" " lineNumbers=1
      void lv_gltf_model_delete(lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                           | Description              |
      | ------- | -------------------------------------------------------------- | ------------------------ |
      | `model` | <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> | the gltf model to delete |
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_play_animation" file="libs/gltf/gltf_data/lv_gltf_model.h" line="129" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L129">
      lv_gltf_model_play_animation [#lv_gltf_model_play_animation]

      Select and start playing an animation.

      ```c title=" " lineNumbers=1
      lv_result_t lv_gltf_model_play_animation(lv_gltf_model_t *model, size_t index)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                           | Description                         |
      | ------- | -------------------------------------------------------------- | ----------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> | Pointer to the glTF model structure |
      | `index` | <ApiLink name="size_t" />                                      | Animation number to start playing   |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK if the animation was started else LV\_RESULT\_INVALID
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_pause_animation" file="libs/gltf/gltf_data/lv_gltf_model.h" line="136" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L136">
      lv_gltf_model_pause_animation [#lv_gltf_model_pause_animation]

      Pause the current animation.

      ```c title=" " lineNumbers=1
      void lv_gltf_model_pause_animation(lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                           | Description                         |
      | ------- | -------------------------------------------------------------- | ----------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> | Pointer to the glTF model structure |
    </ApiMember>

    <ApiMember kind="function" name="lv_gltf_model_is_animation_paused" file="libs/gltf/gltf_data/lv_gltf_model.h" line="143" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/libs/gltf/gltf_data/lv_gltf_model.h#L143">
      lv_gltf_model_is_animation_paused [#lv_gltf_model_is_animation_paused]

      Check if an animation is currently being played.

      ```c title=" " lineNumbers=1
      bool lv_gltf_model_is_animation_paused(lv_gltf_model_t *model)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                                           | Description                         |
      | ------- | -------------------------------------------------------------- | ----------------------------------- |
      | `model` | <ApiLink name="lv_gltf_model_t" display="lv_gltf_model_t *" /> | Pointer to the glTF model structure |
    </ApiMember>
  </ApiTab>
</ApiTabs>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_gltf_model_node.h&#x22;, &#x22;lv_types.h&#x22;, &#x22;lv_event.h&#x22;, &#x22;lv_gltf_model_loader.h&#x22;]" includedBy="[&#x22;lv_gltf.h&#x22;]" transitiveIncludes="[&#x22;lv_3dmath.h&#x22;, &#x22;lv_array.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;]" />
