org.sunflow.core

Class Scene


public class Scene
extends java.lang.Object

Represents a entire scene, defined as a collection of instances viewed by a camera.

Constructor Summary

Scene()
Creates an empty scene.

Method Summary

boolean
calculatePhotons(PhotonStore map, String type, int seed)
Create a photon map as prescribed by the given PhotonStore.
BoundingBox
getBounds()
Get scene world space bounding box.
ShadingState
getRadiance(IntersectionState istate, float rx, float ry, double lensU, double lensV, double time, int instance)
Get the radiance seen through a particular pixel
int
getThreadPriority()
Get the priority level to assign to multi-threaded operations.
int
getThreads()
Get number of allowed threads for multi-threaded operations.
void
render(Options options, ImageSampler sampler, Display display)
Render the scene using the specified options, image sampler and display.
void
setBakingInstance(Instance instance)
The provided instance will be considered for lightmap baking.
void
setCamera(Camera camera)
Sets the current camera (no support for multiple cameras yet).
void
setInstanceLists(Instance[] instances, Instance[] infinite)
Update the instance lists for this scene.
void
setLightList(LightSource[] lights)
Update the light list for this scene.
void
setShaderOverride(Shader shader, boolean photonOverride)
Enables shader overiding (set null to disable).

Constructor Details

Scene

public Scene()
Creates an empty scene.

Method Details

calculatePhotons

public boolean calculatePhotons(PhotonStore map,
                                String type,
                                int seed)
Create a photon map as prescribed by the given PhotonStore.
Parameters:
map - object that will recieve shot photons
type - type of photons being shot
seed - QMC seed parameter
Returns:
true upon success

getBounds

public BoundingBox getBounds()
Get scene world space bounding box.
Returns:
scene bounding box

getRadiance

public ShadingState getRadiance(IntersectionState istate,
                                float rx,
                                float ry,
                                double lensU,
                                double lensV,
                                double time,
                                int instance)
Get the radiance seen through a particular pixel
Parameters:
istate - intersection state for ray tracing
rx - pixel x coordinate
ry - pixel y coordinate
lensU - DOF sampling variable
lensV - DOF sampling variable
time - motion blur sampling variable
instance - QMC instance seed
Returns:
a shading state for the intersected primitive, or null if nothing is seen through the specifieFd point

getThreadPriority

public int getThreadPriority()
Get the priority level to assign to multi-threaded operations.
Returns:
thread priority

getThreads

public int getThreads()
Get number of allowed threads for multi-threaded operations.
Returns:
number of threads that can be started

render

public void render(Options options,
                   ImageSampler sampler,
                   Display display)
Render the scene using the specified options, image sampler and display.
Parameters:
options - rendering options object
sampler - image sampler
display - display to send the final image to, a default display will be created if null

setBakingInstance

public void setBakingInstance(Instance instance)
The provided instance will be considered for lightmap baking. If the specified instance is null, lightmap baking will be disabled and normal rendering will occur.
Parameters:
instance - instance to bake

setCamera

public void setCamera(Camera camera)
Sets the current camera (no support for multiple cameras yet).
Parameters:
camera - camera to be used as the viewpoint for the scene

setInstanceLists

public void setInstanceLists(Instance[] instances,
                             Instance[] infinite)
Update the instance lists for this scene.
Parameters:
instances - regular instances
infinite - infinite instances (no bounds)

setLightList

public void setLightList(LightSource[] lights)
Update the light list for this scene.
Parameters:
lights - array of light source objects

setShaderOverride

public void setShaderOverride(Shader shader,
                              boolean photonOverride)
Enables shader overiding (set null to disable). The specified shader will be used to shade all surfaces
Parameters:
shader - shader to run over all surfaces, or null to disable overriding
photonOverride - true to override photon scattering with this shader or false to run the regular shaders