58 for (j = 0; j < 4; j++)
59 for (i = 0; i < 4; i++)
66 for (j = 0; j < 4; j++)
67 for (i = 0; i < 4; i++)
75 for (
int j = 0; j < 4; j++)
76 for (
int i = 0; i < 4; i++)
82 for (
int j = 0; j < 4; j++)
83 for (
int i = 0; i < 4; i++)
194 for (j = 0; j < 4; j++)
195 for (i = 0; i < 4; i++)
198 for (k = 0; k < 4; k++)
202 for (j = 0; j < 4; j++)
203 for (i = 0; i < 4; i++)
248 m_int = momax(1e-3, m_int);
284 MOfloat a, b, c, d, e, f, g, h, i;
339 yrc = sqrt(2.0) / mag;
497 m_TextureFilterLabelName =
"";
508 m_renderman = p_renderman;
514 m_use_screen_tex =
false;
515 for (i = 0; i < p_src_tex.Count(); i++)
517 m_src_tex.Add(p_src_tex[i]);
518 if (p_src_tex[i]->GetName() ==
moText(
"screen_texture")) m_use_screen_tex =
true;
520 for (i = 0; i < p_dest_tex.Count(); i++) {
521 m_dest_tex.Add(p_dest_tex[i]);
523 CheckDestTexAttachStatus();
529 moShaderCG* pcg = NULL;
534 pcg = (moShaderCG*)m_shader;
547 for (i = 0; i < m_src_tex.Count(); i++)
551 if (pglsl) m_src_tex_unit[i] = pglsl->
GetUniformID(uname);
555 if (pglsl) m_src_tex_offset[i] = pglsl->
GetUniformID(uname);
559 uname =
moText(
"tempo_angle");
562 uname =
moText(
"dest_tex_size");
563 if (pglsl) m_dest_tex_size = pglsl->
GetUniformID(uname);
565 uname =
moText(
"fade_const");
568 uname =
moText(
"tempo_dt");
571 uname =
moText(
"tempo_delta");
574 uname =
moText(
"tempo_syncro");
577 uname =
moText(
"tempo_ticks");
580 uname =
moText(
"dest_tex_size");
581 if (pglsl) m_dest_tex_size = pglsl->
GetUniformID(uname);
583 uname =
moText(
"fade_const");
586 uname =
moText(
"random_uniform");
587 if (pglsl) m_random_uniform = pglsl->
GetUniformID(uname);
592 m_uniform_variables_idx[u] = -1;
598 if (m_uniform_idx==-1) {
599 m_uniform_idx = m_shader->m_Config.GetParamIndex(
"uniform" );
603 if (m_uniform_idx>-1) {
604 for(
int u=0; u<m_shader->m_Config.GetParam(m_uniform_idx).GetValuesCount(); u++ ) {
605 moValue vb = m_shader->m_Config.GetParam(m_uniform_idx).GetValues().Get(u);
608 uname = uniform_var_name;
609 if (m_uniform_variables_idx[u]==-1 && pglsl) {
610 m_uniform_variables_idx[u] = pglsl->
GetUniformID(uname);
611 MODebug2->Message(
"moTextureFilter::Init > setting uniform id for ("+uname+
","+uniform_var_type+
") in:"+
IntToStr(m_uniform_variables_idx[u]));
618 m_DefParams = p_params;
640 Apply( p_i, 1.0, p_params);
645 MOint w = m_dest_tex[0]->GetWidth();
646 MOint h = m_dest_tex[0]->GetHeight();
650 if (m_use_screen_tex) m_renderman->SaveScreen();
654 m_shader->StartShader();
655 SetupShader(w, h, NULL, p_fade, p_params);
658 m_shader->DrawGrid(w, h, m_src_tex.Count());
661 m_shader->StopShader();
671 Apply( p_cycle, 1.0, p_params);
676 MOint w = m_dest_tex[0]->GetWidth();
677 MOint h = m_dest_tex[0]->GetHeight();
682 if (m_use_screen_tex) m_renderman->SaveScreen();
686 m_shader->StartShader();
687 SetupShader(w, h, NULL, p_fade, p_params);
690 m_shader->DrawGrid(w, h, m_src_tex.Count());
693 m_shader->StopShader();
702 Apply( p_tempo, 1.0, p_params);
707 MOint w = m_dest_tex[0]->GetWidth();
708 MOint h = m_dest_tex[0]->GetHeight();
712 if (m_use_screen_tex) m_renderman->SaveScreen();
716 m_shader->StartShader();
717 SetupShader(w, h, p_tempo, p_fade, p_params);
720 m_shader->DrawGrid(w, h, m_src_tex.Count());
723 m_shader->StopShader();
732 Apply( p_src_mob, 1.0, p_params);
737 Apply( p_src_mob, p_tempo, 1.0, p_params);
741 if (p_src_mob==NULL)
return;
742 if (m_shader==NULL)
return;
744 MOint w = m_dest_tex[0]->GetWidth();
745 MOint h = m_dest_tex[0]->GetHeight();
748 if (m_use_screen_tex) m_renderman->SaveScreen();
752 m_shader->StartShader();
753 SetupShader(w, h, p_tempo, p_fade, p_params, p_src_mob);
755 BindSrcTex( p_src_mob );
756 m_shader->DrawGrid(w, h, m_src_tex.Count());
759 m_shader->StopShader();
769 Apply( p_src_mob, NULL, p_fade, p_params );
776 for (
MOuint i = 0; i < m_src_tex.Count(); i++)
778 if (-1 < m_src_tex_unit[i]) {
780 glUniform1iARB(m_src_tex_unit[i], i);
783 if (-1 < m_src_tex_offset[i]) {
784 if (m_glman->RectTexture(m_src_tex[i]->GetTexTarget())) glUniform2fARB(m_src_tex_offset[i], 1.0, 1.0);
785 else glUniform2fARB(m_src_tex_offset[i], 1.0 /
float(m_src_tex[i]->GetWidth()), 1.0 /
float(m_src_tex[i]->GetHeight()));
793 if (-1 < m_tempo_angle) {
794 float a = p_tempo->
ang;
797 glUniform2fARB(m_tempo_angle, a, f);
801 glUniform1fARB(m_tempo_dt, p_tempo->
dt );
803 if (-1<m_tempo_syncro) {
804 glUniform1fARB(m_tempo_syncro, p_tempo->
syncro );
806 if (-1<m_tempo_delta) {
807 glUniform1fARB(m_tempo_delta, p_tempo->
delta );
809 if (-1<m_tempo_ticks) {
810 glUniform1fARB(m_tempo_ticks, (
float)p_tempo->
ticks );
816 glUniform2fARB(m_tempo_angle, 0.0, 0.0);
817 glUniform1fARB(m_tempo_dt, 0.0);
820 if (-1 < m_dest_tex_size) {
821 glUniform2fARB(m_dest_tex_size, w, h);
825 if (-1 < m_fade_const) {
826 glUniform1fARB(m_fade_const, p_fade);
835 if (-1 < m_random_uniform) {
839 glUniform2fARB(m_random_uniform, r, seed);
844 if (p_src_object && m_shader) {
849 if (m_uniform_idx>-1) {
850 for(
int u=0; u<m_shader->m_Config.GetParam(m_uniform_idx).GetValuesCount(); u++ ) {
851 moValue vb = m_shader->m_Config.GetParam(m_uniform_idx).GetValues().Get(u);
855 if (m_uniform_variables_idx[u]>-1) {
857 if (uniform_var_type==
"FLOAT") {
859 float p_float = p_src_object->
GetConfig()->
Eval( uniform_var_name );
860 glUniform1fARB( m_uniform_variables_idx[u], p_float );
862 int inletidx = p_src_object->
GetInletIndex(uniform_var_name);
864 float p_float = p_src_object->
GetInlets()->Get(inletidx)->GetData()->Float();
865 glUniform1fARB( m_uniform_variables_idx[u], p_float );
869 if (uniform_var_type==
"INT") {
871 int p_int = p_src_object->
GetConfig()->
Int( uniform_var_name );
872 glUniform1iARB( m_uniform_variables_idx[u], p_int );
874 int inletidx = p_src_object->
GetInletIndex(uniform_var_name);
876 int p_int = p_src_object->
GetInlets()->Get(inletidx)->GetData()->Int();
877 glUniform1iARB( m_uniform_variables_idx[u], p_int );
919 m_DefParams = p_params;
927 m_blend_on = glIsEnabled(GL_BLEND);
929 glGetIntegerv(GL_POLYGON_MODE, &m_poly_mode);
933 glPolygonMode(GL_FRONT, GL_FILL);
936 m_glman->SetOrthographicView(w, h, 0.0, w, 0.0, h);
941 m_glman->RestoreView();
943 if (m_blend_on) glEnable(GL_BLEND);
945 glPolygonMode(GL_FRONT, m_poly_mode);
951 moFBO* fbo = m_dest_tex[0]->GetFBO();
961 GLsizei n = m_dest_tex.Count();
963 for (i = 0; i < n; i++)
965 ptex = m_dest_tex[i];
966 if (m_reattach_dest_tex)
978 glDrawBuffers(n, m_draw_buffers);
985 moFBO* fbo = m_dest_tex[0]->GetFBO();
986 if (fbo != NULL) fbo->
Unbind();
992 for (
MOuint i = 0; i < m_src_tex.Count(); i++)
994 glActiveTextureARB(GL_TEXTURE0_ARB + i);
995 glBindTexture(m_src_tex[i]->GetTexTarget(), m_src_tex.GetGLId(i, (GLint)p_i));
1002 for (
MOuint i = 0; i < m_src_tex.Count(); i++)
1004 glActiveTextureARB(GL_TEXTURE0_ARB + i);
1005 glBindTexture(m_src_tex[i]->GetTexTarget(), m_src_tex.GetGLId(i, p_cycle));
1012 for (
MOuint i = 0; i < m_src_tex.Count(); i++)
1014 glActiveTextureARB(GL_TEXTURE0_ARB + i);
1015 glBindTexture(m_src_tex[i]->GetTexTarget(), m_src_tex.GetGLId(i, p_tempo));
1021 if (p_mob==NULL)
return;
1035 src_tempo = &fs.
tempo;
1040 for (
MOuint i = 0; i < m_src_tex.Count(); i++)
1042 glActiveTextureARB(GL_TEXTURE0_ARB + i);
1044 glBindTexture(m_src_tex[i]->GetTexTarget(), m_src_tex.GetGLId(i, src_tempo));
1051 for (
MOuint i = m_src_tex.Count(); 0 < i; i--)
1053 glActiveTextureARB(GL_TEXTURE0_ARB + i - 1);
1054 glBindTexture(m_src_tex[i-1]->GetTexTarget(), 0);
1060 m_reattach_dest_tex =
false;
1061 for (
MOuint i = 0; i < m_dest_tex.Count(); i++)
1062 if ((
int)m_dest_tex[i]->GetFBOAttachPoint() ==
MO_UNDEFINED)
1064 m_reattach_dest_tex =
true;
MOuint GetFBOAttachPoint() const
moValueBase & GetSubValue(MOint p_indexsubvalue=0)
MOdouble Eval(moParamReference p_paramreference, double x,...)
Acceso r�pido a evaluar la funci�n.
void SetZShearMatrix(float dx, float dy)
void BindSrcTex(MOuint p_i)
int GetParamIndex(moText p_paramname)
Devuelve el �ndice correspondiente al par�metro por nombre.
void SetXRotateMatrix(float rs, float rc)
MOint Int(moParamReference p_paramreference)
Acceso r�pido a un valor entero.
void SetYRotateMatrix(float rs, float rc)
MOuint AttachTexture(MOuint p_width, MOuint p_height, const moTexParam &p_param, MOuint p_glid, MOuint p_attach_point)
void PrintVertShaderLog()
virtual MOboolean Init()
Inicializa el objeto.
GLint GetUniformID(const moText &uName)
MOdouble syncro
Syncronización o factor fraccionario, 1.0 predeterminado, sino KX donde K puede ser fraccional (un nú...
void Apply(MOuint p_i, MOfloat p_fade, const moTextFilterParam &p_params)
void SetGLConf(MOint w, MOint h)
MOint GetInletIndex(moText p_connector_name) const
void Update(MOfloat p_bright, MOfloat p_cont)
MOdouble delta
variacion de frecuencia entre 0X y 2X, delta es real
clase de para manejar textos
void Multiply(moColorMatrix &p_mat)
virtual const moEffectState & GetEffectState()
void SimpleHueRotateMatrix()
MOboolean m_PreserveLuminance
Clase Base para Objetos Moldeo ( moEffect, moIODevice, moResource, moConsole )
Objeto dibujable, pre-efecto ( primeros efectos en el orden de dibujado )
clase base para el manejo de una textura
Objeto dibujable, efecto ( efectos en el orden de dibujado )
MOint GetColorAttachPoint(MOuint p_attach_point)
void SetupShader(MOint w, MOint h, moTempo *p_tempo, MOfloat p_fade, const moTextFilterParam &p_params, moMoldeoObject *p_src_object=NULL)
manejador de operaciones comunes de Open GL
moTexParam GetTexParam() const
moDefineDynamicArray(moTextureFilterArray) moColorMatrix
void XFormPoint(float &tx, float &ty, float &tz)
MOulong ticks
tiempo en milisegundos (obsoleto) se usa moTimer ahora.
MOdouble dt
incremento diferencial de tiempo
void SetZRotateMatrix(float rs, float rc)
virtual MOboolean Finish()
moMoldeoObjectType GetType() const
void CheckDestTexAttachStatus()
void Update(MOfloat p_int, MOfloat p_sat, MOfloat p_hue)
LIBMOLDEO_API moText0 IntToStr(int a)
void getParamIDs(void *p_shader)
clase base para objetos dibujables
Objeto dibujable, post-efecto ( últímos efectos en el orden de dibujado )
void PrintFragShaderLog()
void Copy(moColorMatrix &p_mat)
static Real UnitRandom(unsigned int uiSeed=0)