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>
A framebuffer node that contains other
OGLNodes.
Contains methods to invoke before they are displayed and after they are displayed.- Author:
- Matthew Tropiano
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intPolygons Renderedprotected longRender time in nanos. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an OGLNode to this multinode.intGets the number of polygonal objects rendered in this layer.longReturns the length of time it took to render this node, in nanoseconds.booleanvoidDisplays this node's children in the order they were added, if enabled.voidonFramebufferResize(int newWidth, int newHeight) Called when the system canvas gets resized, or once this node gets added to the system.voidpostFramebufferResize(int newWidth, int newHeight) Called byonFramebufferResize(int, int)after all of the added child nodes haveonFramebufferResize(int, int)called on them.voidpostNodeDisplay(GL gl) Called by display() after all of the added child nodes are displayed.voidpreFramebufferResize(int newWidth, int newHeight) Called byonFramebufferResize(int, int)before all of the attached nodes haveonFramebufferResize(int, int)called on them.voidpreNodeDisplay(GL gl) Called by display() before all of the added child nodes are displayed.booleanremoveNode(OGLNode<? super GL> node) Removes an OGLNode from this multinode.voidsetEnabled(boolean enabled) Sets if this node (and all of its added child nodes) are displayed.
-
Field Details
-
renderTimeNanos
protected long renderTimeNanosRender time in nanos. -
polygonsRendered
protected int polygonsRenderedPolygons Rendered
-
-
Constructor Details
-
OGLMultiNode
public OGLMultiNode()The default constructor.
-
-
Method Details
-
addNode
-
removeNode
-
preFramebufferResize
public void preFramebufferResize(int newWidth, int newHeight) Called byonFramebufferResize(int, int)before all of the attached nodes haveonFramebufferResize(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 callsonFramebufferResize(int, int)on all of the added child nodes in the order that they were added.- Specified by:
onFramebufferResizein interfaceOGLNode<GL extends OGLGraphics>- Parameters:
newWidth- the new framebuffer width.newHeight- the new framebuffer height.
-
postFramebufferResize
public void postFramebufferResize(int newWidth, int newHeight) Called byonFramebufferResize(int, int)after all of the added child nodes haveonFramebufferResize(int, int)called on them. Does nothing by default.- Parameters:
newWidth- the new framebuffer width.newHeight- the new framebuffer height.
-
preNodeDisplay
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
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 allOGLGraphicsfunctions here.- Specified by:
onDisplayin interfaceOGLNode<GL extends OGLGraphics>- Parameters:
gl- the graphics object used for issuing commands to OpenGL.
-
postNodeDisplay
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:OGLNodeGets 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:
getPolygonsRenderedin interfaceOGLNode<GL extends OGLGraphics>- Returns:
- the number of polygonal objects rendered in this layer.
-
getRenderTimeNanos
public long getRenderTimeNanos()Description copied from interface:OGLNodeReturns 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 hadOGLNode.onDisplay(OGLGraphics)called on it.- Specified by:
getRenderTimeNanosin interfaceOGLNode<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, neitherpreNodeDisplay(OGLGraphics),onDisplay(OGLGraphics), norpostNodeDisplay(OGLGraphics)is called. It will still receive calls to resize itself.- Parameters:
enabled- true if so, false if not.- See Also:
-