com.threed.jpct.util
Class SkyBox

java.lang.Object
  extended bycom.threed.jpct.util.SkyBox

public class SkyBox
extends java.lang.Object

Simple skybox class to ease the creation of a standard skybox.


Constructor Summary
SkyBox(float size)
          Creates a new skybox.
SkyBox(java.lang.String left, java.lang.String front, java.lang.String right, java.lang.String back, java.lang.String up, java.lang.String down, float size)
          Creates a new skybox.
 
Method Summary
 void compile()
          Can be used to compile the skybox.
 void dispose()
          Disposes the skybox.
 World getWorld()
          Gets the world that this skybox uses.
 void render(World world, FrameBuffer buffer)
          Renders the skybox.
 void setCenter(SimpleVector trans)
          Sets the center of the skybox.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkyBox

public SkyBox(float size)
Creates a new skybox. This constructor assumes that the textures for front, back, left, right, up and down have already been added to the TextureManager and that their names are equal to their purpose, i.e. the front texture is called "front", the left one "left" and so on.

Parameters:
size - the size of the box. The box will extend in all directions by half the size when viewed from the center.

SkyBox

public SkyBox(java.lang.String left,
              java.lang.String front,
              java.lang.String right,
              java.lang.String back,
              java.lang.String up,
              java.lang.String down,
              float size)
Creates a new skybox. This constructor assumes that the textures for front, back, left, right, up and down have already been added to the TextureManager.

Parameters:
left - the name of the texture for the left side
front - the name of the texture for the front side
right - the name of the texture for the right side
back - the name of the texture for the back side
up - the name of the texture for the up side
down - the name of the texture for the down side
size - the size of the box. The box will extend in all directions by half the size when viewed from the center.
Method Detail

dispose

public void dispose()
Disposes the skybox. It can't be used after this.


getWorld

public World getWorld()
Gets the world that this skybox uses. This might be needed if you want to make additional adjustments to it. By default, it's a default world instance with an ambient light of white. The first object in this world is the sky box.

Returns:
the world

compile

public void compile()
Can be used to compile the skybox.


setCenter

public void setCenter(SimpleVector trans)
Sets the center of the skybox. This can be useful if the scene's center is way off from the origin. Default is the origin.

Parameters:
trans -

render

public void render(World world,
                   FrameBuffer buffer)
Renders the skybox. This should be called before rendering the actual scene or the skybox may overwrite transparent polygons.

Parameters:
world - the world that contains the scene
buffer - the frame buffer