org.xith3d.render
Class RenderOptions

java.lang.Object
  extended by org.xith3d.render.RenderOptions

public class RenderOptions
extends java.lang.Object

Storage class for configuring renderer options. Efficiency of this class is important to overall rendering time. All set and get opertaions are simple O(1) complexity operations which should not increase rendering time by a tracable margin. Constructors (and loading of default options or cloning RenderOptions using the loadOptions method) are O(n) operations but should only rarely be used. Import/Export methods are added for convenience and have no time constraints.


Field Summary
static boolean DEFAULT_VALUE_DISPLAY_LISTS_ENABLED
          Whether or not to use display lists for vertex data drawing.
static boolean DEFAULT_VALUE_GL_ERROR_CHECKS_ENABLED
          Whether the graphic card should be checked for errors on every call. if there is an error then an exception will be thrown.
static boolean DEFAULT_VALUE_GL_TRACING_ENABLED
          Whether or not we should turn on the lowest level of graphics card tracing.
static boolean DEFAULT_VALUE_LIGHTING_ENABLED
          The use lights on|off flag.
static boolean DEFAULT_VALUE_TEXTURE_MAPPING_ENABLED
          Whether or not to render textures.
static boolean DEFAULT_VALUE_VBOS_ENABLED
          Whether or not to use vertex buffer objects to store vertex data on the video card.
static boolean DEFAULT_VALUE_WIREFRAME_MODE_ENABLED
          Whether or not to render in only wireframe (GL_LINE) mode.
 
Constructor Summary
RenderOptions()
          Default constructor uses the default settings for all of the render options.
RenderOptions(RenderOptions base)
          Creates a new RenderOptions class which mimmics the given RenderOptions.
 
Method Summary
 boolean areDisplayListsEnabled()
           
 boolean areGLErrorChecksEnabled()
           
 boolean areVBOsEnabled()
           
 java.util.HashMap<java.lang.String,java.lang.Object> exportOptions()
          Populates a HashMap with the options and their values.
 void importOptions(java.util.Map<java.lang.String,java.lang.Object> map)
          Sets all options from the given HashMap into the current RenderOptions object.
 boolean isGLStatesCacheEnabled()
           
 boolean isGLTracingEnabled()
           
 boolean isLightingEnabled()
           
 boolean isTextureMappingEnabled()
           
 boolean isWireframeModeEnabled()
           
 void loadDefaultOptions()
          Loads the Xith3D default options.
 void loadOptions(RenderOptions renderOptions)
          Reads the options from the passed RenderOptions and sets them in this RenderOptions.
 void setDisplayListsEnabled(boolean enabled)
          Sets whether or not to use display lists for vertex data drawing.
 void setGLErrorChecksEnabled(boolean enabled)
          Sets whether the graphic card should be checked for errors on every call. if there is an error then an exception will be thrown.
 void setGLStatesCacheEnabled(boolean enabled)
          Sets the use GL-states-cache on|off flag.
 void setGLTracingEnabled(boolean enabled)
          Sets whether or not we should turn on the lowest level of graphics card tracing.
 void setLightingEnabled(boolean enabled)
          Sets the use lights on|off flag.
 void setTextureMappingEnabled(boolean enabled)
          Sets whether or not to render textures.
 void setVBOsEnabled(boolean enabled)
          Sets whether or not to use vertex buffer objects to store vertex data on the video card.
 void setWireframeModeEnabled(boolean enabled)
          Sets whether or not to render in only wireframe (GL_LINE) mode.
 boolean switchWireframeMode()
          Switches wireframe mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VALUE_LIGHTING_ENABLED

public static final boolean DEFAULT_VALUE_LIGHTING_ENABLED
The use lights on|off flag.

See Also:
Constant Field Values

DEFAULT_VALUE_VBOS_ENABLED

public static final boolean DEFAULT_VALUE_VBOS_ENABLED
Whether or not to use vertex buffer objects to store vertex data on the video card.

See Also:
Constant Field Values

DEFAULT_VALUE_DISPLAY_LISTS_ENABLED

public static final boolean DEFAULT_VALUE_DISPLAY_LISTS_ENABLED
Whether or not to use display lists for vertex data drawing.

See Also:
Constant Field Values

DEFAULT_VALUE_TEXTURE_MAPPING_ENABLED

public static final boolean DEFAULT_VALUE_TEXTURE_MAPPING_ENABLED
Whether or not to render textures.

See Also:
Constant Field Values

DEFAULT_VALUE_WIREFRAME_MODE_ENABLED

public static final boolean DEFAULT_VALUE_WIREFRAME_MODE_ENABLED
Whether or not to render in only wireframe (GL_LINE) mode.

See Also:
Constant Field Values

DEFAULT_VALUE_GL_ERROR_CHECKS_ENABLED

public static final boolean DEFAULT_VALUE_GL_ERROR_CHECKS_ENABLED
Whether the graphic card should be checked for errors on every call. if there is an error then an exception will be thrown.

See Also:
Constant Field Values

DEFAULT_VALUE_GL_TRACING_ENABLED

public static final boolean DEFAULT_VALUE_GL_TRACING_ENABLED
Whether or not we should turn on the lowest level of graphics card tracing. Very expensive.

See Also:
Constant Field Values
Constructor Detail

RenderOptions

public RenderOptions()
Default constructor uses the default settings for all of the render options.


RenderOptions

public RenderOptions(RenderOptions base)
Creates a new RenderOptions class which mimmics the given RenderOptions.

Parameters:
base - The RenderOptions whose options will be cloned. If it is null then the default options are used.
Method Detail

setGLStatesCacheEnabled

public void setGLStatesCacheEnabled(boolean enabled)
Sets the use GL-states-cache on|off flag.

Parameters:
enabled -

isGLStatesCacheEnabled

public final boolean isGLStatesCacheEnabled()
Returns:
the use GL-states-cache on|off flag.

setLightingEnabled

public void setLightingEnabled(boolean enabled)
Sets the use lights on|off flag.

Parameters:
enabled -

isLightingEnabled

public final boolean isLightingEnabled()
Returns:
the use lights on|off flag.

setVBOsEnabled

public void setVBOsEnabled(boolean enabled)
Sets whether or not to use vertex buffer objects to store vertex data on the video card.

Parameters:
enabled -

areVBOsEnabled

public final boolean areVBOsEnabled()
Returns:
whether or not to use vertex buffer objects to store vertex data on the video card.

setDisplayListsEnabled

public void setDisplayListsEnabled(boolean enabled)
Sets whether or not to use display lists for vertex data drawing.

Parameters:
enabled -

areDisplayListsEnabled

public final boolean areDisplayListsEnabled()
Returns:
whether or not to use display lists for vertex data drawing.

setTextureMappingEnabled

public void setTextureMappingEnabled(boolean enabled)
Sets whether or not to render textures.

Parameters:
enabled -

isTextureMappingEnabled

public final boolean isTextureMappingEnabled()
Returns:
whether or not to render textures.

setWireframeModeEnabled

public void setWireframeModeEnabled(boolean enabled)
Sets whether or not to render in only wireframe (GL_LINE) mode.

Parameters:
enabled -

isWireframeModeEnabled

public final boolean isWireframeModeEnabled()
Returns:
whether or not to render in only wireframe (GL_LINE) mode.

switchWireframeMode

public boolean switchWireframeMode()
Switches wireframe mode.

Returns:
the new state.

setGLErrorChecksEnabled

public void setGLErrorChecksEnabled(boolean enabled)
Sets whether the graphic card should be checked for errors on every call. if there is an error then an exception will be thrown.

Parameters:
enabled -

areGLErrorChecksEnabled

public final boolean areGLErrorChecksEnabled()
Returns:
whether the graphic card should be checked for errors on every call. if there is an error then an exception will be thrown.

setGLTracingEnabled

public void setGLTracingEnabled(boolean enabled)
Sets whether or not we should turn on the lowest level of graphics card tracing. Very expensive.

Parameters:
enabled -

isGLTracingEnabled

public final boolean isGLTracingEnabled()
Returns:
whether or not we should turn on the lowest level of graphics card tracing. Very expensive.

loadDefaultOptions

public void loadDefaultOptions()
Loads the Xith3D default options.


loadOptions

public void loadOptions(RenderOptions renderOptions)
Reads the options from the passed RenderOptions and sets them in this RenderOptions.

Parameters:
renderOptions - The render options that will be cloned by this RenderOptions

exportOptions

public java.util.HashMap<java.lang.String,java.lang.Object> exportOptions()
Populates a HashMap with the options and their values. The values are mapped using their Option enum's name.

Returns:
populated HashMap with Option names mapped to their values

importOptions

public void importOptions(java.util.Map<java.lang.String,java.lang.Object> map)
Sets all options from the given HashMap into the current RenderOptions object. The HashMap is interperated and the values are fed into the setValue methods. Hence, if a non-existant Option is used, a RuntimeException may be thrown.

Parameters:
map - The options to import.