Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::EllipseRender2D Class Reference

#include <StkEllipseRender2D.h>

Inheritance diagram for STK::EllipseRender2D:
STK::RenderItem2D

Public Member Functions

void addEllipse (const STK::Vector2f &c, float rx, float ry)
 
void addCircle (const STK::Vector2f &c, float r)
 
void setColor (const STK::Color4f &color)
 Set fill color.
 
const STK::Color4fgetColor () const
 Get fill color.
 
void setLineThickness (float w)
 Set line thickness (in pixels).
 
float getLineThickness () const
 Get line thickness (in pixels).
 
bool hasTexture () const
 
void setTexture (const std::shared_ptr< STK::Texture > &tex, const STK::Vector2f &size)
 
std::shared_ptr< STK::TexturegetTexture ()
 
const std::shared_ptr< const STK::TexturegetTexture () const
 
void setPatternSize (const STK::Vector2f &size)
 
const STK::Vector2fgetPatternSize () const
 
void drawVertexArrays ()
 
void setFixedSize (bool fixed)
 
bool getFixedSize () const
 
void render (GraphicsRender2D &renderer, const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp) override
 
int getBatchId () const override
 
void cleanupBuffers () override
 
virtual STK::Box2< float > getViewBoundingBox (const STK::Matrix4x4f &mvp, const STK::Viewport &glVp, bool reverse_y=false) override
 Get bounding box in viewport pixel coordinates.
 
- Public Member Functions inherited from STK::RenderItem2D
virtual void render (GraphicsRender2D &renderer, const STK::Matrix4x4f &pj, const STK::Matrix4x4f &vm, const STK::Viewport &vp)=0
 
virtual void cleanupBuffers ()=0
 
virtual int getBatchId () const =0
 
void setDepth (float depth)
 
float getDepth () const
 
void setStencilValue (unsigned char stencil_value)
 Set value for stencil operations.
 
unsigned char getStencilValue () const
 Get value for stencil operations.
 
void setStencilMode (StencilMode mode)
 Stencil buffer operations.
 
StencilMode getStencilMode () const
 Stencil buffer operations.
 
const STK::Matrix4x4fgetTransform ()
 
void setPosition (float x, float y)
 Set 2D position of the item. This method will invalidate the transform and cause it to be recalculated on the next frame.
 
void setPosition (const STK::Vector2f &pos)
 Same as above.
 
void setPositionX (float x)
 Set X position separately.
 
void setPositionY (float y)
 Set Y position separately.
 
const STK::Vector2fgetPosition () const
 
float getPositionX () const
 
float getPositionY () const
 
void setScale (const STK::Vector2f &scale)
 
void setScale (float scale)
 Set scale factor for the text item. This method will invalidate the transform and cause it to be recalculated on the next frame.
 
STK::Vector2f getScale () const
 Returns current scale factor for the item.
 
void setAngle (float angle)
 Set rotation angle for the item. Positive rotation direction is counter-clockwise. This method will invalidate the transform and cause it to be recalculated on the next frame.
 
float getAngle () const
 
void setTransform (const STK::Matrix4x4f &transform)
 Set transform directly. This method will set the transformation matrix for this item directly. This will override any values for setPosition(), setScale(), setDepth() and setAngle(). Also, any subsequent calls to these methods will again override this method. In short, either use setTransform() or setPosition/Scale/Angle/Depth.
 
void setPreTransform (const STK::Matrix4x4f &transform)
 
void setPostTransform (const STK::Matrix4x4f &transform)
 
std::optional< STK::Matrix4x4fgetPreTransform () const
 
std::optional< STK::Matrix4x4fgetPostTransform () const
 
void setOpacity (float opacity)
 
float getOpacity () const
 
virtual STK::Box2< float > getViewBoundingBox (const STK::Matrix4x4f &mvp, const STK::Viewport &glVp, bool reverse_y=false)=0
 Get bounding box in viewport pixel coordinates.
 

Additional Inherited Members

- Protected Member Functions inherited from STK::RenderItem2D
virtual void updateTransform ()
 
void setViewScale (float x, float y)
 
- Protected Attributes inherited from STK::RenderItem2D
float depth_ = 0
 
STK::Matrix4x4f transform_
 
STK::Vector2f pos_
 
float angle_ = 0.0f
 
float opacity_ = 1.0f
 
STK::Vector2f scale_ { 1.0f, 1.0f }
 
bool transform_dirty_ = false
 
std::optional< STK::Matrix4x4fpre_transform_
 
std::optional< STK::Matrix4x4fpost_transform_
 
std::mutex xfm_mutex_
 
unsigned char stencil_value_ = 0
 
StencilMode stencil_mode_ = StencilMode::NONE
 
float view_scale_x_ = 1.0f
 
float view_scale_y_ = 1.0f
 

Detailed Description

EllipseRender2D - Efficient rendering of multiple filled circles or ellipses.

Member Function Documentation

◆ cleanupBuffers()

void STK::EllipseRender2D::cleanupBuffers ( )
overridevirtual

Clean up OpenGL graphics objects This method should clean up all OpenGL related buffers and objects. This is normally called by GraphicsRender2D::cleanup()

Implements STK::RenderItem2D.

◆ drawVertexArrays()

void STK::EllipseRender2D::drawVertexArrays ( )
inline

Draw vertex buffers. Low level rendering of the vertex buffers. Needs the correct shader and uniforms to be set first. This method is normally called by the GraphicsRender2D class.

◆ getBatchId()

int STK::EllipseRender2D::getBatchId ( ) const
overridevirtual

Render batch id. This number indicates which item should be rendered together if the depths are equal.

Implements STK::RenderItem2D.

◆ getFixedSize()

bool STK::EllipseRender2D::getFixedSize ( ) const
inline
See also
setFixedSize()

◆ getViewBoundingBox()

STK::Box2< float > STK::EllipseRender2D::getViewBoundingBox ( const STK::Matrix4x4f mvp,
const STK::Viewport glVp,
bool  reverse_y = false 
)
overridevirtual

Get bounding box in viewport pixel coordinates.

Parameters
mvpProjection/Modelview matrix.
glVpOpenGL viewport
reverse_yIf true, any pixel coordinate calculations are using positive y direction downwards. This applies for example to text and icon items which have separate pixel coordinate transforms.
Returns
Min/Max coordinates for the object in pixel coordinates.

Implements STK::RenderItem2D.

◆ render()

void STK::EllipseRender2D::render ( GraphicsRender2D renderer,
const STK::Matrix4x4f pj,
const STK::Matrix4x4f vm,
const STK::Viewport vp 
)
overridevirtual

Render item into the current frame. This method should render a single item into the GraphicsRender2D.

Implements STK::RenderItem2D.

◆ setFixedSize()

void STK::EllipseRender2D::setFixedSize ( bool  fixed)
inline

Set object to be fixed size (in pixels). If true, any viewport scaling will not affect the geometry of this object. All transforms that are set explicitly on the object through INativeRenderItem2D (Position, Scale, Rotation) will still be applied. Example: A circle with offset c = (10, 20) and r = 30 pixels will always be rendered with 30 pixels radius at (10, 20) pixels offset from Position, but can still be moved by changing the Position vector.


The documentation for this class was generated from the following files: