Skip to content

Commit be75dd7

Browse files
committed
Updated documentation at the top of the header file.
1 parent 7fc6d3f commit be75dd7

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,7 @@ if (result == cgltf_result_success)
3838
Note that cgltf does not load the contents of extra files such as buffers or images into memory by default. You'll need to read these files yourself using URIs from `data.buffers[]` or `data.images[]` respectively.
3939
For buffer data, you can alternatively call `cgltf_load_buffers`, which will use `FILE*` APIs to open and read buffer files.
4040

41-
## Reference
42-
`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.
43-
44-
`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 callbacks.
45-
46-
`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).
47-
48-
`void cgltf_free(cgltf_data*)` frees the allocated `cgltf_data` variable.
49-
50-
`cgltf_result cgltf_validate(cgltf_data*)` is an optional function you can call to do additional checks to make sure the parsed glTF data is valid.
41+
**For more in-depth documentation and a description of the public interface refer to the top of the `cgltf.h` file.**
5142

5243
## Support
5344
cgltf supports core glTF 2.0:

cgltf.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
11
/**
22
* cgltf - a single-file glTF 2.0 parser written in C99.
3+
*
4+
* Version: 1.0
5+
*
6+
* Website: https://github.com/jkuhlmann/cgltf
7+
*
38
* Distributed under the MIT License, see notice at the end of this file.
9+
*
10+
* Building:
11+
* Include this file where you need the struct and function
12+
* declarations. Have exactly one source file where you define
13+
* `CGLTF_IMPLEMENTATION` before including this file to get the
14+
* function definitions.
15+
*
16+
* Reference:
17+
* `cgltf_result cgltf_parse(const cgltf_options*, const void*,
18+
* cgltf_size, cgltf_data**)` parses both glTF and GLB data. If
19+
* this function returns `cgltf_result_success`, you have to call
20+
* `cgltf_free()` on the created `cgltf_data*` variable.
21+
* Note that contents of external files for buffers and images are not
22+
* automatically loaded. You'll need to read these files yourself using
23+
* URIs in the `cgltf_data` structure.
24+
*
25+
* `cgltf_options` is the struct passed to `cgltf_parse()` to control
26+
* parts of the parsing process. You can use it to force the file type
27+
* and provide memory allocation callbacks. Should be zero-initialized
28+
* to trigger default behavior.
29+
*
30+
* `cgltf_data` is the struct allocated and filled by `cgltf_parse()`.
31+
* It generally mirrors the glTF format as described by the spec (see
32+
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0).
33+
*
34+
* `void cgltf_free(cgltf_data*)` frees the allocated `cgltf_data`
35+
* variable.
36+
*
37+
* `cgltf_result cgltf_load_buffers(const cgltf_options*, cgltf_data*,
38+
* const char*)` can be optionally called to open and read buffer
39+
* files using the `FILE*` APIs.
40+
*
41+
* `cgltf_result cgltf_parse_file(const cgltf_options* options, const
42+
* char* path, cgltf_data** out_data)` can be used to open the given
43+
* file using `FILE*` APIs and parse the data using `cgltf_parse()`.
44+
*
45+
* `cgltf_result cgltf_validate(cgltf_data*)` can be used to do additional
46+
* checks to make sure the parsed glTF data is valid.
447
*/
548
#ifndef CGLTF_H_INCLUDED__
649
#define CGLTF_H_INCLUDED__

0 commit comments

Comments
 (0)