Viewer Interface

The Viewer interface methods give complete control over a rendering device. Every method needed to view a model is included here. By implementing these abstract methods, it is possible to write custom viewers that can provide unique functionality. Developers can, for instance, control the tick rate of their models.

Viewer Methods

getCurrentTime Retrieves the number of seconds since startModel was invoked.
getCurrentTickTime Retrieves the time provided for the most recent call to tick or 0 if tick has not yet been called.
getPreferences Enables the application to dynamically view the viewer preferences.
registerErrorAndWarningReceiver Enables the application to register an object that will have its methods invoked upon asynchronous errors encountered when Microsoft® DirectAnimation® media is controlling the frame loop or when recoverable errors occur when sampling and displaying the model.
startModel Starts the behaviors associated with the model at global time 0.
stopModel Forces all media to stop immediately.
tick() Provides a shorthand way of writing tick(getCurrentTime()).
tick(timeToUse) Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.

getCurrentTime

Viewer Interface

Retrieves the number of seconds since startModel was invoked.

Syntax

public abstract double getCurrentTime( );

Return Value

Returns a double floating-point number.

getCurrentTickTime

Viewer Interface

Retrieves the time provided for the most recent call to tick or 0 if tick has not yet been called.

Syntax

public abstract double getCurrentTickTime( );

Return Value

Returns the double floating-point number representing the current tick time.

getPreferences

Viewer Interface

Enables the application to dynamically view the viewer preferences. For more information about preferences, see Preferences.

Syntax

public abstract Preferences getPreferences( );

Return Value

Returns the Preferences object.

registerErrorAndWarningReceiver

Viewer Interface

Enables the application to register an object that will have its methods invoked upon asynchronous errors encountered when DirectAnimation media is controlling the frame loop or when recoverable errors occur when sampling and displaying the model.

Syntax

public abstract ErrorAndWarningReceiver
     registerErrorAndWarningReceiver(
     ErrorAndWarningReceiver w
);

Parameters

w
ErrorAndWarningReceiver object to be registered.

Return Value

Returns the ErrorAndWarningReceiver object.

startModel

Viewer Interface

Starts the behaviors associated with the model at global time 0. Also causes the createModel method on the model itself to be invoked.

Syntax

public abstract void startModel( );

stopModel

Viewer Interface

Forces all media to stop immediately. It is not required to call this method, however, without it, some media (such as sounds) will continue playing until the object is released.

Syntax

public abstract void stopModel( );

tick()

Viewer Interface

Provides a shorthand way of writing tick(getCurrentTime()). It is the easiest way to explicitly sample and display model and provides a real-time clock for global time.

Syntax

public abstract void tick( );

tick(timeToUse)

Viewer Interface

Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.

Syntax

public abstract void tick( double timeToUse );

Parameters

timeToUse
Global time for the single sampling.

Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.