class
#include <nCine/Graphics/SceneNode.h>
SceneNode Base class for the transformation nodes hierarchy.
Base classes
- class Object
- Base class of nCine objects.
Derived classes
- class Jazz2::Rendering::BlurRenderPass
- Applies blur to a scene.
- class Jazz2::Rendering::CombineRenderer
- Combines all previous passes of a scene into a resulting image.
- class Jazz2::Rendering::LightingRenderer
- Processes all lights in a scene into an intermediate target.
- class Jazz2::Rendering::UpscaleRenderPass
- Upscales input image usually to a native resolution.
- class Jazz2::Rendering::UpscaleRenderPass::AntialiasingSubpass
- Optional antialiasing subpass.
- class Jazz2::Tiles::TileMap
- Represents a renderable tile map, consists of multiple layers.
- class Jazz2::UI::Canvas
- Canvas.
- class DrawableNode
- Object that can be drawn through the render queue.
- class ParticleSystem
- Represents a particle system.
Public types
- enum class VisitOrderState { Disabled, Enabled, SameAsParent }
Public static variables
- static float MinRotation constexpr
- Minimum amount of rotation to trigger a sine and cosine calculation.
Public static functions
- static auto sType() -> ObjectType
Constructors, destructors, conversion operators
- SceneNode(SceneNode* parent, float x, float y)
- Constructor for a node with a parent and a specified relative position.
- SceneNode(SceneNode* parent, Vector2f position)
- Constructor for a node with a parent and a specified relative position as a vector.
- SceneNode(SceneNode* parent) explicit
- Constructor for a node with a parent and positioned in the relative origin.
- SceneNode()
- Constructor for a node with no parent and positioned in the origin.
- ~SceneNode() override
- Destructor will delete every child node.
- SceneNode(SceneNode&& other) noexcept
- SceneNode(const SceneNode& other) protected
- Protected copy constructor used to clone objects.
Public functions
- auto operator=(SceneNode&& other) -> SceneNode& noexcept
- auto clone() const -> SceneNode
- Returns a copy of this object.
- auto parent() const -> const SceneNode*
- Returns the parent as a constant node, if there is any.
- auto parent() -> SceneNode*
- Returns the parent node, if there is any.
- auto setParent(SceneNode* parentNode) -> bool
- Sets the parent node.
- auto children() -> const SmallVectorImpl<SceneNode*>&
- Returns the array of child nodes.
- auto children() const -> const SmallVectorImpl<const SceneNode*>&
- Returns an array of constant child nodes.
- auto addChildNode(SceneNode* childNode) -> bool
- Adds a node as a child of this one.
- auto removeChildNode(SceneNode* childNode) -> bool
- Removes a child of this node, without reparenting nephews.
- auto removeChildNodeAt(unsigned int index) -> bool
- Removes the child at the specified index, without reparenting nephews.
- auto removeAllChildrenNodes() -> bool
- Removes all children, without reparenting nephews.
- auto unlinkChildNode(SceneNode* childNode) -> bool
- Removes a child of this node reparenting nephews as children.
- auto childOrderIndex() const -> unsigned int
- Returns the child order index of this node or zero if it does not have a parent.
- auto swapChildrenNodes(unsigned int firstIndex, unsigned int secondIndex) -> bool
- Swaps two children at the specified indices.
- auto swapNodeForward() -> bool
- Brings this node one node forward in the parent's list of children.
- auto swapNodeBack() -> bool
- Brings this node one node back in the parent's list of children.
- auto visitOrderState() const -> enum VisitOrderState
- Returns
true
if the node visit order is used together with the layer. - void setVisitOrderState(enum VisitOrderState visitOrderState)
- Enables the use of the node visit order together with the layer.
- auto visitOrderIndex() const -> uint16_t
- Returns the visit drawing order of the node.
- void OnUpdate(float timeMult) virtual
- Called once every frame to update the node.
- void OnVisit(RenderQueue& renderQueue, unsigned int& visitOrderIndex) virtual
- Draws the node and visits its children.
- auto OnDraw(RenderQueue& renderQueue) -> bool virtual
- Renders the node.
- auto isUpdateEnabled() const -> bool
- Returns
true
if the node is updating. - void setUpdateEnabled(bool updateEnabled)
- Enables or disables node updating.
- auto isDrawEnabled() const -> bool
- Returns
true
if the node is drawing. - void setDrawEnabled(bool drawEnabled)
- Enables or disables node drawing.
- auto isEnabled() const -> bool
- Returns
true
if the node is both updating and drawing. - void setEnabled(bool isEnabled)
- Enables or disables both node updating and drawing.
- auto position() const -> Vector2f
- Returns node position relative to its parent.
- auto absPosition() const -> Vector2f
- Returns absolute node position.
- void setPosition(float x, float y)
- Sets the node position through two coordinates.
- void setPosition(Vector2f position)
- Sets the node position through a vector.
- void setPositionX(float x)
- Sets the X coordinate of the node position.
- void setPositionY(float y)
- Sets the Y coordinate of the node position.
- void move(float x, float y)
- Moves the node based on two offsets.
- void move(Vector2f position)
- Adds a move vector to the node current position.
- void moveX(float x)
- Moves the node by an offset on the X axis.
- void moveY(float y)
- Moves the node by an offset on the Y axis.
- auto absAnchorPoint() const -> Vector2f
- Gets the transformation anchor point in pixels.
- void setAbsAnchorPoint(float x, float y)
- Sets the transformation anchor point in pixels.
- void setAbsAnchorPoint(Vector2f point)
- Sets the transformation anchor point in pixels with a
Vector2f
- auto scale() const -> const Vector2f&
- Gets the node scale factors.
- auto absScale() const -> const Vector2f&
- Gets the node absolute scale factors.
- void setScale(float scaleFactor)
- Scales the node size both horizontally and vertically.
- void setScale(float scaleFactorX, float scaleFactorY)
- Scales the node size both horizontally and vertically.
- void setScale(Vector2f scaleFactor)
- Scales the node size both horizontally and vertically with a
Vector2f
- auto rotation() const -> float
- Gets the node rotation in radians.
- auto absRotation() const -> float
- Gets the node absolute rotation in radians.
- void setRotation(float rotation)
- Sets the node rotation in radians.
- auto color() const -> Colorf
- Gets the node color.
- auto absColor() const -> Colorf
- Gets the node absolute color.
- void setColor(const Color& color)
- Sets the node color through a
Color
object. - void setColor(const Colorf& color)
- Sets the node color through a
Colorf
object. - auto alpha() const -> float
- Gets the node alpha.
- auto absAlpha() const -> float
- Gets the node absolute alpha.
- void setAlpha(unsigned char alpha)
- Sets the node alpha through an unsigned char component.
- void setAlphaF(float alpha)
- Sets the node alpha through a float component.
- auto layer() const -> uint16_t
- Gets the node rendering layer.
- auto absLayer() const -> uint16_t
- Gets the node absolute rendering layer.
- void setLayer(uint16_t layer)
- Sets the node rendering layer.
- auto worldMatrix() const -> const Matrix4x4f&
- Gets the node world matrix.
- void setWorldMatrix(const Matrix4x4f& worldMatrix)
- Sets the node world matrix (only useful when called inside
OnPostUpdate()
) - auto localMatrix() const -> const Matrix4x4f&
- Gets the node local matrix.
- void setLocalMatrix(const Matrix4x4f& localMatrix)
- Sets the node local matrix.
- auto deleteChildrenOnDestruction() const -> bool
- Gets the delete children on destruction flag.
- void setDeleteChildrenOnDestruction(bool shouldDeleteChildrenOnDestruction)
- Sets the delete children on destruction flag.
- auto lastFrameUpdated() const -> unsigned long int
- Returns the last frame in which any of the viewports have updtated this node.
Protected types
- enum DirtyBitPositions { TransformationBit = 0, ColorBit = 1, SizeBit = 2, TextureBit = 3, AabbBit = 4 }
- Bit positions inside the dirty bitset.
Protected functions
Protected variables
- SceneNode* parent_
- A pointer to the parent node.
- SmallVector<SceneNode*, 0> children_
- The array of child nodes.
- unsigned int childOrderIndex_
- The order index of this node among its siblings.
- bool updateEnabled_
- bool drawEnabled_
- bool withVisitOrder_
- When enabled the visit order is used to resolve the drawing order of same layer nodes.
- bool shouldDeleteChildrenOnDestruction_
- A flag indicating whether the destructor should also delete all children.
- enum VisitOrderState visitOrderState_
- The visit order state of this node.
- uint16_t visitOrderIndex_
- The visit order index of this node.
- uint16_t layer_
- The node rendering layer.
- Vector2f position_
- The node relative position.
- Vector2f anchorPoint_
- Vector2f scaleFactor_
- Horizontal and vertical scale factors for node size.
- float rotation_
- Clock-wise node rotation in radians.
- Colorf color_
- Node color for transparency and translucency.
- Vector2f absPosition_
- Absolute position as calculated by the
transform()
function. - Vector2f absScaleFactor_
- Absolute horizontal and vertical scale factors as calculated by the
transform()
function. - float absRotation_
- Absolute node rotation as calculated by the
transform()
function. - Colorf absColor_
- Absolute node color as calculated by the
transform()
function. - uint16_t absLayer_
- Absolute node rendering layer as calculated by the
transform()
function. -
BitSet<std::
uint8_t> dirtyBits_ - Bitset that stores the various dirty states bits.
- Matrix4x4f worldMatrix_
- World transformation matrix (calculated from local and parent's world)
- Matrix4x4f localMatrix_
- Local transformation matrix.
- unsigned long int lastFrameUpdated_
- The last frame any viewport updated this node.
Function documentation
uint16_t nCine:: SceneNode:: absLayer() const
Gets the node absolute rendering layer.
void nCine:: SceneNode:: setLayer(uint16_t layer)
Sets the node rendering layer.
bool nCine:: SceneNode:: deleteChildrenOnDestruction() const
Gets the delete children on destruction flag.
If the flag is true the children are deleted upon node destruction.
Variable documentation
unsigned int nCine:: SceneNode:: childOrderIndex_ protected
The order index of this node among its siblings.
bool nCine:: SceneNode:: withVisitOrder_ protected
When enabled the visit order is used to resolve the drawing order of same layer nodes.
uint16_t nCine:: SceneNode:: layer_ protected
The node rendering layer.
Even if the base scene node is not always drawable, it carries layer information to easily pass that information to its children.
Vector2f nCine:: SceneNode:: anchorPoint_ protected
The anchor point for transformations, in pixels