net.jinx.video
Class Options

java.lang.Object
  extended by net.jinx.video.Options
Direct Known Subclasses:
ModelContext

public class Options
extends java.lang.Object

Holds flags and other attributes for rendering. Unlike Hierarchy, the attributes are stored in their native form and have individual methods to handle each. There are also a pair of methods for pushing and poping values from an internal stack. This can be handy for hierarchical 3D objects that require different settings for each part.

API Stability: Stable.


Constructor Summary
protected Options()
          Constructs a new Options object.
 
Method Summary
 float getAlpha()
          Provides the current alpha transparency value.
 java.awt.Color getAWTClearColor()
          Provides the clear color as a java.awt.Color.
 float[] getClearColor()
          Provides the clear color that is used to clear the color buffer.
 double getFarClip()
          Provides the value of the far clipping plane.
 double getFOV()
          Provides the angle for the field of view.
 float[] getGlobalAmbientLight()
          Provides the global ambient light color.
 double getNearClip()
          Provides the value of the near clipping plane.
 boolean getSmoothness()
          Indicates whether or not objects should be rendered as smooth or flat shaded.
 boolean getSolidity()
          Indicates whether or not objects should be rendered as solid or wire frames.
 int getTextureMode()
          Provides the value of the current texture mode.
 java.lang.String getTextureModeName()
          Provides the texture mode name for the value of the current texture mode attribute.
 boolean getTwosidedness()
          Indicates whether or not polygons should be rendered as one or two sided.
 boolean getUseLists()
          Indicates whether or not display lists should be used.
 boolean isAmbient()
          Indicates whether or not ambient color should be used.
 boolean isCountingFrames()
          Indicates whether or not frames should be counted.
 boolean isDebuggingGL()
          Indicates whether or not the OpenGL pipeline should be debugged.
 boolean isDiffuse()
          Indicates whether or not diffuse color should be used.
 boolean isEmissive()
          Indicates whether or not emissive color should be used.
 boolean isShiny()
          Indicates whether or not the shininess color component should be used.
 boolean isSpecular()
          Indicates whether or not specular color should be used.
 boolean isTracingGL()
          Indicates whether or not the OpenGL pipeline should be traced.
 void load(net.jinx.db.Hierarchy h)
          Configures this Context object using the given Hierarchy.
 void pop()
          Restores the state of this Context object from it's internal stack.
 void push()
          Pushes the current state of this Context object onto it's own internal stack.
 void setAlpha(float alpha)
          Allows setting the current alpha transparency value.
 void setAmbient(boolean ambient)
          Allows setting whether or not ambient color should be used.
 void setClearColor(float[] clearColor)
          Sets the clear color that is used to clear the color buffer.
 void setCountingFrames(boolean countframes)
          Allows setting whether or not frames should be counted.
 void setDebugGL(boolean debuggl)
          Allows setting whether or not the OpenGL pipeline should be debugged.
 void setDiffuse(boolean diffuse)
          Allows setting whether or not diffuse color should be used.
 void setEmissive(boolean emissive)
          Allows setting whether or not emissive color should be used.
 void setFarClip(double far)
          Sets the far clipping plane.
 void setFOV(double fov)
          Allows setting the angle for the field of view.
 void setGlobalAmbientLight(float[] globalAmbient)
          Sets the global ambient light color.
 void setNearClip(double near)
          Sets the near clipping plane.
 void setShininess(boolean shininess)
          Allows setting whether or not the shininess color component should be used.
 void setSmoothness(boolean smooth)
          Allows setting whether or not objects should be rendered as smooth or flat shaded.
 void setSolidity(boolean solid)
          Allows setting whether or not objects should be rendered as solid or not.
 void setSpecular(boolean specular)
          Allows setting whether or not specular color should be used.
 void setTextureMode(int textureMode)
          Sets the texture mode attribute.
 void setTextureModeName(java.lang.String modeName)
          Sets the texture mode attribute based on the given String.
 void setTraceGL(boolean tracegl)
          Allows setting whether or not the OpenGL pipeline should be traced.
 void setTwosidedness(boolean twoside)
          Allows setting whether or not objects should be rendered as one or two sided.
 void setUseLists(boolean uselists)
          Allows setting whether or not display lists should be used.
 void store(net.jinx.db.Hierarchy h)
          Stores this Context object's flags into the given Hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Options

protected Options()
Constructs a new Options object.

Method Detail

isDebuggingGL

public boolean isDebuggingGL()
Indicates whether or not the OpenGL pipeline should be debugged.

Returns:
true if the OpenGL pipeline should be debugged.

setDebugGL

public void setDebugGL(boolean debuggl)
Allows setting whether or not the OpenGL pipeline should be debugged.

Parameters:
debuggl - true if the OpenGL pipeline should be debugged.

isTracingGL

public boolean isTracingGL()
Indicates whether or not the OpenGL pipeline should be traced.

Returns:
true if the OpenGL pipeline should be traced.

setTraceGL

public void setTraceGL(boolean tracegl)
Allows setting whether or not the OpenGL pipeline should be traced.

Parameters:
tracegl - true if the OpenGL pipeline should be traced.

setFOV

public void setFOV(double fov)
Allows setting the angle for the field of view.

Parameters:
fov - the angle.

getFOV

public double getFOV()
Provides the angle for the field of view.

Returns:
the angle.

setNearClip

public void setNearClip(double near)
Sets the near clipping plane.

Parameters:
near - the value for the near clipping plane.

getNearClip

public double getNearClip()
Provides the value of the near clipping plane.

Returns:
the clipping plane value.

setFarClip

public void setFarClip(double far)
Sets the far clipping plane.

Parameters:
far - the value for the far clipping plane.

getFarClip

public double getFarClip()
Provides the value of the far clipping plane.

Returns:
the clipping plane value.

setAmbient

public void setAmbient(boolean ambient)
Allows setting whether or not ambient color should be used.

Parameters:
ambient - true if ambient color should be used.

isAmbient

public boolean isAmbient()
Indicates whether or not ambient color should be used.

Returns:
true if ambient color should be used.

setDiffuse

public void setDiffuse(boolean diffuse)
Allows setting whether or not diffuse color should be used.

Parameters:
diffuse - true if diffuse color should be used.

isDiffuse

public boolean isDiffuse()
Indicates whether or not diffuse color should be used.

Returns:
true if diffuse color should be used.

setSpecular

public void setSpecular(boolean specular)
Allows setting whether or not specular color should be used.

Parameters:
specular - true if specular color should be used.

isSpecular

public boolean isSpecular()
Indicates whether or not specular color should be used.

Returns:
true if specular color should be used.

setEmissive

public void setEmissive(boolean emissive)
Allows setting whether or not emissive color should be used.

Parameters:
emissive - true if emissive color should be used.

isEmissive

public boolean isEmissive()
Indicates whether or not emissive color should be used.

Returns:
true if emissive color should be used.

setShininess

public void setShininess(boolean shininess)
Allows setting whether or not the shininess color component should be used.

Parameters:
shininess - true if the shininess color component should be used.

isShiny

public boolean isShiny()
Indicates whether or not the shininess color component should be used.

Returns:
true if the shininess color component should be used.

getSolidity

public boolean getSolidity()
Indicates whether or not objects should be rendered as solid or wire frames.

Returns:
true if objects should be solid.

setSolidity

public void setSolidity(boolean solid)
Allows setting whether or not objects should be rendered as solid or not.

Parameters:
solid - if true, solid; if false, wire frame.

getSmoothness

public boolean getSmoothness()
Indicates whether or not objects should be rendered as smooth or flat shaded.

Returns:
true if objects should be smooth.

setSmoothness

public void setSmoothness(boolean smooth)
Allows setting whether or not objects should be rendered as smooth or flat shaded.

Parameters:
smooth - if true, smooth; if false, flat shaded.

getTwosidedness

public boolean getTwosidedness()
Indicates whether or not polygons should be rendered as one or two sided.

Returns:
true if objects should be two sided.

setTwosidedness

public void setTwosidedness(boolean twoside)
Allows setting whether or not objects should be rendered as one or two sided.

Parameters:
twoside - two sided if true; if false, one sided.

getUseLists

public boolean getUseLists()
Indicates whether or not display lists should be used.

Returns:
true if display lists should be used.

setUseLists

public void setUseLists(boolean uselists)
Allows setting whether or not display lists should be used.

Parameters:
uselists - if true display lists should be used.

isCountingFrames

public boolean isCountingFrames()
Indicates whether or not frames should be counted.

Returns:
true if frames should be counted.

setCountingFrames

public void setCountingFrames(boolean countframes)
Allows setting whether or not frames should be counted.

Parameters:
countframes - true indicates frames will be counted; false means that they won't be counted.

getAlpha

public float getAlpha()
Provides the current alpha transparency value.

Returns:
the alpha value as a normalized float (zero to one).

setAlpha

public void setAlpha(float alpha)
Allows setting the current alpha transparency value. This is multiplied by whatever alpha value may have been specified for an object, allowing both per-vertex and per-model alpha effects.

Parameters:
alpha - the alpha value as a float. This value will be clamped between zero and one.

getGlobalAmbientLight

public float[] getGlobalAmbientLight()
Provides the global ambient light color. The returned array is a length four array representing an RGBA color.

Returns:
the array.

setGlobalAmbientLight

public void setGlobalAmbientLight(float[] globalAmbient)
Sets the global ambient light color.

Parameters:
globalAmbient - the array of color data. It must be length four.

getClearColor

public float[] getClearColor()
Provides the clear color that is used to clear the color buffer. The returned array is a length four array representing an RGBA color.

Returns:
the array.

getAWTClearColor

public java.awt.Color getAWTClearColor()
Provides the clear color as a java.awt.Color.

Returns:
the color.

setClearColor

public void setClearColor(float[] clearColor)
Sets the clear color that is used to clear the color buffer.

Parameters:
clearColor - the array of color data. It must be length four.

getTextureMode

public int getTextureMode()
Provides the value of the current texture mode.

Returns:
the current texture mode value.

getTextureModeName

public java.lang.String getTextureModeName()
Provides the texture mode name for the value of the current texture mode attribute.

Returns:
the texture mode name.

setTextureMode

public void setTextureMode(int textureMode)
Sets the texture mode attribute.

Parameters:
textureMode - this must be one of GL_MODULATE, GL_REPLACE, GL_BLEND, or GL_DECAL from the net.java.games.jogl.GL interface.

setTextureModeName

public void setTextureModeName(java.lang.String modeName)
Sets the texture mode attribute based on the given String.

Parameters:
modeName - the name of the mode to use. Must be one of "modulate", "mod", "replace", "rep", "blend", "decal", or "dec".
Throws:
java.lang.IllegalArgumentException - if the String is not one of the specified Strings.
NullPointeException - if modeName is null.

load

public void load(net.jinx.db.Hierarchy h)
Configures this Context object using the given Hierarchy. If an attribute is missing, the current value is used.

Parameters:
h - the Hierarchy.

store

public void store(net.jinx.db.Hierarchy h)
Stores this Context object's flags into the given Hierarchy.

Parameters:
h - the Hierarchy.

push

public void push()
Pushes the current state of this Context object onto it's own internal stack. Can be restored by pop().


pop

public void pop()
Restores the state of this Context object from it's internal stack.