Class OctreeVolume

java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.octree.OctreeVolume

public class OctreeVolume extends Object
 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 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 cellAllocationPointer
      Pointer 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

      public int doesIntersect(int cubeX, int cubeY, int cubeZ, int cubeSize, Ray r)
    • fillRectangle

      public void fillRectangle(IntegerPoint p1, IntegerPoint p2, Color color)
      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

      public void putCell(int x, int y, int z, Color color)
    • setCellColor

      public void setCellColor(int pointer, int color)
    • setCellIllumination

      public void setCellIllumination(int pointer, int illumination)
    • traceCell

      public int traceCell(int cellX, int cellY, int cellZ, int cellSize, int pointer, Ray ray)
      Trace ray through the world and return pointer to intersecting cell.
      Returns:
      pointer to intersecting cell or TRACE_NO_HIT if no intersection.