Package com.ijurnove.cpu3d
Class Scene
java.lang.Object
com.ijurnove.cpu3d.Scene
A
Scene consists of a set of Shape3ds, a set of Lights, and a Camera.
Scenes have two sets of flags, one which can be modified at any time, and one which can only be set at
initialization. These are stored as a SceneFlags object and a SceneInitFlags object respectively.
To render a Scene, use the render() method.
-
Constructor Summary
ConstructorsConstructorDescriptionScene(SceneInitFlags initFlags) Constructs an emptyScenewith the specifiedSceneInitFlags.Scene(SceneInitFlags initFlags, Shape3d[] shapes, Light[] lights, Camera viewCamera) Constructs a Scene with a specified SceneInitFlags, Shape3d[], Light[], and Camera. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a specified Light to this Scene.voidAdds a specified Shape3d to this Scene.protected com.ijurnove.cpu3d.ColorMapdoubleReturns the value of a specified SceneFlag.final doublegetInitFlag(SceneInitFlag flag) Returns the value of a specified SceneInitFlag.getLight(int index) Returns the Light at a specified index.protected intprotected intgetShape(int index) Returns the Shape3d at a specified index.Returns the Camera that this Scene is rendered from.intReturns the number of Lights in this Scene.protected voidorthoProjection(Camera orthoCam) protected voidperspProjectionForPointShadowMap(Camera perspCam) protected voidrender()Renders this Scene from the perspective of its Camera.voidsetBackground(int[] rgb) Sets the background color of this Scene.voidSets a SceneFlag to a given value.voidsetViewCamera(Camera viewCamera) Sets the Camera of this Scene.intReturns the number of Shape3ds in this Scene.protected void
-
Constructor Details
-
Scene
Constructs an emptyScenewith the specifiedSceneInitFlags.- Parameters:
initFlags- the specified SceneInitFlags
-
Scene
Constructs a Scene with a specified SceneInitFlags, Shape3d[], Light[], and Camera.- Parameters:
initFlags- the specified SceneInitFlagsshapes- the specified Shape3d[]lights- the specified Light[]viewCamera- the specified Camera from which the Scene will be rendered
-
-
Method Details
-
getShape
Returns the Shape3d at a specified index.- Parameters:
index- the index of the Shape3d- Returns:
- the Shape3d at the specified index
-
getLight
Returns the Light at a specified index.- Parameters:
index- the index of the Light- Returns:
- the Light at the specified index
-
getViewCamera
Returns the Camera that this Scene is rendered from.- Returns:
- the Camera that this Scene is rendered from
-
getInitFlag
Returns the value of a specified SceneInitFlag.- Parameters:
flag- the specified SceneInitFlag- Returns:
- the value of the specified SceneInitFlag
-
shapeCount
public int shapeCount()Returns the number of Shape3ds in this Scene.- Returns:
- the number of Shape3ds in this Scene
-
lightCount
public int lightCount()Returns the number of Lights in this Scene.- Returns:
- the number of Lights in this Scene
-
getColorMap
protected com.ijurnove.cpu3d.ColorMap getColorMap() -
getPixelWidth
protected int getPixelWidth() -
getPixelHeight
protected int getPixelHeight() -
getShapes
-
getLights
-
addLight
Adds a specified Light to this Scene.- Parameters:
light- the specified Light
-
addShape
Adds a specified Shape3d to this Scene.- Parameters:
shape- the specified Shape3d
-
setViewCamera
Sets the Camera of this Scene.- Parameters:
viewCamera- the specified Camera
-
setFlag
Sets a SceneFlag to a given value.- Parameters:
flag- the specified SceneFlagvalue- the new value
-
getFlag
Returns the value of a specified SceneFlag.- Parameters:
flag- the specified SceneFlag- Returns:
- the value of the specified SceneFlag
-
setBackground
public void setBackground(int[] rgb) Sets the background color of this Scene.- Parameters:
rgb- the RGB color values to set. values range from 0-255
-
project
-
perspProjectionForPointShadowMap
-
orthoProjection
-
updateShadows
protected void updateShadows() -
render
Renders this Scene from the perspective of its Camera. Returns a BufferedImage with dimensions specified in the SceneInitFlags.- Returns:
- the rendered Scene as a BufferedImage
-