void moEffectCubeMap::Draw( moTempo* tempogral,moEffectState* parentstate) { PreDraw( tempogral,parentstate); glEnable(GL_DEPTH_TEST); // Disables Depth Testing glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPushMatrix(); // Store The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix //gluLookAt(0, 0, 0, 0, 0, 1, 0, 1, 0); gluPerspective(45,1.33f,0.0f,3.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); // Store The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix glTranslatef( m_Config[moR(CUBEMAP_TRANSLATEX)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(CUBEMAP_TRANSLATEY)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(CUBEMAP_TRANSLATEZ)].GetData()->Fun()->Eval(state.tempo.ang)); glRotatef( m_Config[moR(CUBEMAP_ROTATEX)].GetData()->Fun()->Eval(state.tempo.ang), 1.0, 0.0, 0.0 ); glRotatef( m_Config[moR(CUBEMAP_ROTATEY)].GetData()->Fun()->Eval(state.tempo.ang), 0.0, 1.0, 0.0 ); glRotatef( m_Config[moR(CUBEMAP_ROTATEZ)].GetData()->Fun()->Eval(state.tempo.ang), 0.0, 0.0, 1.0 ); glScalef( m_Config[moR(CUBEMAP_SCALEX)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(CUBEMAP_SCALEY)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(CUBEMAP_SCALEZ)].GetData()->Fun()->Eval(state.tempo.ang)); glColor4f( m_Config[moR(CUBEMAP_COLOR)][MO_SELECTED][MO_RED].Fun()->Eval(state.tempo.ang) * state.tintr, m_Config[moR(CUBEMAP_COLOR)][MO_SELECTED][MO_GREEN].Fun()->Eval(state.tempo.ang) * state.tintg, m_Config[moR(CUBEMAP_COLOR)][MO_SELECTED][MO_BLUE].Fun()->Eval(state.tempo.ang) * state.tintb, m_Config[moR(CUBEMAP_COLOR)][MO_SELECTED][MO_ALPHA].Fun()->Eval(state.tempo.ang) * m_Config[moR(CUBEMAP_ALPHA)].GetData()->Fun()->Eval(state.tempo.ang) * state.alpha); moTexture* pImageLeft = (moTexture*) m_Config[moR(CUBEMAP_TEXTURELEFT)].GetData()->Pointer(); moTexture* pImageRight = (moTexture*) m_Config[moR(CUBEMAP_TEXTURERIGHT)].GetData()->Pointer(); moTexture* pImageFront = (moTexture*) m_Config[moR(CUBEMAP_TEXTUREFRONT)].GetData()->Pointer(); moTexture* pImageBack = (moTexture*) m_Config[moR(CUBEMAP_TEXTUREBACK)].GetData()->Pointer(); moTexture* pImageTop = (moTexture*) m_Config[moR(CUBEMAP_TEXTURETOP)].GetData()->Pointer(); moTexture* pImageBottom = (moTexture*) m_Config[moR(CUBEMAP_TEXTUREBOTTOM)].GetData()->Pointer(); //front glBindTexture( GL_TEXTURE_2D, m_Config[moR(CUBEMAP_TEXTUREFRONT)].GetData()->GetGLId(&state.tempo, 1, NULL ) ); glBegin(GL_QUADS); glTexCoord2f(pImageFront->GetMaxCoordS(),0); glVertex3f(-1,-1,-1); glTexCoord2f(0,0); glVertex3f(1,-1,-1); glTexCoord2f(0,pImageFront->GetMaxCoordT()); glVertex3f(1,1,-1); glTexCoord2f(pImageFront->GetMaxCoordS(),pImageFront->GetMaxCoordT()); glVertex3f(-1,1,-1); glEnd(); //up glBindTexture( GL_TEXTURE_2D, m_Config[moR(CUBEMAP_TEXTURETOP)].GetData()->GetGLId(&state.tempo, 1, NULL ) ); glBegin(GL_QUADS); glTexCoord2f(pImageTop->GetMaxCoordS(),0); glVertex3f(-1,1,-1); glTexCoord2f(0,0); glVertex3f(1,1,-1); glTexCoord2f(0,pImageTop->GetMaxCoordT()); glVertex3f(1,1,1); glTexCoord2f(pImageTop->GetMaxCoordS(),pImageTop->GetMaxCoordT()); glVertex3f(-1,1,1); glEnd(); //left glBindTexture( GL_TEXTURE_2D, m_Config[moR(CUBEMAP_TEXTURELEFT)].GetData()->GetGLId(&state.tempo, 1, NULL ) ); glBegin(GL_QUADS); glTexCoord2f(pImageLeft->GetMaxCoordS(),pImageLeft->GetMaxCoordT()); glVertex3f(-1,1,1); glTexCoord2f(0,pImageLeft->GetMaxCoordT()); glVertex3f(-1,1,-1); glTexCoord2f(0,0); glVertex3f(-1,-1,-1); glTexCoord2f(pImageLeft->GetMaxCoordS(),0); glVertex3f(-1,-1,1); glEnd(); //right glBindTexture( GL_TEXTURE_2D, m_Config[moR(CUBEMAP_TEXTURERIGHT)].GetData()->GetGLId(&state.tempo, 1, NULL ) ); glBegin(GL_QUADS); glTexCoord2f(0,pImageRight->GetMaxCoordT()); glVertex3f(1,1,1); glTexCoord2f(pImageRight->GetMaxCoordS(),pImageRight->GetMaxCoordT()); glVertex3f(1,1,-1); glTexCoord2f(pImageRight->GetMaxCoordS(),0); glVertex3f(1,-1,-1); glTexCoord2f(0,0); glVertex3f(1,-1,1); glEnd(); //down glBindTexture( GL_TEXTURE_2D, m_Config[moR(CUBEMAP_TEXTUREBOTTOM)].GetData()->GetGLId(&state.tempo, 1, NULL ) ); glBegin(GL_QUADS); glTexCoord2f(pImageBottom->GetMaxCoordS(),pImageBottom->GetMaxCoordT()); glVertex3f(-1,-1,-1); glTexCoord2f(0,pImageBottom->GetMaxCoordT()); glVertex3f(1,-1,-1); glTexCoord2f(0,0); glVertex3f(1,-1,1); glTexCoord2f(pImageBottom->GetMaxCoordS(),0); glVertex3f(-1,-1,1); glEnd(); //back glBindTexture( GL_TEXTURE_2D, m_Config[moR(CUBEMAP_TEXTUREBACK)].GetData()->GetGLId(&state.tempo, 1, NULL ) ); glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex3f(-1,-1,1); glTexCoord2f(pImageBack->GetMaxCoordS(),0); glVertex3f(1,-1,1); glTexCoord2f(pImageBack->GetMaxCoordS(),pImageBack->GetMaxCoordT()); glVertex3f(1,1,1); glTexCoord2f(0,pImageBack->GetMaxCoordT()); glVertex3f(-1,1,1); glEnd(); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPopMatrix(); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPopMatrix(); // Restore The Old Projection Matrix }
/* * draws the Emitter * @author Rigardt de Vries * @return void */ void CPICParticleEmitter::Draw() { if (!m_pVertexBuffer) { return; } if (!IsEmpty() ) { TVertexParticleSize* pv; DWORD dwNumParticlesInBatch = 0; PreDraw(); CRenderer* pRenderer = CTotalCubeDomination::GetInstance().GetRenderer(); if (m_ePICType == PIC_BULLET_DAMAGE) { CTextureManager::GetInstance().SetTexture(0, s_uiBulletDamageID); } else if (m_ePICType == PIC_BULLET_SPEED) { CTextureManager::GetInstance().SetTexture(0, s_uiBulletMoveID); } else if (m_ePICType == PIC_MOVE_SPEED) { CTextureManager::GetInstance().SetTexture(0, s_uiMoveID); } else if (m_ePICType == PIC_EXPLODE_RADIUS) { CTextureManager::GetInstance().SetTexture(0, s_uiRadiusID); } else { CTextureManager::GetInstance().SetTexture(0, s_uiShieldID); } pRenderer->SetWorldMatrix(m_matWorld); pRenderer->GetDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_PSIZE); pRenderer->GetDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(TVertexParticleSize) ); SortParticles(); m_pVertexBuffer->Lock(NULL, 0, (void**)&pv, D3DLOCK_DISCARD); for (int32 i = 0; i < static_cast<int32>(m_vecParticles.size() ); ++i) { pv->vec3Position = m_vecParticles[i].vec3Position; const D3DXCOLOR& kr = m_vecParticles[i].colour; pv->colour = D3DCOLOR_COLORVALUE(kr.r, kr.g, kr.b, kr.a); pv->fsize = m_vecParticles[i].fSize; pv++; ++dwNumParticlesInBatch; } m_pVertexBuffer->Unlock(); //if (IsAlive() == true) //{ pRenderer->GetDevice()->DrawPrimitive(D3DPT_POINTLIST, 0, dwNumParticlesInBatch); //} PostDraw(); } }
void moPostEffectColorFilter::Draw( moTempo* tempogral,moEffectState* parentstate) { PreDraw( tempogral, parentstate); UpdateParameters(); filters.Apply(&state.tempo, FilterParams); glDisable(GL_DEPTH_TEST); glClear (GL_DEPTH_BUFFER_BIT); m_pResourceManager->GetGLMan()->SetOrthographicView(sWidth, sHeight); glColor4f(color[0] * state.tintr, color[1] * state.tintg, color[2] * state.tintb, color[3] * state.alpha); SetBlendMode(); glBindTexture(GL_TEXTURE_2D, tex_glid); glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex2f(0.0, 0.0); glTexCoord2f(0.0, 1.0); glVertex2f(0.0, sHeight); glTexCoord2f(1.0, 1.0); glVertex2f(sWidth, sHeight); glTexCoord2f(1.0, 0.0); glVertex2f(sWidth, 0.0); glEnd(); }
int D3DApp::Run() { MSG msg; ZeroMemory(&msg, sizeof(MSG)); gTimer->Start(); while (msg.message != WM_QUIT) { gDInput->poll(); gTimer->Tick(); if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { Update(); PreDraw(); Draw(); PostDraw(); } } gTimer->Stop(); return (int)msg.wParam; }
void moSequenceEffect::Draw( moTempo* tempogral,moEffectState* parentstate) { MOuint i; PreDraw( tempogral, parentstate); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); // Store The Modelview Matrix glLoadIdentity(); // Dejamos todo como lo encontramos // //Se dibujan los efectos for(i=0;i<effects.Count();i++) { if(effects[i]!=NULL) { if(effects[i]->state.on==MO_ON) { effects[i]->GetConfig()->SetCurrentPreConf( m_Config.GetParam(idp_sequence).GetValue().GetSubValue(i).Int()); effects[i]->Draw(&state.tempo,&state); } } } glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPopMatrix(); // Restore The Old Projection Matrix glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPopMatrix(); // Restore The Old Projection Matrix }
void moMasterEffectMasterChannel::Draw( moTempo* tempogral,moEffectState* parentstate) { PreDraw( tempogral, parentstate); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); /* glTranslatef( movx(m_Config.GetParam(transx), tempo), movy(m_Config.GetParam(transy), tempo), movz(m_Config.GetParam(transz), tempo)); glRotatef( movx(m_Config.GetParam(rotatx), tempo), 1.0, 0.0, 0.0 ); glRotatef( movy(m_Config.GetParam(rotaty), tempo), 0.0, 1.0, 0.0 ); glRotatef( movz(m_Config.GetParam(rotatz), tempo), 0.0, 0.0, 1.0 ); glScale( movx(m_Config.GetParam(scalex), tempo), movy(m_Config.GetParam(scaley), tempo), movz(m_Config.GetParam(scalez), tempo)); */ /* glColor4f( m_Config.GetParam(color).GetValueFlt(MO_RED)*state.tint, m_Config.GetParam(color).GetValueFlt(MO_GREEN*state.tint), m_Config.GetParam(color).GetValueFlt(MO_BLUE)*state.tint, m_Config.GetParam(color).GetValueFlt(MO_ALPHA)*state.alpha); */ // Aca van los comandos OpenGL del efecto. }
bool GObject::ObjectRender(ID3D11DeviceContext* pContext, bool bCommand) { for (int iModel = 0; iModel < m_pModelList.size(); iModel++) { TObjWM* pUnit = m_pModelList[iModel].get(); PreDraw(pContext, pUnit, bCommand); PostDraw(pContext, pUnit, bCommand); } return true; }
/* * Draws the particles * * @author Michael McQuarrie * * @return void */ void CFlagParticleEmitter::Draw() { if (!m_pVertexBuffer) { return; } if (!IsEmpty() ) { //First PreDraw it TVertexParticleSize* pv; DWORD dwNumParticlesInBatch = 0; PreDraw(); //Get the renderer CRenderer* pRenderer = CTotalCubeDomination::GetInstance().GetRenderer(); //Get the texture CTextureManager::GetInstance().SetTexture(0, s_uiTextureID); //Set Matrix pRenderer->SetWorldMatrix(m_matWorld); //Set FVF and source things pRenderer->GetDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_PSIZE); pRenderer->GetDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(TVertexParticleSize) ); SortParticles(); m_pVertexBuffer->Lock(NULL, 0, (void**)&pv, D3DLOCK_DISCARD); //Doing colour things for (int32 i = 0; i < static_cast<int32>(m_vecParticles.size() ); ++i) { if (m_vecParticles[i].bAlive) { pv->vec3Position = m_vecParticles[i].vec3Position; const D3DXCOLOR& kr = m_vecParticles[i].colour; pv->colour = D3DCOLOR_COLORVALUE(kr.r, kr.g, kr.b, 1.0f - kr.a); pv->fsize = m_vecParticles[i].fLifeTime + 0.5f; pv++; ++dwNumParticlesInBatch; } } m_pVertexBuffer->Unlock(); //Draw it if (IsAlive() == true) { pRenderer->GetDevice()->DrawPrimitive(D3DPT_POINTLIST, 0, dwNumParticlesInBatch); } //End the drawing PostDraw(); } }
inline void CCoordFrame::SetRect(RECT& rect) { IGlyph::SetRect(rect); RECT rect_graph = rect; rect_graph.left += getRulerWidth().left, rect_graph.top += getRulerWidth().top, rect_graph.right -= getRulerWidth().right, rect_graph.bottom -= getRulerWidth().bottom; _referframe->SetRectSize(rect_graph); PreDraw(); }
void moPreEffectErase::Draw( moTempo* tempogral, moEffectState* parentstate ) { PreDraw(tempogral, parentstate); moVector4d ClearColor = m_Config.EvalColor( moR((MOint)ERASE_COLOR) ); glClearColor( ClearColor.X() * state.tintr, ClearColor.Y() * state.tintg, ClearColor.Z() * state.tintb, ClearColor.W() * m_Config.Eval(moR((MOint)ERASE_ALPHA)) * state.alpha ); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }
//! Expose callback. void GraphView::BeginViewExpose(bool predraw) { glViewport( 0, 0, mW, mH ); glDisable(GL_DEPTH_TEST); glClearColor( mClearColor[0], mClearColor[1], mClearColor[2], mClearColor[3]); glClear(GL_COLOR_BUFFER_BIT); glLineWidth(1.0); int lWidth = CalcWidth(); int lHeight = CalcHeight(); Push2dViewport(lWidth, lHeight); // call graph manager proc if (predraw) PreDraw(); }
/* * Draw the particles in this emitter * @author Rigardt de Vries * @return void */ void CSpiralParticleEmitter::Draw() { if (!m_pVertexBuffer) { return; } if (!IsEmpty() ) { TVertexParticle* pv; DWORD dwNumParticlesInBatch = 0; PreDraw(); CRenderer* pRenderer = CTotalCubeDomination::GetInstance().GetRenderer(); CTextureManager::GetInstance().SetTexture(0, s_uiTextureID); pRenderer->SetWorldMatrix(m_matWorld); pRenderer->GetDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE); pRenderer->GetDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(TVertexParticle) ); SortParticles(); m_pVertexBuffer->Lock(NULL, 0, (void**)&pv, D3DLOCK_DISCARD); for (int32 i = 0; i < static_cast<int32>(m_vecParticles.size() ); ++i) { if (m_vecParticles[i].bAlive) { pv->vec3Position = m_vecParticles[i].vec3Position; const D3DXCOLOR& kr = m_vecParticles[i].colour; pv->colour = D3DCOLOR_COLORVALUE(kr.r, kr.g, kr.b, kr.a); pv++; ++dwNumParticlesInBatch; } } m_pVertexBuffer->Unlock(); if (dwNumParticlesInBatch) { pRenderer->GetDevice()->DrawPrimitive(D3DPT_POINTLIST, 0, dwNumParticlesInBatch); } PostDraw(); } }
GLYPH_CHANGED_TYPE CCoordFrame::renew_world(float x, float y, bool redraw_cood/* = false*/, bool bfirstdata/* = false*/) { _changed_type = GLYPH_CHANGED_TYPE_NONE; if (bfirstdata) { _referframe->RenewYLimit(x, y); _changed_type = GLYPH_CHANGED_TYPE_COORDFRAME; } else { _changed_type = (_referframe->_real_world.renew_min_max(x, y)) ? GLYPH_CHANGED_TYPE_COORDFRAME : GLYPH_CHANGED_TYPE_NONE; } if (_changed_type){ _referframe->RenewByRealWorld(); } if (_changed_type || redraw_cood) { PreDraw(); _changed_type = (GLYPH_CHANGED_TYPE)(((int)GLYPH_CHANGED_TYPE_COORDFRAME | (int)GLYPH_CHANGED_TYPE_CANVAS_BKG)); } return _changed_type; }
void moCalibrationGrid::Draw( moTempo* tempogral, moEffectState* parentstate ) { MOint indeximage; MOdouble PosTextX0, PosTextX1, PosTextY0, PosTextY1; int ancho,alto; int w = m_pResourceManager->GetRenderMan()->ScreenWidth(); int h = m_pResourceManager->GetRenderMan()->ScreenHeight(); PreDraw( tempogral, parentstate); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // glOrtho(0,w,0,h,-1,1); // Set Up An Ortho Screen m_pResourceManager->GetGLMan()->SetPerspectiveView( w, h ); glMatrixMode(GL_PROJECTION); gluLookAt( 0, 0, 10.0, 0, 0, 0, 0, 1, 0); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); // Store The Modelview Matrix glLoadIdentity(); // Reset The View glColor4f(1.0,1.0,1.0,1.0); glDisable( GL_TEXTURE_2D ); glBegin (GL_LINES); glVertex3f (-0.5, 0.5, 0); glVertex3f (0.5, -0.5, 0); glEnd (); glBegin (GL_LINES); glVertex3f (0.5, 0.5, 0); glVertex3f (-0.5, -0.5, 0); glEnd (); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); glBegin (GL_QUADS); glVertex3f (-7.69, 5.77, 0); glVertex3f (7.69, 5.77, 0); glVertex3f (7.69, -5.77, 0); glVertex3f (-7.69, -5.77, 0); /* glVertex3f (-5, 5.7 , 0); glVertex3f (5.7, 5.7 , 0); glVertex3f (5.7, -5 , 0); glVertex3f (-5, -5, 0); */ glEnd (); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); }
void moPostEffectVideoWall::Draw( moTempo* tempogral,moEffectState* parentstate) { PreDraw( tempogral, parentstate); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); /* glColor4f( m_Config[moR(VIDEOWALL_COLOR)][MO_SELECTED][MO_RED].Fun()->Eval(m_EffectState.tempo.ang) * state.tintr, m_Config[moR(VIDEOWALL_COLOR)][MO_SELECTED][MO_GREEN].Fun()->Eval(m_EffectState.tempo.ang) * state.tintg, m_Config[moR(VIDEOWALL_COLOR)][MO_SELECTED][MO_BLUE].Fun()->Eval(m_EffectState.tempo.ang) * state.tintb, m_Config[moR(VIDEOWALL_COLOR)][MO_SELECTED][MO_ALPHA].Fun()->Eval(m_EffectState.tempo.ang) * m_Config[moR(VIDEOWALL_ALPHA)].GetData()->Fun()->Eval(m_EffectState.tempo.ang) * state.alpha); */ SetColor( m_Config[moR(VIDEOWALL_COLOR)], m_Config[moR(VIDEOWALL_ALPHA)], m_EffectState ); MOint cf,i,j; cf = m_Config.GetParam(moR(VIDEOWALL_CONFIGURATION)).GetValue().GetSubValue(0).Int(); glClearColor(0.0, 0.0, 0.0, 1.0); //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT); //glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); MOint w = m_pResourceManager->GetRenderMan()->RenderWidth(); MOint h = m_pResourceManager->GetRenderMan()->RenderHeight(); MOfloat s0 = 0.35; MOfloat s1 = 0.55; MOfloat t0 = 0.35; MOfloat t1 = 0.55; glBindTexture(GL_TEXTURE_2D, m_pResourceManager->GetRenderMan()->RenderTexGLId(MO_EFFECTS_TEX)); if(cf==0) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); //glRotatef(m_EffectState.tempo.ang * 30.0, 1, 0, 0); //glRotatef(m_EffectState.tempo.ang * 40.0, 0, 1, 0); //glRotatef(m_EffectState.tempo.ang * 50.0, 0, 0, 1); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 1.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); // Update the modelview matrix glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(1.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(1.0, 1.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(1.0, -1.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(-1.0, 1.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(-1.0, -1.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(-1.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, -1.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-0.5, -0.5); glTexCoord2f(s0, t1); glVertex2f(-0.5, 0.5); glTexCoord2f(s1, t1); glVertex2f( 0.5, 0.5); glTexCoord2f(s1, t0); glVertex2f( 0.5, -0.5); glEnd(); } /*version cuatro reflejados*/ if(cf==1) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glRotatef(m_EffectState.tempo.ang*2*15.0,0.0,0.0,1.0); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(-1.0, 1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, 1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(1.0, 1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, 1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(-1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(-1.0, -1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, -1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(1.0, -1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, -1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glEnd(); } if(cf==2) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glRotatef(m_EffectState.tempo.ang*2.0*15,0.0,0.0,1.0); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-1.0-1.0, 0.0+1.0); glTexCoord2f(s0, t1); glVertex2f(-1.0-1.0, 1.0+1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0-1.0, 1.0+1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0-1.0, 0.0+1.0); glTexCoord2f(s0, t0); glVertex2f(1.0+1.0, 0.0+1.0); glTexCoord2f(s0, t1); glVertex2f(1.0+1.0, 1.0+1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0+1.0, 1.0+1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0+1.0, 0.0+1.0); glTexCoord2f(s0, t0); glVertex2f(-1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(-1.0, 1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, 1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(1.0, 1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, 1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(-1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(-1.0, -1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, -1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(1.0, -1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, -1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(-1.0-1.0, 0.0-1.0); glTexCoord2f(s0, t1); glVertex2f(-1.0-1.0, -1.0-1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0-1.0, -1.0-1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0-1.0, 0.0-1.0); glTexCoord2f(s0, t0); glVertex2f(1.0+1.0, 0.0-1.0); glTexCoord2f(s0, t1); glVertex2f(1.0+1.0, -1.0-1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0+1.0, -1.0-1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0+1.0, 0.0-1.0); glEnd(); } if(cf==3) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glRotatef(m_EffectState.tempo.ang*2.0*15,0.0,0.0,1.0); glBegin(GL_TRIANGLES); for(i=0;i<4;i++) { for(j=0;j<4;j++) { if((i % 2)==0 &&(j % 2)==0) { glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*i,2.0-1.0*j); glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*(j+1)); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*(j+1)); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*i,2.0-1.0*j); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*(j+1)); glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*(i+1),2.0-1.0*j); } else if((i % 2)==1 &&(j % 2)==0) { glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*j); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*(j+1)); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*j); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*(i+1),2.0-1.0*j); glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*(j+1)); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*(j+1)); } else if((i % 2)==0 &&(j % 2)==1) { glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*j); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*i,2.0-1.0*(j+1)); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*j); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*(i+1),2.0-1.0*j); glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*(j+1)); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*i,2.0-1.0*(j+1)); } else if((i % 2)==1 &&(j % 2)==1) { glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*j); glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*(j+1)); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*(j+1)); glTexCoord2f(s0, t0); glVertex2f(-2.0+1.0*i,2.0-1.0*j); glTexCoord2f(s1, t1); glVertex2f(-2.0+1.0*(i+1), 2.0-1.0*(j+1)); glTexCoord2f(s1, t0); glVertex2f(-2.0+1.0*(i+1),2.0-1.0*j); } } } glEnd(); } float an,an2,rad; rad = 2.0 * m_EffectState.amplitude; if(cf==4) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glRotatef(m_EffectState.tempo.ang*2.0*15,0.0,0.0,1.0); glBegin(GL_TRIANGLE_FAN); //el centro glTexCoord2f(s0, t0); glVertex2f(0.0,0.0); //los bordes for(i=0;i<23;i++) { an =(float)(i) *(moMathf::PI / 12.0f); an2 =(float)(i+1) *(moMathf::PI / 12.0f); if((i % 2) ==0) { glTexCoord2f(s0, t1); glVertex2f(rad*cos(an),2.0*sin(an)); glTexCoord2f(s1, t1); glVertex2f(rad*cos(an2),2.0*sin(an2)); } else { glTexCoord2f(s1, t1); glVertex2f(rad*cos(an),2.0*sin(an)); glTexCoord2f(s0, t1); glVertex2f(rad*cos(an2),2.0*sin(an2)); } } glTexCoord2f(s0, t1); glVertex2f(rad*cos(0.0),rad*sin(0.0)); glEnd(); } if(cf==5) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glRotatef(m_EffectState.tempo.ang*2.0*15,1.0,1.0,1.0); glBegin(GL_TRIANGLE_FAN); //el centro glTexCoord2f(s0, t0); glVertex2f(0.0,0.0); //los bordes for(i=0;i<23;i++) { an =(float)(i) *(moMathf::PI / 12.0f); an2 =(float)(i+1) *(moMathf::PI / 12.0f); if((i % 2) ==0) { glTexCoord2f(s0, t1); glVertex2f(rad*cos(an),2.0*sin(an)); glTexCoord2f(s1, t1); glVertex2f(rad*cos(an2),2.0*sin(an2)); } else { glTexCoord2f(s1, t1); glVertex2f(rad*cos(an),2.0*sin(an)); glTexCoord2f(s0, t1); glVertex2f(rad*cos(an2),2.0*sin(an2)); } } glTexCoord2f(s0, t1); glVertex2f(rad*cos(0.0),rad*sin(0.0)); glEnd(); } if(cf==6) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(0.0, 0.0, -2.5+m_Config[moR(VIDEOWALL_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)); glRotatef(m_EffectState.tempo.ang*togra,1.0,0.0,1.0); glBegin(GL_QUADS); glTexCoord2f(s0, t0); glVertex2f(-1.0-1.0, 0.0+1.0); glTexCoord2f(s0, t1); glVertex2f(-1.0-1.0, 1.0+1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0-1.0, 1.0+1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0-1.0, 0.0+1.0); glTexCoord2f(s0, t0); glVertex2f(1.0+1.0, 0.0+1.0); glTexCoord2f(s0, t1); glVertex2f(1.0+1.0, 1.0+1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0+1.0, 1.0+1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0+1.0, 0.0+1.0); glTexCoord2f(s0, t0); glVertex2f(-1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(-1.0, 1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, 1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(1.0, 1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, 1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(-1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(-1.0, -1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, -1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(1.0, 0.0); glTexCoord2f(s0, t1); glVertex2f(1.0, -1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0, -1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0, 0.0); glTexCoord2f(s0, t0); glVertex2f(-1.0-1.0, 0.0-1.0); glTexCoord2f(s0, t1); glVertex2f(-1.0-1.0, -1.0-1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0-1.0, -1.0-1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0-1.0, 0.0-1.0); glTexCoord2f(s0, t0); glVertex2f(1.0+1.0, 0.0-1.0); glTexCoord2f(s0, t1); glVertex2f(1.0+1.0, -1.0-1.0); glTexCoord2f(s1, t1); glVertex2f( 0.0+1.0, -1.0-1.0); glTexCoord2f(s1, t0); glVertex2f( 0.0+1.0, 0.0-1.0); glEnd(); } }
void moEffectSampleTest::Draw( moTempo* tempogral, moEffectState* parentstate ) { MOint indeximage; MOdouble PosTextX0, PosTextX1, PosTextY0, PosTextY1; int ancho,alto; int w = m_pResourceManager->GetRenderMan()->ScreenWidth(); int h = m_pResourceManager->GetRenderMan()->ScreenHeight(); PreDraw( tempogral, parentstate); // Guardar y resetar la matriz de vista del modelo // glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The View // Cambiar la proyeccion para una vista ortogonal // glDisable(GL_DEPTH_TEST); // Disables Depth Testing glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix glOrtho(0,w,0,h,-1,1); // Set Up An Ortho Screen // Funcion de blending y de alpha channel // glEnable(GL_BLEND); glDisable(GL_ALPHA); // Draw // glTranslatef( ( m_Config[moR(SAMPLETEST_TRANSLATEX)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)+Tx )*w, ( m_Config[moR(SAMPLETEST_TRANSLATEY)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)+Ty )*h, m_Config[moR(SAMPLETEST_TRANSLATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)+Tz); glRotatef( m_Config[moR(SAMPLETEST_ROTATEX)].GetData()->Fun()->Eval(m_EffectState.tempo.ang), 1.0, 0.0, 0.0 ); glRotatef( m_Config[moR(SAMPLETEST_ROTATEY)].GetData()->Fun()->Eval(m_EffectState.tempo.ang), 0.0, 1.0, 0.0 ); glRotatef( m_Config[moR(SAMPLETEST_ROTATEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang), 0.0, 0.0, 1.0 ); glScalef( m_Config[moR(SAMPLETEST_SCALEX)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)*Sx, m_Config[moR(SAMPLETEST_SCALEY)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)*Sy, m_Config[moR(SAMPLETEST_SCALEZ)].GetData()->Fun()->Eval(m_EffectState.tempo.ang)*Sz); SetColor( m_Config[moR(SAMPLETEST_COLOR)][MO_SELECTED], m_Config[moR(SAMPLETEST_ALPHA)][MO_SELECTED], m_EffectState ); SetBlending( (moBlendingModes) m_Config[moR(SAMPLETEST_BLENDING)][MO_SELECTED][0].Int() ); moTexture* pImage = (moTexture*) m_Config[moR(SAMPLETEST_TEXTURE)].GetData()->Pointer(); glBindTexture( GL_TEXTURE_2D, m_Config[moR(SAMPLETEST_TEXTURE)].GetData()->GetGLId(&m_EffectState.tempo) ); PosTextX0 = 0.0; PosTextX1 = 1.0 * ( pImage!=NULL ? pImage->GetMaxCoordS() : 1.0 ); PosTextY0 = 0.0; PosTextY1 = 1.0 * ( pImage!=NULL ? pImage->GetMaxCoordT() : 1.0 ); //ancho = (int)m_Config[ moR(SAMPLETEST_WIDTH) ].GetData()->Fun()->Eval(m_EffectState.tempo.ang)* (float)(w/800.0); //alto = (int)m_Config[ moR(SAMPLETEST_HEIGHT) ].GetData()->Fun()->Eval(m_EffectState.tempo.ang)* (float)(h/600.0); glBegin(GL_QUADS); glTexCoord2f( PosTextX0, PosTextY1); glVertex2f( -0.5*w, -0.5*h); glTexCoord2f( PosTextX1, PosTextY1); glVertex2f( 0.5*w, -0.5*h); glTexCoord2f( PosTextX1, PosTextY0); glVertex2f( 0.5*w, 0.5*h); glTexCoord2f( PosTextX0, PosTextY0); glVertex2f( -0.5*w, 0.5*h); glEnd(); moTrackerSystemData* m_pTrackerData = NULL; bool m_bTrackerInit = false; //Procesar Inlets for(int i=0; i<m_Inlets.Count(); i++) { moInlet* pInlet = m_Inlets[i]; if (pInlet->Updated() && ( pInlet->GetConnectorLabelName()==moText("TRACKERKLT") || pInlet->GetConnectorLabelName()==moText("TRACKERGPUKLT") || pInlet->GetConnectorLabelName()==moText("TRACKERGPUKLT2")) ) { m_pTrackerData = (moTrackerSystemData *)pInlet->GetData()->Pointer(); if (m_pTrackerData && !m_bTrackerInit) { m_bTrackerInit = true; //SelectScriptFunction("Reset"); //RunSelectedFunction(); //MODebug2->Push(IntToStr(TrackerId)); //MODebug2->Push(moText("Receiving:") + IntToStr(m_pTrackerData->GetFeaturesCount()) ); if (m_pTrackerData->GetFeaturesCount()>0) { int tw = m_pTrackerData->GetVideoFormat().m_Width; int th = m_pTrackerData->GetVideoFormat().m_Height; //MODebug2->Push(moText("vformat:")+IntToStr(tw)+moText("th")+IntToStr(th)); for (i = 0; i < m_pTrackerData->GetFeaturesCount(); i++) { moTrackerFeature* pF = m_pTrackerData->GetFeature(i); //if (pF && pF->valid) { float x = (pF->x / (float)tw) - 0.5; float y = -(pF->y / (float)th) + 0.5; float tr_x = (pF->tr_x / (float)tw) - 0.5; float tr_y = -(pF->tr_y / (float)th) + 0.5; float v_x = (pF->v_x / (float)tw); float v_y = -(pF->v_y / (float)th); float vel = sqrtf( v_x*v_x+v_y*v_y ); int v = pF->val; //MODebug2->Log(moText(" x:")+FloatToStr(pF->x) + moText(" y:")+FloatToStr(pF->y) ); glBindTexture(GL_TEXTURE_2D,0); glColor4f(1.0, 0.0, 0.0, 1.0); if (v >= KLT_TRACKED) glColor4f(0.0, 1.0, 0.0, 1.0); else if (v == KLT_NOT_FOUND) glColor4f(1.0, 0.0, 1.0, 1.0); else if (v == KLT_SMALL_DET) glColor4f(1.0, 0.0, 1.0, 1.0); else if (v == KLT_MAX_ITERATIONS) glColor4f(1.0, 0.0, 1.0, 1.0); else if (v == KLT_OOB) glColor4f(1.0, 0.0, 1.0, 1.0); else if (v == KLT_LARGE_RESIDUE) glColor4f(1.0, 0.0, 1.0, 1.0); if ( pF->valid ) { glBegin(GL_QUADS); glVertex2f((tr_x - 0.008)*w, (tr_y - 0.008)*h); glVertex2f((tr_x - 0.008)*w, (tr_y + 0.008)*h); glVertex2f((tr_x + 0.008)*w, (tr_y + 0.008)*h); glVertex2f((tr_x + 0.008)*w, (tr_y - 0.008)*h); glEnd(); glBegin(GL_QUADS); glVertex2f((x - 0.008)*w, (y - 0.008)*h); glVertex2f((x - 0.008)*w, (y + 0.008)*h); glVertex2f((x + 0.008)*w, (y + 0.008)*h); glVertex2f((x + 0.008)*w, (y - 0.008)*h); glEnd(); glDisable(GL_TEXTURE_2D); glColor4f(1.0, 1.0, 1.0, 1.0); glBegin(GL_LINES); glVertex2f( x*w, y*h); glVertex2f( tr_x*w, tr_y*h); glEnd(); if ( vel > 0.001 ) { glDisable(GL_TEXTURE_2D); glColor4f(0.0, 0.0, 1.0, 1.0); //glPointSize((GLfloat)10); glLineWidth((GLfloat)10.0); glBegin(GL_LINES); glVertex2f( x*w, y*h); glVertex2f( x*w+v_x*w, y*h+v_y*h); glEnd(); } } } } } } } }
void moPostEffectVideoPanel::Draw( moTempo* tempogral,moEffectState* parentstate) { PreDraw( tempogral, parentstate); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glColor4f( m_Config.GetParam(color).GetValueFlt(MO_RED)*state.tintr, m_Config.GetParam(color).GetValueFlt(MO_GREEN)*state.tintg, m_Config.GetParam(color).GetValueFlt(MO_BLUE)*state.tintb, m_Config.GetParam(color).GetValueFlt(MO_ALPHA)*state.alpha); MOint cf; cf = m_Config.GetParam(configuration).GetValueFlt(0); glClearColor(0.0, 0.0, 0.0, 0.0); //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT); //glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, MORenderMan->RenderTexGLId(MO_EFFECTS_TEX) ); //CAJA PANELES VERTICALES if(cf==0) { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( -3, 0.0, -5.0); glBegin(GL_QUADS); glTexCoord2f( 0.0, 0.0); glVertex2f(-0.5, -1.0); glTexCoord2f( 0.0, 1.0); glVertex2f(-0.5, 1.0); glTexCoord2f( 1.0, 1.0); glVertex2f( 0.5, 1.0); glTexCoord2f( 1.0, 0.0); glVertex2f( 0.5, -1.0); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( -1, 0.0, -5.0 ); glBegin(GL_QUADS); glTexCoord2f( 0.0, 0.0); glVertex2f(-0.5, -1.0); glTexCoord2f( 0.0, 1.0); glVertex2f(-0.5, 1.0); glTexCoord2f( 1.0, 1.0); glVertex2f( 0.5, 1.0); glTexCoord2f( 1.0, 0.0); glVertex2f( 0.5, -1.0); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(1, 0.0, -5.0 ); glBegin(GL_QUADS); glTexCoord2f( 0.0, 0.0); glVertex2f(-0.5, -1.0); glTexCoord2f( 0.0, 1.0); glVertex2f(-0.5, 1.0); glTexCoord2f( 1.0, 1.0); glVertex2f( 0.5, 1.0); glTexCoord2f( 1.0, 0.0); glVertex2f( 0.5, -1.0); glEnd(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef(3, 1.0, -5.0); glBegin(GL_QUADS); glTexCoord2f( 0.0, 0.0); glVertex2f(-0.5, -1.0); glTexCoord2f( 0.0, 1.0); glVertex2f(-0.5, 1.0); glTexCoord2f( 1.0, 1.0); glVertex2f( 0.5, 1.0); glTexCoord2f( 1.0, 0.0); glVertex2f( 0.5, -1.0); glEnd(); } //CAJA CON PERSPECTIVA if(cf==1) { MOfloat tZ = -4.1; vector_3d box_vertex[8]; vector_2d box_texcor[8]; box_vertex[0][0] = -4.0; box_vertex[0][1] = 3.0; box_vertex[0][2] = 0.0; box_texcor[0][0] = 0.0; box_texcor[0][1] = 1.0*0.58; box_vertex[1][0] = 4.0; box_vertex[1][1] = 3.0; box_vertex[1][2] = 0.0; box_texcor[1][0] = 1.0*0.78; box_texcor[1][1] = 1.0*0.58; box_vertex[2][0] = -3.5; box_vertex[2][1] = 2.0; box_vertex[2][2] = -4.0; box_texcor[2][0] = 0.25*0.78; box_texcor[2][1] = 0.75*0.58; box_vertex[3][0] = 3.5; box_vertex[3][1] = 2.0; box_vertex[3][2] = -4.0; box_texcor[3][0] = 0.75*0.78; box_texcor[3][1] = 0.75*0.58; box_vertex[4][0] = -4.0; box_vertex[4][1] = -3.0; box_vertex[4][2] = 0.0; box_texcor[4][0] = 0.0; box_texcor[4][1] = 0.0; box_vertex[5][0] = -3.5; box_vertex[5][1] = -3.0; box_vertex[5][2] = -4.0; box_texcor[5][0] = 0.25*0.78; box_texcor[5][1] = 0.0; box_vertex[6][0] = 3.5; box_vertex[6][1] = -3.0; box_vertex[6][2] = -4.0; box_texcor[6][0] = 0.75*0.78; box_texcor[6][1] = 0.0; box_vertex[7][0] = 4.0; box_vertex[7][1] = -3.0; box_vertex[7][2] = 0.0; box_texcor[7][0] = 1.0*0.78; box_texcor[7][1] = 0.0; //panel izquierdo: vx 4, 0, 2, 5 glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, tZ ); glBegin(GL_QUADS); glTexCoord2f( box_texcor[4][0], box_texcor[4][1]); glVertex3f( box_vertex[4][0], box_vertex[4][1], box_vertex[4][2]); glTexCoord2f( box_texcor[0][0], box_texcor[0][1]); glVertex3f( box_vertex[0][0], box_vertex[0][1], box_vertex[0][2]); glTexCoord2f( box_texcor[2][0], box_texcor[2][1]); glVertex3f( box_vertex[2][0], box_vertex[2][1], box_vertex[2][2]); glTexCoord2f( box_texcor[5][0], box_texcor[5][1]); glVertex3f( box_vertex[5][0], box_vertex[5][1], box_vertex[5][2]); glEnd(); //panel fondo: vx 5, 2, 3, 6 glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, tZ ); glBegin(GL_QUADS); glTexCoord2f( box_texcor[5][0], box_texcor[5][1]); glVertex3f( box_vertex[5][0], box_vertex[5][1], box_vertex[5][2]); glTexCoord2f( box_texcor[2][0], box_texcor[2][1]); glVertex3f( box_vertex[2][0], box_vertex[2][1], box_vertex[2][2]); glTexCoord2f( box_texcor[3][0], box_texcor[3][1]); glVertex3f( box_vertex[3][0], box_vertex[3][1], box_vertex[3][2]); glTexCoord2f( box_texcor[6][0], box_texcor[6][1]); glVertex3f( box_vertex[6][0], box_vertex[6][1], box_vertex[6][2]); glEnd(); //panel derecho: vx 6, 3, 1, 7 glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, tZ); glBegin(GL_QUADS); glTexCoord2f( box_texcor[6][0], box_texcor[6][1]); glVertex3f( box_vertex[6][0], box_vertex[6][1], box_vertex[6][2]); glTexCoord2f( box_texcor[3][0], box_texcor[3][1]); glVertex3f( box_vertex[3][0], box_vertex[3][1], box_vertex[3][2]); glTexCoord2f( box_texcor[1][0], box_texcor[1][1]); glVertex3f( box_vertex[1][0], box_vertex[1][1], box_vertex[1][2]); glTexCoord2f( box_texcor[7][0], box_texcor[7][1]); glVertex3f( box_vertex[7][0], box_vertex[7][1], box_vertex[7][2]); glEnd(); //panel arriba: vx 2, 0, 1, 3 glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, tZ); glColor4f( m_Config.GetParam(color).GetValueFlt(MO_RED)*state.tintr*0.5, m_Config.GetParam(color).GetValueFlt(MO_GREEN)*state.tintg*0.5, m_Config.GetParam(color).GetValueFlt(MO_BLUE)*state.tintb*0.5, m_Config.GetParam(color).GetValueFlt(MO_ALPHA)*state.alpha); glBegin(GL_QUADS); glTexCoord2f( box_texcor[2][0], box_texcor[2][1]); glVertex3f( box_vertex[2][0], box_vertex[2][1], box_vertex[2][2]); glTexCoord2f( box_texcor[0][0], box_texcor[0][1]); glVertex3f( box_vertex[0][0], box_vertex[0][1], box_vertex[0][2]); glTexCoord2f( box_texcor[1][0], box_texcor[1][1]); glVertex3f( box_vertex[1][0], box_vertex[1][1], box_vertex[1][2]); glTexCoord2f( box_texcor[3][0], box_texcor[3][1]); glVertex3f( box_vertex[3][0], box_vertex[3][1], box_vertex[3][2]); glEnd(); //panel abajo: vx 4, 5, 6, 7 glColor4f( 0.0, 0.0, 0.0, m_Config.GetParam(color).GetValueFlt(MO_ALPHA)*state.alpha); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0, 0.0, tZ); glBegin(GL_QUADS); glTexCoord2f( box_texcor[4][0], box_texcor[4][1]); glVertex3f( box_vertex[4][0], box_vertex[4][1], box_vertex[4][2]); glTexCoord2f( box_texcor[5][0], box_texcor[5][1]); glVertex3f( box_vertex[5][0], box_vertex[5][1], box_vertex[5][2]); glTexCoord2f( box_texcor[6][0], box_texcor[6][1]); glVertex3f( box_vertex[6][0], box_vertex[6][1], box_vertex[6][2]); glTexCoord2f( box_texcor[7][0], box_texcor[7][1]); glVertex3f( box_vertex[7][0], box_vertex[7][1], box_vertex[7][2]); glEnd(); } if(cf==2) { } if(cf==3) { } if(cf==4) { } if(cf==5) { } if(cf==6) { } }
void moEffectSound::Draw( moTempo* tempogral, moEffectState* parentstate ) { MOint indeximage; MOdouble PosTextX0, PosTextX1, PosTextY0, PosTextY1; int ancho,alto; int w = m_pResourceManager->GetRenderMan()->ScreenWidth(); int h = m_pResourceManager->GetRenderMan()->ScreenHeight(); bool bReBalance = false; PreDraw( tempogral, parentstate); /* if (m_SoundFilename!=m_Config[moParamReference(SOUND_SOUND)][MO_SELECTED][0].Text() ) { m_SoundFilename = m_Config[moParamReference(SOUND_SOUND)][MO_SELECTED][0].Text(); m_SoundFilenameFull = (moText)m_pResourceManager->GetDataMan()->GetDataPath() + (moText)moSlash + (moText)m_SoundFilename; m_Audio.BuildLiveSound( m_SoundFilenameFull ); } */ /* if ( tempogral->ticks>1 && !moTimeManager::MoldeoTimer->Paused() && !m_bAudioStarted ) { m_Audio.Seek( tempogral->ticks ); m_Audio.Play(); m_bAudioStarted = true; } else if ( tempogral->ticks==0 && !moTimeManager::MoldeoTimer->Started() ) { m_Audio.Stop(); m_bAudioStarted = false; } if ( last_ticks == tempogral->ticks ) { m_Audio.Pause(); m_Audio.Seek( tempogral->ticks ); m_bAudioStarted = false; } */ /* moStreamState audiostate = m_Audio.GetState(); moText textstate = m_Audio.StateToText( audiostate ); long audioposition; last_ticks = moGetTicks(); audioposition = m_Audio.GetPosition(); if ( (long) abs(audioposition - last_ticks) > 8000 ) { if (audiostate!=MO_STREAMSTATE_STOPPED) m_Audio.Seek( last_ticks ); audioposition = last_ticks; } moSetDuration( audioposition ); if (moTimeManager::MoldeoTimer->Paused()) { if (audiostate!=MO_STREAMSTATE_PAUSED) m_Audio.Pause(); } else { if ( moTimeManager::MoldeoTimer->Started() ) { if (audiostate!=MO_STREAMSTATE_PLAYING) m_Audio.Play(); } else { if (audiostate!=MO_STREAMSTATE_STOPPED) m_Audio.Stop(); } } */ // Guardar y resetar la matriz de vista del modelo // glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The View // Cambiar la proyeccion para una vista ortogonal // glDisable(GL_DEPTH_TEST); // Disables Depth Testing glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix glOrtho(0,w,0,h,-1,1); // Set Up An Ortho Screen // Funcion de blending y de alpha channel // glEnable(GL_BLEND); glDisable(GL_ALPHA); SetColor( m_Config[moR(SOUND_COLOR)][MO_SELECTED], m_Config[moR(SOUND_ALPHA)][MO_SELECTED], m_EffectState ); moSound* NextSound = NULL; if (m_Config[ moR(SOUND_SOUND) ].GetData()) NextSound = m_Config[ moR(SOUND_SOUND) ].GetData()->Sound(); if (NextSound && Sound) { ///si se cambió de película if ( Sound->GetName() != NextSound->GetName() ) { if (Sound->Initialized()) { ///parar o pausar... ///faltaria un parametro: STOP on CHANGE, o PAUSE ON CHANGE Sound->Stop(); bReBalance = true; } } } Sound = NextSound; int mLoop = m_Config.Int(moR(SOUND_LOOP)); int mMode = m_Config.Int(moR(SOUND_MODE)); MOulong AudioPosition,AudioDuration; //in ms moText tPosition,tDuration; if (Sound) { AudioPosition = Sound->GetPosition(); AudioDuration = Sound->GetDuration(); tPosition = moVideoManager::NanosecondsToTimecode((MOuint64)AudioPosition*(MOuint64)1000000); tDuration = moVideoManager::NanosecondsToTimecode((MOuint64)AudioDuration*(MOuint64)1000000); double mUserPosition = m_Config.Eval(moR(SOUND_POSITION)); if (mUserPosition!=m_UserPosition) { //MODebug2->Push(" mUserPosition:" + FloatToStr(mUserPosition) + "/" + FloatToStr(m_UserPosition) ); Sound->Seek( (MOulong)mUserPosition, 1.0 ); m_UserPosition = mUserPosition; } ///estamos en syncro de todas maneras con el clock de la Consola... if ( moIsTimerPaused() ) { Sound->Pause(); } /// caso por Timer PARADO (NOT STARTED) if ( moIsTimerStopped() ) { if (Sound->IsPlaying()) Sound->Stop(); } if (!Sound->IsPlaying() && moIsTimerPlaying() ) { Sound->Play(); } switch((SoundMode)mMode) { case MO_SOUND_MODE_PLAYLIST: if ( AudioPosition >= AudioDuration || Sound->IsEOS()) { if ( mLoop && m_Config.GetParam(moR(SOUND_SOUND)).GetIndexValue() == (m_Config.GetParam(moR(SOUND_SOUND)).GetValuesCount()-1) ) { m_Config.GetParam(moR(SOUND_SOUND)).FirstValue(); } else m_Config.GetParam(moR(SOUND_SOUND)).NextValue(); if (Sound->State()!=MO_STREAMSTATE_STOPPED) { Sound->Stop(); } MODebug2->Push( "EOS:" + IntToStr((int)Sound->IsEOS()) ); } break; default: if (mLoop) { if ( AudioPosition >= AudioDuration || Sound->IsEOS()) { Sound->Pause(); Sound->Seek( 0, 1.0 ); //if ( m_FramePosition >= (Sound->GetFrameCount()-1) || Sound->IsEOS() ) { //Sound->Pause(); // //Sound->Play(); //} } } break; } float mVolume = m_Config.Eval( moR(SOUND_VOLUME) ); if ( mVolume != Sound->GetVolume() || bReBalance ) { Sound->SetVolume( mVolume ); } float mPitch = m_Config.Eval( moR(SOUND_PITCH) ); long pitchi1 = ( mPitch * 100.0 ); long pitchi2 = ( Sound->GetPitch() * 100.0 ); if ( pitchi1 != pitchi2 ) { mPitch = (float)pitchi1 / 100.0; Sound->SetPitch( mPitch ); } float mBalance = m_Config.Eval( moR(SOUND_BALANCE) ); if ( mBalance != Sound->GetBalance() || bReBalance ) { Sound->SetBalance( mBalance ); } float mEchoDelay = m_Config.Eval( moR(SOUND_ECHO_DELAY) ); if ( mEchoDelay != Sound->GetEchoDelay() || bReBalance ) { Sound->SetEchoDelay( mEchoDelay ); } float mEchoIntensity = m_Config.Eval( moR(SOUND_ECHO_INTENSITY) ); if ( mEchoIntensity != Sound->GetEchoIntensity() || bReBalance ) { Sound->SetEchoIntensity( mEchoIntensity ); } float mEchoFeedback = m_Config.Eval( moR(SOUND_ECHO_FEEDBACK) ); if ( mEchoFeedback != Sound->GetEchoFeedback() || bReBalance ) { Sound->SetEchoFeedback( mEchoFeedback ); } } moFont* pFont = m_pResourceManager->GetFontMan()->GetFont(0); /* textstate+= moText(" position") + IntToStr(audioposition); textstate+= moText(" diff:") + (moText)IntToStr( abs(audioposition - last_ticks) ); */ moText textaudio = tPosition + " / " + tDuration; if (pFont) { /* pFont->Draw( 0.0, 0.0, textaudio ); */ } }
// we don't need to distinguish, call the Draw functions void PreDispatch(uint32_t eid, ID3D12GraphicsCommandList *cmd) { PreDraw(eid, cmd); }
void moPostEffectDebug::Draw( moTempo* tempogral,moEffectState* parentstate) { //calculamos ticks y frames x seg moTextArray TextArray; MOulong timecodeticks; int w; int h; BeginDraw( tempogral, parentstate); if (m_pResourceManager) { w = m_pResourceManager->GetRenderMan()->ScreenWidth(); h = m_pResourceManager->GetRenderMan()->ScreenHeight(); } ticksprevious = ticks; ticks = moGetTicksAbsolute(); tickselapsed = ticks - ticksprevious; fps_current = 1000.0 / tickselapsed; fps_mean += fps_current; fps_count++; if (fps_count % 10 == 0) { fps_mean /= 10; fps_text = moText("FPS = ") + (moText)FloatToStr(fps_mean); fps_mean = 0; fps_count = 0; } TextArray.Add(fps_text); /* for(int g=560;g>=80 ;g-=20) { //glPrint(0,g,MODebug2->Pop(),0,1.0,1.0); //glPrint(0,g,moText("test"),0,1.0,1.0); } */ /* moText state_datos; moText state_luminosidad; moText state_colorido; moText state_magnitude; state_datos+= "SINC: "; state_datos+= IntToStr(state.synchronized); state_datos+= " FAC: "; state_datos+= FloatToStr(m_EffectState.tempo.factor,4); state_datos+= " SYNCRO: "; state_datos+= FloatToStr(m_EffectState.tempo.syncro,4); state_luminosidad+="ALPHA:"; state_luminosidad+= FloatToStr(state.alpha,4); state_luminosidad+="LUM:"; state_luminosidad+= FloatToStr(state.tint,4); state_colorido+="ALPHA:"; state_colorido+= FloatToStr(state.tintc,4); state_colorido+="SAT:"; state_colorido+= FloatToStr(state.tints,4); state_magnitude+="DELTA:"; state_magnitude+= FloatToStr(m_EffectState.tempo.delta,4); state_magnitude+="AMP:"; state_magnitude+= FloatToStr(state.amplitude,4); MODebug2->Push(state_datos); MODebug2->Push(state_luminosidad); MODebug2->Push(state_colorido); MODebug2->Push(state_magnitude); */ moFont mFont = m_Config.Font( moR(DEBUG_FONT) ); PreDraw( tempogral, parentstate); // Cambiar la proyeccion para una vista ortogonal // glDisable(GL_DEPTH_TEST); // Disables Depth Testing glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix glOrtho(0,w,0,h,-1,1); // Set Up An Ortho Screen glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The View glEnable(GL_BLEND); //color SetColor( m_Config[moR(DEBUG_COLOR)], m_Config[moR(DEBUG_ALPHA)], m_EffectState ); moText Texto = moText(""); int minutes; int seconds; int frames; //if (mFont) { /* pFont->Draw( 0.0, 0.0, Texto, m_Config[moR(DEBUG_FONT)][MO_SELECTED][2].Int(), 0 ); */ Texto+= fps_text; timecodeticks = moGetTicks(); minutes = timecodeticks / (1000*60); seconds = (timecodeticks - minutes*1000*60) / 1000; frames = (timecodeticks - minutes*1000*60 - seconds*1000 ) * 25 / 1000; Texto+= moText(" ticks: ") + (moText)IntToStr(timecodeticks,10) + moText(" ang: ") + (moText)FloatToStr((float)tempogral->ang) + moText(" timecode: ") + (moText)IntToStr(minutes, 2) + moText(":") + (moText)IntToStr(seconds,2) + moText(":") + (moText)IntToStr(frames,2); //glTranslatef( 0.0, 2.0, 0.0 ); mFont.Draw( 0.0, 0.0, Texto, m_Config[moR(DEBUG_FONT)][MO_SELECTED][2].Int(), 0 ); moText Final; int cint = 0; //Final = moText("Debug "); //for( int i=0; i<MODebug2->Count(); i++ ) { // cint++; //Final = MODebug2->GetMessages().Get(i); //} cint = MODebug2->Count(); //Final = Final + moText("(")+IntToStr( cint ) + moText("):"); //if (cint>0) Final = Final + (moText)MODebug2->GetLast(); /* for( int i=0; i<(cint-1); i++ ) { Final = MODebug2->Pop(); } */ mFont.Draw( 0.0, 48.0, Final ); //moText infod = moText("screen width:")+IntToStr(w)+moText(" screen height:")+IntToStr(h); //pFont->Draw( 0, 0, infod, m_Config[moR(TEXT_FONT)][MO_SELECTED][2].Int(), 0, 2.0, 2.0, 0.0); //} glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPopMatrix(); // Restore The Old Projection Matrix glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPopMatrix(); // Restore The Old Projection Matrix }
// we don't need to distinguish, call the Draw functions void PreDispatch(uint32_t eid, VkCommandBuffer cmd) { PreDraw(eid, cmd); }
void THFrame::Draw() { PreDraw(); DrawObjects(); PostDraw(); }
void moDeformationGrid::Draw( moTempo* tempogral, moEffectState* parentstate ) { MOint indeximage; int ancho,alto; int w = m_pResourceManager->GetRenderMan()->ScreenWidth(); int h = m_pResourceManager->GetRenderMan()->ScreenHeight(); UpdateParameters(); PreDraw( tempogral, parentstate); if (clear) { glClearColor(0.0,0.0,0.0,1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } glDisable(GL_DEPTH_TEST); // Disables Depth Testing glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix glOrtho(-0.5,0.5,-0.5*h/w,0.5*h/w,-1,1); // Set Up An Ortho Screen /* glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // glOrtho(0,w,0,h,-1,1); // Set Up An Ortho Screen m_pResourceManager->GetGLMan()->SetPerspectiveView( w, h ); glMatrixMode(GL_PROJECTION); gluLookAt( 0, 0, 10.0, 0, 0, 0, 0, 1, 0); */ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); // Store The Modelview Matrix glLoadIdentity(); // Reset The View glTranslatef( m_Config[moR(DEFORMATIONGRID_TRANSLATEX)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(DEFORMATIONGRID_TRANSLATEY)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(DEFORMATIONGRID_TRANSLATEZ)].GetData()->Fun()->Eval(state.tempo.ang)); glRotatef( m_Config[moR(DEFORMATIONGRID_ROTATEX)].GetData()->Fun()->Eval(state.tempo.ang), 1.0, 0.0, 0.0 ); glRotatef( m_Config[moR(DEFORMATIONGRID_ROTATEY)].GetData()->Fun()->Eval(state.tempo.ang), 0.0, 1.0, 0.0 ); glRotatef( m_Config[moR(DEFORMATIONGRID_ROTATEZ)].GetData()->Fun()->Eval(state.tempo.ang), 0.0, 0.0, 1.0 ); glScalef( m_Config[moR(DEFORMATIONGRID_SCALEX)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(DEFORMATIONGRID_SCALEY)].GetData()->Fun()->Eval(state.tempo.ang), m_Config[moR(DEFORMATIONGRID_SCALEZ)].GetData()->Fun()->Eval(state.tempo.ang)); SetColor( m_Config[moR(DEFORMATIONGRID_COLOR)][MO_SELECTED], m_Config[moR(DEFORMATIONGRID_ALPHA)][MO_SELECTED], state ); glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D,m_Config[moR(DEFORMATIONGRID_TEXTURE)].GetData()->GetGLId(&state.tempo) ); if (m_Points && m_TPoints) for(int j=0; j< (m_Height-1); j++) { glBegin(GL_QUAD_STRIP); for( int i=0; i < m_Width; i++ ) { glTexCoord2f( m_TPoints[i + j * m_Width].X(), m_TPoints[i + j * m_Width].Y() ); glVertex2f( m_Points[i + j * m_Width].X(), m_Points[i + j * m_Width].Y() ); glTexCoord2f( m_TPoints[i + (j+1) * m_Width].X(), m_TPoints[i + (j+1) * m_Width].Y() ); glVertex2f( m_Points[i + (j+1) * m_Width].X(), m_Points[i + (j+1) * m_Width].Y() ); } glEnd(); } if (showgrid>0) { glDisable( GL_TEXTURE_2D ); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); for(int j=0; j< m_Height; j++) { for( int i=0; i < m_Width; i++ ) { glColor4f( 0.0, 1.0, 0.0, 1.0); glBegin(GL_QUADS); glVertex2f( m_Points[i + j * m_Width].X() -0.002, m_Points[i + j * m_Width].Y() +0.002); glVertex2f( m_Points[i + j * m_Width].X()+0.002, m_Points[i + j * m_Width].Y() +0.002); glVertex2f( m_Points[i + j * m_Width].X()+0.002, m_Points[i + j * m_Width].Y() -0.002 ); glVertex2f( m_Points[i + j * m_Width].X() -0.002, m_Points[i + j * m_Width].Y() -0.002 ); glEnd(); if ( m_Selector_I == i && m_Selector_J == j ) { glColor4f( 1.0, 1.0, 0.0, 1.0); glBegin(GL_QUADS); glVertex2f( m_Points[i + j * m_Width].X() -0.01, m_Points[i + j * m_Width].Y() +0.01); glVertex2f( m_Points[i + j * m_Width].X()+0.01, m_Points[i + j * m_Width].Y() +0.01); glVertex2f( m_Points[i + j * m_Width].X()+0.01, m_Points[i + j * m_Width].Y() -0.01 ); glVertex2f( m_Points[i + j * m_Width].X() -0.01, m_Points[i + j * m_Width].Y() -0.01 ); glEnd(); } } } glEnable( GL_TEXTURE_2D ); } /* glBegin (GL_QUADS); glTexCoord2f( PosTextX0, PosTextY1); glVertex3f (-7.69, 5.77, 0); glTexCoord2f( PosTextX1, PosTextY1); glVertex3f (7.69, 5.77, 0); glTexCoord2f( PosTextX1, PosTextY0); glVertex3f (7.69, -5.77, 0); glTexCoord2f( PosTextX0, PosTextY0); glVertex3f (-7.69, -5.77, 0); glEnd(); */ //MODebug2->Push(IntToStr(showgrid)); if (showgrid>0) { ///DRAW THE REFERENCE GRID TO SEE THE DEFORMATION RESULT /*** * for each vertex in the value index selected for the POINTS parameters * draw */ glColor4f(1.0,1.0,1.0,1.0); glDisable( GL_TEXTURE_2D ); glLineWidth( 1.0 ); glBegin (GL_LINES); glVertex3f (-0.25, h/w / 4, 0); glVertex3f (0.25, -h/w / 4, 0); glEnd (); glBegin (GL_LINES); glVertex3f (h/w / 4, h/w / 4, 0); glVertex3f (-h/w / 4, -h/w / 4, 0); glEnd (); glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); glBegin (GL_QUADS); glVertex3f (-0.5, h/w / 2, 0); glVertex3f (0.5, h/w / 2, 0); glVertex3f (0.5, -h/w / 2, 0); glVertex3f (-0.5, -h/w / 2, 0); glEnd (); glScalef(1.2,1.2,0); glBegin (GL_QUADS); glVertex3f (-0.5, h/w / 2, 0); glVertex3f (0.5, h/w / 2, 0); glVertex3f (0.5, -h/w / 2, 0); glVertex3f (-0.5, -h/w / 2, 0); glEnd (); } glLineWidth( 1.0 ); glEnable( GL_TEXTURE_2D ); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); }
void moEffectScene3D::Draw( moTempo* tempogral,moEffectState* parentstate) { PreDraw( tempogral, parentstate); // Guardar y resetar la matriz de vista del modelo // glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPushMatrix(); // Store The Modelview Matrix glLoadIdentity(); // Reset The View // Cambiar la proyeccion para una vista ortogonal // glEnable(GL_DEPTH_TEST); // Disables Depth Testing glDisable(GL_BLEND); glEnable(GL_LIGHT0); // Turn on a light with defaults set glEnable(GL_LIGHTING); // Turn on lighting glEnable(GL_COLOR_MATERIAL); // Allow color glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPushMatrix(); // Store The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix //glOrtho(0,800,0,600,-1,1); // Set Up An Ortho Screen // Give OpenGL our position, then view, then up vector gluPerspective(45.0f,(GLfloat)800/(GLfloat)600, 4.0f ,4000.0f); gluLookAt( mov.movx(m_Config.GetParam(eyex), state.tempo), mov.movy(m_Config.GetParam(eyey), state.tempo), mov.movz(m_Config.GetParam(eyez), state.tempo), mov.movx(m_Config.GetParam(viewx), state.tempo), mov.movy(m_Config.GetParam(viewy), state.tempo), mov.movz(m_Config.GetParam(viewz), state.tempo), 0, 1, 0); // Draw // //BEGIN //glBindTexture(GL_TEXTURE_2D, Images.Get(Image,&state.tempo)); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glTranslatef( mov.movx(m_Config.GetParam(transx), state.tempo), mov.movy(m_Config.GetParam(transy), state.tempo), mov.movz(m_Config.GetParam(transz), state.tempo) ); glRotatef( mov.movx(m_Config.GetParam(rotatx), state.tempo), 1.0, 0.0, 0.0 ); glRotatef( mov.movx(m_Config.GetParam(rotaty), state.tempo), 0.0, 1.0, 0.0 ); glRotatef( mov.movx(m_Config.GetParam(rotatz), state.tempo), 0.0, 0.0, 1.0 ); glScalef( mov.movx(m_Config.GetParam(scalex), state.tempo), mov.movx(m_Config.GetParam(scaley), state.tempo), mov.movx(m_Config.GetParam(scalez), state.tempo) ); Models3d.Draw(m_Config.GetCurrentValue(object), &state, GL_TRIANGLES); //END glEnable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glDisable(GL_COLOR_MATERIAL); // Allow color glDisable(GL_LIGHTING); // Turn on lighting glDisable(GL_LIGHT0); // Turn on a light with defaults set // Dejamos todo como lo encontramos // glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glPopMatrix(); // Restore The Old Projection Matrix glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glPopMatrix(); // Restore The Old Projection Matrix }
void PreMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { PreDraw(eid, cmd); }
//+--------------------------------------------------------------------------- // // Member: CDispRoot::DrawRoot // // Synopsis: Draw this display tree. // // Arguments: pContext draw context // pClientData client data used by clients in DrawClient // hrgnDraw region to draw in destination coordinates // prcDraw rect to draw in destination coordinates // // Notes: if hrgnDraw and prcDraw are both NULL, the bounding rect of // this root node is used // //---------------------------------------------------------------------------- void CDispRoot::DrawRoot( CDispDrawContext* pContext, void* pClientData, HRGN hrgnDraw, const RECT* prcDraw) { // BUGBUG (donmarsh) - for now we must use this root's own context, due // to the context stack used for drawing. Eventually, we should eliminate // the context pointer argument to DrawRoot. Assert(pContext == &_drawContext); AssertSz(!_fDrawLock, "Illegal call to DrawRoot inside Draw()"); AssertSz(_cOpen==0, "DrawRoot called while Display Tree is open"); Assert(_pRenderSurface != NULL); Assert(!IsSet(CDispFlags::s_interiorFlagsNotSetInDraw)); // set redraw region (will become a rect if possible) CRegion rgnRedraw; if(hrgnDraw != NULL) { rgnRedraw = hrgnDraw; } else if(prcDraw != NULL) { rgnRedraw = *prcDraw; } else { rgnRedraw = _rcContainer; } // check for early exit conditions if(!rgnRedraw.Intersects(_rcContainer)) { return; } // set initial context values pContext->SetClientData(pClientData); pContext->SetNoClip(); pContext->_offset = _rcContainer.TopLeft().AsSize(); pContext->_pFirstDrawNode = NULL; pContext->SetRedrawRegion(&rgnRedraw); // BUGBUG (donmarsh) -- this is a little ugly, but our the _rcVisBounds // for CDispRoot must be zero-based, because it is transformed by the // offset in CDispNode::Draw, and if _rcVisBounds == _rcContainer like // one would expect, _rcVisBounds gets transformed twice. _rcVisBounds.MoveToOrigin(); if(_pFirstChildNode == NULL) { pContext->SetDispSurface(_pRenderSurface); _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size); CRect rcClip; rgnRedraw.GetBounds(&rcClip); CRegion rgnClip(rcClip); _pRenderSurface->SetClipRgn(&rgnClip); DrawSelf(pContext, NULL); _pRenderSurface->SetClipRgn(NULL); ::SelectClipRgn(_pRenderSurface->GetRawDC(), NULL); goto Cleanup; } // DrawRoot does not allow recursion _fDrawLock = TRUE; // speed optimization: draw border and scroll bars for first node // without buffering or banding, then subtract them from the redraw // region. if(_pFirstChildNode==_pLastChildNode && _pFirstChildNode->IsContainer() && _pFirstChildNode->IsVisible()) { CDispContainer* pContainer = DYNCAST(CDispContainer, _pFirstChildNode); pContext->SetDispSurface(_pRenderSurface); _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size); CRect rcClip; rgnRedraw.GetBounds(&rcClip); CRegion rgnClip(rcClip); _pRenderSurface->SetClipRgn(&rgnClip); pContainer->DrawBorderAndScrollbars(pContext, &_rcContent); _rcContent.OffsetRect(_rcContainer.TopLeft().AsSize()); _pRenderSurface->SetClipRgn(NULL); // restore clipping on destination surface to redraw region // (this is important when we're using filters and we have a // direct draw surface) if(rgnRedraw.IsComplex()) { ::SelectClipRgn(_pRenderSurface->GetRawDC(), rgnRedraw.GetRegionAlias()); } else { HRGN hrgnClip = ::CreateRectRgnIndirect(&rgnRedraw.AsRect()); ::SelectClipRgn(_pRenderSurface->GetRawDC(), hrgnClip); ::DeleteObject(hrgnClip); } rgnRedraw.Intersect(_rcContent); // early exit if all we needed to draw was the border and scroll bars if(rgnRedraw.IsEmpty()) { goto Cleanup; } } else { _rcContent = _rcContainer; } // early exit if all we needed to draw was the border and scroll bars if(!_rcContent.IsEmpty()) { // try to allocate offscreen buffer BOOL fOffscreen = SetupOffscreenBuffer(pContext); Assert(!fOffscreen || _pOffscreenBuffer); // allocate stacks for redraw regions and context values CRegionStack redrawRegionStack; pContext->SetRedrawRegionStack(&redrawRegionStack); CDispContextStack contextStack; pContext->SetContextStack(&contextStack); // PreDraw pass processes the tree from highest layer to lowest, // culling layers beneath opaque layers, and identifying the lowest // opaque layer which needs to be rendered during the Draw pass PreDraw(pContext); // if we didn't consume the redraw region, we'll have to start rendering // from the root if(!pContext->GetRedrawRegion()->IsEmpty()) { pContext->_pFirstDrawNode = this; redrawRegionStack.PushRegionForRoot(pContext->GetRedrawRegion(), this, _rcContainer); contextStack.Init(); } else { Assert(pContext->_pFirstDrawNode != NULL); AssertSz(redrawRegionStack.MoreToPop(), "Mysterious redraw region stack bug!"); delete pContext->GetRedrawRegion(); contextStack.Restore(); } if(!fOffscreen) { _pRenderSurface->SetBandOffset(_afxGlobalData._Zero.size); DrawEntire(pContext); } else if(_pOffscreenBuffer->Height() >= _rcContent.Height()) { _pOffscreenBuffer->SetBandOffset(_rcContent.TopLeft().AsSize()); DrawEntire(pContext); _pOffscreenBuffer->Draw(_pRenderSurface, _rcContent); } else { DrawBands(pContext, &rgnRedraw, redrawRegionStack); } pContext->SetClientData(NULL); // clear redraw region trails redrawRegionStack.Restore(); for(;;) { CDispNode* pOpaqueNode = (CDispNode*)redrawRegionStack.PopKey(); if(pOpaqueNode == NULL) { break; } pOpaqueNode->ClearFlagToRoot(CDispFlags::s_savedRedrawRegion); } // delete all regions except the first redrawRegionStack.DeleteStack(&rgnRedraw); } Cleanup: // BUGBUG (donmarsh) -- restore _rcVisBounds to coincide with _rcContainer _rcVisBounds = _rcContainer; _fDrawLock = FALSE; }