Class OGLMultiNode<GL extends OGLGraphics>

java.lang.Object
com.blackrook.gloop.opengl.node.OGLMultiNode<GL>
Type Parameters:
GL - the graphics object to call.
All Implemented Interfaces:
OGLNode<GL>

public class OGLMultiNode<GL extends OGLGraphics> extends Object implements OGLNode<GL>
A framebuffer node that contains other OGLNodes. Contains methods to invoke before they are displayed and after they are displayed.
Author:
Matthew Tropiano
  • Field Details

    • renderTimeNanos

      protected long renderTimeNanos
      Render time in nanos.
    • polygonsRendered

      protected int polygonsRendered
      Polygons Rendered
  • Constructor Details

    • OGLMultiNode

      public OGLMultiNode()
      The default constructor.
  • Method Details

    • addNode

      public void addNode(OGLNode<? super GL> node)
      Adds an OGLNode to this multinode.
      Parameters:
      node - the node to add.
    • removeNode

      public boolean removeNode(OGLNode<? super GL> node)
      Removes an OGLNode from this multinode.
      Parameters:
      node - the node to remove.
      Returns:
      true if removed, false if not (was never added).
    • preFramebufferResize

      public void preFramebufferResize(int newWidth, int newHeight)
      Called by onFramebufferResize(int, int) before all of the attached nodes have onFramebufferResize(int, int) called on them. Does nothing by default.
      Parameters:
      newWidth - the new framebuffer width.
      newHeight - the new framebuffer height.
    • onFramebufferResize

      public void onFramebufferResize(int newWidth, int newHeight)
      Called when the system canvas gets resized, or once this node gets added to the system. This calls onFramebufferResize(int, int) on all of the added child nodes in the order that they were added.
      Specified by:
      onFramebufferResize in interface OGLNode<GL extends OGLGraphics>
      Parameters:
      newWidth - the new framebuffer width.
      newHeight - the new framebuffer height.
    • postFramebufferResize

      public void postFramebufferResize(int newWidth, int newHeight)
      Called by onFramebufferResize(int, int) after all of the added child nodes have onFramebufferResize(int, int) called on them. Does nothing by default.
      Parameters:
      newWidth - the new framebuffer width.
      newHeight - the new framebuffer height.
    • preNodeDisplay

      public void preNodeDisplay(GL gl)
      Called by display() before all of the added child nodes are displayed. Does nothing by default.
      Parameters:
      gl - the GL object used for issuing commands to OpenGL.
    • onDisplay

      public void onDisplay(GL gl)
      Displays this node's children in the order they were added, if enabled. The rendering thread for the target window enters this method, so it is safe to call all OGLGraphics functions here.
      Specified by:
      onDisplay in interface OGLNode<GL extends OGLGraphics>
      Parameters:
      gl - the graphics object used for issuing commands to OpenGL.
    • postNodeDisplay

      public void postNodeDisplay(GL gl)
      Called by display() after all of the added child nodes are displayed. Does nothing by default.
      Parameters:
      gl - the GL object used for issuing commands to OpenGL.
    • getPolygonsRendered

      public int getPolygonsRendered()
      Description copied from interface: OGLNode
      Gets the number of polygonal objects rendered in this layer.

      This is mostly for statistical purposes. Results of this call should not be considered accurate until the node has had OGLNode.onDisplay(OGLGraphics) called on it.

      Specified by:
      getPolygonsRendered in interface OGLNode<GL extends OGLGraphics>
      Returns:
      the number of polygonal objects rendered in this layer.
    • getRenderTimeNanos

      public long getRenderTimeNanos()
      Description copied from interface: OGLNode
      Returns the length of time it took to render this node, in nanoseconds. Results of this call should not be considered accurate until the node has had OGLNode.onDisplay(OGLGraphics) called on it.
      Specified by:
      getRenderTimeNanos in interface OGLNode<GL extends OGLGraphics>
      Returns:
      the length of time it took to render this node, in nanoseconds.
    • isEnabled

      public boolean isEnabled()
      Returns:
      true if this multinode is enabled, false if not.
      See Also:
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets if this node (and all of its added child nodes) are displayed. If this node is NOT enabled, neither preNodeDisplay(OGLGraphics), onDisplay(OGLGraphics), nor postNodeDisplay(OGLGraphics) is called. It will still receive calls to resize itself.
      Parameters:
      enabled - true if so, false if not.
      See Also: