DirectAnimation Animated Header --CameraBvr Class DirectAnimation Animated Header --CameraBvr Class* Microsoft DirectAnimation SDK
*Index  *Topic Contents
*Previous Topic: BvrsToRun Class
*Next Topic: ColorBvr Class

CameraBvr Class


public class CameraBvr extends Behavior {
    // Methods
    public CameraBvr depth(NumberBvr d);
    public CameraBvr depthResolution(NumberBvr n);
    public CameraBvr transform(Transform3Bvr xf);

    public static CameraBvr newUninitBvr();
}

Creates an object that represents a camera behavior. A camera is used with the render method 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 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 methods described below.

For more information about behaviors, see the Behavior class.

CameraBvr Methods

bullet1.gifdepth

bullet1.gifdepthResolution

bullet1.giftransform

bullet1.gifnewUninitBvr


depth

CameraBvr Class

Creates a new camera behavior that is the result of applying the specified depth to the original behavior.

public CameraBvr depth(
  NumberBvr d
  );

Parameters
d
The NumberBvr object that sets the maximum viewing depth of the CameraBvr. This parameter can also be of type double.
Return Values

Returns the CameraBvr object.

Remarks

By default, cameras have infinite depth, which means that all objects in front of the camera are visible. The new behavior is a CameraBvr whose maximum viewing depth is the NumberBvr depth. If depth < 0, the CameraBvr will be unable to see anything. If you prefer to think in terms of hither and yon, this method 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.


depthResolution

CameraBvr Class

Creates a new camera behavior by applying the specified depth resolution (res) to the original behavior.

public CameraBvr depthResolution(
  NumberBvr res
  );

Parameters
res
The NumberBvr object that sets the minimum depth (in camera coordinates) that is guaranteed to be distinct. This parameter can also be of type double.
Return Values

Returns the CameraBvr object.

Remarks

The Z-buffered rendering approach assigns one depth-value (typically one of 65,536 possibilities) to each pixel on the screen. The res 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 (assuming a minimum distance to be observed for the entire visible space) adjusts the far clipping plane accordingly.

For example, if the projection point is at (0,0,2), the image clip is at (0,0,1), and the depth resolution (res) is 1cm, then the resultant camera will have a viewing depth of slightly over 25.1 meters. 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.


transform

CameraBvr Class

Modifies, moves, or orients a camera.

public CameraBvr transform(
  Transform3Bvr xf
  );

Parameters
xf
The Transform3Bvr object.
Return Values

Returns the CameraBvr object.

Remarks

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 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.

This attribute composes values.


newUninitBvr

CameraBvr Class

Allows you to refer to a camera behavior before that behavior has been defined. With this method you can create a camera behavior and use it in the definition of other behaviors, but not actually define its contents until some later point. (This is accomplished with the init method, which is available on all behaviors.) The system generates a run-time error if you initialize a non-uninitialized behavior, initialize an uninitialized behavior that has already been initialized, or run an initialized behavior that has not yet been initialized.

public static CameraBvr newUninitBvr( );

Return Values

Returns the CameraBvr object.

Relevant Methods from the Statics Class

The following methods are defined in the Statics class and are most relevant to objects of type CameraBvr:

public static CameraBvr parallelCamera(NumberBvr nearclip);

public static CameraBvr perspectiveCamera(NumberBvr projdst, NumberBvr nearclip);

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

*Top of Page