nCine::DrawableNode class

Object that can be drawn through the render queue.

Base classes

class SceneNode
Base class for the transformation nodes hierarchy.

Derived classes

class BaseSprite
Base class for sprites.

Public types

enum class BlendingPreset { DISABLED, ALPHA, PREMULTIPLIED_ALPHA, ADDITIVE, MULTIPLY }
Presets for blending factors.
enum class BlendingFactor { ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA, SRC_ALPHA_SATURATE }
OpenGL blending factors.

Public static variables

static const Vector2f AnchorCenter
static const Vector2f AnchorBottomLeft
static const Vector2f AnchorTopLeft
static const Vector2f AnchorBottomRight
static const Vector2f AnchorTopRight

Constructors, destructors, conversion operators

DrawableNode(SceneNode* parent, float xx, float yy)
Constructor for a drawable node with a parent and a specified relative position.
DrawableNode(SceneNode* parent, Vector2f position)
Constructor for a drawable node with a parent and a specified relative position as a vector.
DrawableNode(SceneNode* parent) explicit
Constructor for a drawable node with a parent and positioned in the relative origin.
DrawableNode()
Constructor for a drawable node with no parent and positioned in the origin.
~DrawableNode() override
DrawableNode(DrawableNode&&)
Default move constructor.
DrawableNode(const DrawableNode& other) protected
Protected copy constructor used to clone objects.

Public functions

auto operator=(DrawableNode&&) -> DrawableNode&
Default move assignment operator.
auto OnDraw(RenderQueue& renderQueue) -> bool override
Updates the draw command and adds it to the queue.
auto width() const -> float virtual
Returns the width of the node area.
auto height() const -> float virtual
Returns the height of the node area.
auto size() const -> Vector2f
Returns the size of the node area.
auto absWidth() const -> float virtual
Returns the absolute width of the node area.
auto absHeight() const -> float virtual
Returns the absolute height of the node area.
auto absSize() const -> Vector2f
Returns the absolute size of the node area.
auto anchorPoint() const -> Vector2f
Gets the transformation anchor point.
void setAnchorPoint(float xx, float yy)
Sets the transformation anchor point.
void setAnchorPoint(Vector2f point)
Sets the transformation anchor point with a Vector2f
auto isBlendingEnabled() const -> bool
Returns true if the node renders with blending enabled.
void setBlendingEnabled(bool blendingEnabled)
Sets the blending state for node rendering.
auto srcBlendingFactor() const -> BlendingFactor
Returns the source blending factor.
auto destBlendingFactor() const -> BlendingFactor
Returns the destination blending factor.
void setBlendingPreset(BlendingPreset blendingPreset)
Sets a blending preset for source and destination blending factors.
void setBlendingFactors(BlendingFactor srcBlendingFactor, BlendingFactor destBlendingFactor)
Sets a specific source and destination blending factors.
auto lastFrameRendered() const -> unsigned long int
Returns the last frame in which any of the viewports have rendered this node (node was not culled)
auto aabb() const -> Rectf
Returns the axis-aligned bounding box of the node area in the last frame.

Protected functions

void updateAabb() virtual
Calculates updated values for the AABB.
void updateCulling()
Called by each viewport update method to update a node culling state.
void shaderHasChanged() pure virtual
Performs the required tasks upon a change to the shader.
void updateRenderCommand() pure virtual
Updates the render command.

Protected variables

float width_
Node width in pixel.
float height_
Node height in pixel.
RenderCommand renderCommand_
The render command class associated with this node.
unsigned long int lastFrameRendered_
The last frame any viewports rendered this node.
Rectf aabb_
Axis-aligned bounding box of the node area.

Enum documentation

enum class nCine::DrawableNode::BlendingPreset

Presets for blending factors.

Enumerators
DISABLED

uses GL_ONE and GL_ZERO

ALPHA

uses GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA

PREMULTIPLIED_ALPHA

uses GL_ONE and GL_ONE_MINUS_SRC_ALPHA

ADDITIVE

uses GL_SRC_ALPHA and GL_ONE

MULTIPLY

uses GL_DST_COLOR and GL_ZERO