smk::Transformable3D Class Reference

#include <Transformable.hpp>

Inheritance diagram for smk::Transformable3D:

Description

A 2D Drawable object supporting several transformations:

Definition at line 111 of file Transformable.hpp.

Public Member Functions

void SetTransformation (const glm::mat4 &mat)
 set the transformation to use for drawing this object, represented as 4x4 matrix. More...
 
glm::mat4 transformation () const override
 
 Transformable3D (Transformable3D &&)=default
 
 Transformable3D (const Transformable3D &)=default
 
Transformable3Doperator= (Transformable3D &&)=default
 
Transformable3Doperator= (const Transformable3D &)=default
 
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
 

Member Function Documentation

◆ blend_mode()

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

Definition at line 36 of file Transformable.hpp.

36{ return blend_mode_; }

◆ color()

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

Definition at line 28 of file Transformable.hpp.

28{ return color_; }

◆ Draw()

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

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)
inherited

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)
inherited

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)
inherited

Set the object's texture.

Definition at line 138 of file Transformable.cpp.

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

◆ SetTransformation()

void smk::Transformable3D::SetTransformation ( const glm::mat4 &  mat)

set the transformation to use for drawing this object, represented as 4x4 matrix.

See also
https://learnopengl.com/Getting-started/Transformations
Parameters
transformationThe 4x4 matrix defining the transformation.

Definition at line 160 of file Transformable.cpp.

160 {
161 transformation_ = mat;
162}

◆ SetVertexArray()

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

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
inlineinherited

Definition at line 32 of file Transformable.hpp.

32{ return texture_; }

◆ transformation()

glm::mat4 smk::Transformable3D::transformation ( ) const
overridevirtual

Implements smk::TransformableBase.

Definition at line 164 of file Transformable.cpp.

164 {
165 return transformation_;
166}

◆ vertex_array()

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

Definition at line 40 of file Transformable.hpp.

40{ return vertex_array_; }

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