#include <StkGraphicsRender2D.h>
|
enum class | BatchId {
Polygons = 0x1000000
, PolygonsTextured = 0x2000000
, Ellipses = 0x3000000
, Polylines = 0x4000000
,
Ellipselines = 0x5000000
, EllipsesTextured = 0x6000000
, PolylinesStippled = 0x7000000
, PolylinesTextured = 0x8000000
,
Text = 0x9000000
, TextOutlined = 0xa000000
, Icons = 0xb000000
} |
|
|
| GraphicsRender2D (std::shared_ptr< STK::ShaderProgramManager > shader_mgr) |
|
bool | initShaders () |
|
const std::shared_ptr< STK::ShaderProgramManager > & | getShaderManager () const |
|
void | bindShader (const std::shared_ptr< STK::ShaderProgram > &shader) |
|
void | applyStencilMask (const std::shared_ptr< STK::RenderItem2D > &i) |
|
bool | initFrameUniforms (const std::shared_ptr< STK::ShaderProgram > &shader, const STK::Matrix4x4f &pj, const STK::Viewport &vp) |
|
void | drawPolyline (STK::PolylineRender2D &l, const STK::Matrix4x4f &vm) |
|
void | drawPolygon (STK::PolygonRender2D &p, const STK::Matrix4x4f &vm) |
|
void | drawEllipse (STK::EllipseRender2D &e, const STK::Matrix4x4f &vm) |
|
void | drawText (STK::TextRenderItem &t, const STK::Matrix4x4f &vm) |
|
void | drawTextSDF (STK::TextRenderItemSDF &t, const STK::Matrix4x4f &vm) |
|
void | drawIcon (STK::IconRenderItem &icon, const STK::Matrix4x4f &vm) |
|
void | addGraphicsItem (std::shared_ptr< STK::RenderItem2D > l) |
|
void | removeGraphicsItem (const std::shared_ptr< STK::RenderItem2D > &i) |
|
void | clearGraphicsItems () |
|
void | redraw (const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp) |
| Redraw all graphics items with the given projection and view matrix.
|
|
void | drawItems (const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp, const std::vector< std::shared_ptr< STK::RenderItem2D > > &items) |
| Draw all items in the list.
|
|
void | cleanup () |
|
void | setViewportAngle (float vp_angle) |
|
float | getViewportAngle () const |
|
void | setOpacity (float opacity) |
|
float | getOpacity () const |
|
bool | hitTest (const STK::Matrix4x4f &vm, const STK::Viewport &vp, const std::vector< std::shared_ptr< STK::RenderItem2D > > &renderItems, int x, int y, int pickRadius=3) |
| Hit test a list of graphics items. This method will check if the given position in pixel coordinates intersects the graphics of any of the given render items, and can be used for example for mouse picking.
|
|
const std::shared_ptr< STK::VertexBufferManager2D > & | getVertexBufferManager () const |
|
|
std::string | lineShaderName = "LineSimple2D" |
|
std::string | lineTexturedShaderName = "LineTextured2D" |
|
std::string | polygonShaderName = "DefaultNoLighting" |
|
std::string | polygonTextureShaderName = "PolygonTexture2D" |
|
std::string | ellipseShaderName = "EllipseSimple2D" |
|
std::string | ellipseTextureShaderName = "EllipseTexture2D" |
|
std::string | ellipseLineShaderName = "EllipseLine2D" |
|
std::string | textShaderName = "TextLabel" |
|
std::string | textBackgroundShaderName = "TextBackground" |
|
std::string | textOutlineShaderName = "TextLabelSDF" |
|
std::string | iconShaderName = "Icon2D" |
|
GraphicsRender2D - Efficient rendering of 2D graphics
◆ addGraphicsItem()
void STK::GraphicsRender2D::addGraphicsItem |
( |
std::shared_ptr< STK::RenderItem2D > |
l | ) |
|
|
inline |
◆ cleanup()
void STK::GraphicsRender2D::cleanup |
( |
| ) |
|
Clean up all graphics rendering objects. This includes deleting the graphics items and freeing up any OpenGL buffers. This method should be called on shutdown of an application, but before deleting the last OpenGL context.
◆ clearGraphicsItems()
void STK::GraphicsRender2D::clearGraphicsItems |
( |
| ) |
|
|
inline |
Remove all graphics items. This method will remove all graphics items from the renderer. Note that no OpenGL buffer cleanup is done here. This is intended for objects that may be taken in and out of the frame.
◆ hitTest()
Hit test a list of graphics items. This method will check if the given position in pixel coordinates intersects the graphics of any of the given render items, and can be used for example for mouse picking.
- Parameters
-
vm | Current view matrix for the 2D view. |
vp | Curremt viewport for the 2D view. |
renderItems | List of render items to check. |
x | x coordinate of position to check in pixel coordinates. |
y | y coordinate of position to check in pixel coordinates. |
pickRadius | Radius of hit zone |
- Returns
- True if any of the objects hit, false if not.
◆ initShaders()
bool STK::GraphicsRender2D::initShaders |
( |
| ) |
|
Initialize OpenGL shaders for rendering. This should normally not be called explicitly, but you may do so if you need to keep control of initialization of OpenGL objects.
◆ setViewportAngle()
void STK::GraphicsRender2D::setViewportAngle |
( |
float |
vp_angle | ) |
|
|
inline |
Set viewport angle. This angle will rotate all point objects such as text labels and icons, unless the item has specifically set the "keepUpright" flag.
The documentation for this class was generated from the following files:
- Native/SilentToolkit/StkScene/StkGraphicsRender2D.h
- Native/SilentToolkit/StkScene/StkGraphicsRender2D.cpp