com.brackeen.javagamebook.bsp2D
Class RoomDef

java.lang.Object
  extended bycom.brackeen.javagamebook.bsp2D.RoomDef

public class RoomDef
extends java.lang.Object

The RoomDef class represents a convex room with walls, a floor, and a ceiling. The floor may be above the ceiling, in which case the RoomDef is a "pillar" or "block" structure, rather than a "room". RoomDefs are used as a shortcut to create the actual BSPPolygons used in the 2D BSP tree.


Constructor Summary
RoomDef()
          Creates a new RoomDef with an ambient light intensity of 0.5.
RoomDef(float ambientLightIntensity)
          Creates a new RoomDef with the specified ambient light intensity.
 
Method Summary
 void addVertex(float x, float z, float bottom, float top, Texture texture)
          Adds a new wall vertex at the specified (x,z) location, with the specified texture, bottom location, and top location.
 void addVertex(float x, float z, float bottom, float top, Texture texture, Rectangle3D texBounds)
          Adds a new wall vertex at the specified (x,z) location, with the specified texture, texture bounds, bottom location, and top location.
 void addVertex(float x, float z, Texture texture)
          Adds a new wall vertex at the specified (x,z) location, with the specified texture.
 java.util.List createHorizontalPolygons()
          Creates and returns a list of BSPPolygons that represent the horizontal floor and ceiling of this room.
 java.util.List createPolygons()
          Creates and returns a list of BSPPolygons that represent the walls, floor, and ceiling of this room.
 java.util.List createVerticalPolygons()
          Creates and returns a list of BSPPolygons that represent the vertical walls of this room.
 void setCeil(float height, Texture texture)
          Sets the ceiling height and ceiling texture of this room.
 void setCeil(float height, Texture texture, Rectangle3D texBounds)
          Sets the ceiling height, ceiling texture, and ceiling texture bounds of this room.
 void setFloor(float height, Texture texture)
          Sets the floor height and floor texture of this room.
 void setFloor(float height, Texture texture, Rectangle3D texBounds)
          Sets the floor height, floor texture, and floor texture bounds of this room.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoomDef

public RoomDef()
Creates a new RoomDef with an ambient light intensity of 0.5. The walls, floors and ceiling all use this ambient light intensity.


RoomDef

public RoomDef(float ambientLightIntensity)
Creates a new RoomDef with the specified ambient light intensity. The walls, floors and ceiling all use this ambient light intensity.

Method Detail

addVertex

public void addVertex(float x,
                      float z,
                      Texture texture)
Adds a new wall vertex at the specified (x,z) location, with the specified texture. The wall stretches from the floor to the ceiling. If the texture is null, no polygon for the wall is created.


addVertex

public void addVertex(float x,
                      float z,
                      float bottom,
                      float top,
                      Texture texture)
Adds a new wall vertex at the specified (x,z) location, with the specified texture, bottom location, and top location. If the texture is null, no polygon for the wall is created.


addVertex

public void addVertex(float x,
                      float z,
                      float bottom,
                      float top,
                      Texture texture,
                      Rectangle3D texBounds)
Adds a new wall vertex at the specified (x,z) location, with the specified texture, texture bounds, bottom location, and top location. If the texture is null, no polygon for the wall is created.


setFloor

public void setFloor(float height,
                     Texture texture)
Sets the floor height and floor texture of this room. If the texture is null, no floor polygon is created, but the height of the floor is used as the default bottom wall boundary.


setFloor

public void setFloor(float height,
                     Texture texture,
                     Rectangle3D texBounds)
Sets the floor height, floor texture, and floor texture bounds of this room. If the texture is null, no floor polygon is created, but the height of the floor is used as the default bottom wall boundary. If the texture bounds is null, a default texture bounds is used.


setCeil

public void setCeil(float height,
                    Texture texture)
Sets the ceiling height and ceiling texture of this room. If the texture is null, no ceiling polygon is created, but the height of the ceiling is used as the default top wall boundary.


setCeil

public void setCeil(float height,
                    Texture texture,
                    Rectangle3D texBounds)
Sets the ceiling height, ceiling texture, and ceiling texture bounds of this room. If the texture is null, no floor polygon is created, but the height of the floor is used as the default bottom wall boundary. If the texture bounds is null, a default texture bounds is used.


createPolygons

public java.util.List createPolygons()
Creates and returns a list of BSPPolygons that represent the walls, floor, and ceiling of this room.


createVerticalPolygons

public java.util.List createVerticalPolygons()
Creates and returns a list of BSPPolygons that represent the vertical walls of this room.


createHorizontalPolygons

public java.util.List createHorizontalPolygons()
Creates and returns a list of BSPPolygons that represent the horizontal floor and ceiling of this room.