summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@opencompositing.org>2008-04-10 00:39:14 +0200
committerDennis Kasprzyk <onestone@opencompositing.org>2008-04-10 00:39:14 +0200
commitbef97587cfb13d00d2666b5633341f26cdacbb48 (patch)
tree68915a8c9738c3ee50212eabe1d33c04b915f600
parent6446339621792f4fb6b4b8e42c56c4a02f318497 (diff)
download3d-bef97587cfb13d00d2666b5633341f26cdacbb48.tar.gz
3d-bef97587cfb13d00d2666b5633341f26cdacbb48.tar.bz2
Only calculate second matrices, if window depth is active.
-rw-r--r--3d.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/3d.c b/3d.c
index b8b2138..1227cab 100644
--- a/3d.c
+++ b/3d.c
@@ -436,7 +436,7 @@ tdPostPaintViewport (CompScreen *s,
CompTransform screenSpaceOffset;
CompWindow *w;
CompWalker walk;
- float wDepth;
+ float wDepth = 0.0;
float pointZ = cs->invert * cs->distance;
Bool foundFtb;
@@ -444,8 +444,9 @@ tdPostPaintViewport (CompScreen *s,
{ .v = { 0.0, 0.5, pointZ, 1.0 } },
{ .v = { 0.0, 0.0, pointZ, 1.0 } } };
- wDepth = -MIN((tdGetWidth (s)) / 30, (1.0 - tds->basicScale) /
- tds->maxDepth);
+ if (tds->withDepth)
+ wDepth = -MIN((tdGetWidth (s)) / 30, (1.0 - tds->basicScale) /
+ tds->maxDepth);
/* all BTF windows in normal order */
for (w = s->windows; w; w = w->next)
@@ -507,11 +508,14 @@ tdPostPaintViewport (CompScreen *s,
(tdw->depth * ((1.0 - tds->basicScale) /
tds->maxDepth));
- tds->currentScale += wDepth;
- tds->bTransform = sTransform;
- (*s->applyScreenTransform) (s, sAttrib, output,
- &tds->bTransform);
- tds->currentScale -= wDepth;
+ if (wDepth != 0.0)
+ {
+ tds->currentScale += wDepth;
+ tds->bTransform = sTransform;
+ (*s->applyScreenTransform) (s, sAttrib, output,
+ &tds->bTransform);
+ tds->currentScale -= wDepth;
+ }
(*s->applyScreenTransform) (s, sAttrib, output, &mTransform);
(*s->enableOutputClipping) (s, &mTransform, region, output);
@@ -525,8 +529,9 @@ tdPostPaintViewport (CompScreen *s,
screenSpaceOffset = screenSpace;
matrixTranslate (&screenSpaceOffset, offX, offY, 0);
- matrixMultiply (&tds->bTransform, &tds->bTransform,
- &screenSpaceOffset);
+ if (wDepth != 0.0)
+ matrixMultiply (&tds->bTransform, &tds->bTransform,
+ &screenSpaceOffset);
matrixMultiply (&mTransform, &mTransform,
&screenSpaceOffset);
@@ -534,8 +539,9 @@ tdPostPaintViewport (CompScreen *s,
}
else
{
- matrixMultiply (&tds->bTransform, &tds->bTransform,
- &screenSpace);
+ if (wDepth != 0.0)
+ matrixMultiply (&tds->bTransform, &tds->bTransform,
+ &screenSpace);
matrixMultiply (&mTransform, &mTransform, &screenSpace);
}