ganeswidgets/src/hgtransformedquad.cpp
changeset 20 a60f8b6b1d32
parent 5 4fa04caf0f43
equal deleted inserted replaced
17:a10844a9914d 20:a60f8b6b1d32
   104     {
   104     {
   105         HgQuad* quad = mQuad;
   105         HgQuad* quad = mQuad;
   106 
   106 
   107         QMatrix4x4 mirror = trans;
   107         QMatrix4x4 mirror = trans;
   108 
   108 
       
   109         QVector2D temp = quad->scale();
   109         qreal distToPlane = qAbs(quad->position().y() - mirroringPlaneY);
   110         qreal distToPlane = qAbs(quad->position().y() - mirroringPlaneY);
   110         
   111         
   111         mirror.translate(quad->position().x(), mirroringPlaneY - distToPlane/1, quad->position().z());
   112         mirror.translate(quad->position().x(), mirroringPlaneY - distToPlane, quad->position().z());
   112         mirror.scale(quad->scale().x(), -quad->scale().y()/1);
   113         mirror.scale(quad->scale().x(), -temp.y()*ReflectionHeight);
   113         mirror.rotate(quad->rotation());
   114         mirror.rotate(quad->rotation());
   114             
   115             
   115         QMatrix4x4 modelViewProjMatrix = projView * mirror;
   116         QMatrix4x4 modelViewProjMatrix = projView * mirror;
   116         
   117         
   117         perspectiveTransformPoints(mMirroredPoints, modelViewProjMatrix, center, windowSize);    
   118         perspectiveTransformPoints(mMirroredPoints, modelViewProjMatrix, center, windowSize);    
   118         
   119                 
   119         for (int i = 0; i < 4; i++)
   120         for (int i = 0; i < 4; i++)
   120             mMirroredPoints[i] += translate;
   121             mMirroredPoints[i] += translate;
   121 
   122 
   122     }
   123     }
   123 
   124