Class OctreeVolume
java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.octree.OctreeVolume
There are 3 cell types: UNUSED SOLID contains: original color visible color, after being illuminated by nearby light sources CLUSTER contains pointers to 8 sub cells
-
Field Summary
Modifier and TypeFieldDescriptionint[]
int[]
int[]
int[]
int[]
int[]
int[]
int[]
int
Pointer to the first unused cell.int
static final int
int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
breakSolidCell
(int pointer) void
clearCell
(int pointer) Clears the cell.void
deleteCell
(int cellPointer) int
doesIntersect
(int cubeX, int cubeY, int cubeZ, int cubeSize, Ray r) void
fillRectangle
(IntegerPoint p1, IntegerPoint p2, Color color) Fill 3D rectangle.int
getCellColor
(int pointer) int
getCellIllumination
(int pointer) int
Scans cells arrays and returns pointer to found unused cell.void
initWorld
(int bufferLength, int masterCellSize) boolean
isCellSolid
(int pointer) int
makeNewCell
(int color, int illumination) void
markCellAsSolid
(int pointer) Mark cell as solid.void
void
setCellColor
(int pointer, int color) void
setCellIllumination
(int pointer, int illumination) int
Trace ray through the world and return pointer to intersecting cell.
-
Field Details
-
TRACE_NO_HIT
public static final int TRACE_NO_HIT- See Also:
-
cell1
public int[] cell1 -
cell2
public int[] cell2 -
cell3
public int[] cell3 -
cell4
public int[] cell4 -
cell5
public int[] cell5 -
cell6
public int[] cell6 -
cell7
public int[] cell7 -
cell8
public int[] cell8 -
cellAllocationPointer
public int cellAllocationPointerPointer to the first unused cell. -
usedCellsCount
public int usedCellsCount -
masterCellSize
public int masterCellSize
-
-
Constructor Details
-
OctreeVolume
public OctreeVolume()
-
-
Method Details
-
breakSolidCell
public void breakSolidCell(int pointer) -
clearCell
public void clearCell(int pointer) Clears the cell.- Parameters:
pointer
- Pointer to the cell.
-
deleteCell
public void deleteCell(int cellPointer) -
doesIntersect
-
fillRectangle
Fill 3D rectangle. -
getCellColor
public int getCellColor(int pointer) -
getCellIllumination
public int getCellIllumination(int pointer) -
initWorld
public void initWorld(int bufferLength, int masterCellSize) -
isCellSolid
public boolean isCellSolid(int pointer) -
getNewCellPointer
public int getNewCellPointer()Scans cells arrays and returns pointer to found unused cell.- Returns:
- pointer to found unused cell
-
makeNewCell
public int makeNewCell(int color, int illumination) -
markCellAsSolid
public void markCellAsSolid(int pointer) Mark cell as solid.- Parameters:
pointer
- pointer to cell
-
putCell
-
setCellColor
public void setCellColor(int pointer, int color) -
setCellIllumination
public void setCellIllumination(int pointer, int illumination) -
traceCell
Trace ray through the world and return pointer to intersecting cell.- Returns:
- pointer to intersecting cell or TRACE_NO_HIT if no intersection.
-