org.sunflow.core.photonmap

Class GlobalPhotonMap

Implemented Interfaces:
GlobalPhotonMapInterface, PhotonStore

public final class GlobalPhotonMap
extends java.lang.Object
implements GlobalPhotonMapInterface

Constructor Summary

GlobalPhotonMap(int numEmit, int numGather, float gatherRadius)

Method Summary

boolean
allowDiffuseBounced()
Allow photons reflected diffusely?
boolean
allowReflectionBounced()
Allow specularly reflected photons?
boolean
allowRefractionBounced()
Allow refracted photons?
Color
getRadiance(Point3 p, Vector3 n)
void
init()
Initialize the map after all photons have been stored.
int
numEmit()
Number of photons to emit from this surface.
void
precomputeRadiance()
void
prepare(BoundingBox sceneBounds)
Initialize this object for the specified scene size.
void
store(ShadingState state, Vector3 dir, Color power, Color diffuse)
Store the specified photon.

Constructor Details

GlobalPhotonMap

public GlobalPhotonMap(int numEmit,
                       int numGather,
                       float gatherRadius)

Method Details

allowDiffuseBounced

public boolean allowDiffuseBounced()
Allow photons reflected diffusely?
Specified by:
allowDiffuseBounced in interface PhotonStore
Returns:
true if diffuse bounces should be traced

allowReflectionBounced

public boolean allowReflectionBounced()
Allow specularly reflected photons?
Specified by:
allowReflectionBounced in interface PhotonStore
Returns:
true if specular reflection bounces should be traced

allowRefractionBounced

public boolean allowRefractionBounced()
Allow refracted photons?
Specified by:
allowRefractionBounced in interface PhotonStore
Returns:
true if refracted bounces should be traced

getRadiance

public Color getRadiance(Point3 p,
                         Vector3 n)
Specified by:
getRadiance in interface GlobalPhotonMapInterface

init

public void init()
Initialize the map after all photons have been stored. This can be used to balance a kd-tree based photon map for example.
Specified by:
init in interface PhotonStore

numEmit

public int numEmit()
Number of photons to emit from this surface.
Specified by:
numEmit in interface PhotonStore
Returns:
number of photons

precomputeRadiance

public void precomputeRadiance()

prepare

public void prepare(BoundingBox sceneBounds)
Initialize this object for the specified scene size.
Specified by:
prepare in interface PhotonStore
Parameters:
sceneBounds - scene bounding box

store

public void store(ShadingState state,
                  Vector3 dir,
                  Color power,
                  Color diffuse)
Store the specified photon.
Specified by:
store in interface PhotonStore
Parameters:
state - shading state
dir - photon direction
power - photon power
diffuse - diffuse color at the hit point