HDK
|
#include <stddef.h>
Go to the source code of this file.
typedef struct cgltf_accessor cgltf_accessor |
typedef struct cgltf_accessor_sparse cgltf_accessor_sparse |
typedef enum cgltf_alpha_mode cgltf_alpha_mode |
typedef struct cgltf_animation cgltf_animation |
typedef struct cgltf_animation_channel cgltf_animation_channel |
typedef enum cgltf_animation_path_type cgltf_animation_path_type |
typedef struct cgltf_animation_sampler cgltf_animation_sampler |
typedef struct cgltf_asset cgltf_asset |
typedef struct cgltf_attribute cgltf_attribute |
typedef enum cgltf_attribute_type cgltf_attribute_type |
typedef int cgltf_bool |
typedef struct cgltf_buffer cgltf_buffer |
typedef struct cgltf_buffer_view cgltf_buffer_view |
typedef enum cgltf_buffer_view_type cgltf_buffer_view_type |
typedef struct cgltf_camera cgltf_camera |
typedef struct cgltf_camera_orthographic cgltf_camera_orthographic |
typedef struct cgltf_camera_perspective cgltf_camera_perspective |
typedef enum cgltf_camera_type cgltf_camera_type |
typedef struct cgltf_clearcoat cgltf_clearcoat |
typedef enum cgltf_component_type cgltf_component_type |
typedef struct cgltf_data cgltf_data |
typedef enum cgltf_data_free_method cgltf_data_free_method |
typedef struct cgltf_draco_mesh_compression cgltf_draco_mesh_compression |
typedef struct cgltf_emissive_strength cgltf_emissive_strength |
typedef struct cgltf_extension cgltf_extension |
typedef struct cgltf_extras cgltf_extras |
typedef struct cgltf_file_options cgltf_file_options |
typedef enum cgltf_file_type cgltf_file_type |
typedef float cgltf_float |
typedef struct cgltf_image cgltf_image |
typedef enum cgltf_interpolation_type cgltf_interpolation_type |
typedef struct cgltf_iridescence cgltf_iridescence |
typedef struct cgltf_light cgltf_light |
typedef enum cgltf_light_type cgltf_light_type |
typedef struct cgltf_material cgltf_material |
typedef struct cgltf_material_mapping cgltf_material_mapping |
typedef struct cgltf_material_variant cgltf_material_variant |
typedef struct cgltf_memory_options cgltf_memory_options |
typedef struct cgltf_mesh cgltf_mesh |
typedef struct cgltf_mesh_gpu_instancing cgltf_mesh_gpu_instancing |
typedef struct cgltf_meshopt_compression cgltf_meshopt_compression |
typedef struct cgltf_morph_target cgltf_morph_target |
typedef struct cgltf_node cgltf_node |
typedef struct cgltf_options cgltf_options |
typedef struct cgltf_pbr_metallic_roughness cgltf_pbr_metallic_roughness |
typedef struct cgltf_pbr_specular_glossiness cgltf_pbr_specular_glossiness |
typedef struct cgltf_primitive cgltf_primitive |
typedef enum cgltf_primitive_type cgltf_primitive_type |
typedef enum cgltf_result cgltf_result |
typedef struct cgltf_sampler cgltf_sampler |
typedef struct cgltf_scene cgltf_scene |
typedef struct cgltf_sheen cgltf_sheen |
typedef size_t cgltf_size |
cgltf - a single-file glTF 2.0 parser written in C99.
Version: 1.13
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_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_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_result cgltf_copy_extras_json(const cgltf_data*, const cgltf_extras*, char* dest, cgltf_size* dest_size)
allows users to retrieve the "extras" data that can be attached to many glTF objects (which can be arbitrary JSON data). The cgltf_extras
struct stores the offsets of the start and end of the extras JSON data as it appears in the complete glTF JSON data. This function copies the extras data into the provided buffer. If dest
is NULL, the length of the data is written into dest_size
. You can then parse this data using your own JSON parser or, if you've included the cgltf implementation using the integrated JSMN JSON parser.
typedef struct cgltf_skin cgltf_skin |
typedef struct cgltf_specular cgltf_specular |
typedef long long int cgltf_ssize |
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_transmission cgltf_transmission |
typedef enum cgltf_type cgltf_type |
typedef unsigned int cgltf_uint |
typedef struct cgltf_volume cgltf_volume |
enum cgltf_alpha_mode |
enum cgltf_attribute_type |
enum cgltf_camera_type |
enum cgltf_component_type |
enum cgltf_file_type |
enum cgltf_light_type |
enum cgltf_primitive_type |
enum cgltf_result |
enum cgltf_type |
cgltf_bool cgltf_accessor_read_float | ( | const cgltf_accessor * | accessor, |
cgltf_size | index, | ||
cgltf_float * | out, | ||
cgltf_size | element_size | ||
) |
cgltf_size cgltf_accessor_read_index | ( | const cgltf_accessor * | accessor, |
cgltf_size | index | ||
) |
cgltf_bool cgltf_accessor_read_uint | ( | const cgltf_accessor * | accessor, |
cgltf_size | index, | ||
cgltf_uint * | out, | ||
cgltf_size | element_size | ||
) |
cgltf_size cgltf_accessor_unpack_floats | ( | const cgltf_accessor * | accessor, |
cgltf_float * | out, | ||
cgltf_size | float_count | ||
) |
cgltf_result cgltf_copy_extras_json | ( | const cgltf_data * | data, |
const cgltf_extras * | extras, | ||
char * | dest, | ||
cgltf_size * | dest_size | ||
) |
cgltf_size cgltf_decode_string | ( | char * | string | ) |
cgltf_size cgltf_decode_uri | ( | char * | uri | ) |
void cgltf_free | ( | cgltf_data * | data | ) |
cgltf_result cgltf_load_buffer_base64 | ( | const cgltf_options * | options, |
cgltf_size | size, | ||
const char * | base64, | ||
void ** | out_data | ||
) |
cgltf_result cgltf_load_buffers | ( | const cgltf_options * | options, |
cgltf_data * | data, | ||
const char * | gltf_path | ||
) |
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 | ||
) |
cgltf_size cgltf_num_components | ( | cgltf_type | type | ) |
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_validate | ( | cgltf_data * | data | ) |