Back to index

nux  3.0.0
Public Types | Public Member Functions | Protected Attributes | Private Attributes
nux::CompositionLayer Class Reference

#include <PaintLayer.h>

Inheritance diagram for nux::CompositionLayer:
Inheritance graph
[legend]
Collaboration diagram for nux::CompositionLayer:
Collaboration graph
[legend]

List of all members.

Public Types

enum  PaintLayerType {
  PaintLayer_Color, PaintLayer_Shape, PaintLayer_ShapeROP, PaintLayer_Texture,
  PaintLayer_DeviceTexture, PaintLayer_ImageStyle
}

Public Member Functions

 CompositionLayer (ObjectPtr< IOpenGLBaseTexture > texture0, TexCoordXForm texxform0, const Color &color0, ObjectPtr< IOpenGLBaseTexture > texture1, TexCoordXForm texxform1, const Color &color1, LayerBlendMode layer_blend_mode, bool write_alpha, const ROPConfig &ROP)
 Layer blend operation.
 CompositionLayer (ObjectPtr< IOpenGLBaseTexture > texture0, TexCoordXForm texxform0, const Color &color0, const Color &blend_color, LayerBlendMode layer_blend_mode, bool write_alpha, const ROPConfig &ROP)
 Layer blend operation.
 CompositionLayer (const Color &base_color, ObjectPtr< IOpenGLBaseTexture > texture0, TexCoordXForm texxform0, const Color &color0, LayerBlendMode layer_blend_mode, bool write_alpha, const ROPConfig &ROP)
 Layer blend operation.
virtual ~CompositionLayer ()
virtual void Renderlayer (GraphicsEngine &graphics_engine)
virtual AbstractPaintLayerClone () const
virtual void SetGeometry (const Geometry &geo)
void SetModelViewMatrix (const Matrix4 &mat)
 Preserve the model view matrix at the moment layer is pushed on the paint layer stack. See Painter class.
Matrix4 GetModelViewMatrix ()
Geometry const & GetGeometry () const

Protected Attributes

Geometry geometry_
Matrix4 model_view_matrix_

Private Attributes

ObjectPtr< IOpenGLBaseTexturem_source_texture
Color m_source_texture_color
TexCoordXForm m_source_texture_texxform
ObjectPtr< IOpenGLBaseTexturem_foreground_texture
Color m_foreground_texture_color
TexCoordXForm m_foreground_texture_texxform
Color m_source_color
Color m_foreground_color
bool m_write_alpha
ROPConfig m_rop
LayerBlendMode m_blend_mode

Detailed Description

Definition at line 80 of file PaintLayer.h.


Member Enumeration Documentation

Enumerator:
PaintLayer_Color 
PaintLayer_Shape 
PaintLayer_ShapeROP 
PaintLayer_Texture 
PaintLayer_DeviceTexture 
PaintLayer_ImageStyle 

Definition at line 33 of file AbstractPaintLayer.h.


Constructor & Destructor Documentation

nux::CompositionLayer::CompositionLayer ( ObjectPtr< IOpenGLBaseTexture texture0,
TexCoordXForm  texxform0,
const Color &  color0,
ObjectPtr< IOpenGLBaseTexture texture1,
TexCoordXForm  texxform1,
const Color &  color1,
LayerBlendMode  layer_blend_mode,
bool  write_alpha,
const ROPConfig ROP 
)

Layer blend operation.

Blend(texture0*color0, texture1*color1);

Definition at line 130 of file PaintLayer.cpp.

  {
    m_source_texture = texture0;
    m_source_texture_color = color0;
    m_source_texture_texxform = texxform0;

    m_foreground_texture = texture1;
    m_foreground_texture_color = color1;
    m_foreground_texture_texxform = texxform1;
    
    m_blend_mode = layer_blend_mode;
    
    m_rop = ROP;
    m_write_alpha = write_alpha;
  }

Here is the caller graph for this function:

nux::CompositionLayer::CompositionLayer ( ObjectPtr< IOpenGLBaseTexture texture0,
TexCoordXForm  texxform0,
const Color &  color0,
const Color &  blend_color,
LayerBlendMode  layer_blend_mode,
bool  write_alpha,
const ROPConfig ROP 
)

Layer blend operation.

Blend(texture0*color0, blend_color);

Definition at line 148 of file PaintLayer.cpp.

  {
    m_source_texture = texture0;
    m_source_texture_color = color0;
    m_source_texture_texxform = texxform0;
    
    m_foreground_color = blend_color;
    
    m_blend_mode = layer_blend_mode;
    
    m_write_alpha = write_alpha;
    m_rop = ROP;
  }
nux::CompositionLayer::CompositionLayer ( const Color &  base_color,
ObjectPtr< IOpenGLBaseTexture texture0,
TexCoordXForm  texxform0,
const Color &  color0,
LayerBlendMode  layer_blend_mode,
bool  write_alpha,
const ROPConfig ROP 
)

Layer blend operation.

Blend(texture0*color0, color0);

Definition at line 164 of file PaintLayer.cpp.

  {
    m_source_color = base_color;
    
    m_foreground_texture = texture0;
    m_foreground_texture_texxform = texxform0;
    m_foreground_texture_color = color0;
    
    m_blend_mode = layer_blend_mode;
    m_write_alpha = write_alpha;
    
    m_rop = ROP;
  }

Definition at line 181 of file PaintLayer.cpp.

Here is the call graph for this function:


Member Function Documentation

Implements nux::AbstractPaintLayer.

Definition at line 240 of file PaintLayer.cpp.

  {
    return new CompositionLayer(*this);
  }

Here is the call graph for this function:

Geometry const & nux::AbstractPaintLayer::GetGeometry ( ) const [inherited]

Definition at line 22 of file AbstractPaintLayer.cpp.

  {
    return geometry_;
  }

Here is the caller graph for this function:

Definition at line 32 of file AbstractPaintLayer.cpp.

  {
    return model_view_matrix_;
  }

Here is the caller graph for this function:

void nux::CompositionLayer::Renderlayer ( GraphicsEngine graphics_engine) [virtual]

Implements nux::AbstractPaintLayer.

Definition at line 189 of file PaintLayer.cpp.

  {
    unsigned int current_alpha_blend;
    unsigned int current_src_blend_factor;
    unsigned int current_dest_blend_factor;
    unsigned int current_red_mask;
    unsigned int current_green_mask;
    unsigned int current_blue_mask;
    unsigned int current_alpha_mask;
    
    // Get the current color mask and blend states. They will be restored later.
    graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);
    graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);

    graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);
    graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);
    
    if (m_source_texture.IsValid())
    {
        if (m_foreground_texture.IsValid())
        {
          graphics_engine.QRP_GLSL_TexBlendOverTex(geometry_.x, geometry_.y, geometry_.GetWidth(),
            geometry_.GetHeight(), m_source_texture,
            m_source_texture_texxform, m_source_texture_color,
            m_foreground_texture, m_foreground_texture_texxform,
            m_foreground_texture_color, m_blend_mode);
        }
        else
        {
          graphics_engine.QRP_GLSL_ColorBlendOverTex(geometry_.x, geometry_.y, geometry_.GetWidth(),
            geometry_.GetHeight(), m_source_texture,
            m_source_texture_texxform, m_source_texture_color,
            m_foreground_color, m_blend_mode);
        }
    }
    else
    {
      if (m_foreground_texture.IsValid())
      {
        graphics_engine.QRP_GLSL_TexBlendOverColor(geometry_.x, geometry_.y, geometry_.GetWidth(),
          geometry_.GetHeight(), m_source_color,
          m_foreground_texture, m_foreground_texture_texxform,
          m_foreground_texture_color,
          m_blend_mode);
      }
    }

    graphics_engine.GetRenderStates().SetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);
    graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
  }

Here is the call graph for this function:

void nux::AbstractPaintLayer::SetGeometry ( const Geometry geo) [virtual, inherited]

Definition at line 17 of file AbstractPaintLayer.cpp.

  {
    geometry_ = geo;
  }

Here is the caller graph for this function:

void nux::AbstractPaintLayer::SetModelViewMatrix ( const Matrix4 mat) [inherited]

Preserve the model view matrix at the moment layer is pushed on the paint layer stack. See Painter class.

Definition at line 27 of file AbstractPaintLayer.cpp.

  {
    model_view_matrix_ = mat;
  }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 59 of file AbstractPaintLayer.h.

Definition at line 130 of file PaintLayer.h.

Definition at line 125 of file PaintLayer.h.

Definition at line 120 of file PaintLayer.h.

Definition at line 121 of file PaintLayer.h.

Definition at line 122 of file PaintLayer.h.

Definition at line 128 of file PaintLayer.h.

Definition at line 124 of file PaintLayer.h.

Definition at line 116 of file PaintLayer.h.

Definition at line 117 of file PaintLayer.h.

Definition at line 118 of file PaintLayer.h.

Definition at line 127 of file PaintLayer.h.

Definition at line 60 of file AbstractPaintLayer.h.


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