Class SceneRenderer

java.lang.Object
com.j3d.engine.scene.draw.SceneRenderer

public class SceneRenderer extends Object
SceneRenderer is a static class that manages all GTri objects in the scene and their rendering order based on their distance from the camera. The main purpose of this class is to optimize the rendering process by maintaining a sorted list of GTri objects, allowing for efficient rendering based on whichever method is chosen as this class will have multiple methods for sorting GTri in the future.

The inner package "methods" contains the different sorting methods that SceneRenderer can use. It's configured by the SceneManager (or debug settings) to choose which method to use for sorting GTri objects. This is mostly for testing and performance comparison purposes, as when a method is chosen, it will be used for all rendering cycles until changed.

Author:
Lehlogonolo Poole
See Also:
  • Field Details

    • queue

      private SortMethod queue
      A list used for sorting GTri based on whichever method SceneRenderer uses. The list is cleared after each render cycle.
  • Constructor Details

    • SceneRenderer

      public SceneRenderer()
  • Method Details

    • setSortMethod

      public void setSortMethod(PureSortMethod method)
      Sets the sort method for SceneRenderer.
      Parameters:
      method - The PureSortMethod to set.
    • register

      public void register(RenderState<?,?> tri)
      Registers a GTri with SceneRenderer.
      Parameters:
      tri - The GTri to register.
    • unregister

      public void unregister(RenderState<?,?> tri)
      Unregisters a triangle from SceneRenderer
      Parameters:
      tri - The triangle to unregister.
    • unregister

      public void unregister(UUID uuid)
    • clearQueue

      public void clearQueue()
      Clears the SceneRenderer queue.
    • draw

      public void draw(Graphics2D g)
      Draws all the triangles that have been sorted within the queue.
      Parameters:
      g - The Graphics2D context.
    • pureRegistered

      public int pureRegistered()