void ExpandAnim::applyTransform () { GLMatrix *transform = &mTransform; float defaultXScale = 0.3f; float forwardProgress; float expandProgress; const float expandPhaseEnd = 0.5f; forwardProgress = getProgress (); if ((1 - forwardProgress) < expandPhaseEnd) expandProgress = (1 - forwardProgress) / expandPhaseEnd; else expandProgress = 1.0f; // animation movement transform->translate (WIN_X (mWindow) + WIN_W (mWindow) / 2.0f, WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f, 0.0f); transform->scale (defaultXScale + (1.0f - defaultXScale) * expandProgress, (1 - forwardProgress), 0.0f); transform->translate (-(WIN_X (mWindow) + WIN_W (mWindow) / 2.0f), -(WIN_Y (mWindow) + WIN_H (mWindow) / 2.0f), 0.0f); }
bool ResizeWindow::glPaint (const GLWindowPaintAttrib &attrib, const GLMatrix &transform, const CompRegion ®ion, unsigned int mask) { bool status; if (window == static_cast<resize::CompWindowImpl*>(rScreen->logic.w)->impl () && rScreen->logic.mode == ResizeOptions::ModeStretch) { GLMatrix wTransform (transform); BoxRec box; float xOrigin, yOrigin; float xScale, yScale; int x, y; if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) return false; status = gWindow->glPaint (attrib, transform, region, mask | PAINT_WINDOW_NO_CORE_INSTANCE_MASK); GLWindowPaintAttrib lastAttrib (gWindow->lastPaintAttrib ()); if (window->alpha () || lastAttrib.opacity != OPAQUE) mask |= PAINT_WINDOW_TRANSLUCENT_MASK; rScreen->logic.getPaintRectangle (&box); getStretchScale (&box, &xScale, &yScale); x = window->geometry (). x (); y = window->geometry (). y (); xOrigin = x - window->border ().left; yOrigin = y - window->border ().top; wTransform.translate (xOrigin, yOrigin, 0.0f); wTransform.scale (xScale, yScale, 1.0f); wTransform.translate ((rScreen->logic.geometry.x - x) / xScale - xOrigin, (rScreen->logic.geometry.y - y) / yScale - yOrigin, 0.0f); gWindow->glDraw (wTransform, lastAttrib, region, mask | PAINT_WINDOW_TRANSFORMED_MASK); } else { status = gWindow->glPaint (attrib, transform, region, mask); } return status; }
void MythRenderOpenGL2::PushTransformation(const UIEffects &fx, QPointF ¢er) { GLMatrix newtop = m_transforms.top(); if (fx.hzoom != 1.0 || fx.vzoom != 1.0 || fx.angle != 0.0) { newtop.translate(-center.x(), -center.y()); newtop.scale(fx.hzoom, fx.vzoom); newtop.rotate(fx.angle); newtop.translate(center.x(), center.y()); } m_transforms.push(newtop); }
bool CubeScreen::cubeCheckOrientation (const GLScreenPaintAttrib &sAttrib, const GLMatrix &transform, CompOutput *output, std::vector<GLVector> &points) { WRAPABLE_HND_FUNCTN_RETURN (bool, cubeCheckOrientation, sAttrib, transform, output, points) GLMatrix sTransform = transform; GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()->getMatrix ()); GLVector pntA, pntB, pntC; GLVector vecA, vecB, ortho; bool rv = false; priv->gScreen->glApplyTransform (sAttrib, output, &sTransform); sTransform.translate (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); sTransform.scale (priv->mOutputXScale, priv->mOutputYScale, 1.0f); mvp = pm * sTransform; pntA = mvp * points[0]; if (pntA[3] < 0.0f) rv = !rv; pntA.homogenize (); pntB = mvp * points[1]; if (pntB[3] < 0.0f) rv = !rv; pntB.homogenize (); pntC = mvp * points[2]; pntC.homogenize (); vecA = pntC - pntA; vecB = pntC - pntB; ortho = vecA ^ vecB; if (ortho[2] > 0.0f) rv = !rv; return rv; }