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
FieldsModifier and TypeFieldDescriptionint[]int[]int[]int[]int[]int[]int[]int[]intPointer to the first unused cell.intstatic final intint -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbreakSolidCell(int pointer) voidclearCell(int pointer) Clears the cell.voiddeleteCell(int cellPointer) intdoesIntersect(int cubeX, int cubeY, int cubeZ, int cubeSize, Ray r) voidfillRectangle(IntegerPoint p1, IntegerPoint p2, Color color) Fill 3D rectangle.intgetCellColor(int pointer) intgetCellIllumination(int pointer) intScans cells arrays and returns pointer to found unused cell.voidinitWorld(int bufferLength, int masterCellSize) booleanisCellSolid(int pointer) intmakeNewCell(int color, int illumination) voidmarkCellAsSolid(int pointer) Mark cell as solid.voidvoidsetCellColor(int pointer, int color) voidsetCellIllumination(int pointer, int illumination) intTrace 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.
-