Class ZDepthIdBuffer

java.lang.Object
com.j3d.engine.scene.draw.methods.utils.ZDepthIdBuffer

public class ZDepthIdBuffer extends Object
ZDepthIdBuffer is a high-performance software rasterizer used for object picking. It renders a scene into an off-screen buffer, storing the UUID of the topmost object at each pixel, along with its depth. This allows for fast determination of which objects are visible from the camera's perspective without drawing them to the screen. The primary optimisations include: - Integer-based triangle rasterisation using edge functions. - Incremental depth calculation. - Efficient collection of unique visible object IDs using a HashSet.
Author:
Gemini IntelliJ Plugin
See Also:
  • Field Details

    • buffer

      private final UUID[][] buffer
    • depthBuffer

      private final float[][] depthBuffer
    • width

      private final int width
    • height

      private final int height
  • Constructor Details

    • ZDepthIdBuffer

      public ZDepthIdBuffer()
    • ZDepthIdBuffer

      public ZDepthIdBuffer(int width, int height)
    • ZDepthIdBuffer

      public ZDepthIdBuffer(UUID[][] buffer, float[][] depthBuffer)
  • Method Details

    • clear

      public void clear()
    • line

      public void line(GLine line)
    • point

      public void point(GPoint pt)
    • tri

      public void tri(GTri triangle)
      Rasterizes a triangle using an efficient, integer-based edge-function algorithm. This avoids costly floating-point operations per pixel.
    • draw

      public ArrayList<UUID> draw(ArrayList<Layer> layers)
      Processes all layers and returns a list of unique, visible object UUIDs. This uses a HashSet for efficient collection of unique IDs.
    • rasterizeObject

      private void rasterizeObject(GObject obj)
    • getBuffer

      public UUID[][] getBuffer()
    • getDepthBuffer

      public float[][] getDepthBuffer()