#include <stdio.h>
#include <example_utils.h>
printf(
"camera: %s", EXAMPLE_NAME(example_camera_names, camera->
type));
break;
break;
printf(
" lensfile=\"" EXAMPLE_STR_FMT
"\" aperturediameter=%g", EXAMPLE_STR_ARG(camera->
as.
realistic.
lens_file),
break;
default: break;
}
printf(
" position start=(%g %g %g) end=(%g %g %g)%s\n", start->
m[3], start->
m[7], start->
m[11], end->
m[3],
end->
m[7], end->
m[11], start == end ?
"" :
" (animated)");
}
}
printf("film: %s %ux%u -> \"" EXAMPLE_STR_FMT "\" iso=%g diagonal=%gmm\n",
}
printf(
"sampler: %s", EXAMPLE_NAME(example_sampler_names, sampler->
type));
break;
default: break;
}
printf(
" seed=%d\n", (
int)sampler->
seed);
}
printf(
"integrator: %s", EXAMPLE_NAME(example_integrator_names, integrator->
type));
switch (integrator->
type) {
break;
default: break;
}
printf("\n");
}
int main(const int argc, char** argv) {
if (argc < 2) {
fprintf(stderr, "usage: %s scene.pbrt\n", argv[0]);
return 1;
}
example_print_error(argv[1], err);
return 1;
}
print_camera(&scene);
printf(
"accelerator: %s\n", EXAMPLE_NAME(example_accelerator_names, scene.
accelerator.
type));
size_t object_shapes = 0u;
for (
size_t i = 0; i < children.
count; ++i) { ++shapes_by_type[children.
shapes[i].
type]; }
object_shapes += children.
count;
}
printf(
"\nshapes: %zu (+%zu inside %zu object(s), %zu instance(s))\n", scene.
shapes.
count, object_shapes,
if (shapes_by_type[t] != 0u) { printf(" %-14s %zu\n", EXAMPLE_NAME(example_shape_names, t), shapes_by_type[t]); }
}
printf(
" %-14s \"" EXAMPLE_STR_FMT
"\"\n", EXAMPLE_NAME(example_material_names, m->
type), EXAMPLE_STR_ARG(m->
name));
}
printf(
" %-14s \"" EXAMPLE_STR_FMT
"\" (%s)\n", EXAMPLE_NAME(example_texture_class_names, t->
tex_class),
}
printf(
" %-14s \"" EXAMPLE_STR_FMT
"\"\n", EXAMPLE_NAME(example_media_names, m->
type), EXAMPLE_STR_ARG(m->
name));
}
return 0;
}
@ TPBRT_CAMERA_TYPE_PERSPECTIVE
Perspective camera.
Definition camera.h:28
@ TPBRT_CAMERA_TYPE_REALISTIC
Realistic camera.
Definition camera.h:30
@ TPBRT_CAMERA_TYPE_ORTHOGRAPHIC
Orthographic camera.
Definition camera.h:26
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_INTEGRATOR_TYPE_VOL_PATH
Volumetric path tracing.
Definition integrator.h:40
@ TPBRT_INTEGRATOR_TYPE_PATH
Path tracing.
Definition integrator.h:30
@ TPBRT_INTEGRATOR_TYPE_BDPT
Bidirectional path tracing.
Definition integrator.h:24
@ TPBRT_INTEGRATOR_TYPE_SPPM
Stochastic progressive photon mapping.
Definition integrator.h:38
@ TPBRT_SAMPLER_TYPE_INDEPENDENT
Independent sampler.
Definition sampler.h:24
@ TPBRT_SAMPLER_TYPE_HALTON
Halton sampler.
Definition sampler.h:22
@ TPBRT_SAMPLER_TYPE_SOBOL
Sobol sampler.
Definition sampler.h:28
@ TPBRT_SAMPLER_TYPE_STRATIFIED
Stratified sampler.
Definition sampler.h:30
@ TPBRT_SAMPLER_TYPE_Z_SOBOL
Z-Sobol sampler.
Definition sampler.h:32
@ TPBRT_SAMPLER_TYPE_PADDED_SOBOL
Padded sobol sampler.
Definition sampler.h:26
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_MAX_NUM
Count of available shape types.
Definition shape.h:44
@ TPBRT_TEXTURE_TYPE_FLOAT
Float texture.
Definition texture.h:58
#define TPBRT_NULL
NULL value.
Definition fwd.h:19
tpbrt_accelerator_type_t type
Accelerator type.
Definition accelerator.h:88
tpbrt_size_t count
Number of area lights in list.
Definition light.h:231
tpbrt_float_t screen_window[4]
The bounds of the film plane in screen space.
Definition camera.h:45
tpbrt_float_t focal_distance
The focal distance of the lens. If "lensradius" is zero, this has no effect. Otherwise,...
Definition camera.h:64
tpbrt_float_t fov
Specifies the field of view for the perspective camera. This is the spread angle of the viewing frust...
Definition camera.h:66
tpbrt_float_t lens_radius
The radius of the lens.
Definition camera.h:62
tpbrt_string_t lens_file
Specifies the name of a lens description file that gives the collection of lens elements in the lens ...
Definition camera.h:146
tpbrt_float_t aperture_diameter
Diameter of the lens system's aperture, specified in mm. The smaller the aperture,...
Definition camera.h:148
PBRT Camera representation.
Definition camera.h:159
tpbrt_float_t shutter_close
The time at which the virtual camera shutter closes.
Definition camera.h:163
tpbrt_camera_perspective_params_t perspective
Perspective camera parameters.
Definition camera.h:176
union tpbrt_camera_t::@2 as
Initialized value depends on current type value.
tpbrt_transform_animated_t transform
Transform handle.
Definition camera.h:165
tpbrt_camera_type_t type
Camera type.
Definition camera.h:184
tpbrt_float_t shutter_open
The time at which the virtual camera shutter opens.
Definition camera.h:161
tpbrt_camera_realistic_params_t realistic
Realistic camera parameters.
Definition camera.h:180
tpbrt_camera_orthographic_params_t orthographic
Orthographic camera parameters.
Definition camera.h:174
PBRT film representation.
Definition film.h:105
tpbrt_float_t iso
Film sensitivity to light; final pixel values are scaled by the "iso" value divided by 100.
Definition film.h:119
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_float_t crop_window[4]
The sub-region of the image to render. The four values specified should be fractions in the range [0,...
Definition film.h:107
tpbrt_float_t diagonal
Diagonal length of the film, in mm. (This value is only used when the RealisticCamera is used....
Definition film.h:117
tpbrt_film_type_t type
Film type.
Definition film.h:134
tpbrt_float_t y_radius
The width of the filter in the y direction.
Definition filter.h:72
tpbrt_filter_type_t type
filter type.
Definition filter.h:85
tpbrt_float_t x_radius
The width of the filter in the x direction.
Definition filter.h:70
tpbrt_uint_t max_depth
Maximum length of a light-carrying path sampled by the integrator.
Definition integrator.h:77
tpbrt_uint_t max_depth
Maximum length of a light-carrying path sampled by the integrator.
Definition integrator.h:122
tpbrt_uint_t max_depth
Maximum length of a light-carrying path sampled by the integrator.
Definition integrator.h:166
tpbrt_float_t radius
Initial photon search radius. (This value will be reduced as photons are accumulated at each pixel....
Definition integrator.h:170
PBRT integrator representation.
Definition integrator.h:192
tpbrt_integrator_path_params_t path
Path integrator parameters.
Definition integrator.h:204
tpbrt_integrator_sppm_params_t sppm
SPPM integrator parameters.
Definition integrator.h:212
tpbrt_integrator_type_t type
Value type.
Definition integrator.h:218
tpbrt_integrator_vol_path_params_t vol_path
VOL path integrator parameters.
Definition integrator.h:214
tpbrt_integrator_bdpt_params_t bdpt
BDPT integrator parameters.
Definition integrator.h:198
union tpbrt_integrator_t::@6 as
Value dependent on type value.
tpbrt_uint_t max_depth
Maximum length of a light-carrying path sampled by the integrator.
Definition integrator.h:181
tpbrt_area_lights_list_t area_lights
List of area lights.
Definition light.h:242
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 m[16u]
Array of 16 elements.
Definition math.h:210
PBRT material representation.
Definition material.h:376
tpbrt_material_type_t type
Material value type.
Definition material.h:409
tpbrt_string_t name
Material name (if it is not named material name is empty).
Definition material.h:380
tpbrt_size_t count
Number of materials in list.
Definition material.h:420
tpbrt_material_t * materials
Materials list data.
Definition material.h:418
tpbrt_shapes_list_t children
Objects shapes.
Definition object.h:28
tpbrt_size_t count
Number of objects instances in list.
Definition object_instance.h:38
tpbrt_object_t * objects
Objects in list.
Definition object.h:39
tpbrt_size_t count
Number of objects in list.
Definition object.h:41
tpbrt_uint_t pixel_samples
The number of samples to take in each pixel.
Definition sampler.h:60
tpbrt_uint_t pixel_samples
The number of samples to take in each pixel.
Definition sampler.h:71
tpbrt_uint_t pixel_samples
The number of samples to take in each pixel.
Definition sampler.h:80
tpbrt_uint_t pixel_samples
The number of samples to take in each pixel.
Definition sampler.h:91
tpbrt_bool_t jitter
Whether or not the generated samples should be jittered inside each stratum; this is generally only w...
Definition sampler.h:106
tpbrt_uint_t x_samples
The number of samples per pixel to take in the x direction.
Definition sampler.h:102
tpbrt_uint_t y_samples
The number of samples per pixel to take in the y direction. In general, "xsamples" and "ysamples" sho...
Definition sampler.h:104
PBRT sampler representation.
Definition sampler.h:124
tpbrt_sampler_padded_sobol_params_t padded_sobol
Padded sobol sampler parameters.
Definition sampler.h:135
tpbrt_sampler_stratified_params_t stratified
Stratified sampler parameters.
Definition sampler.h:139
union tpbrt_sampler_t::@22 as
Value dependent on type value.
tpbrt_sampler_type_t type
Sampler value type.
Definition sampler.h:145
tpbrt_sampler_sobol_params_t sobol
Sobol sampler parameters.
Definition sampler.h:137
tpbrt_sampler_independent_params_t independent
Independent sampler parameters.
Definition sampler.h:133
tpbrt_sampler_z_sobol_params_t z_sobol
Z-Sobol sampler parameters.
Definition sampler.h:141
tpbrt_int_t seed
A seed to use for the pseudorandom number generator. The default seed value is zero,...
Definition sampler.h:126
tpbrt_sampler_halton_params_t halton
Halton sampler parameters.
Definition sampler.h:131
tpbrt_uint_t pixel_samples
The number of samples to take in each pixel.
Definition sampler.h:115
PBRT scene representation.
Definition scene.h:38
tpbrt_camera_t camera
Scene camera.
Definition scene.h:43
tpbrt_filter_t filter
Scene filter.
Definition scene.h:55
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_sampler_t sampler
Scene sampler.
Definition scene.h:51
tpbrt_float_t start_time
Scene animation start time.
Definition scene.h:53
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_float_t end_time
Scene animation end time.
Definition scene.h:57
tpbrt_textures_list_t textures
List with all scene textures.
Definition scene.h:60
tpbrt_accelerator_t accelerator
Scene accelerator.
Definition scene.h:49
tpbrt_medias_list_t medias
List with all scene medias.
Definition scene.h:64
tpbrt_objects_list_t objects
List with all scene objects.
Definition scene.h:70
tpbrt_objects_instances_list_t instances
List with all scene objects instances.
Definition scene.h:72
tpbrt_integrator_t integrator
Scene integrator.
Definition scene.h:47
tpbrt_shape_type_t type
Shape value type.
Definition shape.h:232
List of shapes.
Definition shape.h:261
tpbrt_size_t count
Number of shapes in list.
Definition shape.h:265
tpbrt_shape_t * shapes
Shapes list data.
Definition shape.h:263
PBRT texture representation.
Definition texture.h:376
tpbrt_string_t name
Texture name.
Definition texture.h:386
tpbrt_texture_type_t type
Texture type.
Definition texture.h:380
tpbrt_texture_class_t tex_class
Texture class.
Definition texture.h:382
tpbrt_texture_t * textures
Textures list data.
Definition texture.h:437
tpbrt_size_t count
Number of textures in list.
Definition texture.h:439