libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moTextureFilter Class Reference

#include <moTextureFilter.h>

Inheritance diagram for moTextureFilter:
moAbstract

Public Member Functions

 moTextureFilter ()
 
virtual ~moTextureFilter ()
 
virtual MOboolean Init (moGLManager *p_glman, moRenderManager *p_renderman, moTextureArray &p_src_tex, moTextureArray &p_dest_tex, moShader *p_shader, const moTextFilterParam &p_params)
 
virtual MOboolean Finish ()
 
void Apply (MOuint p_i, MOfloat p_fade, const moTextFilterParam &p_params)
 
void Apply (MOuint p_i)
 
void Apply (MOfloat p_cycle, MOfloat p_fade, const moTextFilterParam &p_params)
 
void Apply (MOfloat p_cycle)
 
void Apply (moTempo *p_tempo, MOfloat p_fade, const moTextFilterParam &p_params)
 
void Apply (moTempo *p_tempo)
 
void Apply (moMoldeoObject *p_src_mob, MOfloat p_fade, const moTextFilterParam &p_params)
 
void Apply (moMoldeoObject *p_src_mob, moTempo *p_tempo, MOfloat p_fade, const moTextFilterParam &p_params)
 
void Apply (moMoldeoObject *p_src_mob)
 
moTextureIndexGetSrcTex ()
 
moTextureIndexGetDestTex ()
 
moShaderGetShader ()
 
void CheckDestTexAttachStatus ()
 
void SetTextureFilterLabelName (moText p_text)
 
moText GetTextureFilterLabelName ()
 
const moTextFilterParamGetTextFilterParam ()
 
- Public Member Functions inherited from moAbstract
 moAbstract ()
 
virtual ~moAbstract ()
 
virtual MOboolean Init ()
 Inicializa el objeto. More...
 
MOboolean Initialized ()
 Pregunta si está inicializado. More...
 

Protected Member Functions

void SetupShader (MOint w, MOint h, moTempo *p_tempo, MOfloat p_fade, const moTextFilterParam &p_params, moMoldeoObject *p_src_object=NULL)
 
void SetGLConf (MOint w, MOint h)
 
void RestoreGLConf ()
 
void BindDestFBO ()
 
void UnbindDestFBO ()
 
void BindSrcTex (MOuint p_i)
 
void BindSrcTex (MOfloat p_cycle)
 
void BindSrcTex (moTempo *p_tempo)
 
void BindSrcTex (moMoldeoObject *p_mob)
 
void UnbindSrcTex ()
 
void RenderTexQuad (MOint w, MOint h)
 

Protected Attributes

moShaderm_shader
 
moRenderManagerm_renderman
 
moGLManagerm_glman
 
moText m_TextureFilterLabelName
 
GLint m_src_tex_unit [MO_MAX_TEXTURE_UNITS]
 
GLint m_src_tex_offset [MO_MAX_TEXTURE_UNITS]
 
GLint m_tempo_angle
 
GLint m_tempo_dt
 
GLint m_tempo_syncro
 
GLint m_tempo_delta
 
GLint m_tempo_ticks
 
GLint m_fade_const
 
GLint m_dest_tex_size
 
GLint m_random_uniform
 
int m_uniform_idx
 
int m_uniform_variables_idx [MAX_UNIFORM_VARS]
 idx of uniform parameters variables in moMoldeoObject More...
 
moTextFilterParam m_DefParams
 idx of uniform variables in shader code moShader More...
 
moTextureIndex m_src_tex
 
moTextureIndex m_dest_tex
 
GLboolean m_blend_on
 
GLint m_poly_mode
 
GLenum m_draw_buffers [MO_MAX_COLOR_ATTACHMENTS_EXT]
 
MOboolean m_use_screen_tex
 
MOboolean m_reattach_dest_tex
 

Additional Inherited Members

- Public Attributes inherited from moAbstract
MOboolean m_bInitialized
 Valor de inicialización More...
 
- Static Public Attributes inherited from moAbstract
static moDebugMODebug2 = new moDebug()
 Clase de impresión de errores para depuración More...
 
static moTextHeapMODebug = new moTextHeap()
 Lista de textos. More...
 

Detailed Description

Esta clase define un filtro 2D para aplicar en texturas. Un filtro es básicamente un programa de shader (escrito en CG o GLSL) con un conjunto de predefinido de parámetros uniformes y una grilla 2D donde las texturas fuente son mapeadas. Los puntos de la grilla 2D pueden ser modificados en el estadio de vértices del filtro, permitiendo distorsiones arbitrarias en la forma de la texturas.

Definition at line 156 of file moTextureFilter.h.

Constructor & Destructor Documentation

moTextureFilter::moTextureFilter ( )

El constructor por defecto de la clase.

Definition at line 493 of file moTextureFilter.cpp.

virtual moTextureFilter::~moTextureFilter ( )
inlinevirtual

El destructor por defecto de la clase.

Definition at line 166 of file moTextureFilter.h.

Member Function Documentation

void moTextureFilter::Apply ( MOuint  p_i,
MOfloat  p_fade,
const moTextFilterParam p_params 
)

Aplica el filtro sobre las texturas de orígen y escribiendo el resutlado en las texturas de destino.

Parameters
p_icuadro a utilizar en las texturas de orígen (en el caso de que sean animadas).
p_fadeconstante de "fading" utilizada para mezclar el resultado del filtro.
p_paramsparámetros del filtro.

Definition at line 643 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( MOuint  p_i)

Definition at line 638 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( MOfloat  p_cycle,
MOfloat  p_fade,
const moTextFilterParam p_params 
)

Aplica el filtro sobre las texturas de orígen y escribiendo el resutlado en las texturas de destino.

Parameters
p_cyclefracción del ciclo entre 0.0 y 1.0 a utilizar en las texturas de orígen (en el caso de que sean animadas).
p_fadeconstante de "fading" utilizada para mezclar el resultado del filtro.
p_paramsparámetros del filtro.

Definition at line 674 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( MOfloat  p_cycle)

Definition at line 669 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( moTempo p_tempo,
MOfloat  p_fade,
const moTextFilterParam p_params 
)

Aplica el filtro sobre las texturas de orígen y escribiendo el resutlado en las texturas de destino.

Parameters
p_tempotempo a utilizar en las texturas de orígen (en el caso de que sean animadas).
p_fadeconstante de "fading" utilizada para mezclar el resultado del filtro.
p_paramsparámetros del filtro.

Definition at line 705 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( moTempo p_tempo)

Definition at line 700 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( moMoldeoObject p_src_mob,
MOfloat  p_fade,
const moTextFilterParam p_params 
)

Definition at line 762 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( moMoldeoObject p_src_mob,
moTempo p_tempo,
MOfloat  p_fade,
const moTextFilterParam p_params 
)

Definition at line 735 of file moTextureFilter.cpp.

void moTextureFilter::Apply ( moMoldeoObject p_src_mob)

Definition at line 730 of file moTextureFilter.cpp.

void moTextureFilter::BindDestFBO ( )
protected

Definition at line 944 of file moTextureFilter.cpp.

void moTextureFilter::BindSrcTex ( MOuint  p_i)
protected

Definition at line 984 of file moTextureFilter.cpp.

void moTextureFilter::BindSrcTex ( MOfloat  p_cycle)
protected

Definition at line 994 of file moTextureFilter.cpp.

void moTextureFilter::BindSrcTex ( moTempo p_tempo)
protected

Definition at line 1004 of file moTextureFilter.cpp.

void moTextureFilter::BindSrcTex ( moMoldeoObject p_mob)
protected

Definition at line 1014 of file moTextureFilter.cpp.

void moTextureFilter::CheckDestTexAttachStatus ( )

Verifica que todas las texturas de destino estén asociadas a lo búfers de color del mismo FBO. En caso contrario, las mismas serán re-asociadas (utilizando el FBO de la primera textura de destino) en el momento de aplicar el filtro.

Definition at line 1053 of file moTextureFilter.cpp.

MOboolean moTextureFilter::Finish ( )
virtual

Método de finalización.

Returns
true si la operación fue exitosa, false en caso contrario.

Reimplemented from moAbstract.

Definition at line 628 of file moTextureFilter.cpp.

moTextureIndex* moTextureFilter::GetDestTex ( )
inline

Devuelve el puntero a la lista de texturas de destino.

Returns
puntero a la lista de texturas de destino.

Definition at line 224 of file moTextureFilter.h.

moShader* moTextureFilter::GetShader ( )
inline

Definition at line 226 of file moTextureFilter.h.

moTextureIndex* moTextureFilter::GetSrcTex ( )
inline

Devuelve el puntero a la lista de texturas de orígen.

Returns
puntero a la lista de texturas de orígen.

Definition at line 219 of file moTextureFilter.h.

const moTextFilterParam& moTextureFilter::GetTextFilterParam ( )
inline

Definition at line 244 of file moTextureFilter.h.

moText moTextureFilter::GetTextureFilterLabelName ( )
inline

Definition at line 240 of file moTextureFilter.h.

MOboolean moTextureFilter::Init ( moGLManager p_glman,
moRenderManager p_renderman,
moTextureArray &  p_src_tex,
moTextureArray &  p_dest_tex,
moShader p_shader,
const moTextFilterParam p_params 
)
virtual

Método de inicialización de la grilla.

Parameters
p_glmanpuntero al administrador de OpenGL.
p_rendermanpuntero al administrador de render.
p_src_texreferencia a la lista de texturas de orígen.
p_dest_texreferencia a la lista de texturas de destino.
p_shaderpuntero al programa de shader que define el filtro.
p_paramspuntero al objeto de parámetros a utilizar en este filtro.
Returns
true si la operación fue exitosa, false en caso contrario.

Definition at line 502 of file moTextureFilter.cpp.

void moTextureFilter::RenderTexQuad ( MOint  w,
MOint  h 
)
protected
void moTextureFilter::RestoreGLConf ( )
protected

Definition at line 934 of file moTextureFilter.cpp.

void moTextureFilter::SetGLConf ( MOint  w,
MOint  h 
)
protected

Definition at line 920 of file moTextureFilter.cpp.

void moTextureFilter::SetTextureFilterLabelName ( moText  p_text)
inline

Definition at line 237 of file moTextureFilter.h.

void moTextureFilter::SetupShader ( MOint  w,
MOint  h,
moTempo p_tempo,
MOfloat  p_fade,
const moTextFilterParam p_params,
moMoldeoObject p_src_object = NULL 
)
protected

TODO: load and evaluate each parameter of m_shader->config using also p_src_object as parameters!!!

TODO: load and evaluate each parameter of m_shader->config using also p_src_object as parameters!!!

        if (uniform_var_type=="FLOAT") {
          float p_float = 0.0;
          int paramidx = p_src_object->GetConfig()->GetParamIndex(uniform_var_name);
          if (paramidx>-1) {
            p_float = p_src_object->GetConfig()->Eval( moParamReference(paramidx)  );
          } else {
            int inletidx = p_src_object->GetInletIndex(uniform_var_name);
            if (inletidx>-1) {
              p_float = p_src_object->GetInlets()->Get(inletidx)->GetData()->Float();
            }
          }
          glUniform1fARB( m_uniform_variables_idx[u], p_float );

MODebug2->Message("Assigning FLOAT:" + FloatToStr(p_float)); } else if (uniform_var_type=="INT") { float p_int = 0; int paramidx = p_src_object->GetConfig()->GetParamIndex(uniform_var_name); if (paramidx>-1) { p_int = p_src_object->GetConfig()->Int( moParamReference(paramidx) ); } else { int inletidx = p_src_object->GetInletIndex(uniform_var_name); if (inletidx>-1) { p_int = p_src_object->GetInlets()->Get(inletidx)->GetData()->Int(); } } glUniform1iARB( m_uniform_variables_idx[u], p_int ); MODebug2->Message("Assigning FLOAT:" + FloatToStr(p_float)); }

Definition at line 769 of file moTextureFilter.cpp.

void moTextureFilter::UnbindDestFBO ( )
protected

Definition at line 978 of file moTextureFilter.cpp.

void moTextureFilter::UnbindSrcTex ( )
protected

Definition at line 1044 of file moTextureFilter.cpp.

Member Data Documentation

GLboolean moTextureFilter::m_blend_on
protected

Definition at line 278 of file moTextureFilter.h.

moTextFilterParam moTextureFilter::m_DefParams
protected

idx of uniform variables in shader code moShader

Definition at line 272 of file moTextureFilter.h.

moTextureIndex moTextureFilter::m_dest_tex
protected

Definition at line 276 of file moTextureFilter.h.

GLint moTextureFilter::m_dest_tex_size
protected

Definition at line 264 of file moTextureFilter.h.

GLenum moTextureFilter::m_draw_buffers[MO_MAX_COLOR_ATTACHMENTS_EXT]
protected

Definition at line 280 of file moTextureFilter.h.

GLint moTextureFilter::m_fade_const
protected

Definition at line 263 of file moTextureFilter.h.

moGLManager* moTextureFilter::m_glman
protected

Definition at line 251 of file moTextureFilter.h.

GLint moTextureFilter::m_poly_mode
protected

Definition at line 279 of file moTextureFilter.h.

GLint moTextureFilter::m_random_uniform
protected

Definition at line 265 of file moTextureFilter.h.

MOboolean moTextureFilter::m_reattach_dest_tex
protected

Definition at line 283 of file moTextureFilter.h.

moRenderManager* moTextureFilter::m_renderman
protected

Definition at line 250 of file moTextureFilter.h.

moShader* moTextureFilter::m_shader
protected

Definition at line 249 of file moTextureFilter.h.

moTextureIndex moTextureFilter::m_src_tex
protected

Definition at line 275 of file moTextureFilter.h.

GLint moTextureFilter::m_src_tex_offset[MO_MAX_TEXTURE_UNITS]
protected

Definition at line 257 of file moTextureFilter.h.

GLint moTextureFilter::m_src_tex_unit[MO_MAX_TEXTURE_UNITS]
protected

Definition at line 256 of file moTextureFilter.h.

GLint moTextureFilter::m_tempo_angle
protected

Definition at line 258 of file moTextureFilter.h.

GLint moTextureFilter::m_tempo_delta
protected

Definition at line 261 of file moTextureFilter.h.

GLint moTextureFilter::m_tempo_dt
protected

Definition at line 259 of file moTextureFilter.h.

GLint moTextureFilter::m_tempo_syncro
protected

Definition at line 260 of file moTextureFilter.h.

GLint moTextureFilter::m_tempo_ticks
protected

Definition at line 262 of file moTextureFilter.h.

moText moTextureFilter::m_TextureFilterLabelName
protected

Definition at line 253 of file moTextureFilter.h.

int moTextureFilter::m_uniform_idx
protected

Definition at line 268 of file moTextureFilter.h.

int moTextureFilter::m_uniform_variables_idx[MAX_UNIFORM_VARS]
protected

idx of uniform parameters variables in moMoldeoObject

Definition at line 269 of file moTextureFilter.h.

MOboolean moTextureFilter::m_use_screen_tex
protected

Definition at line 282 of file moTextureFilter.h.


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