DirectX Media for Animation Java Reference Previous
Previous
Classes
Classes
Index
Index
Next
Next

GeometryBvr Class

Methods , Fields

public class GeometryBvr extends Behavior {
    // Fields
    public static GeometryBvr ambientLight;
    public static GeometryBvr directionalLight;
    public static GeometryBvr emptyGeometry;
    public static GeometryBvr pointLight;

    // Constructor
    public GeometryBvr();

    // Methods
    public Bbox3Bvr boundingBox();
    public GeometryBvr diffuseColor(ColorBvr col);
    public GeometryBvr emissiveColor(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 specularColor(ColorBvr col);
    public GeometryBvr specularExponent(NumberBvr exp);
    public GeometryBvr texture(ImageBvr textureImageBvr);
    public GeometryBvr transform(Transform3Bvr xf);
    public GeometryBvr undetectable();
       
    public static GeometryBvr importGeometry(String pathname) throws IllegalImport;
    public static GeometryBvr newUninitBvr();
    public static GeometryBvr soundSource(SoundBvr sound);
    public static GeometryBvr spotLight(NumberBvr fullcone, NumberBvr cutoff);
    public static GeometryBvr union(GeometryBvr g1, GeometryBvr g2);
}

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.


Methods


boundingBox

public Bbox3Bvr    boundingBox();

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

Return Value:

Returns the Bbox3Bvr object.


diffuseColor

public GeometryBvr diffuseColor(ColorBvr col);

Specifies the diffuse color of the new geometry behavior. The diffuse color is the diffuse (or matte) reflective color of the surface. By default, the diffuse color is white. The bounding box is the bounding box of the underlying geometry.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
col The ColorBvr object.

Remarks:

This attribute overrides previous values.


emissiveColor

public GeometryBvr emissiveColor(ColorBvr col);

Creates a new geometry behavior in which all points that have the given color behavior are emissive, that is, emit reflected light of this color. The bounding box is the bounding box of the underlying geometry.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
col The ColorBvr object.

Remarks:

This attribute overrides previous values.


lightAttenuation

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

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

Return Value:

Returns the GeometryBvr object.

ParameterDescription
const, linear, and quadratic The NumberBvr objects specifying the attenuation of a light source.

Remarks:

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

public GeometryBvr lightColor(ColorBvr col);

Creates a new geometry behavior in which the light source has the given color behavior. By default, a light source is white. The bounding box is the bounding box of the underlying geometry.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
col The ColorBvr object.

Remarks:

This attribute overrides previous values.


opacity

public GeometryBvr opacity(NumberBvr opac);

Sets the opacity value for all surfaces to the given number behavior. Opacity values can range from 0.0 to 1.0. If the corresponding number behavior has a value outside this range, the integer part of the value is discarded and only the fractional part is used. By default, the opacity is 1.

Return Value:

Returns the GeometryBvr object.

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

Remarks:

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


render

public ImageBvr render(CameraBvr camera);

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

Return Value:

Returns the ImageBvr object.

ParameterDescription
camera The CameraBvr object.


render

public SoundBvr render(MicrophoneBvr mic);

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

Return Value:

Returns the SoundBvr object.

ParameterDescription
mic The MicrophoneBvr object.


specularColor

public GeometryBvr specularColor(ColorBvr col);

Creates a new geometry behavior in which all points that have the given color behavior are specular, that is, reflect light of this color. By default, the specular color is black. The bounding box is the bounding box of the underlying geometry.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
col The ColorBvr object.

Remarks:

This attribute overrides previous values.


specularExponent

public GeometryBvr specularExponent(NumberBvr exp);

Creates a new geometry behavior in which all specular points have the given specular exponent. The exponent defines the sharpness of the reflected light. A value of 5 gives a metallic appearance, and higher values give a more plastic appearance. By default, the specular exponent is 1. The bounding box is the bounding box of the underlying geometry.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
exp The NumberBvr object defining the sharpness of the reflected light.

Remarks:

This attribute overrides previous values.


texture

public GeometryBvr texture(ImageBvr textureImageBvr);

Creates a new geometry behavior by mapping the given texture, as defined by the given image behavior, to the surfaces of the original geometry. 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.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
textureImageBvr The ImageBvr object.

Remarks:

This attribute overrides previous values.


transform

public GeometryBvr transform(Transform3Bvr xf);

Creates a new geometry behavior that is the result of applying the given three-dimensional transformation to the original geometry behavior. 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)));

Return Value:

Returns the GeometryBvr object.

ParameterDescription
xf The Transform3Bvr object.

Remarks:

This attribute composes values.


undetectable

public GeometryBvr undetectable();

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.

Return Value:

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.


importGeometry

public static GeometryBvr importGeometry(java.lang.String pathname) throws IllegalImport;

Creates a geometry behavior by importing the given VRML or .X file.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
pathname A character string specifying either a URL or the name of a file.

Throws:

IllegalImport The given file does not exist or is not in a valid format.


newUninitBvr

public static GeometryBvr newUninitBvr();

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.

Return Value:

Returns the GeometryBvr object.


soundSource

public static GeometryBvr soundSource(SoundBvr sound);

Creates a geometry behavior that contains the given sound behavior. The bounding box is the nullary bounding box, where the maximum coordinate is less than the minimum coordinate.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
sound The SoundBvr object.


spotLight

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

Creates a spotlight geometry. A spotlight is a positioned, directed light source initially located at the origin and directed along the negative z-axis. Examples of real-world spotlights include desklamps, headlights, and flashlights. The bounding box is the nullary bounding box, where the maximum extent is less than the minimum extent.

The fullcone parameter specifies the half-angle of the region that will receive the full intensity of the spotlight. This parameter can have values from 0.00 to pi.

The cutoff parameter specifies the half-angle of the region past which surfaces will receive no illumination. This parameter can have values from the value of fullcone to pi.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
fullcone The NumberBvr object specifying the angle in radians from the main spotlight axis for which surfaces will receive full illumination from the light.
cutoff The NumberBvr object specifying the angle in radians from the main spotlight axis past which surfaces will receive no illumination from the light.

Remarks:

Surfaces receive illumination from the spotlight in the following manner:

Remarks:

These rules are illustrated in the following diagram: Spotlight

Remarks:

The following diagram shows how the intensity of the spotlight changes in relationship to the angle: Intensity


union

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

Creates a geometry behavior by combining the given geometries. The new geometry contains all elements of the original geometries. The bounding box of a set of unioned geometries is simply the union of the bounding boxes of each of the geometries.

Return Value:

Returns the GeometryBvr object.

ParameterDescription
g1 and g2 The GeometryBvr objects.


Fields

emptyGeometry
A geometry behavior (GeometryBvr object in which all points are invisible (transparent) and undetectable. The bounding box is the nullary bounding box, where the maximum coordinate is less than the minimum coordinate.
ambientLight
A geometry behavior (GeometryBvr object) in which the light source is ambient (room) light. The bounding box is the nullary bounding box, where the maximum extent is less than the minimum extent. Ambient light is light that, instead of coming directly from a light source, bounces from surface to surface and provides overall scene-lighting. For example, if you are in a room lit by a lamp, everything not directly lit by the lamp is receiving ambient light. It leaves the lamp, bounces off the walls, the floors, the ceiling, and all around, until it reaches almost the entire room. Using too much ambient light can make a scene look washed out, while too little will yield shadowed areas that look unnaturally black. Unlike directional lights and pointlights, transformations have no effect on ambient lights.
directionalLight
A geometry behavior (GeometryBvr object) in which the light source is positioned pointing down the negative z axis. The bounding box is the nullary bounding box, where the maximum extent is less than the minimum extent. Directional light specifies a light such that the light direction is the same everywhere. This is in contrast to a positional light such as a point or spot light, where the direction to the light source changes depending on where the surface is. Directional lights are useful for simulating the sun because, from our perspective on earth, the sun's rays appear to travel in the same direction. Directional lights are also cheaper to compute than positional lights, though this difference may be negligible and should not be assumed. Transformations do have an effect on directional lights.
pointLight
A geometry behavior (GeometryBvr object) in which the light source is positioned at the origin and radiates light in all directions. The bounding box is the nullary bounding box, where the maximum extent is less than the minimum extent. Pointlights simulate most real-world lights such as bare light bulbs, wall-mounted light fixtures, and ceiling lights. They shine in all directions, radiating outward from the center. Transformations do have an effect on pointlights.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.