DirectAnimation Animated Header --GeometryBvr Class DirectAnimation Animated Header --GeometryBvr Class* Microsoft DirectAnimation SDK
*Contents  *Index  *Topic Contents
*Previous Topic: FontStyleBvr Class
*Next Topic: ImageBvr Class

GeometryBvr Class


public class GeometryBvr extends Behavior {

    // Constructor
    public GeometryBvr();

    // Methods
    public Bbox3Bvr boundingBox();
    public GeometryBvr diffuseColor(ColorBvr col);
    public GeometryBvr lightAttenuation(NumberBvr const, NumberBvr linear, NumberBvr quadratic);
    public GeometryBvr lightColor(ColorBvr col);
    public GeometryBvr opacity(NumberBvr opac);
    public ImageBvr render(CameraBvr camera);
    public SoundBvr render(MicrophoneBvr mic);
    public GeometryBvr texture(ImageBvr image);
    public GeometryBvr transform(Transform3Bvr xf);
    public GeometryBvr undetectable();
       
    public static GeometryBvr newUninitBvr();
}

The GeometryBvr class is a class of three-dimensional objects that includes surfaces, lights, sounds, their attributes, and/or combinations of these elements. Like other behaviors, the value of the elements of the geometry can change over time.

In general, every geometry behavior is spatially infinite and of infinite resolution. Conceptually, each of the infinitely many points in the geometry has associated with it an opacity value, a color, a normal (used for lighting computations), a texture coordinate, a detectability value, and a single-channel sound emanating from that point (generally, this is silence).

Surface geometry is either detectable or not. If a surface is detectable, the geometry fires a pick event whenever the cursor passes over a surface point. Neither lights nor sounds are detectable (or pickable).

Light geometries include ambient lights, directional lights, point lights, and spotlights. Light geometries can be attributed with both color and distance attenuation.

A texture in a geometry is an image, the points of which are mapped to the surface of the three-dimensional object represented by the geometry. If there is no surface in the geometry, the texture is ignored.

A geometry can also be a sound. The sound is audible when the geometry is within the appropriate range of a microphone behavior.

The bounding box query is used to construct and compose media, and different types of images and behaviors provide specific bounding boxes. This means, for example, that the bounding box of an image is not defined as the smallest axis-aligned, enclosing region of the non-transparent parts of an image. Instead, bounding boxes are defined on a per-operation basis. The emptyGeometry object, for example, has its own definition of a bounding box, defined below.

For more information about behaviors, see the Behavior class.

GeometryBvr Methods

boundingBox
diffuseColor
lightAttenuation
lightColor
opacity
render(camera)
render(microphone)
texture
transform
undetectable
newUninitBvr


boundingBox

GeometryBvr Class

Creates a bounding box behavior that defines the axis-aligned bounding box enclosing all non-transparent portions of the geometry behavior.

public Bbox3Bvr boundingBox( );

Return Values

Returns the Bbox3Bvr object.


diffuseColor

GeometryBvr Class

Specifies the diffuse color of the new geometry behavior. The diffuse color is the diffuse (or matte) reflective color of the surface.

public GeometryBvr diffuseColor(
  ColorBvr col
  );

Parameters
col
The ColorBvr object.
Return Values

Returns the GeometryBvr object.

Remarks

By default, the diffuse color is white. The bounding box is the bounding box of the underlying geometry.

This attribute overrides previous values.


lightAttenuation

GeometryBvr Class

Creates a new geometry behavior in which any light sources have the given attenuation. The new attenuation is set to 1 / (const + linear ´ d + quadratic ´ d2) where d is the distance from the light to the object.

public GeometryBvr lightAttenuation(
  NumberBvr const,
  NumberBvr linear,
  NumberBvr quadratic
  );

Parameters
const, linear, and quadratic
The NumberBvr objects specifying the attenuation of a light source. These parameters can also be of type double.
Return Values

Returns the GeometryBvr object.

Remarks

By default, the attenuation coefficients are (1, 0, 0), which means no light attenuation. The bounding box is the bounding box of the underlying geometry.

An attenuation of (1, 1, 0) gives a linear attenuation that is useful for light falloff in a room. An attenuation of (1, 0, 1) gives a quadratic attenuation that simulates lights that are in the open, such as street lamps and headlights. This attribute overrides previous values.


lightColor

GeometryBvr Class

Creates a new geometry behavior in which all embedded lights have the specified color.

public GeometryBvr lightColor(
  ColorBvr col
  );

Parameters
col
The ColorBvr object.
Return Values

Returns the GeometryBvr object.

Remarks

By default, a light source is white. The bounding box is the bounding box of the underlying geometry.

This attribute overrides previous values.


opacity

GeometryBvr Class

Sets the opacity value for all surfaces to the given number behavior. Opacity values can range from 0.0 to 1.0.

public GeometryBvr opacity(
  NumberBvr opac
  );

Parameters
opac
The NumberBvr object representing the opacity value. The geometry is fully opaque if the value is 1, and fully transparent if the value is 0. This parameter can also be of type double.
Return Values

Returns the GeometryBvr object.

Remarks

If the opac parameter has a value outside the 0.0 to 1.0 range, the integer part of the value is discarded and only the fractional part is used. By default, the opacity is 1.

This attribute composes values. The resulting opacity is the new value times the old value.


render

GeometryBvr Class

Creates an image behavior that is a two-dimensional projection of this geometry behavior. The camera parameter defines how the geometry is projected into two dimensions.

public ImageBvr render(
  CameraBvr camera
  );

Parameters
camera
The CameraBvr object.
Return Values

Returns the ImageBvr object.

Remarks

The resulting image is infinite in extent. The bounding box of a rendered geometry is the axis-aligned extent of the projection of the three-dimensional bounding box onto the image plane.


render

GeometryBvr Class

Creates a sound behavior that represents the sound associated with this geometry behavior as detected by the given microphone.

public SoundBvr render(
  MicrophoneBvr mic
  );

Parameters
mic
The MicrophoneBvr object.
Return Values

Returns the SoundBvr object.


texture

GeometryBvr Class

Creates a new geometry behavior by mapping the given image, as defined by the given image behavior, to the surfaces of the original geometry.

public GeometryBvr texture(
  ImageBvr image
  );

Parameters
image
The ImageBvr object.
Return Values

Returns the GeometryBvr object.

Remarks

If the geometry has no surfaces, the texture is ignored. If the original geometry already has a texture, the new texture completely overlays the original. Texture maps have no effect when applied to a geometry that lacks texture coordinates. By default, a geometry has no texture. The bounding box is the bounding box of the underlying geometry.

This attribute overrides previous values.


transform

GeometryBvr Class

Creates a new geometry behavior that is the result of applying the given three-dimensional transformation to the original geometry behavior.

public GeometryBvr transform(
  Transform3Bvr xf
  );

Parameters
xf
The Transform3Bvr object.
Return Values

Returns the GeometryBvr object.

Remarks

The transformation applies to all points in the geometry, including those associated with the positions and orientations of light sources, textures, and sounds. The bounding box of a transformed geometry is the axis-aligned box enclosing the box that is the result of applying the transformation to the underlying geometry. The following example rotates a red cube around the y-axis by PI/3 radians:

//Get the cube (assume there is light)
GeometryBvr c0 = import("cube.wrl");
//Color it red
GeometryBvr c1 = c0.diffuseColor(red);
//Rotate it
GeometryBvr c2 = c1.transform(rotate(yVector3, toBvr(Math.PI/3)));

This attribute composes values.


undetectable

GeometryBvr Class

Creates a new undetectable geometry behavior from the original geometry. An undetectable geometry means that, while the geometry is still as visible or as audible as before, any attempts to pick it are ignored.

public GeometryBvr undetectable( );

Return Values

Returns the GeometryBvr object.

Remarks

The undetectable method is useful for specifying which objects are detectable and which are not. For example, suppose a semi-transparent green sphere is used to simulate a glow around an object. Because this sphere encloses the object, the object itself would be unpickable. Instead, the pick information would always be for the sphere. Tagging the sphere as unpickable allows the object itself to be picked. This attribute overrides previous values.


newUninitBvr

GeometryBvr Class

This method allows you to refer to an GeometryBvr behavior before that behavior has been defined. With this method you can create the 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 GeometryBvr newUninitBvr( );

Return Values

Returns the GeometryBvr object.

Relevant Methods from the Statics Class

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

public static GeometryBvr importGeometry(URL url);

public static GeometryBvr importGeometry(URL url, GeometryBvr geoStandIn, DXMEvent[] ev, NumberBvr[] progress, NumberBvr[] size);

public static GeometryBvr soundSource(SoundBvr sound);

public static GeometryBvr spotLight(NumberBvr fullcone, NumberBvr cutoff);

public static GeometryBvr union(GeometryBvr g1, GeometryBvr g2);

public static GeometryBvr unionArray(GeometryBvr[], geometries);

Relevant Fields from the Statics Class

The following fields are defined in the Statics class and are most relevant to objects of type GeometryBvr.

public final static GeometryBvr ambientLight;

public final static GeometryBvr directionalLight;

public final static GeometryBvr emptyGeometry;

public final static GeometryBvr pointLight;

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

*Top of Page