RHTgrCamera Reference
Calling Sequence
oCamera = Obj_New("RHTgrCamera", [, CAMERA_LOCATION{Get, Set}=[x,y,z]] [, COLOR{Get, Set}=index or RGB vector] [, DEPTH_CUE{Get, Set}=[zbright, zdim]] [, DIMENSIONS{Get, Set}=[width, height]] [, /DOUBLE {Get, Set}] [, EYE{Set}=value] [, FORCE_AR{Get, Set}={0 | 1}] [, FOV{Get, Set}=value] [, FRUSTUM_DIMS{Get, Set}=[width, height, depth]] [, LOCATION{Get, Set}=[x, y]] [, /LOCK{Get, Set] [, PITCH{Get, Set}=value{0 to 360}] [, ROLL{Get, Set}=value{0 to 360}] [,THIRD_PERSON{Get, Set}=value] [, /TRACK{Get, Set}] [, /TRANSPARENT{Get, Set}] [, UNITS{Get, Set}={0 | 1 | 2 | 3}] [, UVALUE{Get, Set}=value] [, YAW{Get, Set}=value{0 to 360}] [, ZOOM{Get, Set}=value])
Keywords
camera_location
Set this keyword to a 3 element vector [x,y,z] that defines the camera's position in world space.
Default: [0.,0.,1.]
depth_cue
Set this keyword to a 2 element vector [zbright, zdim] specifying the
near and far Z planes between which depth cueing is in effect.
Depth (Z) distance is measured in positive units away from the camera.
For example, if the depth_cue property is set to [5,10] an object
would start to fade into the background 5 units from the camera
and would fade completely into the background 10 units from the camera.
zbright < zdim, rendering darkens with depth
zbringt > zdim, rendering lightens with depth
zbright = zdim, no depth cueing
Default: [0.0, 0.0]
force_AR
Set this keyword to lock the pixel aspect ratio based on the camera's viewplane dimensions and the initial dimensions of the destination object. Subsequent changes to the dimensions of the destination object will result in changes to the viewplane dimensions to preserve the initial pixel aspect ratio.
Default: 0
fov
Set this keyword to a 2 element vector [width, height]
specifying the camera's natural (unzoomed) field of view
in degrees . You can only set this property via the camera's
SetProperty method.
0 > FOV < 180
Default: Defined by frustum Dimensions.
frustum_dims
Set this keyword to a 3 element vector [width, height, depth] that defines the camera's viewing volume. Objects contained within the view volume are rendered, objects outside of the view volume are not.
Default: [2.0, 2.0, 2.0]
lock
Set this keyword to lock the camera to prevent rolling when simultaneously changing the pitch and yaw while panning. This roll is a result of normal quaternion rotation (?) but can be disorienting and by default is suppressed. If you desire a true quaternion camera, set this keyword to 0.
Default: 1
pitch
Set this keyword to a scalar defining the pitch (rotation about the X axis)of the camera in degrees. 0 >= pitch =< 360
Default: 0.0
roll
Set this keyword to a scalar defining the roll (rotation about the Z axis) of the camera in degrees. 0 >= roll =< 360
Default: 0.0
third_person
Set this keyword to a scalar defining the number of units the camera will lag behind the defined camera position. This creates a simple 3rd person effect. Setting this keyword equal to 0 will disable it.
Default: 0.0
yaw
Set this keyword to a scalar defining the yaw (rotation about the Y axis) of the camera in degrees. 0 >= yaw =< 360
Default: 0.0
zerror
Set this keyword to a scalar defining, in relative terms, the precision
of the Z buffer. Poor precision results in "flimmering" where objects
close to one another randomly show thru each other, usually at distance.
Note that increasing Z buffer precision by setting zerror to a small
value will increase the distance between the eye and the near clipping
plane which will limit how "close" you can get to objects before they
are clipped. Conversely, setting zerror to a large value will bring the eye right up to the near clipping plane allowing you to get very
close to objects but at the same time reducing the precision of the Z
buffer at distance.
Default: 6.0
zoom
Set this keyword to a scalar defining the zoom factor of the
camera. Setting zoom < 0 will zoom the camera out (increasing
field of view) while setting zoom > 0 will zoom it in (decreasing
field of view). The default field of view of the camera (zoom = 0)
depends on the frustum dimensions (as set by either the
frustum_dims or FOV keywords).
Default: 0.0
Methods
This object inherits methods from it's superclass, IDLgrView, and adds or modifies the following methods:
Add
This procedure method adds a model to the camera's view. Models added to the camera will be rendered if they fall within the viewing volume.
Set the position keyword to specify where the model should be
added relative to the models currently contained within the
camera.
Set the dynamic keyword to add the model(s) as dynamically
culled content. During transformation, the extent of dynamic
models is determined and any models falling completely outside
the viewing frustum will not be rendered.
Set the static keyword to add the model(s) as statically
culled content. A binary tree is constructed to spatially
partition the static model space. During transformation,
this tree is traversed to determine which models fall within
the view frustum. Models outside the view frustum will not be
rendered. Static model geometry and transformations must not
be modified after being added to the camera.
The performance of view frustum culling depends on many factors. In general, static culling is far more efficient than dynamic culling and can be used without penalty in most situations. Dynamic culling is very costly and its applicability is limited. Follow the hints provided in the examples and experiment.
The position keyword will be ignored if the dynamic and
static keywords are set.
oCamera -> Add, oModel
GetDirectionVector
This function method returns a unit vector representing the current camera orientation.
lvector = oCamera -> GetDirectionVector()
Lookat
This procedure method changes the camera's orientation by calculating a direction vector from the camera's position to a given point in space, a.k.a. the lookat point. The lookat point is in world coordinates.
Set the track keyword to force the camera
to follow your lookat point thru subsequent transformations
To point the camera at [5,10,20]:
oCamera -> Lookat, [5,10,20]
Pan
This procedure method changes the camera's orientation by changing its pitch and yaw. The values passed are the changes in pitch and yaw in degrees. Positive changes rotate the camera counterclockwise, negative changes rotate it clockwise.
To pan the camera 15 deg. to the right and 5 deg. down:
oCamera -> Pan, 15.0, -5.0
Roll
This procedure method roll's the camera about the z axis. The value passed is the change in roll in degrees. Positive values roll counterclockwise, negative values roll clockwise.
To roll the camera 10 degrees about the Z axis:
oCamera -> Roll, 10.0
Truck
This procedure method moves the camera along a defined vector relative to the current orientation. You must define the vector to move along [x, y, z] and a distance to move the camera. Note: when trucking the camera, positive z is forward.
To move the camera forward 10 units:
oCamera -> Truck, [0, 0, 1], 10.
Zoom
This procedure method "zooms" the camera by specified zoom factor.
To zoom in the camera so that your subject is 5 times it's size:
oCamera -> Zoom, 5.