Beatmup
Beatmup::Scene::ShadedBitmapLayer Class Reference

Bitmap layer using a custom shader. More...

#include <scene.h>

Inheritance diagram for Beatmup::Scene::ShadedBitmapLayer:
Beatmup::Scene::BitmapLayer Beatmup::Scene::Layer Beatmup::Object

Public Member Functions

ImageShader * getShader () const
 
void setShader (ImageShader *shader)
 
- 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 AbstractBitmap * getBitmap () const
 
void setBitmap (AbstractBitmap *bitmap)
 
AffineMapping & getBitmapMapping ()
 
const AffineMapping & getBitmapMapping () 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)
 
AffineMapping & getMapping ()
 
const AffineMapping & getMapping () const
 
void setMapping (const AffineMapping &mapping)
 
virtual Layer * getChild (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

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

Private Attributes

ImageShader * shader
 

Friends

class Scene
 
class SceneRenderer
 

Additional Inherited Members

- Public Types inherited from Beatmup::Scene::Layer
enum class  Type {
  SceneLayer = 0 , BitmapLayer , MaskedBitmapLayer , ShapedBitmapLayer ,
  ShadedBitmapLayer
}
 
- Protected Attributes inherited from Beatmup::Scene::BitmapLayer
float invAr
 inverse aspect ratio of what is rendered (set by SceneRenderer) More...
 
AbstractBitmap * bitmap
 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...
 

Detailed Description

Bitmap layer using a custom shader.

Definition at line 268 of file scene.h.

Constructor & Destructor Documentation

◆ ShadedBitmapLayer()

Scene::ShadedBitmapLayer::ShadedBitmapLayer ( )
protected

Definition at line 442 of file scene.cpp.

442  :
444  shader(nullptr)
445 {}
@ ShadedBitmapLayer
layer displaying a bitmap through a custom fragment shader

Member Function Documentation

◆ render()

void Scene::ShadedBitmapLayer::render ( RenderingContext &  context)
protectedvirtual

Reimplemented from Beatmup::Scene::BitmapLayer.

Definition at line 448 of file scene.cpp.

448  {
449  if (!shader)
450  return;
452 
453  if (content)
454  invAr = content->getInvAspectRatio();
455  else
456  invAr = 0;
457 
458  AffineMapping arMapping(context.getMapping());
459  if (content)
460  arMapping.matrix.scale(1.0f, invAr);
461 
462  shader->prepare(context.getGpu(), content, TextureParam::INTERP_LINEAR, nullptr, arMapping);
464  shader->process(context.getGpu());
465 }
2x3 affine mapping containing a 2x2 matrix and a 2D point
Definition: geometry.h:639
static const char * VERTICAL_FLIP_ID
Vertical flipping variable name in vertex shader.
void setInteger(std::string name, int value)
Sets a scalar integer uniform value.
void process(GraphicPipeline &gpu)
Apply the shader to produce an image.
void prepare(GraphicPipeline &gpu, GL::TextureHandler *input, const TextureParam texParam, AbstractBitmap *output, const AffineMapping &mapping)
Conducts required preparations for blending.
const AffineMapping & getMapping() const
const bool isRenderingOnScreen() const
GraphicPipeline & getGpu()
GL::TextureHandler * resolveContent(RenderingContext &context)
Definition: scene.cpp:273
float invAr
inverse aspect ratio of what is rendered (set by SceneRenderer)
Definition: scene.h:173
@ INTERP_LINEAR
bilinear pixel interpolation
std::string content

◆ getShader()

ImageShader* Beatmup::Scene::ShadedBitmapLayer::getShader ( ) const
inline

Definition at line 277 of file scene.h.

277 { return shader; }

◆ setShader()

void Beatmup::Scene::ShadedBitmapLayer::setShader ( ImageShader *  shader)
inline

Definition at line 278 of file scene.h.

278 { this->shader = shader; }

Friends And Related Function Documentation

◆ Scene

friend class Scene
friend

Definition at line 269 of file scene.h.

◆ SceneRenderer

friend class SceneRenderer
friend

Definition at line 270 of file scene.h.

Member Data Documentation

◆ shader

ImageShader* Beatmup::Scene::ShadedBitmapLayer::shader
private

Definition at line 272 of file scene.h.


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