Package renderer.scene
Class Scene
- java.lang.Object
-
- renderer.scene.Scene
-
public final class Scene extends Object
AScene
data structure is aList
ofPosition
data structures and aCamera
data structure.Each
Position
object represents aModel
object in a distinct position in three-dimensional camera space.Each
Model
object represents a distinct geometric object in the scene.The
Camera
object determines a "view volume", which determines how much of the scene is actually visible (to the camera) and gets rendered into the framebuffer.
-
-
Constructor Summary
Constructors Constructor Description Scene()
Construct aScene
with a default perspectiveCamera
object.Scene(String name)
Scene(String name, Camera camera)
Scene(String name, Camera camera, List<Position> positionList, boolean debug)
Construct aScene
object with all the given data.Scene(Camera camera)
Construct aScene
with the givenCamera
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPosition(Position... pArray)
Add aPosition
(or Positions) to thisScene
.Scene
changeCamera(Camera camera)
Create a newScene
that is essentially the same as thisScene
but holding a refernece to the givenCamera
object.Model
getModelByName(String name)
Position
getPosition(int index)
Position
getPositionByModelName(String name)
void
setPosition(int index, Position position)
String
toString()
For debugging.
-
-
-
Constructor Detail
-
Scene
public Scene(String name)
- Parameters:
name
-String
name for thisScene
- Throws:
NullPointerException
- ifname
isnull
-
Scene
public Scene(Camera camera)
Construct aScene
with the givenCamera
object.- Parameters:
camera
-Camera
object for thisScene
- Throws:
NullPointerException
- ifcamera
isnull
-
Scene
public Scene(String name, Camera camera)
- Parameters:
name
-String
name for thisScene
camera
-Camera
object for thisScene
- Throws:
NullPointerException
- ifname
isnull
NullPointerException
- ifcamera
isnull
-
Scene
public Scene(String name, Camera camera, List<Position> positionList, boolean debug)
Construct aScene
object with all the given data.- Parameters:
name
-String
name for thisScene
camera
-Camera
object for thisScene
positionList
-List
ofPosition
objectsdebug
- debug status for thisScene
- Throws:
NullPointerException
- ifcamera
isnull
NullPointerException
- ifpositionList
isnull
NullPointerException
- ifname
isnull
-
-
Method Detail
-
changeCamera
public Scene changeCamera(Camera camera)
Create a newScene
that is essentially the same as thisScene
but holding a refernece to the givenCamera
object.- Parameters:
camera
-Camera
object for the newScene
- Returns:
- a new
Scene
object holding the givenCamera
object - Throws:
NullPointerException
- ifcamera
isnull
-
getPosition
public Position getPosition(int index)
- Parameters:
index
- index of thePosition
to return- Returns:
Position
at the specified index in theList
ofPosition
s- Throws:
IndexOutOfBoundsException
- if the index is out of range(index < 0 || index >= size())
-
setPosition
public void setPosition(int index, Position position)
- Parameters:
index
- index of thePosition
to setposition
-Position
object to place at the specified index in theList
ofPosition
s- Throws:
NullPointerException
- ifPosition
isnull
IndexOutOfBoundsException
- if the index is out of range(index < 0 || index >= size())
-
addPosition
public void addPosition(Position... pArray)
Add aPosition
(or Positions) to thisScene
.- Parameters:
pArray
- array ofPosition
s to add to thisScene
- Throws:
NullPointerException
- if anyPosition
isnull
-
getModelByName
public Model getModelByName(String name)
-
getPositionByModelName
public Position getPositionByModelName(String name)
-
-