Back to index

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

#include <PaintLayer.h>

Inheritance diagram for nux::TextureLayer:
Inheritance graph
[legend]
Collaboration diagram for nux::TextureLayer:
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

 TextureLayer (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm texxform, const Color &color, bool WriteAlpha=false, const ROPConfig &ROP=ROPConfig::Default)
 TextureLayer (ObjectPtr< IOpenGLBaseTexture > device_texture, TexCoordXForm texxform, const Color &color0, bool write_alpha, const ROPConfig &ROP, const Color &blend_color, LayerBlendMode color_blend_mode)
virtual ~TextureLayer ()
virtual void Renderlayer (GraphicsEngine &graphics_engine)
virtual AbstractPaintLayerClone () const
virtual ObjectPtr
< IOpenGLBaseTexture
GetDeviceTexture ()
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_device_texture
Color m_color
bool m_write_alpha
ROPConfig m_rop
TexCoordXForm m_texxform
Color m_blend_color
LayerBlendMode m_color_blend_mode

Detailed Description

Definition at line 136 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::TextureLayer::TextureLayer ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm  texxform,
const Color &  color,
bool  WriteAlpha = false,
const ROPConfig ROP = ROPConfig::Default 
)

Definition at line 246 of file PaintLayer.cpp.

  {
    m_device_texture = device_texture;
    m_color = color;
    m_write_alpha = write_alpha;
    m_rop = ROP;
    m_texxform = texxform;
    
    m_color_blend_mode = LAYER_BLEND_MODE_LAST;
  }

Here is the caller graph for this function:

nux::TextureLayer::TextureLayer ( ObjectPtr< IOpenGLBaseTexture device_texture,
TexCoordXForm  texxform,
const Color &  color0,
bool  write_alpha,
const ROPConfig ROP,
const Color &  blend_color,
LayerBlendMode  color_blend_mode 
)

Definition at line 257 of file PaintLayer.cpp.

  {
    m_device_texture = device_texture;
    m_color = color0;
    m_write_alpha = write_alpha;
    m_rop = ROP;
    m_texxform = texxform;
    
    m_blend_color = blend_color;
    m_color_blend_mode = color_blend_mode;
  }

Definition at line 270 of file PaintLayer.cpp.

Here is the call graph for this function:


Member Function Documentation

Implements nux::AbstractPaintLayer.

Definition at line 309 of file PaintLayer.cpp.

  {
    return new TextureLayer(*this);
  }

Here is the call graph for this function:

Definition at line 314 of file PaintLayer.cpp.

  {
    return m_device_texture;
  }
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::TextureLayer::Renderlayer ( GraphicsEngine graphics_engine) [virtual]

Implements nux::AbstractPaintLayer.

Definition at line 275 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_color_blend_mode == LAYER_BLEND_MODE_LAST)
    {
      graphics_engine.QRP_1Tex(geometry_.x, geometry_.y, geometry_.GetWidth(), geometry_.GetHeight(), m_device_texture,
        m_texxform, m_color);
    }
    else
    {
      graphics_engine.QRP_GLSL_ColorBlendOverTex(geometry_.x, geometry_.y, geometry_.GetWidth(), geometry_.GetHeight(), m_device_texture,
        m_texxform, m_color, m_blend_color, m_color_blend_mode);
    }
    
    // Restore Color mask and blend states.
    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:

Here is the caller 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 155 of file PaintLayer.h.

Color nux::TextureLayer::m_color [private]

Definition at line 150 of file PaintLayer.h.

Definition at line 156 of file PaintLayer.h.

Definition at line 149 of file PaintLayer.h.

Definition at line 152 of file PaintLayer.h.

Definition at line 153 of file PaintLayer.h.

Definition at line 151 of file PaintLayer.h.

Definition at line 60 of file AbstractPaintLayer.h.


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