Package renderer.scene
Class Scene
- java.lang.Object
-
- renderer.scene.Scene
-
public final class Scene extends Object
AScenedata structure is aListofPositiondata structures and aCameradata structure.Each
Positionobject represents aModelobject in a distinct position in three-dimensional world space.Each
Modelobject represents a distinct geometric object in the scene.The
Cameraobject 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 aScenewith a default perspectiveCameraobject.Scene(String name)Scene(String name, Camera camera)Scene(String name, Camera camera, List<Position> positionList, boolean debug)Construct aSceneobject with all the given data.Scene(Camera camera)Construct aScenewith the givenCameraobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPosition(Position... pArray)Add aPosition(or Positions) to thisScene.ScenechangeCamera(Camera camera)Create a newScenethat is essentially the same as thisScenebut holding a refernece to the givenCameraobject.ModelgetModelByName(String name)PositiongetPosition(int index)PositiongetPositionByModelName(String name)voidsetPosition(int index, Position position)StringtoString()For debugging.
-
-
-
Constructor Detail
-
Scene
public Scene(String name)
- Parameters:
name-Stringname for thisScene- Throws:
NullPointerException- ifnameisnull
-
Scene
public Scene(Camera camera)
Construct aScenewith the givenCameraobject.- Parameters:
camera-Cameraobject for thisScene- Throws:
NullPointerException- ifcameraisnull
-
Scene
public Scene(String name, Camera camera)
- Parameters:
name-Stringname for thisScenecamera-Cameraobject for thisScene- Throws:
NullPointerException- ifnameisnullNullPointerException- ifcameraisnull
-
Scene
public Scene(String name, Camera camera, List<Position> positionList, boolean debug)
Construct aSceneobject with all the given data.- Parameters:
name-Stringname for thisScenecamera-Cameraobject for thisScenepositionList-ListofPositionobjectsdebug- debug status for thisScene- Throws:
NullPointerException- ifcameraisnullNullPointerException- ifpositionListisnullNullPointerException- ifnameisnull
-
-
Method Detail
-
changeCamera
public Scene changeCamera(Camera camera)
Create a newScenethat is essentially the same as thisScenebut holding a refernece to the givenCameraobject.- Parameters:
camera-Cameraobject for the newScene- Returns:
- a new
Sceneobject holding the givenCameraobject - Throws:
NullPointerException- ifcameraisnull
-
getPosition
public Position getPosition(int index)
- Parameters:
index- index of thePositionto return- Returns:
Positionat the specified index in theListofPositions- 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 thePositionto setposition-Positionobject to place at the specified index in theListofPositions- Throws:
NullPointerException- ifPositionisnullIndexOutOfBoundsException- 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 ofPositions to add to thisScene- Throws:
NullPointerException- if anyPositionisnull
-
getModelByName
public Model getModelByName(String name)
-
getPositionByModelName
public Position getPositionByModelName(String name)
-
-