#include <stdio.h>
#include <example_utils.h>
printf(" %s=(%g %g %g)", label, w.x, w.y, w.z);
}
printf(
" %-11s", EXAMPLE_NAME(example_light_names, light->
type));
print_world_point(
"position", light_to_world, light->
as.
point.
from);
break;
print_world_point(
"from", light_to_world, light->
as.
spot.
from);
print_world_point(
"to", light_to_world, light->
as.
spot.
to);
break;
printf(" direction=(%g %g %g)", to.x - from.x, to.y - from.y, to.z - from.z);
break;
}
printf(
" environment map \"" EXAMPLE_STR_FMT
"\"", EXAMPLE_STR_ARG(light->
as.
infinite.
file_name));
}
break;
break;
break;
default: break;
}
printf(" spectrum=");
example_print_spectrum(stdout, spectrum);
}
printf(
" scale=%g", light->
scale);
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;
}
}
continue;
}
printf(
" shape %zu (%s) emits ", i, EXAMPLE_NAME(example_shape_names, shape->
type));
example_print_spectrum(stdout, &area->
as.
diffuse.
l);
printf(
" origin=(%g %g %g)", object_to_world->
m03, object_to_world->
m13, object_to_world->
m23);
}
printf("\n");
}
return 0;
}
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_area_light_by_handle(const tpbrt_area_lights_list_t *area_lights_list, tpbrt_area_light_handle_t handle, const tpbrt_area_light_t **area_light)
Returns pointer to area light to which handle is provided.
@ TPBRT_LIGHT_SOURCE_TYPE_INFINITE
Infinite light source.
Definition light.h:32
@ TPBRT_LIGHT_SOURCE_TYPE_DISTANT
Distant (directional) light source.
Definition light.h:28
@ TPBRT_LIGHT_SOURCE_TYPE_POINT
Point light source.
Definition light.h:34
@ TPBRT_LIGHT_SOURCE_TYPE_GONIOMETRIC
Goniometric light source.
Definition light.h:30
@ TPBRT_LIGHT_SOURCE_TYPE_SPOT
Spot light source.
Definition light.h:38
@ TPBRT_LIGHT_SOURCE_TYPE_PROJECTION
Projection light source.
Definition light.h:36
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.
#define TPBRT_NULL
NULL value.
Definition fwd.h:19
tpbrt_spectrum_t l
Spectral distribution of the light's emitted radiance.
Definition light.h:176
tpbrt_bool_t two_sided
Determines whether the light source emits light from just the side of the surface where the surface n...
Definition light.h:178
PBRT area light representation.
Definition light.h:185
union tpbrt_area_light_t::@8 as
Value dependent on type value.
tpbrt_area_light_diffuse_params_t diffuse
Diffuse area light parameters.
Definition light.h:196
tpbrt_float_t scale
Scale factor that modulates the amount of light that the light source emits into the scene.
Definition light.h:189
tpbrt_opt_float_t power
Total luminous power or illuminance emitted by the light.
Definition light.h:191
tpbrt_size_t count
Number of area lights in list.
Definition light.h:231
tpbrt_point_t from
"from" and "to" define the direction vector along which illumination from the light arrives at the sc...
Definition light.h:51
tpbrt_point_t to
"from" and "to" define the direction vector along which illumination from the light arrives at the sc...
Definition light.h:53
tpbrt_spectrum_t l
Spectral distribution of the radiance emitted by the light source.
Definition light.h:49
tpbrt_string_t file_name
The filename of the image file that stores a goniometric diagram to use for the lighting distribution...
Definition light.h:62
tpbrt_spectrum_t i
The spectral distribution of emission from the light; the radiant intensity in a particular direction...
Definition light.h:64
tpbrt_string_t file_name
The environment map to use for the infinite area light. If no filename is provided,...
Definition light.h:73
tpbrt_spectrum_t l
The spectral distribution of emission from the light; the radiance intensity in a particular directio...
Definition light.h:77
tpbrt_spectrum_t i
Spectral distribution of the light's emitted radiant intensity.
Definition light.h:86
tpbrt_point_t from
The location of the light.
Definition light.h:88
tpbrt_string_t file_name
The image to project into the scene.
Definition light.h:99
tpbrt_float_t fov
The spread angle of the projected light, along the shorter image axis.
Definition light.h:101
tpbrt_spectrum_t i
Spectral distribution of the light's emitted radiant intensity.
Definition light.h:97
tpbrt_point_t from
One of two points defining the lighting vector.
Definition light.h:112
tpbrt_point_t to
One of two points defining the lighting vector.
Definition light.h:114
tpbrt_float_t cone_delta_angle
The angle at which the spotlight intensity begins to fall off at the edges.
Definition light.h:118
tpbrt_float_t cone_angle
The angle that the spotlight's cone makes with its primary axis. For directions up to this angle from...
Definition light.h:116
tpbrt_spectrum_t i
Spectral distribution of the light's emitted radiant intensity.
Definition light.h:110
PBRT light source representation.
Definition light.h:125
union tpbrt_light_source_t::@7 as
Value dependent on type value.
tpbrt_light_source_projection_params_t projection
Projection light source parameters.
Definition light.h:148
tpbrt_light_source_infinite_params_t infinite
Infinite light source parameters.
Definition light.h:144
tpbrt_light_source_spot_params_t spot
Spot light source parameters.
Definition light.h:150
tpbrt_light_source_goniometric_params_t goniometric
Goniometric light source parameters.
Definition light.h:142
tpbrt_transform_handle_t transform
Transform handle.
Definition light.h:127
tpbrt_float_t scale
Scale factor that modulates the amount of light that the light source emits into the scene.
Definition light.h:129
tpbrt_light_source_point_params_t point
Point light source parameters.
Definition light.h:146
tpbrt_light_source_distant_params_t distant
Distant light source parameters.
Definition light.h:140
tpbrt_light_source_type_t type
Light value type.
Definition light.h:154
tpbrt_opt_float_t power_illuminance
Total luminous power or illuminance emitted by the light.
Definition light.h:131
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
tpbrt_light_source_t * lights
Light sources.
Definition light.h:218
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
tpbrt_float_t value
Value set only when has_value is TPBRT_TRUE.
Definition math.h:22
tpbrt_bool_t has_value
Indicates if value is set.
Definition math.h:24
PBRT scene representation.
Definition scene.h:38
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
PBRT shape representation.
Definition shape.h:218
tpbrt_transform_animated_t transform
Animated transform.
Definition shape.h:222
tpbrt_area_light_handle_t area_light
Area light handle.
Definition shape.h:226
tpbrt_shape_type_t type
Shape value type.
Definition shape.h:232
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 Spectrum representation.
Definition color.h:166
tpbrt_size_t size
String size.
Definition common.h:24
3 component vector.
Definition math.h:98