Om
1.0.0
A universal framework for multimedia simulation
|
A class that handles drawing GUI objects using a graphics rendering context. More...
#include <omGraphicsGUIRenderer.h>
Public Member Functions | |
GUIRenderer () | |
Create a new GUI renderer with no valid rendering context. More... | |
virtual | ~GUIRenderer () |
Destroy a GUI renderer, releasing all allocated resources. More... | |
GraphicsContext * | getContext () const |
Return a pointer to the graphics context which this GUI renderer is using to render. More... | |
void | setContext (GraphicsContext *newContext) |
Set a pointer to the graphics context which this GUI renderer is using to render. More... | |
const Viewport & | getViewport () const |
Return the current viewport that this GUI renderer is drawing to. More... | |
void | setViewport (const Viewport &newViewport) |
Replace the current viewport for the renderer. More... | |
void | setViewport (const AABB2f &newViewport) |
Replace the current viewport for the renderer. More... | |
void | pushViewport () |
Push the current viewport onto the viewport stack. The current viewport is unchanged. More... | |
void | popViewport () |
Remove the last viewport from the viewport stack and make it the current viewport. More... | |
const ScissorTest & | getScissorTest () const |
Return the current scissor test that this GUI renderer is using. More... | |
void | setScissorTest (const ScissorTest &newScissorTest) |
Replace the current scissor test for the renderer. More... | |
void | setScissorTest (const AABB2f &newScissorBounds, Bool enabled=true) |
Replace the current scissor test for the renderer. More... | |
void | pushScissorTest () |
Push the current scissor test onto the scissor test stack. The current scissor test is unchanged. More... | |
void | popScissorTest () |
Remove the last scissor test from the scissor test stack and make it the current one. More... | |
const Matrix4f & | getProjection () const |
Return the current projection transform that this GUI renderer is using. More... | |
void | setProjection (const Matrix4f &newProjection) |
Set the current projection transform that this GUI renderer is using. More... | |
void | setProjection (const AABB2 &viewVolume) |
void | setProjection (const AABB3 &viewVolume) |
Replace the current projection matrix for the renderer with a 3D orthographic projection matrix. More... | |
void | pushProjection () |
Push the current projection transform that this GUI renderer has onto the stack. More... | |
void | popProjection () |
Pop the current projection transform that this GUI renderer has from the stack. More... | |
const Matrix4f & | getTransform () const |
Return the current model-view transform that this GUI renderer is using. More... | |
void | setTransform (const Transform2 &newTransform) |
Set the current model-view transform that this GUI renderer is using. More... | |
void | setTransform (const Transform3 &newTransform) |
Set the current model-view transform that this GUI renderer is using. More... | |
void | setTransform (const Matrix4f &newTransform) |
Set the current model-view transform that this GUI renderer is using. More... | |
void | applyTransform (const Transform2f &newTransform) |
Multiply the current transformation matrix for the renderer by another matrix. More... | |
void | applyTransform (const Transform3f &newTransform) |
Multiply the current transformation matrix for the renderer by another matrix. More... | |
void | applyTransform (const Matrix4f &newTransform) |
Multiply the current transformation matrix for the renderer by another matrix. More... | |
void | pushTransform () |
Push the current model-view transform that this GUI renderer has onto the stack. More... | |
void | popTransform () |
Pop the current model-view transform that this GUI renderer has from the stack. More... | |
virtual Bool | drawViewport (const objects::GUIObject &object, const Viewport &viewport) |
Draw the specified object to the specified framebuffer viewport. More... | |
virtual Bool | drawObject (const objects::GUIObject &object, const AABB3f &parentBounds) |
Draw the specified object within the specified parent bounding box. More... | |
virtual Bool | drawObjectView (const objects::ObjectView &objectView, const AABB3f &parentBounds) |
Draw an object view in the specified parent bounding box. More... | |
virtual Bool | drawRenderView (const objects::RenderView &renderView, const AABB3f &parentBounds) |
Draw a render view in the specified parent bounding box. More... | |
virtual Bool | drawScrollView (const objects::ScrollView &scrollView, const AABB3f &parentBounds) |
Draw a scroll view in the specified parent bounding box. More... | |
virtual Bool | drawSplitView (const objects::SplitView &splitView, const AABB3f &parentBounds) |
Draw a split view in the specified parent bounding box. More... | |
virtual Bool | drawTabView (const objects::TabView &tabView, const AABB3f &parentBounds) |
Draw a tab view in the specified parent bounding box. More... | |
virtual Bool | drawGridView (const objects::GridView &gridView, const AABB3f &parentBounds) |
Draw a grid view in the specified parent bounding box. More... | |
virtual Bool | drawTreeView (const objects::TreeView &treeView, const AABB3f &parentBounds) |
Draw a tree view in the specified parent bounding box. More... | |
virtual Bool | drawListView (const objects::ListView &listView, const AABB3f &parentBounds) |
Draw a list view in the specified parent bounding box. More... | |
virtual Bool | drawGraphView (const objects::GraphView &graphView, const AABB3f &parentBounds) |
Draw a graph view in the specified parent bounding box. More... | |
virtual Bool | drawButton (const objects::Button &button, const AABB3f &parentBounds) |
Draw a button in the specified parent bounding box. More... | |
virtual Bool | drawMeter (const objects::Meter &meter, const AABB3f &parentBounds) |
Draw a meter in the specified parent bounding box. More... | |
virtual Bool | drawSlider (const objects::Slider &slider, const AABB3f &parentBounds) |
Draw a slider in the specified parent bounding box. More... | |
virtual Bool | drawKnob (const objects::Knob &knob, const AABB3f &parentBounds) |
Draw a knob in the specified parent bounding box. More... | |
virtual Bool | drawTextField (const objects::TextField &textField, const AABB3f &parentBounds) |
Draw a text field in the specified parent bounding box. More... | |
virtual Bool | drawSearchField (const objects::SearchField &searchField, const AABB3f &parentBounds) |
Draw a search field in the specified parent bounding box. More... | |
virtual Bool | drawNumberField (const objects::NumberField &numberField, const AABB3f &parentBounds) |
Draw a number field in the specified parent bounding box. More... | |
virtual Bool | drawImageView (const objects::ImageView &imageView, const AABB3f &parentBounds) |
Draw a image view in the specified parent bounding box. More... | |
virtual Bool | drawOptionMenu (const objects::OptionMenu &optionMenu, const AABB3f &parentBounds) |
Draw an option menu in the specified parent bounding box. More... | |
virtual Bool | drawColorPicker (const objects::ColorPicker &optionMenu, const AABB3f &parentBounds) |
Draw a color picker in the specified parent bounding box. More... | |
virtual Bool | drawDivider (const objects::Divider ÷r, const AABB3f &parentBounds) |
Draw a divider in the specified parent bounding box. More... | |
virtual Bool | drawRectangle (const AABB2f &bounds, const Color4f &color, const GUIStyle *style=((void *) 0)) |
Draw a rectangle with the specified bounds and color. More... | |
virtual Bool | drawBorderedRectangle (const AABB2f &bounds, const Color4f &backgroundColor, const Color4f &borderColor, const Border &border, const GUIStyle *style=((void *) 0)) |
Draw a 2D bordered rectangle in the current coordinate system. More... | |
virtual Bool | drawPoint (const Vector2f &point, const Color4f &color, Float pointSize=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a point with the specified position and size with the given color. More... | |
virtual Bool | drawPoints (const Vector2f *points, Size numPoints, const Color4f &color, Float pointSize=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a series of circular points with the specified locations, color, and size. More... | |
Bool | drawPoints (const ArrayList< Vector2f > &points, const Color4f &color, Float pointSize=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a series of circular points with the specified locations, color, and size. More... | |
virtual Bool | drawLine (const Vector2f &start, const Vector2f &end, const Color4f &color, Float width=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a line with the specified start and endpoints with the given start and ending color. More... | |
virtual Bool | drawLines (const Vector2f *vertices, Size numVertices, const Color4f &color, Float width=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a series of disconnected lines with the specified vertices and color. More... | |
Bool | drawLines (const ArrayList< Vector2f > &vertices, const Color4f &color, Float width=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a series of disconnected lines with the specified vertices and color. More... | |
virtual Bool | drawLineStrip (const Vector2f *vertices, Size numVertices, const Color4f &color, Float width=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a connected line strip with the specified vertices and color. More... | |
Bool | drawLineStrip (const ArrayList< Vector2f > &vertices, const Color4f &color, Float width=Float(1), const GUIStyle *style=((void *) 0)) |
Draw a connected line strip with the specified vertices and color. More... | |
virtual Bool | drawCircle (const Vector2f &position, Float radius, const Color4f &color) |
Draw a circle with the specified position, radius, and color. More... | |
virtual Bool | drawImage (const GUIImage &image, const AABB2f &imageBounds, const Color4f &tint, const GUIStyle *style=((void *) 0)) |
Draw a GUI image in the specified bounding box in the current coordinate system. More... | |
virtual Bool | drawString (const UTF8StringIterator &string, const TextStyle &textStyle, Vector2f &position, const GUIStyle *style=((void *) 0)) |
Draw the specified unicode string using the provided text style. More... | |
virtual Bool | drawStringArea (const UTF8StringIterator &string, const TextStyle &textStyle, const AABB2f &bounds, const Origin &textAlignment, const GUIStyle *style=((void *) 0)) |
Draw the specified string within the specified bounding box with the given parameters. More... | |
virtual Bool | drawGlyphLayout (const GlyphLayout &glyphLayout, const TextStyle &textStyle, const GUIStyle *style=((void *) 0)) |
Draw the specified glyph layout in the current coordinate system with the given parameters. More... | |
virtual Bool | drawGlyphLayout (const GlyphLayout &glyphLayout, const TextStyle &textStyle, const AABB2f &parentBounds, const Origin &layoutAlignment, const GUIStyle *style=((void *) 0)) |
Draw the specified glyph layout in the current coordinate system with the given parameters. More... | |
virtual Bool | drawGlyphLayoutSelection (const GlyphLayout &glyphLayout, const AABB1D< Index > &selection, const Color4f &selectionColor, const GUIStyle *style=((void *) 0)) |
Draw rectangles that cover the specified range of selected glyphs from a layout. More... | |
virtual Bool | getStringBounds (const UTF8StringIterator &string, const TextStyle &textStyle, AABB2f &bounds) |
Retrieve a bounding box for the specified string using the given text style. More... | |
void | beginDrawingObject (const objects::GUIObject &object, const AABB3f &parentBounds) |
Apply transformations and scissor test rectangles for the specified object in the given parent bounds. More... | |
void | endDrawingObject (const objects::GUIObject &object) |
Finish drawing the specified object, and return the renderer state to the previous state. More... | |
AABB2f | beginScissorTest (const AABB2f &localScissorViewport, Bool enabled=true, Bool respectParent=true) |
Apply a scissor test to the current rendering state. More... | |
AABB2f | beginScissorTest (const AABB3f &localScissorViewport, Bool enabled=true, Bool respectParent=true) |
Apply a scissor test to the current rendering state. More... | |
void | endScissorTest () |
Restore the previous scissor test. More... | |
Static Public Member Functions | |
static Vector3f | viewProjection (const Matrix4f &projectionTransform, const Vector4f &point) |
Apply the model-view-projection transform and do the perspective divide to get into viewport space. More... | |
static AABB3f | viewProjection (const Matrix4f &PT, const AABB2f &local) |
Apply the model-view-projection transform and do the perspective divide to get a viewport space bounding box. More... | |
static AABB3f | viewProjection (const Matrix4f &PT, const AABB3f &local) |
Apply the model-view-projection transform and do the perspective divide to get a viewport space bounding box. More... | |
A class that handles drawing GUI objects using a graphics rendering context.
om::graphics::gui::renderers::GUIRenderer::GUIRenderer | ( | ) |
Create a new GUI renderer with no valid rendering context.
This renderer will not be able to draw anything until a valid context is supplied via setContext().
|
virtual |
Destroy a GUI renderer, releasing all allocated resources.
|
inline |
Return a pointer to the graphics context which this GUI renderer is using to render.
void om::graphics::gui::renderers::GUIRenderer::setContext | ( | GraphicsContext * | newContext | ) |
Set a pointer to the graphics context which this GUI renderer is using to render.
This causes the renderer to use the specified context to do all of its rendering. The renderer reinitializes all internal state using the new context. If the new context is NULL or not valid, the renderer will not be able to render anything.
|
inline |
Return the current viewport that this GUI renderer is drawing to.
|
inline |
Replace the current viewport for the renderer.
This method changes the context's viewport if the context is valid and replaces the locally-stored current viewport regardless of whether or not the context is valid.
This method may cause previously buffered drawing commands to be flushed to the screen.
|
inline |
Replace the current viewport for the renderer.
This method changes the context's viewport if the context is valid and replaces the locally-stored current viewport regardless of whether or not the context is valid.
This method may cause previously buffered drawing commands to be flushed to the screen.
|
inline |
Push the current viewport onto the viewport stack. The current viewport is unchanged.
Each call to pushViewport() should be paired with a call to popViewport(), otherwise the stack will continue to grow and produce undesired behavior.
|
inline |
Remove the last viewport from the viewport stack and make it the current viewport.
If there are no viewports on the stack, the method has no effect.
|
inline |
Return the current scissor test that this GUI renderer is using.
|
inline |
Replace the current scissor test for the renderer.
This method changes the context's scissor test if the context is valid and replaces the locally-stored current scissor test regardless of whether or not the context is valid.
This method may cause previously buffered drawing commands to be flushed to the screen.
|
inline |
Replace the current scissor test for the renderer.
This method changes the context's scissor test if the context is valid and replaces the locally-stored current scissor test regardless of whether or not the context is valid.
This method may cause previously buffered drawing commands to be flushed to the screen.
|
inline |
Push the current scissor test onto the scissor test stack. The current scissor test is unchanged.
Each call to pushScissorTest() should be paired with a call to popScissorTest(), otherwise the stack will continue to grow and produce undesired behavior.
|
inline |
Remove the last scissor test from the scissor test stack and make it the current one.
If there are no scissor tests on the stack, the method has no effect.
|
inline |
Return the current projection transform that this GUI renderer is using.
|
inline |
Set the current projection transform that this GUI renderer is using.
|
inline |
The resulting projection views the specified volume with its view direction down the negative Z axis. The z near and far planes are set to be 1 and -1, respectively.
|
inline |
Replace the current projection matrix for the renderer with a 3D orthographic projection matrix.
The resulting projection views the specified volume with its view direction down the negative Z axis.
|
inline |
Push the current projection transform that this GUI renderer has onto the stack.
|
inline |
Pop the current projection transform that this GUI renderer has from the stack.
|
inline |
Return the current model-view transform that this GUI renderer is using.
|
inline |
Set the current model-view transform that this GUI renderer is using.
|
inline |
Set the current model-view transform that this GUI renderer is using.
|
inline |
Set the current model-view transform that this GUI renderer is using.
|
inline |
Multiply the current transformation matrix for the renderer by another matrix.
|
inline |
Multiply the current transformation matrix for the renderer by another matrix.
|
inline |
Multiply the current transformation matrix for the renderer by another matrix.
|
inline |
Push the current model-view transform that this GUI renderer has onto the stack.
|
inline |
Pop the current model-view transform that this GUI renderer has from the stack.
|
virtual |
Draw the specified object to the specified framebuffer viewport.
This is the main method that should be used for drawing the top-level object in the GUI hierarchy. It sets up the viewport and renders all child objects recursively.
|
virtual |
Draw the specified object within the specified parent bounding box.
This method is typically called by GUIObject subclasses that have child objects that need to be drawn where the concrete object type is unknown.
|
virtual |
Draw an object view in the specified parent bounding box.
|
virtual |
Draw a render view in the specified parent bounding box.
|
virtual |
Draw a scroll view in the specified parent bounding box.
|
virtual |
Draw a split view in the specified parent bounding box.
|
virtual |
Draw a tab view in the specified parent bounding box.
|
virtual |
Draw a grid view in the specified parent bounding box.
|
virtual |
Draw a tree view in the specified parent bounding box.
|
virtual |
Draw a list view in the specified parent bounding box.
|
virtual |
Draw a graph view in the specified parent bounding box.
|
virtual |
Draw a button in the specified parent bounding box.
|
virtual |
Draw a meter in the specified parent bounding box.
|
virtual |
Draw a slider in the specified parent bounding box.
|
virtual |
Draw a knob in the specified parent bounding box.
|
virtual |
Draw a text field in the specified parent bounding box.
|
virtual |
Draw a search field in the specified parent bounding box.
|
virtual |
Draw a number field in the specified parent bounding box.
|
virtual |
Draw a image view in the specified parent bounding box.
|
virtual |
Draw an option menu in the specified parent bounding box.
|
virtual |
Draw a color picker in the specified parent bounding box.
|
virtual |
Draw a divider in the specified parent bounding box.
|
virtual |
Draw a rectangle with the specified bounds and color.
All coordinates are specified in the current local coordinate system.
|
virtual |
Draw a 2D bordered rectangle in the current coordinate system.
|
virtual |
Draw a point with the specified position and size with the given color.
All coordinates are specified in the current local coordinate system. The method returns whether or not the point was successfully drawn.
|
virtual |
Draw a series of circular points with the specified locations, color, and size.
All coordinates are specified in the current local coordinate system. The method returns whether or not the points were successfully drawn.
|
inline |
Draw a series of circular points with the specified locations, color, and size.
All coordinates are specified in the current local coordinate system. The method returns whether or not the points were successfully drawn.
|
virtual |
Draw a line with the specified start and endpoints with the given start and ending color.
All coordinates are specified in the current local coordinate system. The method returns whether or not the line was successfully drawn.
|
virtual |
Draw a series of disconnected lines with the specified vertices and color.
All coordinates are specified in the current local coordinate system. Every 2 vertices represent the start and endpoints of a line. The method returns whether or not the lines were successfully drawn.
|
inline |
Draw a series of disconnected lines with the specified vertices and color.
All coordinates are specified in the current local coordinate system. Every 2 vertices represent the start and endpoints of a line. The method returns whether or not the lines were successfully drawn.
|
virtual |
Draw a connected line strip with the specified vertices and color.
All coordinates are specified in the current local coordinate system. The method returns whether or not the lines were successfully drawn.
|
inline |
Draw a connected line strip with the specified vertices and color.
All coordinates are specified in the current local coordinate system. The method returns whether or not the lines were successfully drawn.
|
virtual |
Draw a circle with the specified position, radius, and color.
All coordinates are specified in the current local coordinate system. The method returns whether or not the circle was successfully drawn.
|
virtual |
Draw a GUI image in the specified bounding box in the current coordinate system.
If the specified image is not valid or drawing fails, FALSE is returned indicating failure. Otherwise, TRUE is returned if the operation is successful.
|
virtual |
Draw the specified unicode string using the provided text style.
The position and font size are assumed to be in normalized vertical-screen-unit coordinates. The current viewport is assumed to represent the current dimensions of the screen and so the specified position and size are scaled by the height of the viewport to get their values in pixel units.
|
virtual |
Draw the specified string within the specified bounding box with the given parameters.
|
virtual |
Draw the specified glyph layout in the current coordinate system with the given parameters.
|
virtual |
Draw the specified glyph layout in the current coordinate system with the given parameters.
|
virtual |
Draw rectangles that cover the specified range of selected glyphs from a layout.
|
virtual |
Retrieve a bounding box for the specified string using the given text style.
This method computes a bounding box for the string where the starting pen position is the origin (0,0). If the method succeeds, the string's bounding box is placed in the output reference parameter and TRUE is returned. If the method fails, FALSE is returned and no bounding box is computed.
This method is useful for centering and laying out text before rendering it.
|
inlinestatic |
Apply the model-view-projection transform and do the perspective divide to get into viewport space.
|
inlinestatic |
Apply the model-view-projection transform and do the perspective divide to get a viewport space bounding box.
|
inlinestatic |
Apply the model-view-projection transform and do the perspective divide to get a viewport space bounding box.
void om::graphics::gui::renderers::GUIRenderer::beginDrawingObject | ( | const objects::GUIObject & | object, |
const AABB3f & | parentBounds | ||
) |
Apply transformations and scissor test rectangles for the specified object in the given parent bounds.
void om::graphics::gui::renderers::GUIRenderer::endDrawingObject | ( | const objects::GUIObject & | object | ) |
Finish drawing the specified object, and return the renderer state to the previous state.
AABB2f om::graphics::gui::renderers::GUIRenderer::beginScissorTest | ( | const AABB2f & | localScissorViewport, |
Bool | enabled = true , |
||
Bool | respectParent = true |
||
) |
Apply a scissor test to the current rendering state.
The method returns the viewport-space scissor viewport BEFORE clipping with the parent scissor rectangle.
AABB2f om::graphics::gui::renderers::GUIRenderer::beginScissorTest | ( | const AABB3f & | localScissorViewport, |
Bool | enabled = true , |
||
Bool | respectParent = true |
||
) |
Apply a scissor test to the current rendering state.
The method returns the viewport-space scissor viewport BEFORE clipping with the parent scissor rectangle.
|
inline |
Restore the previous scissor test.