com.jme.scene
Class Skybox

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Node
          extended bycom.jme.scene.Skybox
All Implemented Interfaces:
java.io.Serializable

public class Skybox
extends Node

A Box made of textured quads that simulate having a sky, horizon and so forth around your scene. Either attach to a camera node or update on each frame to set this skybox at the camera's position.

Version:
$Id: Skybox.java,v 1.6 2004/09/14 21:52:11 mojomonkey Exp $
Author:
David Bitkowski, Jack Lindamood (javadoc only)
See Also:
Serialized Form

Field Summary
static int DOWN
          The -Y side of the skybox.
static int EAST
          The -X side of the skybox.
static int NORTH
          The +Z side of the skybox.
static int SOUTH
          The -Z side of the skybox.
static int UP
          The +Y side of the skybox.
static int WEST
          The +X side of the skybox.
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
Skybox(java.lang.String name, float xExtent, float yExtent, float zExtent)
          Creates a new skybox.
 
Method Summary
 Quad getSide(int direction)
          Retrieve the quad indicated by the given side.
 void preloadTextures()
          Force all of the textures to load.
 void setTexture(int direction, Texture texture)
          Set the texture to be displayed on the given side of the skybox.
 void setTexture(int direction, Texture texture, int textureUnit)
          Set the texture to be displayed on the given side of the skybox.
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, drawBounds, findCollisions, findPick, getChild, getChild, getChildren, getQuantity, hasChild, hasCollision, putClone, setChild, setForceView, updateCollisionTree, updateWorldBound, updateWorldData
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORTH

public static final int NORTH
The +Z side of the skybox.

See Also:
Constant Field Values

SOUTH

public static final int SOUTH
The -Z side of the skybox.

See Also:
Constant Field Values

EAST

public static final int EAST
The -X side of the skybox.

See Also:
Constant Field Values

WEST

public static final int WEST
The +X side of the skybox.

See Also:
Constant Field Values

UP

public static final int UP
The +Y side of the skybox.

See Also:
Constant Field Values

DOWN

public static final int DOWN
The -Y side of the skybox.

See Also:
Constant Field Values
Constructor Detail

Skybox

public Skybox(java.lang.String name,
              float xExtent,
              float yExtent,
              float zExtent)
Creates a new skybox. The size of the skybox and name is specified here. By default, no textures are set.

Parameters:
name - The name of the skybox.
xExtent - The x size of the skybox in both directions from the center.
yExtent - The y size of the skybox in both directions from the center.
zExtent - The z size of the skybox in both directions from the center.
Method Detail

setTexture

public void setTexture(int direction,
                       Texture texture)
Set the texture to be displayed on the given side of the skybox. Replaces any existing texture on that side.

Parameters:
direction - One of Skybox.NORTH, Skybox.SOUTH, and so on...
texture - The texture for that side to assume.

setTexture

public void setTexture(int direction,
                       Texture texture,
                       int textureUnit)
Set the texture to be displayed on the given side of the skybox. Only replaces the texture at the index specified by textureUnit.

Parameters:
direction - One of Skybox.NORTH, Skybox.SOUTH, and so on...
texture - The texture for that side to assume.
textureUnit - The texture unite of the given side's TextureState the texture will assume.

getSide

public Quad getSide(int direction)
Retrieve the quad indicated by the given side.

Parameters:
direction - One of Skybox.NORTH, Skybox.SOUTH, and so on...
Returns:
The Quad that makes up that side of the Skybox.

preloadTextures

public void preloadTextures()
Force all of the textures to load. This prevents pauses later during the application as you pan around the world.