#include <stdio.h>
int main(const int argc, char** argv) {
if (argc < 2) {
fprintf(stderr, "usage: %s scene.pbrt\n", argv[0]);
return 1;
}
char message[128];
fprintf(stderr, "failed to load %s: %s (%d)\n", argv[1], message, (int)err);
return 1;
}
printf(
"sphere r=%g at (%g %g %g)\n", shape->
as.
sphere.
radius, object_to_world->
m03, object_to_world->
m13,
}
}
(void)material;
}
return 0;
}
tpbrt_size_t tpbrt_get_error_message(tpbrt_error_t error, tpbrt_char_t *buffer, tpbrt_size_t buffer_size)
Writes error message to given buffer.
tpbrt_error_t
Error type (used as result type where success = TPBRT_ERROR_NONE = 0).
Definition error.h:20
@ TPBRT_ERROR_NONE
No error -> Success.
Definition error.h:22
tpbrt_error_t tpbrt_get_material_by_handle(const tpbrt_materials_list_t *materials, tpbrt_material_handle_t handle, const tpbrt_material_t **material)
Returns pointer to material to which handle is provided.
void tpbrt_scene_free(tpbrt_scene_t *scene)
Free all scene resources.
tpbrt_error_t tpbrt_scene_load_from_file(const tpbrt_char_t *filepath, tpbrt_scene_t *out_scene)
Loads scene from given file.
@ TPBRT_SHAPE_TYPE_SPHERE
Sphere.
Definition shape.h:36
@ TPBRT_SHAPE_TYPE_TRIANGLE_MESH
Triangle mesh.
Definition shape.h:38
#define TPBRT_NULL
NULL value.
Definition fwd.h:19
tpbrt_string_t file_name
The output filename.
Definition film.h:111
tpbrt_uint_t y_resolution
The number of pixels in the y direction.
Definition film.h:115
tpbrt_uint_t x_resolution
The number of pixels in the x direction.
Definition film.h:113
tpbrt_lights_sources_list_t lights_sources
List of light sources.
Definition light.h:240
tpbrt_size_t count
Number of light sources in list.
Definition light.h:220
4 by 4 row-major matrix.
Definition math.h:181
tpbrt_float_t m13
Definition math.h:201
tpbrt_float_t m03
Definition math.h:199
tpbrt_float_t m23
Definition math.h:203
PBRT material representation.
Definition material.h:376
tpbrt_size_t count
Number of materials in list.
Definition material.h:420
PBRT scene representation.
Definition scene.h:38
tpbrt_film_t film
Scene film.
Definition scene.h:45
tpbrt_shapes_list_t shapes
List with all scene shapes.
Definition scene.h:68
tpbrt_transforms_list_t transforms
List with all unique transforms.
Definition scene.h:74
tpbrt_lights_list_t lights
List with all scene lights.
Definition scene.h:66
tpbrt_materials_list_t materials
List with all scene materials.
Definition scene.h:62
tpbrt_textures_list_t textures
List with all scene textures.
Definition scene.h:60
tpbrt_float_t radius
The sphere's radius.
Definition shape.h:162
PBRT shape representation.
Definition shape.h:218
tpbrt_transform_animated_t transform
Animated transform.
Definition shape.h:222
tpbrt_material_handle_t material
Material handle.
Definition shape.h:224
tpbrt_shape_type_t type
Shape value type.
Definition shape.h:232
tpbrt_shape_triangle_mesh_params_t triangle_mesh
Triangle mesh parameters.
Definition shape.h:249
tpbrt_shape_sphere_params_t sphere
Sphere shape parameters.
Definition shape.h:247
union tpbrt_shape_t::@23 as
Value dependent on type value.
tpbrt_point3_array_t p
The vertex positions of the triangle mesh.
Definition shape.h:179
tpbrt_uint_array_t indices
The array of integer offsets into the per-vertex data arrays (P, and any of N, S, or uv that are pres...
Definition shape.h:177
tpbrt_size_t count
Number of shapes in list.
Definition shape.h:265
tpbrt_shape_t * shapes
Shapes list data.
Definition shape.h:263
tpbrt_size_t size
String size.
Definition common.h:24
const tpbrt_char_t * data
String characters.
Definition common.h:22
tpbrt_size_t count
Number of textures in list.
Definition texture.h:439
tpbrt_size_t count
Array items count.
Definition math.h:57
tpbrt_size_t count
Array items count.
Definition math.h:174