rendered paste bodydiff --git a/3d.c b/3d.c
index 27b670f..8e0b17b 100644
--- a/3d.c
+++ b/3d.c
@@ -59,6 +59,8 @@ typedef struct _tdWindow
CompWindow *next;
CompWindow *prev;
+
+ CompTransform bTransform;
} tdWindow;
typedef struct _tdScreen
@@ -197,12 +199,10 @@ tdPaintWindowWithDepth (CompWindow *w,
Region region,
unsigned int mask)
{
- Bool wasCulled;
- Bool status;
- int wx, wy, wx2, wy2, ww, wh;
- int bevel;
- float wwidth;
- CompTransform wTransform = *transform;
+ Bool wasCulled;
+ Bool status;
+ int wx, wy, wx2, wy2, ww, wh;
+ int bevel;
CompScreen *s = w->screen;
TD_SCREEN (s);
@@ -218,7 +218,6 @@ tdPaintWindowWithDepth (CompWindow *w,
ww = wx2 - wx;
wh = wy2 - wy;
- wwidth = -(tdGetWidth (s)) / 30;
bevel = tdGetBevel (s);
if (ww && wh && !(mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK))
@@ -230,14 +229,10 @@ tdPaintWindowWithDepth (CompWindow *w,
glEnable (GL_CULL_FACE);
glCullFace (GL_FRONT);
- matrixTranslate (&wTransform, 0.0f, 0.0f, wwidth);
-
- UNWRAP (tds, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, &wTransform, region,
+ UNWRAP (tds, s, paintWindow);
+ status = (*s->paintWindow) (w, attrib, &tdw->bTransform, region,
mask | PAINT_WINDOW_TRANSFORMED_MASK);
WRAP (tds, s, paintWindow, tdPaintWindow);
-
- matrixTranslate (&wTransform, 0.0f, 0.0f, -wwidth);
}
else
{
@@ -245,13 +240,13 @@ tdPaintWindowWithDepth (CompWindow *w,
glCullFace (GL_BACK);
UNWRAP (tds, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, &wTransform, region, mask);
+ status = (*s->paintWindow) (w, attrib, transform, region, mask);
WRAP (tds, s, paintWindow, tdPaintWindow);
}
/* Paint window depth. */
glPushMatrix ();
- glLoadMatrixf (wTransform.m);
+ glLoadMatrixf (transform->m);
glDisable (GL_CULL_FACE);
glEnable (GL_BLEND);
@@ -264,31 +259,48 @@ tdPaintWindowWithDepth (CompWindow *w,
/* Top */
glVertex3f (wx + DOBEVEL (Topleft), wy, 0);
glVertex3f (wx + ww - DOBEVEL (Topright), wy, 0);
- glVertex3f (wx + ww - DOBEVEL (Topright), wy, wwidth);
- glVertex3f (wx + DOBEVEL (Topleft), wy, wwidth);
+
+ glPushMatrix ();
+ glLoadMatrixf (tdw->bTransform.m);
+ glVertex3f (wx + ww - DOBEVEL (Topright), wy, 0);
+ glVertex3f (wx + DOBEVEL (Topleft), wy, 0);
+ glPopMatrix ();
/* Bottom */
glVertex3f (wx + DOBEVEL (Bottomleft), wy + wh, 0);
glVertex3f (wx + ww - DOBEVEL (Bottomright), wy + wh, 0);
- glVertex3f (wx + ww - DOBEVEL (Bottomright), wy + wh, wwidth);
- glVertex3f (wx + DOBEVEL (Bottomleft), wy + wh, wwidth);
+
+ glPushMatrix ();
+ glLoadMatrixf (tdw->bTransform.m);
+ glVertex3f (wx + ww - DOBEVEL (Bottomright), wy + wh, 0);
+ glVertex3f (wx + DOBEVEL (Bottomleft), wy + wh, 0);
+ glPopMatrix ();
glColor4f (0.70f, 0.70f, 0.70f, w->paint.opacity / OPAQUE);
/* Left */
glVertex3f (wx, wy + DOBEVEL (Topleft), 0);
glVertex3f (wx, wy + wh - DOBEVEL (Bottomleft), 0);
- glVertex3f (wx, wy + wh - DOBEVEL (Bottomleft), wwidth);
- glVertex3f (wx, wy + DOBEVEL (Topleft), wwidth);
+
+ glPushMatrix ();
+ glLoadMatrixf (tdw->bTransform.m);
+ glVertex3f (wx, wy + wh - DOBEVEL (Bottomleft), 0);
+ glVertex3f (wx, wy + DOBEVEL (Topleft), 0);
+ glPopMatrix ();
/* Right */
glVertex3f (wx + ww, wy + DOBEVEL (Topright), 0);
glVertex3f (wx + ww, wy + wh - DOBEVEL (Bottomright), 0);
- glVertex3f (wx + ww, wy + wh - DOBEVEL (Bottomright), wwidth);
- glVertex3f (wx + ww, wy + DOBEVEL (Topright), wwidth);
+
+ glPushMatrix ();
+ glLoadMatrixf (tdw->bTransform.m);
+ glVertex3f (wx + ww, wy + wh - DOBEVEL (Bottomright), 0);
+ glVertex3f (wx + ww, wy + DOBEVEL (Topright), 0);
+ glPopMatrix ();
glColor4f (0.95f, 0.95f, 0.95f, w->paint.opacity / OPAQUE);
+#if 0
/* Top left bevel */
if (tdGetBevelTopleft (s))
{
@@ -367,7 +379,7 @@ tdPaintWindowWithDepth (CompWindow *w,
glVertex3f (wx + ww, wy + bevel, 0);
glVertex3f (wx + ww, wy + bevel, wwidth);
}
-
+#endif
glEnd ();
glPopMatrix ();
@@ -376,14 +388,10 @@ tdPaintWindowWithDepth (CompWindow *w,
glEnable (GL_CULL_FACE);
glCullFace (GL_FRONT);
- matrixTranslate (&wTransform, 0.0f, 0.0f, wwidth);
-
- UNWRAP (tds, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, &wTransform, region,
+ UNWRAP (tds, s, paintWindow);
+ status = (*s->paintWindow) (w, attrib, &tdw->bTransform, region,
mask | PAINT_WINDOW_TRANSFORMED_MASK);
WRAP(tds, s, paintWindow, tdPaintWindow);
-
- matrixTranslate(&wTransform, 0.0f, 0.0f, -wwidth);
}
else
{
@@ -391,7 +399,7 @@ tdPaintWindowWithDepth (CompWindow *w,
glCullFace (GL_BACK);
UNWRAP(tds, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, &wTransform, region, mask);
+ status = (*s->paintWindow) (w, attrib, transform, region, mask);
WRAP (tds, s, paintWindow, tdPaintWindow);
}
}
@@ -511,11 +519,14 @@ tdPostPaintViewport (CompScreen *s,
CompWindow *firstFTB = NULL;
CompWindow *w;
CompWalker walk;
+ float wDepth;
float vPoints[3][3] = {{ -0.5, 0.0, (cs->invert * cs->distance)},
{ 0.0, 0.5, (cs->invert * cs->distance)},
{ 0.0, 0.0, (cs->invert * cs->distance)}};
+ wDepth = -(tdGetWidth (s)) / 30;
+
/* all non 3d windows first */
tds->first = NULL;
tds->last = NULL;
@@ -601,6 +612,11 @@ tdPostPaintViewport (CompScreen *s,
tds->currentScale = tds->basicScale +
(tdw->depth * ((1.0 - tds->basicScale) /
tds->maxDepth));
+
+ tds->currentScale += wDepth;
+ tdw->bTransform = sTransform;
+ (*s->applyScreenTransform) (s, sAttrib, output, &tdw->bTransform);
+ tds->currentScale -= wDepth;
(*s->applyScreenTransform) (s, sAttrib, output, &mTransform);
(*s->enableOutputClipping) (s, &mTransform, region, output);