simogl.effect.fog
Class Fog

java.lang.Object
  extended by simogl.effect.fog.Fog

public class Fog
extends java.lang.Object

This class can be used to represent fog

Author:
Frank Bruns

Constructor Summary
Fog()
          Creates a new Fog object with the following default properties:
Fog mode: EXP Color: RGBA parameters all 1.0f (pure white fog) Density: 1.0f Start/End: 0.0f/1.0f Remember to enable the use of fog with the setEnabled()-method, because it is disabled by default
Fog(float red, float green, float blue, float alpha, float start, float end)
          Creates a new Fog object with the specified parameters.
 
Method Summary
 void draw(javax.media.opengl.GL gl)
           
 float[] getColor()
          Returns the RGBA color of the fog as an array of four values
 float getDensity()
          Returns the fog's density
 float getEnd()
          Returns the end position of the fog
 float getStart()
          Returns the fog's start position
 boolean isInExp2Mode()
          Returns whether exp2 fog mode is active
 boolean isInExpMode()
          Returns whether exp fog mode is active
 boolean isInLinearMode()
          Returns whether linear fog mode is active
 void setColor(float red, float green, float blue, float alpha)
          Sets the RGBA color of the fog to the specified values
 void setDensity(int density)
          Sets the fog's density.
 void setEnabled(boolean enableFog)
          Specifies whether the fog shall be enabled or disabled.
 void setEnd(float end)
          Sets the end position of the fog
 void setStart(float start)
          Sets the start position of the fog
 void setStartAndEnd(float start, float end)
          Sets the start and end position of the fog
 void setToExp2Mode()
          Sets the fog mode to exp2 fog mode.
 void setToExpMode()
          Sets the fog mode to exp fog mode.
 void setToLinearMode()
          Sets the fog mode to linear fog mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fog

public Fog()
Creates a new Fog object with the following default properties:
Remember to enable the use of fog with the setEnabled()-method, because it is disabled by default


Fog

public Fog(float red,
           float green,
           float blue,
           float alpha,
           float start,
           float end)
Creates a new Fog object with the specified parameters. Usually at most one Fog object of this type is needed in the whole application.
Remember to enable the use of fog with the setEnabled()-method, because it is disabled by default

Parameters:
red - amount of red
green - amount of green
blue - amount of blue
alpha - alpha value
start - start position of the fog
end - end position of the fog
Method Detail

setColor

public void setColor(float red,
                     float green,
                     float blue,
                     float alpha)
Sets the RGBA color of the fog to the specified values

Parameters:
red - amount of red
green - amount of green
blue - amount of blue
alpha - alpha value

getColor

public float[] getColor()
Returns the RGBA color of the fog as an array of four values

Returns:
RGBA color of the fog

setEnabled

public void setEnabled(boolean enableFog)
Specifies whether the fog shall be enabled or disabled.

Parameters:
enableFog - enable fog? --> true = yes, false = no

setStart

public void setStart(float start)
Sets the start position of the fog

Parameters:
start - fog's start position

getStart

public float getStart()
Returns the fog's start position

Returns:
fog's start position

setEnd

public void setEnd(float end)
Sets the end position of the fog

Parameters:
end - the fog's end position

getEnd

public float getEnd()
Returns the end position of the fog

Returns:
the fog's end position

setStartAndEnd

public void setStartAndEnd(float start,
                           float end)
Sets the start and end position of the fog

Parameters:
start - start position
end - end position

setDensity

public void setDensity(int density)
Sets the fog's density. The default value is 1.0f. Reasonable values for linear fog mode are around 0.5f and around 0.005f for exp fog mode.

Parameters:
density - density value for the fog

getDensity

public float getDensity()
Returns the fog's density

Returns:
density value of the fog

setToLinearMode

public void setToLinearMode()
Sets the fog mode to linear fog mode. If you switch to this mode the fog density value is set to 0.5f, because it is a reasonable start value for it.


isInLinearMode

public boolean isInLinearMode()
Returns whether linear fog mode is active

Returns:
is linear mode active? --> true = yes, false = no

setToExpMode

public void setToExpMode()
Sets the fog mode to exp fog mode. This is the default fog mode. If you switch to this mode the fog density value is set to 0.005f, because it is a reasonable start value for it.


isInExpMode

public boolean isInExpMode()
Returns whether exp fog mode is active

Returns:
is exp mode active? --> true = yes, false = no

setToExp2Mode

public void setToExp2Mode()
Sets the fog mode to exp2 fog mode. If you switch to this mode the fog density value is set to 0.005f, because it is a reasonable start value for it.


isInExp2Mode

public boolean isInExp2Mode()
Returns whether exp2 fog mode is active

Returns:
is exp2 mode active? --> true = yes, false = no

draw

public void draw(javax.media.opengl.GL gl)