com.jme.scene
Class Skybox

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Node
          extended by com.jme.scene.Skybox
All Implemented Interfaces:
Savable, 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 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
David Bitkowski, Jack Lindamood (javadoc only)
See Also:
Serialized Form

Nested Class Summary
static class Skybox.Face
           
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
Skybox()
           
Skybox(java.lang.String name, float xExtent, float yExtent, float zExtent)
          Creates a new skybox.
 
Method Summary
 Quad getFace(Skybox.Face face)
          Retrieve the quad indicated by the given side.
 Texture getTexture(Skybox.Face face)
           
 void preloadTexture(Skybox.Face face)
           
 void preloadTextures()
          Force all of the textures to load.
 void read(JMEImporter e)
           
 void setTexture(Skybox.Face face, Texture texture)
          Set the texture to be displayed on the given face of the skybox.
 void setTexture(Skybox.Face face, Texture texture, int textureUnit)
          Set the texture to be displayed on the given side of the skybox.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, attachChildAt, childChange, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, findCollisions, findPick, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, hasCollision, lockBounds, lockMeshes, lockShadows, lockTransforms, setModelBound, sortLights, swapChildren, unlockBounds, unlockMeshes, unlockShadows, unlockTransforms, updateModelBound, updateWorldBound, updateWorldData, updateWorldVectors
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBranch, lockMeshes, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBranch, unlockMeshes, updateGeometricState, updateRenderState, updateRenderState, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Constructor Detail

Skybox

public Skybox()

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(Skybox.Face face,
                       Texture texture)
Set the texture to be displayed on the given face of the skybox. Replaces any existing texture on that face.

Parameters:
face - the face to set
texture - The texture for that side to assume.
Throws:
java.lang.IllegalArgumentException - if face is null.

setTexture

public void setTexture(Skybox.Face face,
                       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:
face - the face to set
texture - The texture for that side to assume.
textureUnit - The texture unite of the given side's TextureState the texture will assume.

getTexture

public Texture getTexture(Skybox.Face face)

getFace

public Quad getFace(Skybox.Face face)
Retrieve the quad indicated by the given side.

Parameters:
face - One of Skybox.Face.North, Skybox.Face.South, and so on...
Returns:
The Quad that makes up that side of the Skybox.

preloadTexture

public void preloadTexture(Skybox.Face face)

preloadTextures

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


write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class Node
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class Node
Throws:
java.io.IOException