Beatmup
Beatmup::Scene::CustomMaskedBitmapLayer Class Reference

Layer containing a bitmap and a mask applied to the bitmap when rendering. More...

#include <scene.h>

Inheritance diagram for Beatmup::Scene::CustomMaskedBitmapLayer:
Beatmup::Scene::BitmapLayer Beatmup::Scene::Layer Beatmup::Object Beatmup::Scene::MaskedBitmapLayer Beatmup::Scene::ShapedBitmapLayer

Public Member Functions

AffineMappinggetMaskMapping ()
 
const AffineMappinggetMaskMapping () const
 
void setMaskMapping (const AffineMapping &mapping)
 
color4i getBackgroundColor () const
 
void setBackgroundColor (color4i color)
 
- Public Member Functions inherited from Beatmup::Scene::BitmapLayer
bool testPoint (float x, float y) const
 Tests if a given point falls in the layer. More...
 
const AbstractBitmapgetBitmap () const
 
void setBitmap (AbstractBitmap *bitmap)
 
AffineMappinggetBitmapMapping ()
 
const AffineMappinggetBitmapMapping () const
 
void setBitmapMapping (const AffineMapping &mapping)
 
color4i getModulationColor () const
 
void setModulationColor (color4i color)
 
- Public Member Functions inherited from Beatmup::Scene::Layer
Type getType () const
 
const std::string & getName () const
 
void setName (const char *name)
 
AffineMappinggetMapping ()
 
const AffineMappinggetMapping () const
 
void setMapping (const AffineMapping &mapping)
 
virtual LayergetChild (float x, float y, unsigned int recursionDepth=0) const
 Picks a child layer at given point, if any. More...
 
bool isVisible () const
 Returns layer visibility flag. More...
 
bool isPhantom () const
 Returns true if the layer is ignored when searching a layer by point. More...
 
void setVisible (bool visible)
 Sets layer visibility. More...
 
void setPhantom (bool phantom)
 Makes/unmakes the layer "phantom". More...
 
template<class LayerType >
LayerType & castTo () const
 
- Public Member Functions inherited from Beatmup::Object
virtual ~Object ()
 

Protected Member Functions

 CustomMaskedBitmapLayer (Type type)
 
void configure (RenderingContext &context, GL::TextureHandler *content)
 
- Protected Member Functions inherited from Beatmup::Scene::BitmapLayer
 BitmapLayer ()
 
 BitmapLayer (Type type)
 
GL::TextureHandlerresolveContent (RenderingContext &context)
 
void configure (RenderingContext &context, GL::TextureHandler *content)
 Configures current rendering program to render this layer. More...
 
void render (RenderingContext &context)
 
- Protected Member Functions inherited from Beatmup::Scene::Layer
 Layer (Type type)
 

Protected Attributes

AffineMapping maskMapping
 mask mapping w.r.t. the layer mapping More...
 
color4i bgColor
 color to fill mask areas where the bitmap is not present More...
 
- Protected Attributes inherited from Beatmup::Scene::BitmapLayer
float invAr
 inverse aspect ratio of what is rendered (set by SceneRenderer) More...
 
AbstractBitmapbitmap
 content to display, used if the image source is set to BITMAP More...
 
AffineMapping bitmapMapping
 bitmap mapping w.r.t. the layer mapping More...
 
color4i modulation
 modulation color More...
 
- Protected Attributes inherited from Beatmup::Scene::Layer
AffineMapping mapping
 layer mapping More...
 
bool visible
 layer visibility More...
 
bool phantom
 if true, layer is ignored by selection by point More...
 

Additional Inherited Members

- Public Types inherited from Beatmup::Scene::Layer
enum class  Type {
  SceneLayer = 0 , BitmapLayer , MaskedBitmapLayer , ShapedBitmapLayer ,
  ShadedBitmapLayer
}
 

Detailed Description

Layer containing a bitmap and a mask applied to the bitmap when rendering.

Both bitmap and mask have their own positions and orientations relative to the layer's position and orientation.

Definition at line 197 of file scene.h.

Constructor & Destructor Documentation

◆ CustomMaskedBitmapLayer()

Scene::CustomMaskedBitmapLayer::CustomMaskedBitmapLayer ( Type  type)
protected

Definition at line 322 of file scene.cpp.

322  :
324 {}
color4i bgColor
color to fill mask areas where the bitmap is not present
Definition: scene.h:203
AffineMapping maskMapping
mask mapping w.r.t. the layer mapping
Definition: scene.h:202
static const color4i ZERO
Definition: constants.h:32

Member Function Documentation

◆ configure()

void Scene::CustomMaskedBitmapLayer::configure ( RenderingContext context,
GL::TextureHandler content 
)
protected

Definition at line 326 of file scene.cpp.

326  {
328  AffineMapping arImgMapping(bitmapMapping), arMaskMapping(maskMapping);
329  arImgMapping.matrix.scale(1.0f, invAr);
330  arMaskMapping.matrix.scale(1.0f, invAr);
331  context.getProgram().setVector4("bgColor", bgColor);
333  context.getProgram().setMatrix3("invImgMapping", arImgMapping.getInverse() * arMaskMapping);
334  context.getProgram().setMatrix3("maskMapping", arMaskMapping);
335 }
2x3 affine mapping containing a 2x2 matrix and a 2D point
Definition: geometry.h:639
void setVector4(const std::string &name, const float x, const float y, const float z, const float w)
Definition: program.cpp:378
void setMatrix3(const std::string &name, const Matrix2 &mat, const Point &pos)
Definition: program.cpp:402
static const char * MODELVIEW_MATRIX_ID
Modelview matrix (mapping input geometry to output) shader variable name in vertex shader.
const AffineMapping & getMapping() const
float invAr
inverse aspect ratio of what is rendered (set by SceneRenderer)
Definition: scene.h:173
void configure(RenderingContext &context, GL::TextureHandler *content)
Configures current rendering program to render this layer.
Definition: scene.cpp:279
AffineMapping bitmapMapping
bitmap mapping w.r.t. the layer mapping
Definition: scene.h:175
std::string content

◆ getMaskMapping() [1/2]

AffineMapping& Beatmup::Scene::CustomMaskedBitmapLayer::getMaskMapping ( )
inline

Definition at line 205 of file scene.h.

205 { return maskMapping; }

◆ getMaskMapping() [2/2]

const AffineMapping& Beatmup::Scene::CustomMaskedBitmapLayer::getMaskMapping ( ) const
inline

Definition at line 206 of file scene.h.

206 { return maskMapping; }

◆ setMaskMapping()

void Beatmup::Scene::CustomMaskedBitmapLayer::setMaskMapping ( const AffineMapping mapping)
inline

Definition at line 207 of file scene.h.

207 { this->maskMapping = mapping; }
AffineMapping mapping
layer mapping
Definition: scene.h:80

◆ getBackgroundColor()

color4i Beatmup::Scene::CustomMaskedBitmapLayer::getBackgroundColor ( ) const
inline

Definition at line 209 of file scene.h.

209 { return bgColor; }

◆ setBackgroundColor()

void Beatmup::Scene::CustomMaskedBitmapLayer::setBackgroundColor ( color4i  color)
inline

Definition at line 210 of file scene.h.

210 { this->bgColor = color; }

Member Data Documentation

◆ maskMapping

AffineMapping Beatmup::Scene::CustomMaskedBitmapLayer::maskMapping
protected

mask mapping w.r.t. the layer mapping

Definition at line 202 of file scene.h.

◆ bgColor

color4i Beatmup::Scene::CustomMaskedBitmapLayer::bgColor
protected

color to fill mask areas where the bitmap is not present

Definition at line 203 of file scene.h.


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