org.sunflow.core
Class IntersectionState
java.lang.Object
org.sunflow.core.IntersectionState
public final class IntersectionState
extends java.lang.Object
This class is used to store ray/object intersections. It also provides
additional data to assist
AccelerationStructure
objects with
traversal.
float[] | getRobustStack() - Used for algorithms which do bounding box based ray intersection.
|
IntersectionState.StackNode[] | getStack() - Get stack object for tree based
AccelerationStructure s.
|
int | getStackTop() - Index to use as the top of the stack, this is needed because of the
two-level nature of ray-intersection (instances then primitive list).
|
boolean | hit() - Checks to see if a hit has been recorded.
|
void | setIntersection(int id, float u, float v) - Record an intersection with the specified primitive id.
|
IntersectionState
public IntersectionState()
Initializes all traversal stacks.
getRobustStack
public final float[] getRobustStack()
Used for algorithms which do bounding box based ray intersection.
- array of floating point values for the stack
getStackTop
public final int getStackTop()
Index to use as the top of the stack, this is needed because of the
two-level nature of ray-intersection (instances then primitive list).
hit
public final boolean hit()
Checks to see if a hit has been recorded.
true
if a hit has been recorded,
false
otherwise
setIntersection
public final void setIntersection(int id,
float u,
float v)
Record an intersection with the specified primitive id. The parent object
is assumed to be the current instance. The u and v parameters are used to
pinpoint the location on the surface if needed.
id
- primitive id of the intersected objectu
- u surface paramater of the intersection pointv
- v surface parameter of the intersection point