jme.locale.external.feature
Class SkyBox

java.lang.Object
  extended byjme.locale.external.feature.SkyBox
All Implemented Interfaces:
Sky

public class SkyBox
extends java.lang.Object
implements Sky

SkyBox defines a implementation of the sky interface where the sky is defined by a cube with a texture on each of the six faces. The cube is centered at the position of the player. The depth buffer for the skybox is turn off so it will always appear behind any object/locale rendered. The skybox moves with the connected entity.

Version:
$Id: SkyBox.java,v 1.2 2003/09/03 16:20:51 mojomonkey Exp $
Author:
Mark Powell

Field Summary
static int BACK
          Defines the index to the back texture of the skybox
static int BOTTOM
          Defines the index to the bottom texture of the skybox
static int FRONT
          Defines the index to the front texture of the skybox
static int LEFT
          Defines the index to the left texture of the skybox
static int RIGHT
          Defines the index to the right texture of the skybox
static int TOP
          Defines the index to the top texture of the skybox
 
Constructor Summary
SkyBox(float size)
          Constructor creates a new SkyBox object.
 
Method Summary
 float getSize()
          getSize returns the size of the sky box.
 void render()
          render displays the skybox to the viewport.
 void setColor(Vector color)
          setColor sets the color tint of the skybox.
 void setTexture(int side, java.lang.String filename)
          setTexture sets a specified side texture to a given image texture.
 void setTextures(java.lang.String[] textures)
          setTextures takes an array of image file names.
 void update(float time)
          update does nothing, as the skybox is a static display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP

public static final int TOP
Defines the index to the top texture of the skybox

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Defines the index to the bottom texture of the skybox

See Also:
Constant Field Values

LEFT

public static final int LEFT
Defines the index to the left texture of the skybox

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Defines the index to the right texture of the skybox

See Also:
Constant Field Values

FRONT

public static final int FRONT
Defines the index to the front texture of the skybox

See Also:
Constant Field Values

BACK

public static final int BACK
Defines the index to the back texture of the skybox

See Also:
Constant Field Values
Constructor Detail

SkyBox

public SkyBox(float size)
Constructor creates a new SkyBox object. The size of the box is given by the size parameter where the box is centered at (size/2, size/2, size/2).

Parameters:
size - the size of each side of the box.
Method Detail

setTexture

public void setTexture(int side,
                       java.lang.String filename)
setTexture sets a specified side texture to a given image texture. The image will be loaded as a texture and assigned to the proper side.

Parameters:
side - what side to set teh texture to.
filename - the image file to use as the texture.
Throws:
MonkeyRuntimeException - if the side is invalid.

setTextures

public void setTextures(java.lang.String[] textures)
setTextures takes an array of image file names. Each texture is then loaded from the file and set as the corresponding side's texture.

Parameters:
textures - array of texture file names.
Throws:
MonkeyRuntimeException - if the textures array is null or not of size 6.

getSize

public float getSize()
getSize returns the size of the sky box.

Specified by:
getSize in interface Sky
Returns:
the size of a sky box side.

setColor

public void setColor(Vector color)
setColor sets the color tint of the skybox.

Parameters:
color - the tint of the box.

update

public void update(float time)
update does nothing, as the skybox is a static display.

Specified by:
update in interface Sky
Parameters:
time - the time value for frame independant timing.

render

public void render()
render displays the skybox to the viewport. Each side is rendered as a triangle fan with it's normal facing inward.

Specified by:
render in interface Sky