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 classKDTree.BuildStatsprivate static classKDTree.BuildTask
-
Field Summary
Fields Modifier and Type Field Description private BoundingBoxboundsprivate static longCLOSEDprivate static booleandumpprivate static java.lang.StringdumpPrefixprivate static floatEMPTY_BONUSprivate static floatINTERSECT_COSTprivate static intMAX_DEPTHprivate intmaxPrimsprivate static longOPENEDprivate static longPLANARprivate PrimitiveListprimitiveListprivate int[]primitivesprivate static floatTRAVERSAL_COSTprivate int[]treeprivate static longTYPE_MASK
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(PrimitiveList primitives)Construct an acceleration structure for the specified primitive list.private voidbuildTree(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 intdumpObj(int offset, int vertOffset, int maxN, BoundingBox bounds, java.io.FileWriter file, java.io.FileWriter mtlFile)voidintersect(Ray r, IntersectionState state)Intersect the specified ray with the geometry in local space.private static longpack(float split, long type, int axis, int object)private static voidradix12(long[] splits, int n)static voidsetDumpMode(boolean dump, java.lang.String prefix)private static intunpackAxis(long p)private static intunpackObject(long p)private static floatunpackSplit(long p)private static longunpackSplitType(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:AccelerationStructureConstruct an acceleration structure for the specified primitive list.- Specified by:
buildin 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:AccelerationStructureIntersect the specified ray with the geometry in local space. The ray will be provided in local space.- Specified by:
intersectin interfaceAccelerationStructure- Parameters:
r- ray in local spacestate- state to store the intersection into
-
-