diff options
author | Dennis Kasprzyk <onestone@opencompositing.org> | 2007-06-26 19:53:40 +0200 |
---|---|---|
committer | Dennis Kasprzyk <onestone@opencompositing.org> | 2007-06-26 19:53:40 +0200 |
commit | 32d46ad39e347ec07d7ce664a21e561cf381c006 (patch) | |
tree | f43f68d258d36a4eb5de147dd0f3e67252b0e072 /plugins/cube.c | |
parent | 6d92eff1efd83a1bb6168e3d8001b60d6d52bac7 (diff) |
Fixed orientation calculation for "inside cube" mode.
Diffstat (limited to 'plugins/cube.c')
-rw-r--r-- | plugins/cube.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/plugins/cube.c b/plugins/cube.c index 1ca4ef75..63a428ee 100644 --- a/plugins/cube.c +++ b/plugins/cube.c @@ -932,6 +932,7 @@ cubeCheckOrientation (CompScreen *s, float pntA[4], pntB[4], pntC[4]; float vecA[3], vecB[3]; float ortho[3]; + Bool rv = FALSE; CUBE_SCREEN (s); @@ -957,9 +958,17 @@ cubeCheckOrientation (CompScreen *s, pntC[3] = 1.0f; MULTMV (mvp, pntA); + + if (pntA[3] < 0.0f) + rv = !rv; + DIVV (pntA); MULTMV (mvp, pntB); + + if (pntB[3] < 0.0f) + rv = !rv; + DIVV (pntB); MULTMV (mvp, pntC); @@ -979,12 +988,9 @@ cubeCheckOrientation (CompScreen *s, if (ortho[2] > 0.0f) - { - /* The viewport is reversed, should be painted front to back. */ - return TRUE; - } + rv = !rv; - return FALSE; + return rv; } static void @@ -1001,17 +1007,11 @@ cubeMoveViewportAndPaint (CompScreen *s, CUBE_SCREEN (s); - float vPoints[3][3] = { { -0.5, 0.0, cs->distance}, - { 0.0, 0.5, cs->distance}, - { 0.0, 0.0, cs->distance}}; - - /* Special handling for inside cube mode. Orientation calculation - doesn't work right because some points are transformed outside - the visible range. */ - if (cs->invert == 1) - ftb = cs->checkOrientation (s, sAttrib, transform, outputPtr, vPoints); - else - ftb = FALSE; + 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}}; + + ftb = cs->checkOrientation (s, sAttrib, transform, outputPtr, vPoints); if ((paintOrder == FTB && !ftb) || (paintOrder == BTF && ftb)) |