Foundation
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
cgltf.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  cgltf_memory_options
 
struct  cgltf_file_options
 
struct  cgltf_options
 
struct  cgltf_extras
 
struct  cgltf_extension
 
struct  cgltf_buffer
 
struct  cgltf_meshopt_compression
 
struct  cgltf_buffer_view
 
struct  cgltf_accessor_sparse
 
struct  cgltf_accessor
 
struct  cgltf_attribute
 
struct  cgltf_image
 
struct  cgltf_sampler
 
struct  cgltf_texture
 
struct  cgltf_texture_transform
 
struct  cgltf_texture_view
 
struct  cgltf_pbr_metallic_roughness
 
struct  cgltf_pbr_specular_glossiness
 
struct  cgltf_clearcoat
 
struct  cgltf_transmission
 
struct  cgltf_ior
 
struct  cgltf_specular
 
struct  cgltf_volume
 
struct  cgltf_sheen
 
struct  cgltf_emissive_strength
 
struct  cgltf_iridescence
 
struct  cgltf_diffuse_transmission
 
struct  cgltf_subsurface
 
struct  cgltf_anisotropy
 
struct  cgltf_dispersion
 
struct  cgltf_foundation_materials
 
struct  cgltf_material
 
struct  cgltf_material_mapping
 
struct  cgltf_morph_target
 
struct  cgltf_draco_mesh_compression
 
struct  cgltf_mesh_gpu_instancing
 
struct  cgltf_primitive
 
struct  cgltf_mesh
 
struct  cgltf_skin
 
struct  cgltf_camera_perspective
 
struct  cgltf_camera_orthographic
 
struct  cgltf_camera_lens
 
struct  cgltf_camera
 
struct  cgltf_light
 
struct  cgltf_light_area
 
struct  cgltf_curve
 
struct  cgltf_foundation_environment
 
struct  cgltf_foundation_color_management
 
struct  cgltf_node
 
struct  cgltf_scene
 
struct  cgltf_animation_sampler
 
struct  cgltf_animation_channel
 
struct  cgltf_animation
 
struct  cgltf_material_variant
 
struct  cgltf_asset
 
struct  cgltf_data
 

Typedefs

typedef size_t cgltf_size
 
typedef long long int cgltf_ssize
 
typedef float cgltf_float
 
typedef int cgltf_int
 
typedef unsigned int cgltf_uint
 
typedef int cgltf_bool
 
typedef enum cgltf_file_type cgltf_file_type
 
typedef enum cgltf_result cgltf_result
 
typedef struct cgltf_memory_options cgltf_memory_options
 
typedef struct cgltf_file_options cgltf_file_options
 
typedef struct cgltf_options cgltf_options
 
typedef enum cgltf_buffer_view_type cgltf_buffer_view_type
 
typedef enum cgltf_attribute_type cgltf_attribute_type
 
typedef enum cgltf_component_type cgltf_component_type
 
typedef enum cgltf_type cgltf_type
 
typedef enum cgltf_primitive_type cgltf_primitive_type
 
typedef enum cgltf_alpha_mode cgltf_alpha_mode
 
typedef enum cgltf_animation_path_type cgltf_animation_path_type
 
typedef enum cgltf_interpolation_type cgltf_interpolation_type
 
typedef enum cgltf_camera_type cgltf_camera_type
 
typedef enum cgltf_light_type cgltf_light_type
 
typedef enum cgltf_light_area_type cgltf_light_area_type
 
typedef enum cgltf_curve_basis cgltf_curve_basis
 
typedef enum cgltf_curve_render_mode cgltf_curve_render_mode
 
typedef enum cgltf_foundation_environment_type cgltf_foundation_environment_type
 
typedef enum cgltf_foundation_environment_projection cgltf_foundation_environment_projection
 
typedef enum cgltf_foundation_material_shader_block cgltf_foundation_material_shader_block
 
typedef enum cgltf_foundation_material_hair_model cgltf_foundation_material_hair_model
 
typedef enum cgltf_data_free_method cgltf_data_free_method
 
typedef struct cgltf_extras cgltf_extras
 
typedef struct cgltf_extension cgltf_extension
 
typedef struct cgltf_buffer cgltf_buffer
 
typedef enum cgltf_meshopt_compression_mode cgltf_meshopt_compression_mode
 
typedef enum cgltf_meshopt_compression_filter cgltf_meshopt_compression_filter
 
typedef struct cgltf_meshopt_compression cgltf_meshopt_compression
 
typedef struct cgltf_buffer_view cgltf_buffer_view
 
typedef struct cgltf_accessor_sparse cgltf_accessor_sparse
 
typedef struct cgltf_accessor cgltf_accessor
 
typedef struct cgltf_attribute cgltf_attribute
 
typedef struct cgltf_image cgltf_image
 
typedef enum cgltf_filter_type cgltf_filter_type
 
typedef enum cgltf_wrap_mode cgltf_wrap_mode
 
typedef struct cgltf_sampler cgltf_sampler
 
typedef struct cgltf_texture cgltf_texture
 
typedef struct cgltf_texture_transform cgltf_texture_transform
 
typedef struct cgltf_texture_view cgltf_texture_view
 
typedef struct cgltf_pbr_metallic_roughness cgltf_pbr_metallic_roughness
 
typedef struct cgltf_pbr_specular_glossiness cgltf_pbr_specular_glossiness
 
typedef struct cgltf_clearcoat cgltf_clearcoat
 
typedef struct cgltf_transmission cgltf_transmission
 
typedef struct cgltf_ior cgltf_ior
 
typedef struct cgltf_specular cgltf_specular
 
typedef struct cgltf_volume cgltf_volume
 
typedef struct cgltf_sheen cgltf_sheen
 
typedef struct cgltf_emissive_strength cgltf_emissive_strength
 
typedef struct cgltf_iridescence cgltf_iridescence
 
typedef struct cgltf_diffuse_transmission cgltf_diffuse_transmission
 
typedef struct cgltf_subsurface cgltf_subsurface
 
typedef struct cgltf_anisotropy cgltf_anisotropy
 
typedef struct cgltf_dispersion cgltf_dispersion
 
typedef struct cgltf_foundation_materials cgltf_foundation_materials
 
typedef struct cgltf_material cgltf_material
 
typedef struct cgltf_material_mapping cgltf_material_mapping
 
typedef struct cgltf_morph_target cgltf_morph_target
 
typedef struct cgltf_draco_mesh_compression cgltf_draco_mesh_compression
 
typedef struct cgltf_mesh_gpu_instancing cgltf_mesh_gpu_instancing
 
typedef struct cgltf_primitive cgltf_primitive
 
typedef struct cgltf_mesh cgltf_mesh
 
typedef struct cgltf_node cgltf_node
 
typedef struct cgltf_skin cgltf_skin
 
typedef struct cgltf_camera_perspective cgltf_camera_perspective
 
typedef struct cgltf_camera_orthographic cgltf_camera_orthographic
 
typedef struct cgltf_camera_lens cgltf_camera_lens
 
typedef struct cgltf_camera cgltf_camera
 
typedef struct cgltf_light cgltf_light
 
typedef struct cgltf_light_area cgltf_light_area
 
typedef struct cgltf_curve cgltf_curve
 
typedef struct cgltf_foundation_environment cgltf_foundation_environment
 
typedef struct cgltf_foundation_color_management cgltf_foundation_color_management
 
typedef struct cgltf_scene cgltf_scene
 
typedef struct cgltf_animation_sampler cgltf_animation_sampler
 
typedef struct cgltf_animation_channel cgltf_animation_channel
 
typedef struct cgltf_animation cgltf_animation
 
typedef struct cgltf_material_variant cgltf_material_variant
 
typedef struct cgltf_asset cgltf_asset
 
typedef struct cgltf_data cgltf_data
 

Enumerations

enum  cgltf_file_type { cgltf_file_type_invalid , cgltf_file_type_gltf , cgltf_file_type_glb , cgltf_file_type_max_enum }
 
enum  cgltf_result {
  cgltf_result_success , cgltf_result_data_too_short , cgltf_result_unknown_format , cgltf_result_invalid_json ,
  cgltf_result_invalid_gltf , cgltf_result_invalid_options , cgltf_result_file_not_found , cgltf_result_io_error ,
  cgltf_result_out_of_memory , cgltf_result_legacy_gltf , cgltf_result_max_enum
}
 
enum  cgltf_buffer_view_type { cgltf_buffer_view_type_invalid , cgltf_buffer_view_type_indices , cgltf_buffer_view_type_vertices , cgltf_buffer_view_type_max_enum }
 
enum  cgltf_attribute_type {
  cgltf_attribute_type_invalid , cgltf_attribute_type_position , cgltf_attribute_type_normal , cgltf_attribute_type_tangent ,
  cgltf_attribute_type_texcoord , cgltf_attribute_type_color , cgltf_attribute_type_joints , cgltf_attribute_type_weights ,
  cgltf_attribute_type_custom , cgltf_attribute_type_max_enum
}
 
enum  cgltf_component_type {
  cgltf_component_type_invalid , cgltf_component_type_r_8 , cgltf_component_type_r_8u , cgltf_component_type_r_16 ,
  cgltf_component_type_r_16u , cgltf_component_type_r_32u , cgltf_component_type_r_32f , cgltf_component_type_max_enum
}
 
enum  cgltf_type {
  cgltf_type_invalid , cgltf_type_scalar , cgltf_type_vec2 , cgltf_type_vec3 ,
  cgltf_type_vec4 , cgltf_type_mat2 , cgltf_type_mat3 , cgltf_type_mat4 ,
  cgltf_type_max_enum
}
 
enum  cgltf_primitive_type {
  cgltf_primitive_type_invalid , cgltf_primitive_type_points , cgltf_primitive_type_lines , cgltf_primitive_type_line_loop ,
  cgltf_primitive_type_line_strip , cgltf_primitive_type_triangles , cgltf_primitive_type_triangle_strip , cgltf_primitive_type_triangle_fan ,
  cgltf_primitive_type_max_enum
}
 
enum  cgltf_alpha_mode { cgltf_alpha_mode_opaque , cgltf_alpha_mode_mask , cgltf_alpha_mode_blend , cgltf_alpha_mode_max_enum }
 
enum  cgltf_animation_path_type {
  cgltf_animation_path_type_invalid , cgltf_animation_path_type_translation , cgltf_animation_path_type_rotation , cgltf_animation_path_type_scale ,
  cgltf_animation_path_type_weights , cgltf_animation_path_type_max_enum
}
 
enum  cgltf_interpolation_type { cgltf_interpolation_type_linear , cgltf_interpolation_type_step , cgltf_interpolation_type_cubic_spline , cgltf_interpolation_type_max_enum }
 
enum  cgltf_camera_type { cgltf_camera_type_invalid , cgltf_camera_type_perspective , cgltf_camera_type_orthographic , cgltf_camera_type_max_enum }
 
enum  cgltf_light_type {
  cgltf_light_type_invalid , cgltf_light_type_directional , cgltf_light_type_point , cgltf_light_type_spot ,
  cgltf_light_type_max_enum
}
 
enum  cgltf_light_area_type { cgltf_light_area_type_invalid , cgltf_light_area_type_rect , cgltf_light_area_type_disk , cgltf_light_area_type_max_enum }
 
enum  cgltf_curve_basis {
  cgltf_curve_basis_invalid , cgltf_curve_basis_linear , cgltf_curve_basis_bezier , cgltf_curve_basis_bspline ,
  cgltf_curve_basis_catmull_rom , cgltf_curve_basis_max_enum
}
 
enum  cgltf_curve_render_mode { cgltf_curve_render_mode_invalid , cgltf_curve_render_mode_capsule , cgltf_curve_render_mode_max_enum }
 
enum  cgltf_foundation_environment_type { cgltf_foundation_environment_type_invalid , cgltf_foundation_environment_type_color , cgltf_foundation_environment_type_hdri , cgltf_foundation_environment_type_max_enum }
 
enum  cgltf_foundation_environment_projection { cgltf_foundation_environment_projection_invalid , cgltf_foundation_environment_projection_longlat , cgltf_foundation_environment_projection_max_enum }
 
enum  cgltf_foundation_material_shader_block { cgltf_foundation_material_shader_block_invalid , cgltf_foundation_material_shader_block_principled , cgltf_foundation_material_shader_block_hair , cgltf_foundation_material_shader_block_max_enum }
 
enum  cgltf_foundation_material_hair_model { cgltf_foundation_material_hair_model_invalid , cgltf_foundation_material_hair_model_chiang , cgltf_foundation_material_hair_model_max_enum }
 
enum  cgltf_data_free_method { cgltf_data_free_method_none , cgltf_data_free_method_file_release , cgltf_data_free_method_memory_free , cgltf_data_free_method_max_enum }
 
enum  cgltf_meshopt_compression_mode {
  cgltf_meshopt_compression_mode_invalid , cgltf_meshopt_compression_mode_attributes , cgltf_meshopt_compression_mode_triangles , cgltf_meshopt_compression_mode_indices ,
  cgltf_meshopt_compression_mode_max_enum
}
 
enum  cgltf_meshopt_compression_filter {
  cgltf_meshopt_compression_filter_none , cgltf_meshopt_compression_filter_octahedral , cgltf_meshopt_compression_filter_quaternion , cgltf_meshopt_compression_filter_exponential ,
  cgltf_meshopt_compression_filter_max_enum
}
 
enum  cgltf_filter_type {
  cgltf_filter_type_undefined = 0 , cgltf_filter_type_nearest = 9728 , cgltf_filter_type_linear = 9729 , cgltf_filter_type_nearest_mipmap_nearest = 9984 ,
  cgltf_filter_type_linear_mipmap_nearest = 9985 , cgltf_filter_type_nearest_mipmap_linear = 9986 , cgltf_filter_type_linear_mipmap_linear = 9987
}
 
enum  cgltf_wrap_mode { cgltf_wrap_mode_clamp_to_edge = 33071 , cgltf_wrap_mode_mirrored_repeat = 33648 , cgltf_wrap_mode_repeat = 10497 }
 

Functions

cgltf_result cgltf_parse (const cgltf_options *options, const void *data, cgltf_size size, cgltf_data **out_data)
 
cgltf_result cgltf_parse_file (const cgltf_options *options, const char *path, cgltf_data **out_data)
 
cgltf_result cgltf_load_buffers (const cgltf_options *options, cgltf_data *data, const char *gltf_path)
 
cgltf_result cgltf_load_buffer_base64 (const cgltf_options *options, cgltf_size size, const char *base64, void **out_data)
 
cgltf_size cgltf_decode_string (char *string)
 
cgltf_size cgltf_decode_uri (char *uri)
 
cgltf_result cgltf_validate (cgltf_data *data)
 
void cgltf_free (cgltf_data *data)
 
void cgltf_node_transform_local (const cgltf_node *node, cgltf_float *out_matrix)
 
void cgltf_node_transform_world (const cgltf_node *node, cgltf_float *out_matrix)
 
const uint8_t * cgltf_buffer_view_data (const cgltf_buffer_view *view)
 
const cgltf_accessorcgltf_find_accessor (const cgltf_primitive *prim, cgltf_attribute_type type, cgltf_int index)
 
cgltf_bool cgltf_accessor_read_float (const cgltf_accessor *accessor, cgltf_size index, cgltf_float *out, cgltf_size element_size)
 
cgltf_bool cgltf_accessor_read_uint (const cgltf_accessor *accessor, cgltf_size index, cgltf_uint *out, cgltf_size element_size)
 
cgltf_size cgltf_accessor_read_index (const cgltf_accessor *accessor, cgltf_size index)
 
cgltf_size cgltf_num_components (cgltf_type type)
 
cgltf_size cgltf_component_size (cgltf_component_type component_type)
 
cgltf_size cgltf_calc_size (cgltf_type type, cgltf_component_type component_type)
 
cgltf_size cgltf_accessor_unpack_floats (const cgltf_accessor *accessor, cgltf_float *out, cgltf_size float_count)
 
cgltf_size cgltf_accessor_unpack_indices (const cgltf_accessor *accessor, void *out, cgltf_size out_component_size, cgltf_size index_count)
 
cgltf_result cgltf_copy_extras_json (const cgltf_data *data, const cgltf_extras *extras, char *dest, cgltf_size *dest_size)
 
cgltf_size cgltf_mesh_index (const cgltf_data *data, const cgltf_mesh *object)
 
cgltf_size cgltf_material_index (const cgltf_data *data, const cgltf_material *object)
 
cgltf_size cgltf_accessor_index (const cgltf_data *data, const cgltf_accessor *object)
 
cgltf_size cgltf_buffer_view_index (const cgltf_data *data, const cgltf_buffer_view *object)
 
cgltf_size cgltf_buffer_index (const cgltf_data *data, const cgltf_buffer *object)
 
cgltf_size cgltf_image_index (const cgltf_data *data, const cgltf_image *object)
 
cgltf_size cgltf_texture_index (const cgltf_data *data, const cgltf_texture *object)
 
cgltf_size cgltf_sampler_index (const cgltf_data *data, const cgltf_sampler *object)
 
cgltf_size cgltf_skin_index (const cgltf_data *data, const cgltf_skin *object)
 
cgltf_size cgltf_camera_index (const cgltf_data *data, const cgltf_camera *object)
 
cgltf_size cgltf_light_index (const cgltf_data *data, const cgltf_light *object)
 
cgltf_size cgltf_light_area_index (const cgltf_data *data, const cgltf_light_area *object)
 
cgltf_size cgltf_curve_index (const cgltf_data *data, const cgltf_curve *object)
 
cgltf_size cgltf_node_index (const cgltf_data *data, const cgltf_node *object)
 
cgltf_size cgltf_scene_index (const cgltf_data *data, const cgltf_scene *object)
 
cgltf_size cgltf_animation_index (const cgltf_data *data, const cgltf_animation *object)
 
cgltf_size cgltf_animation_sampler_index (const cgltf_animation *animation, const cgltf_animation_sampler *object)
 
cgltf_size cgltf_animation_channel_index (const cgltf_animation *animation, const cgltf_animation_channel *object)
 

Typedef Documentation

◆ cgltf_accessor

◆ cgltf_accessor_sparse

◆ cgltf_alpha_mode

◆ cgltf_animation

◆ cgltf_animation_channel

◆ cgltf_animation_path_type

◆ cgltf_animation_sampler

◆ cgltf_anisotropy

◆ cgltf_asset

typedef struct cgltf_asset cgltf_asset

◆ cgltf_attribute

◆ cgltf_attribute_type

◆ cgltf_bool

typedef int cgltf_bool

◆ cgltf_buffer

typedef struct cgltf_buffer cgltf_buffer

◆ cgltf_buffer_view

◆ cgltf_buffer_view_type

◆ cgltf_camera

typedef struct cgltf_camera cgltf_camera

◆ cgltf_camera_lens

◆ cgltf_camera_orthographic

◆ cgltf_camera_perspective

◆ cgltf_camera_type

◆ cgltf_clearcoat

◆ cgltf_component_type

◆ cgltf_curve

typedef struct cgltf_curve cgltf_curve

◆ cgltf_curve_basis

◆ cgltf_curve_render_mode

◆ cgltf_data

typedef struct cgltf_data cgltf_data

◆ cgltf_data_free_method

◆ cgltf_diffuse_transmission

◆ cgltf_dispersion

◆ cgltf_draco_mesh_compression

◆ cgltf_emissive_strength

◆ cgltf_extension

◆ cgltf_extras

typedef struct cgltf_extras cgltf_extras

◆ cgltf_file_options

◆ cgltf_file_type

◆ cgltf_filter_type

◆ cgltf_float

typedef float cgltf_float

◆ cgltf_foundation_color_management

◆ cgltf_foundation_environment

◆ cgltf_foundation_environment_projection

◆ cgltf_foundation_environment_type

◆ cgltf_foundation_material_hair_model

◆ cgltf_foundation_material_shader_block

◆ cgltf_foundation_materials

◆ cgltf_image

typedef struct cgltf_image cgltf_image

◆ cgltf_int

typedef int cgltf_int

◆ cgltf_interpolation_type

◆ cgltf_ior

typedef struct cgltf_ior cgltf_ior

◆ cgltf_iridescence

◆ cgltf_light

typedef struct cgltf_light cgltf_light

◆ cgltf_light_area

◆ cgltf_light_area_type

◆ cgltf_light_type

◆ cgltf_material

◆ cgltf_material_mapping

◆ cgltf_material_variant

◆ cgltf_memory_options

◆ cgltf_mesh

typedef struct cgltf_mesh cgltf_mesh

◆ cgltf_mesh_gpu_instancing

◆ cgltf_meshopt_compression

◆ cgltf_meshopt_compression_filter

◆ cgltf_meshopt_compression_mode

◆ cgltf_morph_target

◆ cgltf_node

typedef struct cgltf_node cgltf_node

◆ cgltf_options

typedef struct cgltf_options cgltf_options

◆ cgltf_pbr_metallic_roughness

◆ cgltf_pbr_specular_glossiness

◆ cgltf_primitive

◆ cgltf_primitive_type

◆ cgltf_result

typedef enum cgltf_result cgltf_result

◆ cgltf_sampler

typedef struct cgltf_sampler cgltf_sampler

◆ cgltf_scene

typedef struct cgltf_scene cgltf_scene

◆ cgltf_sheen

typedef struct cgltf_sheen cgltf_sheen

◆ cgltf_size

typedef size_t cgltf_size

cgltf - a single-file glTF 2.0 parser written in C99.

Version: 1.15

Website: https://github.com/jkuhlmann/cgltf

Distributed under the MIT License, see notice at the end of this file.

Building: Include this file where you need the struct and function declarations. Have exactly one source file where you define CGLTF_IMPLEMENTATION before including this file to get the function definitions.

Reference: cgltf_result cgltf_parse(const cgltf_options*, const void*, cgltf_size, cgltf_data**) parses both glTF and GLB data. If this function returns cgltf_result_success, you have to call cgltf_free() on the created cgltf_data* variable. Note that contents of external files for buffers and images are not automatically loaded. You'll need to read these files yourself using URIs in the cgltf_data structure.

cgltf_options is the struct passed to cgltf_parse() to control parts of the parsing process. You can use it to force the file type and provide memory allocation as well as file operation callbacks. Should be zero-initialized to trigger default behavior.

cgltf_data is the struct allocated and filled by cgltf_parse(). It generally mirrors the glTF format as described by the spec (see https://github.com/KhronosGroup/glTF/tree/master/specification/2.0).

void cgltf_free(cgltf_data*) frees the allocated cgltf_data variable.

cgltf_result cgltf_load_buffers(const cgltf_options*, cgltf_data*, const char* gltf_path) can be optionally called to open and read buffer files using the FILE* APIs. The gltf_path argument is the path to the original glTF file, which allows the parser to resolve the path to buffer files.

cgltf_result cgltf_load_buffer_base64(const cgltf_options* options, cgltf_size size, const char* base64, void** out_data) decodes base64-encoded data content. Used internally by cgltf_load_buffers(). This is useful when decoding data URIs in images.

cgltf_result cgltf_parse_file(const cgltf_options* options, const char* path, cgltf_data** out_data) can be used to open the given file using FILE* APIs and parse the data using cgltf_parse().

cgltf_result cgltf_validate(cgltf_data*) can be used to do additional checks to make sure the parsed glTF data is valid.

cgltf_node_transform_local converts the translation / rotation / scale properties of a node into a mat4.

cgltf_node_transform_world calls cgltf_node_transform_local on every ancestor in order to compute the root-to-node transformation.

cgltf_accessor_unpack_floats reads in the data from an accessor, applies sparse data (if any), and converts them to floating point. Assumes that cgltf_load_buffers has already been called. By passing null for the output pointer, users can find out how many floats are required in the output buffer.

cgltf_accessor_unpack_indices reads in the index data from an accessor. Assumes that cgltf_load_buffers has already been called. By passing null for the output pointer, users can find out how many indices are required in the output buffer. Returns 0 if the accessor is sparse or if the output component size is less than the accessor's component size.

cgltf_num_components is a tiny utility that tells you the dimensionality of a certain accessor type. This can be used before cgltf_accessor_unpack_floats to help allocate the necessary amount of memory. cgltf_component_size and cgltf_calc_size exist for similar purposes.

cgltf_accessor_read_float reads a certain element from a non-sparse accessor and converts it to floating point, assuming that cgltf_load_buffers has already been called. The passed-in element size is the number of floats in the output buffer, which should be in the range [1, 16]. Returns false if the passed-in element_size is too small, or if the accessor is sparse.

cgltf_accessor_read_uint is similar to its floating-point counterpart, but limited to reading vector types and does not support matrix types. The passed-in element size is the number of uints in the output buffer, which should be in the range [1, 4]. Returns false if the passed-in element_size is too small, or if the accessor is sparse.

cgltf_accessor_read_index is similar to its floating-point counterpart, but it returns size_t and only works with single-component data types.

cgltf_copy_extras_json allows users to retrieve the "extras" data that can be attached to many glTF objects (which can be arbitrary JSON data). This is a legacy function, consider using cgltf_extras::data directly instead. You can parse this data using your own JSON parser or, if you've included the cgltf implementation using the integrated JSMN JSON parser.

◆ cgltf_skin

typedef struct cgltf_skin cgltf_skin

◆ cgltf_specular

◆ cgltf_ssize

typedef long long int cgltf_ssize

◆ cgltf_subsurface

◆ cgltf_texture

typedef struct cgltf_texture cgltf_texture

◆ cgltf_texture_transform

◆ cgltf_texture_view

◆ cgltf_transmission

◆ cgltf_type

typedef enum cgltf_type cgltf_type

◆ cgltf_uint

typedef unsigned int cgltf_uint

◆ cgltf_volume

typedef struct cgltf_volume cgltf_volume

◆ cgltf_wrap_mode

Enumeration Type Documentation

◆ cgltf_alpha_mode

Enumerator
cgltf_alpha_mode_opaque 
cgltf_alpha_mode_mask 
cgltf_alpha_mode_blend 
cgltf_alpha_mode_max_enum 

◆ cgltf_animation_path_type

Enumerator
cgltf_animation_path_type_invalid 
cgltf_animation_path_type_translation 
cgltf_animation_path_type_rotation 
cgltf_animation_path_type_scale 
cgltf_animation_path_type_weights 
cgltf_animation_path_type_max_enum 

◆ cgltf_attribute_type

Enumerator
cgltf_attribute_type_invalid 
cgltf_attribute_type_position 
cgltf_attribute_type_normal 
cgltf_attribute_type_tangent 
cgltf_attribute_type_texcoord 
cgltf_attribute_type_color 
cgltf_attribute_type_joints 
cgltf_attribute_type_weights 
cgltf_attribute_type_custom 
cgltf_attribute_type_max_enum 

◆ cgltf_buffer_view_type

Enumerator
cgltf_buffer_view_type_invalid 
cgltf_buffer_view_type_indices 
cgltf_buffer_view_type_vertices 
cgltf_buffer_view_type_max_enum 

◆ cgltf_camera_type

Enumerator
cgltf_camera_type_invalid 
cgltf_camera_type_perspective 
cgltf_camera_type_orthographic 
cgltf_camera_type_max_enum 

◆ cgltf_component_type

Enumerator
cgltf_component_type_invalid 
cgltf_component_type_r_8 
cgltf_component_type_r_8u 
cgltf_component_type_r_16 
cgltf_component_type_r_16u 
cgltf_component_type_r_32u 
cgltf_component_type_r_32f 
cgltf_component_type_max_enum 

◆ cgltf_curve_basis

Enumerator
cgltf_curve_basis_invalid 
cgltf_curve_basis_linear 
cgltf_curve_basis_bezier 
cgltf_curve_basis_bspline 
cgltf_curve_basis_catmull_rom 
cgltf_curve_basis_max_enum 

◆ cgltf_curve_render_mode

Enumerator
cgltf_curve_render_mode_invalid 
cgltf_curve_render_mode_capsule 
cgltf_curve_render_mode_max_enum 

◆ cgltf_data_free_method

Enumerator
cgltf_data_free_method_none 
cgltf_data_free_method_file_release 
cgltf_data_free_method_memory_free 
cgltf_data_free_method_max_enum 

◆ cgltf_file_type

Enumerator
cgltf_file_type_invalid 
cgltf_file_type_gltf 
cgltf_file_type_glb 
cgltf_file_type_max_enum 

◆ cgltf_filter_type

Enumerator
cgltf_filter_type_undefined 
cgltf_filter_type_nearest 
cgltf_filter_type_linear 
cgltf_filter_type_nearest_mipmap_nearest 
cgltf_filter_type_linear_mipmap_nearest 
cgltf_filter_type_nearest_mipmap_linear 
cgltf_filter_type_linear_mipmap_linear 

◆ cgltf_foundation_environment_projection

Enumerator
cgltf_foundation_environment_projection_invalid 
cgltf_foundation_environment_projection_longlat 
cgltf_foundation_environment_projection_max_enum 

◆ cgltf_foundation_environment_type

Enumerator
cgltf_foundation_environment_type_invalid 
cgltf_foundation_environment_type_color 
cgltf_foundation_environment_type_hdri 
cgltf_foundation_environment_type_max_enum 

◆ cgltf_foundation_material_hair_model

Enumerator
cgltf_foundation_material_hair_model_invalid 
cgltf_foundation_material_hair_model_chiang 
cgltf_foundation_material_hair_model_max_enum 

◆ cgltf_foundation_material_shader_block

Enumerator
cgltf_foundation_material_shader_block_invalid 
cgltf_foundation_material_shader_block_principled 
cgltf_foundation_material_shader_block_hair 
cgltf_foundation_material_shader_block_max_enum 

◆ cgltf_interpolation_type

Enumerator
cgltf_interpolation_type_linear 
cgltf_interpolation_type_step 
cgltf_interpolation_type_cubic_spline 
cgltf_interpolation_type_max_enum 

◆ cgltf_light_area_type

Enumerator
cgltf_light_area_type_invalid 
cgltf_light_area_type_rect 
cgltf_light_area_type_disk 
cgltf_light_area_type_max_enum 

◆ cgltf_light_type

Enumerator
cgltf_light_type_invalid 
cgltf_light_type_directional 
cgltf_light_type_point 
cgltf_light_type_spot 
cgltf_light_type_max_enum 

◆ cgltf_meshopt_compression_filter

Enumerator
cgltf_meshopt_compression_filter_none 
cgltf_meshopt_compression_filter_octahedral 
cgltf_meshopt_compression_filter_quaternion 
cgltf_meshopt_compression_filter_exponential 
cgltf_meshopt_compression_filter_max_enum 

◆ cgltf_meshopt_compression_mode

Enumerator
cgltf_meshopt_compression_mode_invalid 
cgltf_meshopt_compression_mode_attributes 
cgltf_meshopt_compression_mode_triangles 
cgltf_meshopt_compression_mode_indices 
cgltf_meshopt_compression_mode_max_enum 

◆ cgltf_primitive_type

Enumerator
cgltf_primitive_type_invalid 
cgltf_primitive_type_points 
cgltf_primitive_type_lines 
cgltf_primitive_type_line_loop 
cgltf_primitive_type_line_strip 
cgltf_primitive_type_triangles 
cgltf_primitive_type_triangle_strip 
cgltf_primitive_type_triangle_fan 
cgltf_primitive_type_max_enum 

◆ cgltf_result

Enumerator
cgltf_result_success 
cgltf_result_data_too_short 
cgltf_result_unknown_format 
cgltf_result_invalid_json 
cgltf_result_invalid_gltf 
cgltf_result_invalid_options 
cgltf_result_file_not_found 
cgltf_result_io_error 
cgltf_result_out_of_memory 
cgltf_result_legacy_gltf 
cgltf_result_max_enum 

◆ cgltf_type

enum cgltf_type
Enumerator
cgltf_type_invalid 
cgltf_type_scalar 
cgltf_type_vec2 
cgltf_type_vec3 
cgltf_type_vec4 
cgltf_type_mat2 
cgltf_type_mat3 
cgltf_type_mat4 
cgltf_type_max_enum 

◆ cgltf_wrap_mode

Enumerator
cgltf_wrap_mode_clamp_to_edge 
cgltf_wrap_mode_mirrored_repeat 
cgltf_wrap_mode_repeat 

Function Documentation

◆ cgltf_accessor_index()

cgltf_size cgltf_accessor_index ( const cgltf_data data,
const cgltf_accessor object 
)

◆ cgltf_accessor_read_float()

cgltf_bool cgltf_accessor_read_float ( const cgltf_accessor accessor,
cgltf_size  index,
cgltf_float out,
cgltf_size  element_size 
)

◆ cgltf_accessor_read_index()

cgltf_size cgltf_accessor_read_index ( const cgltf_accessor accessor,
cgltf_size  index 
)

◆ cgltf_accessor_read_uint()

cgltf_bool cgltf_accessor_read_uint ( const cgltf_accessor accessor,
cgltf_size  index,
cgltf_uint out,
cgltf_size  element_size 
)

◆ cgltf_accessor_unpack_floats()

cgltf_size cgltf_accessor_unpack_floats ( const cgltf_accessor accessor,
cgltf_float out,
cgltf_size  float_count 
)

◆ cgltf_accessor_unpack_indices()

cgltf_size cgltf_accessor_unpack_indices ( const cgltf_accessor accessor,
void *  out,
cgltf_size  out_component_size,
cgltf_size  index_count 
)

◆ cgltf_animation_channel_index()

cgltf_size cgltf_animation_channel_index ( const cgltf_animation animation,
const cgltf_animation_channel object 
)

◆ cgltf_animation_index()

cgltf_size cgltf_animation_index ( const cgltf_data data,
const cgltf_animation object 
)

◆ cgltf_animation_sampler_index()

cgltf_size cgltf_animation_sampler_index ( const cgltf_animation animation,
const cgltf_animation_sampler object 
)

◆ cgltf_buffer_index()

cgltf_size cgltf_buffer_index ( const cgltf_data data,
const cgltf_buffer object 
)

◆ cgltf_buffer_view_data()

const uint8_t * cgltf_buffer_view_data ( const cgltf_buffer_view view)

◆ cgltf_buffer_view_index()

cgltf_size cgltf_buffer_view_index ( const cgltf_data data,
const cgltf_buffer_view object 
)

◆ cgltf_calc_size()

cgltf_size cgltf_calc_size ( cgltf_type  type,
cgltf_component_type  component_type 
)

◆ cgltf_camera_index()

cgltf_size cgltf_camera_index ( const cgltf_data data,
const cgltf_camera object 
)

◆ cgltf_component_size()

cgltf_size cgltf_component_size ( cgltf_component_type  component_type)

◆ cgltf_copy_extras_json()

cgltf_result cgltf_copy_extras_json ( const cgltf_data data,
const cgltf_extras extras,
char *  dest,
cgltf_size dest_size 
)

◆ cgltf_curve_index()

cgltf_size cgltf_curve_index ( const cgltf_data data,
const cgltf_curve object 
)

◆ cgltf_decode_string()

cgltf_size cgltf_decode_string ( char *  string)

◆ cgltf_decode_uri()

cgltf_size cgltf_decode_uri ( char *  uri)

◆ cgltf_find_accessor()

const cgltf_accessor * cgltf_find_accessor ( const cgltf_primitive prim,
cgltf_attribute_type  type,
cgltf_int  index 
)

◆ cgltf_free()

void cgltf_free ( cgltf_data data)

◆ cgltf_image_index()

cgltf_size cgltf_image_index ( const cgltf_data data,
const cgltf_image object 
)

◆ cgltf_light_area_index()

cgltf_size cgltf_light_area_index ( const cgltf_data data,
const cgltf_light_area object 
)

◆ cgltf_light_index()

cgltf_size cgltf_light_index ( const cgltf_data data,
const cgltf_light object 
)

◆ cgltf_load_buffer_base64()

cgltf_result cgltf_load_buffer_base64 ( const cgltf_options options,
cgltf_size  size,
const char *  base64,
void **  out_data 
)

◆ cgltf_load_buffers()

cgltf_result cgltf_load_buffers ( const cgltf_options options,
cgltf_data data,
const char *  gltf_path 
)

◆ cgltf_material_index()

cgltf_size cgltf_material_index ( const cgltf_data data,
const cgltf_material object 
)

◆ cgltf_mesh_index()

cgltf_size cgltf_mesh_index ( const cgltf_data data,
const cgltf_mesh object 
)

◆ cgltf_node_index()

cgltf_size cgltf_node_index ( const cgltf_data data,
const cgltf_node object 
)

◆ cgltf_node_transform_local()

void cgltf_node_transform_local ( const cgltf_node node,
cgltf_float out_matrix 
)

◆ cgltf_node_transform_world()

void cgltf_node_transform_world ( const cgltf_node node,
cgltf_float out_matrix 
)

◆ cgltf_num_components()

cgltf_size cgltf_num_components ( cgltf_type  type)

◆ cgltf_parse()

cgltf_result cgltf_parse ( const cgltf_options options,
const void *  data,
cgltf_size  size,
cgltf_data **  out_data 
)

◆ cgltf_parse_file()

cgltf_result cgltf_parse_file ( const cgltf_options options,
const char *  path,
cgltf_data **  out_data 
)

◆ cgltf_sampler_index()

cgltf_size cgltf_sampler_index ( const cgltf_data data,
const cgltf_sampler object 
)

◆ cgltf_scene_index()

cgltf_size cgltf_scene_index ( const cgltf_data data,
const cgltf_scene object 
)

◆ cgltf_skin_index()

cgltf_size cgltf_skin_index ( const cgltf_data data,
const cgltf_skin object 
)

◆ cgltf_texture_index()

cgltf_size cgltf_texture_index ( const cgltf_data data,
const cgltf_texture object 
)

◆ cgltf_validate()

cgltf_result cgltf_validate ( cgltf_data data)