smk::TransformableBase Class Referenceabstract

#include <Transformable.hpp>

Inheritance diagram for smk::TransformableBase:

Description

A Drawable object supporting several transformations:

Definition at line 21 of file Transformable.hpp.

Public Member Functions

virtual glm::mat4 transformation () const =0
 
void SetColor (const glm::vec4 &color)
 Color. More...
 
const glm::vec4 & color () const
 
void SetTexture (Texture texture)
 Set the object's texture. More...
 
const Texturetexture () const
 
void SetBlendMode (const BlendMode &)
 Set the blending mode to be used for drawing the object. More...
 
const BlendModeblend_mode () const
 
void SetVertexArray (VertexArray vertex_array)
 Set the object's shape. More...
 
const VertexArrayvertex_array () const
 
void Draw (RenderTarget &target, RenderState state) const override
 
 TransformableBase (TransformableBase &&) noexcept=default
 
 TransformableBase (const TransformableBase &)=default
 
TransformableBaseoperator= (TransformableBase &&) noexcept=default
 
TransformableBaseoperator= (const TransformableBase &)=default
 

Member Function Documentation

◆ blend_mode()

const BlendMode & smk::TransformableBase::blend_mode ( ) const
inline

Definition at line 36 of file Transformable.hpp.

36{ return blend_mode_; }

◆ color()

const glm::vec4 & smk::TransformableBase::color ( ) const
inline

Definition at line 28 of file Transformable.hpp.

28{ return color_; }

◆ Draw()

void smk::TransformableBase::Draw ( RenderTarget target,
RenderState  state 
) const
overridevirtual

Draw the object on a RenderTarget.

Parameters
targetA RenderTarget to be drawn on.
stateThe RenderState to derive from.

Implements smk::Drawable.

Definition at line 147 of file Transformable.cpp.

147 {
148 state.color *= color();
149 state.texture = texture();
150 state.view *= transformation();
151 state.vertex_array = vertex_array();
152 state.blend_mode = blend_mode();
153 target.Draw(state);
154}

◆ SetBlendMode()

void smk::TransformableBase::SetBlendMode ( const BlendMode blend_mode)

Set the blending mode to be used for drawing the object.

Parameters
blend_modethe BlendMode to be used.

Definition at line 133 of file Transformable.cpp.

133 {
134 blend_mode_ = blend_mode;
135}

◆ SetColor()

void smk::TransformableBase::SetColor ( const glm::vec4 &  color)

Color.

Modify the color of the object. The resulting pixel is the multiplication component wise in between this color and the original pixel color.

Parameters
colorThe color.
Examples
rounded_rectangle.cpp, and shape_2d.cpp.

Definition at line 127 of file Transformable.cpp.

127 {
128 color_ = color;
129}

◆ SetTexture()

void smk::TransformableBase::SetTexture ( Texture  texture)

Set the object's texture.

Definition at line 138 of file Transformable.cpp.

138 {
139 texture_ = std::move(texture);
140}

◆ SetVertexArray()

void smk::TransformableBase::SetVertexArray ( VertexArray  vertex_array)

Set the object's shape.

Definition at line 143 of file Transformable.cpp.

143 {
144 vertex_array_ = std::move(vertex_array);
145}

◆ texture()

const Texture & smk::TransformableBase::texture ( ) const
inline

Definition at line 32 of file Transformable.hpp.

32{ return texture_; }

◆ transformation()

virtual glm::mat4 smk::TransformableBase::transformation ( ) const
pure virtual

Implemented in smk::Transformable.

◆ vertex_array()

const VertexArray & smk::TransformableBase::vertex_array ( ) const
inline

Definition at line 40 of file Transformable.hpp.

40{ return vertex_array_; }

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