SGBackground
Class Sky

java.lang.Object
  extended by SGBackground.Background
      extended by SGBackground.Sky

public class Sky
extends Background


Field Summary
 float phiS
          Angle in radians to the sun vector from the south pole.
 float thetaS
          Angle in radians from the zenith to the sun vector.
 Tuple.Tuple3f toSun
          Tuple3f pointing to the sun.
 
Constructor Summary
Sky(processing.core.PApplet parent, SGCamera.SGCamera cam)
           
Sky(processing.core.PApplet parent, SGCamera.SGCamera cam, int mode)
          Creates a new instance of Sky
 
Method Summary
 int clearSky(Tuple.Tuple3f dir)
          Return the color of the sky for an angle in the sky.
 void draw()
          Render the background with default resolution.
 void draw(int res)
          Renders the background at a set resolution.
 float getTurbidity()
           
 int overcast(Tuple.Tuple3f dir)
          Returns the sky color for a patch of sky using the CIE overcast sky model
 void setMode(int mode)
           
 void setSunByTime(float latitude, float longitude, int julianDay, float timeOfDay, float standardMeridian)
          Sets the position of the sun using an earth position and time.
 void setSunVector(float theta, float phi)
          Set the sun vector using explicit spherical angles
 void setTurbidity(float turbidity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toSun

public Tuple.Tuple3f toSun
Tuple3f pointing to the sun.


thetaS

public float thetaS
Angle in radians from the zenith to the sun vector.


phiS

public float phiS
Angle in radians to the sun vector from the south pole.

Constructor Detail

Sky

public Sky(processing.core.PApplet parent,
           SGCamera.SGCamera cam)
Parameters:
parent -
cam -

Sky

public Sky(processing.core.PApplet parent,
           SGCamera.SGCamera cam,
           int mode)
Creates a new instance of Sky

Parameters:
parent -
cam - Sky will be rendered to fill the view frustum of this camera.
mode - Mode 0 = CIE overcast sky model Mode 1 = Preetham daylight sky model
Method Detail

setMode

public void setMode(int mode)

setTurbidity

public void setTurbidity(float turbidity)

getTurbidity

public float getTurbidity()

draw

public void draw()
Render the background with default resolution.

Specified by:
draw in class Background

draw

public void draw(int res)
Renders the background at a set resolution. Resolution is points per axis, so N^2 points will be sampled.

Parameters:
res - Points per axis to sample. Higher is better, but cost is N^2.

clearSky

public int clearSky(Tuple.Tuple3f dir)
Return the color of the sky for an angle in the sky.

Parameters:
dir - Sky direction to sample
Returns:
int color of the sky. Will be tonemapped using an exponential operator

overcast

public int overcast(Tuple.Tuple3f dir)
Returns the sky color for a patch of sky using the CIE overcast sky model

Parameters:
dir - Sky direction to sample
Returns:
int color of the sky. WIll be tonemapped using an exponential operator

setSunVector

public void setSunVector(float theta,
                         float phi)
Set the sun vector using explicit spherical angles

Parameters:
theta - Angle from the zenith to the sun in radians. Must be 0-PI.
phi - Angle between the sun vector and the south vector in radians.

setSunByTime

public void setSunByTime(float latitude,
                         float longitude,
                         int julianDay,
                         float timeOfDay,
                         float standardMeridian)
Sets the position of the sun using an earth position and time.

Parameters:
latitude -
longitude -
julianDay -
timeOfDay -
standardMeridian -