tinypbrt 1.1.1
pbrt-v4 scene file parser for C11 with a header-only C++20 wrapper
Loading...
Searching...
No Matches

Data Structures

struct  tpbrt_scene_t
 PBRT scene representation. More...
 

Functions

tpbrt_error_t tpbrt_scene_load_from_file (const tpbrt_char_t *filepath, tpbrt_scene_t *out_scene)
 Loads scene from given file.
 
tpbrt_error_t tpbrt_scene_load_from_memory (const tpbrt_char_t *data, const tpbrt_char_t *working_directory, tpbrt_scene_t *out_scene)
 Loads scene from memory (provided string).
 
void tpbrt_scene_free (tpbrt_scene_t *scene)
 Free all scene resources.
 

Detailed Description

Function Documentation

◆ tpbrt_scene_load_from_file()

tpbrt_error_t tpbrt_scene_load_from_file ( const tpbrt_char_t *  filepath,
tpbrt_scene_t *  out_scene 
)

Loads scene from given file.

Parameters
filepathFilepath to scene file.
out_scenePointer to result scene structure.
Returns
Error code. If not TPBRT_ERROR_NONE then out_scene is not initialized.
Examples
examples/export_obj/main.c, examples/lights/main.c, examples/materials/main.c, examples/quickstart/main.c, and examples/scene_info/main.c.

◆ tpbrt_scene_load_from_memory()

tpbrt_error_t tpbrt_scene_load_from_memory ( const tpbrt_char_t *  data,
const tpbrt_char_t *  working_directory,
tpbrt_scene_t *  out_scene 
)

Loads scene from memory (provided string).

Parameters
dataScene string (must end with '\0').
working_directoryDirectory which will be used if Include or Import will be used.
out_scenePointer to result scene structure.
Returns
Error code. If not TPBRT_ERROR_NONE then out_scene is not initialized.
Examples
examples/load_from_memory/main.c.

◆ tpbrt_scene_free()

void tpbrt_scene_free ( tpbrt_scene_t *  scene)

Free all scene resources.

Nothing happens if TPBRT_NULL is provided.

Parameters
sceneScene resources to free.
Examples
examples/export_obj/main.c, examples/lights/main.c, examples/load_from_memory/main.c, examples/materials/main.c, examples/quickstart/main.c, and examples/scene_info/main.c.