br_camera
typedef
camera.h
for precise declaration and ordering)
br_uint_8 type Camera type
br_angle field_of_view Field of view
br_scalar hither_z Front of view volume
br_scalar yon_z Back of view volume
br_scalar aspect Aspect ratio (x/y)
br_scalar width Width of projection surface
br_scalar height Height of projection surface
char * identifier Camera name
void * user User data (application dependent)
BrActorToScreenMatrix4()
83
, BrMatrix4Perspective()
225
.
br_actor
74
.
Members
Behaviour
Type of camera. Which can be one of the following: br_uint_8 type
Parameters
Field of view, i.e. the angle subtended at the camera between the top and bottom of the view volume (pyramid). Applies only to perspective cameras. The value should be greater than zero and less than 180xbc . Note than this is the full angle, i.e. not the half angle, between the view z axis and top (or bottom) of view volume.br_angle field_of_view
Distance of front of view volume from camera along negative z axis, i.e. -br_scalar hither_z
hither_z
in view co-ordinates. The value should be greater than zero.
Distance of back of view volume from camera along negative z axis, i.e. -br_scalar yon_z
yon_z
in view co-ordinates. The value should be greater than hither_z
.
Scaling factor for width of viewing volume. For perspective cameras, xb1 1 in y view ordinates is mapped to the height of the output pixel map, and xb1 br_scalar aspect
aspect
in x view ordinates is mapped to the width of the output pixel map. For parallel cameras, the height
of the view volume is mapped to the height of the output pixel map, whereas width
aspect
is mapped to the width of the output pixel map.
Width of view volume (rectangular prism) in world co-ordinates (before br_scalar width
aspect
is applied) - the actual width is width
aspect
. Applies only to parallel cameras.
Height of view volume (rectangular prism) in world co-ordinates. Applies only to parallel cameras.br_scalar height
Supplementary
Pointer to unique, zero terminated, character string (or char * identifier
Null
if not required). or BrActorLoadMany()
96
it will have been constructed using BrResStrDup()
49.
void * user
Null
upon allocation (if allocated by BRender), and not accessed by BRender thereafter.
E.g.
Copy/Assign
The camera should copied using structure assignment. Access & Maintenance
Modification is not recommended during rendering, especially if applied to the viewing camera. The members should always accord with the camera type. The aspect may need to be updated in line with changing image dimensions. Referencing & Lifetime
If not constructed by BrActorAllocate()
89 it may be multiply referenced (given a sufficient lifetime). The camera structure should be maintained at least as long as it is referenced by any actor.
Initialisation
Only members applicable to the camera type need be initialised. BrActorAllocate(BR_ACTOR_CAMERA,NULL)
currently initialises a br_camera
107 structure as follows (after performing
memset(,0,sizeof(br_camera))
):
br_camera* camera;
...
camera->type=BR_CAMERA_PERSPECTIVE;
camera->field_of_view=BR_ANGLE_DEG(45);
camera->hither_z=BR_SCALAR(0.1);
camera->yon_z=BR_SCALAR(10.0);
camera->aspect=BR_SCALAR(1.0);
Construction & Destruction
The camera structure can either be constructed/destroyed by the application, or by supplying Null
to BrActorAllocate()
89.
Supplementary
Cameras created by BrActorAllocate()
89 are allocated from the
BR_MEMORY_CAMERA
("CAMERA")
resource class, and hence can benefit from the resource class supplementary functions. Import & Export
Cameras are imported and exported with actors that specify them. See BrActorLoad()
95 and
BrActorSave()
94
Generated with CERN WebMaker