DAPreferences Class

A DAPreferences object controls rendering and viewing preference settings (such as texturing and shading) and hardware preferences. The DAPreferences class contains functions for setting and retrieving these values.

To set preferences, first create a DAPreferences object, as shown in the following Microsoft® JScript® code.

 p = DAControl.View.Preferences;

The first time Microsoft DirectAnimation® is run, it establishes the default preferences in the registry. This means the end user can control what the default preference settings are. When the GetPreference function is called, the DAPreferences object contains these settings. You can override these settings by calling the PutPreference function.

DAPreferences Functions

GetPreferenceRetrieves the value of the specified preference.
PropagatePropagates the preferences so that changed preferences take effect.
PutPreference Sets the value of the specified preference.

GetPreference

DAPreferences Class

Retrieves the value of the specified preference.

Syntax

prefObj.GetPreference( preference )

Parameters

preference
Name of the preference whose value is to be retrieved.

Return Value

Returns the value of the specified preference.

Remarks

You can set rendering and viewing preference settings such as texture mapping quality, output audio format, and maximum frames per second in DirectAnimation. For a list of possible preferences and their settings, see PutPreference.

The following example shows how to retrieve the value of the FILL_MODE preference.

 currentvalue = DAControl.GetPreference("FILL_MODE");

Propagate

DAPreferences Class

Propagates the preferences so that changed preferences take effect. Not all preferences can be propagated successfully at all times. For example, whether 3-D hardware will be enabled and whether an application can override registry entries are preferences that the application cannot change as it runs.

Syntax

prefObj.Propagate( );

Return Value

No return value.

See Also

IDAView::get_Preferences

PutPreference

DAPreferences Class

Sets the value of the specified preference.

Syntax

prefObj.PutPreference( preference, value )

Parameters

preference
Name of the preference whose value will be set.
value
New value to set for the preference.

Return Value

No return value.

Remarks

You can set rendering and viewing preference settings such as texture mapping quality, output audio format, and maximum frames per second in DirectAnimation. The following example shows how to get and set preferences.

  v = DAControl.View;
  p = v.Preferences;
  test = p.GetPreference("Dither Enable");
  p.PutPreference("ColorKey Red (0-255)", 0.5);
  p.PutPreference("ColorKey Green (0-255)", 0.5);
  p.PutPreference("ColorKey Blue (0-255)", 0.5);
  p.Propagate();

The following table lists preferences and their values.

Preference NameDescriptionValue
"ColorKey Blue (0-255)"Specifies the value of the blue RGB component.An integer from 0 to 255. Default value is 245.
"ColorKey Green (0-255)"Specifies the value of the green RGB component.An integer from 0 to 255. Default value is 254.
"ColorKey Red (0-255)"Specifies the value of the red RGB component.An integer from 0 to 255. Default value is 1.
"Dither Enable"Determines whether dithering is enabled.Default is enabled (1).
"EnableDynamicConstancyAnalysis"Determines whether analysis is done on the model to see which part remains constant. In most situations, this should be enabled. However, in animations that have an event or SwitchTo construct nearly every frame and are experiencing a slowdown, you might want to disable it.Default is enabled (1).
"Fill Mode"Specifies the fill mode. Solid fill mode (0), wireframe fill mode(1), or point fill mode (2). Default mode is solid fill mode (0).
"Max FPS"Specifies the maximum number of frames per second.Default value is 30.
"Optimizations On"Specifies whether there will be optimizations. Optimizations include such things as image caching and dirty rectangle optimization.Default is optimizations on (1).
"Override Application Preferences"Specifies whether the registry overrides any attempts by the application to set preferences.You can't set this value. It can only be retrieved with GetPreference. Default value is Off (0).
"Perspective Correct Texturing"Specifies whether texturing will be adjusted for perspective.Default is perspective correction on (1).
"RGB Lighting"Specifies whether the lighting mode is RGB. Default is that lighting mode is RGB (1).
"Shade Mode"Specifies what the shading mode will be.Flat shade mode (0), Gouraud shade mode (1), or Phong shade mode (2). Default mode is Gouraud shade mode (1).
"Texture Enable"Determines whether texture mapping is enabled.Default is enabled (1).
"Texture Quality"Specifies what the texture rendering quality will be.Nearest texture quality (0) or linear texture quality (1). Default mode is nearest texture quality (0).
"Enable 3D Hardware Acceleration"Specifies whether 3-D hardware will be enabled. Default is to use 3-D hardware (1). A read-only value that the application can't override.
"Use Video Memory"Specifies whether the video memory will be enabled.Default is to use video memory (1).

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