DirectAnimation Animated Header --DACamera Class DirectAnimation Animated Header --DACamera Class* Microsoft DirectAnimation SDK
*Index  *Topic Contents
*Previous Topic: DABoolean Class
*Next Topic: DAColor Class

DACamera Class


Creates a DACamera object that represents a camera behavior (a camera whose values can be animated, or vary over time). A camera is used with the Render function to project geometry onto an infinite two-dimensional image. Related operations include rendering it into a microphone to extract the sound, or into a pair of microphones to extract stereo sounds.

There are two basic types of cameras: one for parallel projection and one for perspective projection. Both cameras are oriented so that they gaze in the negative z-direction, with positive y-axis considered "up." Also, both cameras have a near clipping plane. This plane (a product of Z-buffered rendering) specifies the closest distance at which an object is visible. Objects closer than the near clipping plane cannot be seen.

Cameras are manipulated via standard three-dimensional transform operations. These transforms modify the camera characteristics and also position and orient the cameras. For more information about these operations, see the transform functions described below.

This class inherits from DABehavior.

DACamera Functions

bullet1.gifDepthAnim

bullet1.gifDepth

bullet1.gifDepthResolutionAnim

bullet1.gifDepthResolution

bullet1.gifTransform


DepthAnim

DACamera Class

Creates a new DACamera object by applying the specified depth to the original object. By default, cameras have infinite depth, which means that all objects in front of the camera are visible. The new object is a DACamera whose maximum viewing depth is the DANumber depth. If depth < 0, the camera will be unable to see anything. If you prefer to think in terms of hither and yon, this function sets yon = hither + depth. It is important to note that depth is the limit on the far plane. As with the near plane, the geometry is bounded as tightly as possible for maximum Z-resolution.

Limiting the depth of the camera is useful for preserving depth resolution when using Z-buffered rendering. It is also useful for a camera inside a building, where no viewing region is larger than some value.

cameraObj.DepthAnim(
  d
  )

Parameters
d
The DANumber object that sets the maximum viewing depth of the DACamera. This value must be an animated number.
Return Values

Returns the DACamera object.


Depth

DACamera Class

Same as DepthAnim except that d is a non-animated number (a double).

cameraObj.Depth(
  d
  )


DepthResolutionAnim

DACamera Class

Creates a new DACamera object by applying the specified depth resolution (res) to the original behavior. The Z-buffered rendering approach assigns one depth-value (typically one of 65,536 possibilities) to each pixel on the screen. The depth resolution is the minimum distance between two objects such that they still appear distinct. This resolution varies as you go from the near clipping plane to the far clipping plane (more precision is lost for far objects), and according to the amount of perspective for the given camera. This method (given a minimim distance to be observed for the entire visible space) adjusts the far clipping plane accordingly.

For example, ifthe projection point is at (0,0,2), the image clip is at (0,0,1), and the depth resolution is set to 1cm, then the resultant DACamera will have a viewing depth of slightly over 25.1m. It is important to note that depth represents the limit on the far plane. As with the near plane, the geometry will actually be bounded as tightly as possible for maximum Z-resolution.

cameraObj.DepthResolutionAnim(
  res
  )

Parameters
res
The DANumber object that sets the minimum depth (in camera coordinates) that is guaranteed to be distinct. This value must be an animated number.
Return Values

Returns the DACamera object.


DepthResolution

DACamera Class

Same as DepthResolutionAnim except that res is a non-animated number (a double).

cameraObj.DepthResolution(
  res
  )


Transform

DACamera Class

Cameras are modified, positioned, and oriented via standard transforms. Scale transforms modify the camera while translations and rotations position and orient the camera. The basic steps for using a camera are defining it, modifying it if necessary, and then placing it in the scene.

It is important to note that all camera scales should be applied before camera rotations, and that only scales, rotations, and translations are supported on cameras. Transformations that do not meet these criteria will yield a camera with an undefined behavior.

There are two types of scale transformations, called Z-scales and X/Y-scales. Z-scales must be positive, non-zero values. Z-scales affect the position of the near clipping plane (if the clipping plane is set to a non-zero value.) For example, if the near clipping plane is located at 10 (that is, if Z=10), then a scale of [1 1 3] will yield a near clipping plane located at Z=30. More importantly, Z-scales move the projection point for a perspective camera. This means an increasing Z-scale yields a perspective camera that is zooming in, and a decreasing Z-scale yields a perspective camera that is zooming out.

Use X/Y-scales to affect the size of the projected image. One way to think of this is that an X/Y-scale sets the size of the camera relative to the world it's viewing. For example, if you are viewing a microscopic scene, use a small X/Y-scale. On the other hand, if you are viewing a solar system, use a large X/Y scale. Scaling a camera by some value in X/Y is exactly equivalent to inversely scaling the resulting image by the same amount. For example, scaling the camera by [10 10 1] is the same as scaling the resulting image by [1/10 1/10]. Finally, disparate scales in X and Y can be used to change the aspect ratio of the rendered image.

Once the camera is defined (via construction and scaling), it can be placed in the scene via rotations and translations just as a light source, microphone, or any other geometric object is placed.

cameraObj.Transform(
  xf
  )

Parameters
xf
The DATransform3 object used to create a new camera.
Return Values

Returns the DACamera object.

Remarks

This function composes values. The resulting transformation is the new value applied to the old value.

Relevant Functions from the DAStatics Class

The following functions are defined in the DAStatics class and are most relevant to objects of type DACamera:

lib.ParallelCameraAnim(nearclip)

lib.ParallelCamera(nearclip)

lib.PerspectiveCameraAnim(projdst, nearclip)

lib.PerspectiveCamera(projdst, nearclip)

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page