DirectX Media for Animation Programmer's Guide Previous
Previous
TOC
TOC
Index
Index
Next
Next

Extensibility

Methods for Constructing Behaviors , New Behavior Primitives , New Data Types , New Subclasses of Existing Data Types

There are many interesting ways in which Direct Animation for Java can be extended. Some of these are discussed below.


Methods for Constructing Behaviors

This first category is listed only for completeness. It is already enabled simply by Direct Animation being accessible through a programming language such as Java. For instance, if a developer wants a behavior that is the square of the sine of some other number behavior, but there is no primitive that provides it, the developer simply writes a function that uses existing primitives to construct it:


public static NumberBvr sinSquared(NumberBvr x) {
    NumberBvr sinx = sin(x);
    return mul(sinx, sinx);
}


New Behavior Primitives

Not everything can be constructed out of the provided primitives. It is often useful to be able to provide ones own primitives. For instance, a developer may want to write a hyperbolic cosine function. The specification for this is not currently complete, but will involve the extender constructing a class that has a method that computes the hyperbolic cosine on an instantaneous value of a number behavior (that is, a Java float). This class will then be "elevated" so that the function becomes available to work on behaviors.


New Data Types

It is also often useful to extend the facilities Direct Animation provides for behaviors and events to entirely new datatypes. This is a possible future enhancement.


New Subclasses of Existing Data Types

Another very powerful extension mechanism is to be able to extend existing data types and introduce new subclasses of these data types. For instance, a developer might have technology for extruding text into 3D and want to provide that functionality as an alternate way of creating behaviors of type GeometryBvr. The power of this then lies in the ability to manipulate this particular geometry just like any other geometry in the system. This is a possible future enhancement.

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