Package org.sunflow.core.accel
Class KDTree
- java.lang.Object
-
- org.sunflow.core.accel.KDTree
-
- All Implemented Interfaces:
AccelerationStructure
public class KDTree extends java.lang.Object implements AccelerationStructure
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
KDTree.BuildStats
private static class
KDTree.BuildTask
-
Field Summary
Fields Modifier and Type Field Description private BoundingBox
bounds
private static long
CLOSED
private static boolean
dump
private static java.lang.String
dumpPrefix
private static float
EMPTY_BONUS
private static float
INTERSECT_COST
private static int
MAX_DEPTH
private int
maxPrims
private static long
OPENED
private static long
PLANAR
private PrimitiveList
primitiveList
private int[]
primitives
private static float
TRAVERSAL_COST
private int[]
tree
private static long
TYPE_MASK
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
build(PrimitiveList primitives)
Construct an acceleration structure for the specified primitive list.private void
buildTree(float minx, float maxx, float miny, float maxy, float minz, float maxz, KDTree.BuildTask task, int depth, IntArray tempTree, int offset, IntArray tempList, KDTree.BuildStats stats)
private int
dumpObj(int offset, int vertOffset, int maxN, BoundingBox bounds, java.io.FileWriter file, java.io.FileWriter mtlFile)
void
intersect(Ray r, IntersectionState state)
Intersect the specified ray with the geometry in local space.private static long
pack(float split, long type, int axis, int object)
private static void
radix12(long[] splits, int n)
static void
setDumpMode(boolean dump, java.lang.String prefix)
private static int
unpackAxis(long p)
private static int
unpackObject(long p)
private static float
unpackSplit(long p)
private static long
unpackSplitType(long p)
-
-
-
Field Detail
-
tree
private int[] tree
-
primitives
private int[] primitives
-
primitiveList
private PrimitiveList primitiveList
-
bounds
private BoundingBox bounds
-
maxPrims
private int maxPrims
-
INTERSECT_COST
private static final float INTERSECT_COST
- See Also:
- Constant Field Values
-
TRAVERSAL_COST
private static final float TRAVERSAL_COST
- See Also:
- Constant Field Values
-
EMPTY_BONUS
private static final float EMPTY_BONUS
- See Also:
- Constant Field Values
-
MAX_DEPTH
private static final int MAX_DEPTH
- See Also:
- Constant Field Values
-
dump
private static boolean dump
-
dumpPrefix
private static java.lang.String dumpPrefix
-
CLOSED
private static final long CLOSED
- See Also:
- Constant Field Values
-
PLANAR
private static final long PLANAR
- See Also:
- Constant Field Values
-
OPENED
private static final long OPENED
- See Also:
- Constant Field Values
-
TYPE_MASK
private static final long TYPE_MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDumpMode
public static void setDumpMode(boolean dump, java.lang.String prefix)
-
build
public void build(PrimitiveList primitives)
Description copied from interface:AccelerationStructure
Construct an acceleration structure for the specified primitive list.- Specified by:
build
in interfaceAccelerationStructure
-
dumpObj
private int dumpObj(int offset, int vertOffset, int maxN, BoundingBox bounds, java.io.FileWriter file, java.io.FileWriter mtlFile) throws java.io.IOException
- Throws:
java.io.IOException
-
pack
private static long pack(float split, long type, int axis, int object)
-
unpackObject
private static int unpackObject(long p)
-
unpackAxis
private static int unpackAxis(long p)
-
unpackSplitType
private static long unpackSplitType(long p)
-
unpackSplit
private static float unpackSplit(long p)
-
radix12
private static void radix12(long[] splits, int n)
-
buildTree
private void buildTree(float minx, float maxx, float miny, float maxy, float minz, float maxz, KDTree.BuildTask task, int depth, IntArray tempTree, int offset, IntArray tempList, KDTree.BuildStats stats)
-
intersect
public void intersect(Ray r, IntersectionState state)
Description copied from interface:AccelerationStructure
Intersect the specified ray with the geometry in local space. The ray will be provided in local space.- Specified by:
intersect
in interfaceAccelerationStructure
- Parameters:
r
- ray in local spacestate
- state to store the intersection into
-
-