Renderable2D
Renderable2D extends Node2D with the interface the renderer needs to issue a draw call. It is the common base for all drawable 2D node types, such as Sprite and Text.
The transforms let a node draw shared geometry without rewriting vertices. A sprite draws a unit quad and supplies a transform that scales it to its size, plus a texture transform that selects its region. A node that owns geometry laid out in node space, such as text, keeps the defaults, which shift the geometry by the anchor and leave texture coordinates alone.
This class is not instantiated directly. Use one of the concrete node types, or derive from it to implement a custom drawable.
INFO
Derives from Node2D and inherits all public properties and methods.
Properties
Normalized anchor point inside the node's bounds.
Defines which point of the bounds as reported by GetSize is placed at the node's position.
(0.0, 0.0)top-left corner of the bounds (default).(0.5, 0.5)center of the bounds.(1.0, 0.0)top-right corner, for right-aligned labels.
Vector2 anchor {0.0f, 0.0f};Functions
Returns the geometry used to draw this node.
virtual std::shared_ptr<Geometry> Renderable2D::GetGeometry()=0;Returns the transform that maps geometry vertices into node space.
The default shifts the geometry by the anchor. Nodes that draw shared geometry compose their own scaling.
virtual Matrix3 Renderable2D::GetGeometryTransform() const;GetNodeType() Node2D::Type virtual
Identifies this node as Node2D::Type::Renderable.
Type vglx::Renderable2D::GetNodeType() const override;Returns the node's size in canvas units before scaling.
The anchor is measured against this size. Returns zero when there is nothing to draw.
virtual Vector2 Renderable2D::GetSize() const=0;Returns the texture sampled by the geometry or nullptr when there's nothing to draw.
virtual std::shared_ptr<Texture2D> Renderable2D::GetTexture() const=0;Returns the transform that maps geometry texture coordinates into the texture.
virtual Matrix3 Renderable2D::GetTextureTransform() const;IsRenderable() bool virtual
Returns true, identifying this node as renderable.
bool Renderable2D::IsRenderable() const override;