diff --git a/3d.c b/3d.c index 9c339b4..28a1656 100644 --- a/3d.c +++ b/3d.c @@ -81,6 +81,7 @@ typedef struct _tdScreen PaintOutputProc paintOutput; DonePaintScreenProc donePaintScreen; InitWindowWalkerProc initWindowWalker; + ApplyScreenTransformProc applyScreenTransform; CubePaintTopProc paintTop; CubePaintBottomProc paintBottom; @@ -107,6 +108,8 @@ typedef struct _tdScreen CompWindow *first; CompWindow *last; + + Bool test; } tdScreen; #define GET_TD_DISPLAY(d) \ @@ -293,7 +296,7 @@ tdPaintWindow(CompWindow * w, TD_SCREEN(w->screen); TD_WINDOW(w); - +#if 0 if (tdw->currentZ != 0.0f) { Bool wasCulled; @@ -556,6 +559,11 @@ tdPaintWindow(CompWindow * w, WRAP(tds, w->screen, paintWindow, tdPaintWindow); } else +#endif + + if (tdw->currentZ != 0.0f && !tds->test) + mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK; + { UNWRAP(tds, w->screen, paintWindow); status = (*w->screen->paintWindow) (w, attrib, transform, region, mask); @@ -565,6 +573,28 @@ tdPaintWindow(CompWindow * w, return status; } + +static void +tdApplyScreenTransform (CompScreen *s, + const ScreenPaintAttrib *sAttrib, + CompOutput *output, + CompTransform *transform) +{ + TD_SCREEN (s); + + UNWRAP (tds, s, applyScreenTransform); + (*s->applyScreenTransform) (s, sAttrib, output, transform); + WRAP (tds, s, applyScreenTransform, tdApplyScreenTransform); + + /* + if (!tds->test) + { + matrixScale(transform, 0.5, 0.5, 0.5); + } + */ + +} + static void tdAddWindow(CompScreen *s, CompWindow *w) { TD_SCREEN(s); @@ -590,7 +620,7 @@ tdPaintTransformedOutput(CompScreen * s, { TD_SCREEN(s); CUBE_SCREEN(s); - +#if 0 CompWindow* w; CompWindow* firstFTB = NULL; @@ -652,10 +682,76 @@ tdPaintTransformedOutput(CompScreen * s, } } } - +#endif + UNWRAP(tds, s, paintTransformedOutput); (*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask); WRAP(tds, s, paintTransformedOutput, tdPaintTransformedOutput); + tds->test = TRUE; + + { + CompTransform sTransform = *transform; + screenLighting (s, TRUE); + + (*s->applyScreenTransform) (s, sAttrib, output, &sTransform); + + + + + + CompWindow *w; + CompWalker walk; + + + + + (*s->initWindowWalker) (s, &walk); + + + /* paint all windows from bottom to top */ + for (w = (*walk.first) (s); w; w = (*walk.next) (w)) + { + CompTransform mTransform = sTransform; + + TD_WINDOW (w); + if (w->destroyed) + continue; + + if (!w->shaded) + { + if (w->attrib.map_state != IsViewable || !w->damaged) + continue; + } + if (tdw->currentZ != 0.0f) + { + matrixScale(&mTransform,1.0 + tdw->currentZ,1.0 + tdw->currentZ,1.0 + tdw->currentZ); + s->enableOutputClipping (s, &mTransform, region, output); + + transformToScreenSpace (s, output, -sAttrib->zTranslate, + &mTransform); + + glPushMatrix (); + glLoadMatrixf (mTransform.m); + + + (*s->paintWindow) (w, &w->paint, &mTransform, w->clip, PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK); + glPopMatrix (); + s->disableOutputClipping (s); + } + } + + + + + + + + } +tds->test = FALSE; + /* + UNWRAP(tds, s, paintTransformedOutput); + (*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask); + WRAP(tds, s, paintTransformedOutput, tdPaintTransformedOutput);*/ } static Bool @@ -806,7 +902,7 @@ tdInitWindowWalker (CompScreen *s, CompWalker* walker) UNWRAP (tds, s, initWindowWalker); (*s->initWindowWalker) (s, walker); WRAP (tds, s, initWindowWalker, tdInitWindowWalker); - +/* if ((tds->active || tds->tdWindowExists) && cs->paintOrder == BTF) { @@ -815,6 +911,7 @@ tdInitWindowWalker (CompScreen *s, CompWalker* walker) walker->next = tdWalkNext; walker->prev = tdWalkPrev; } +*/ } @@ -864,6 +961,8 @@ static Bool tdInitPluginForDisplay (CompPlugin *p, CompDisplay *d) WRAP(tds, s, donePaintScreen, tdDonePaintScreen); WRAP(tds, s, preparePaintScreen, tdPreparePaintScreen); WRAP(tds, s, initWindowWalker, tdInitWindowWalker); + + WRAP (tds, s, applyScreenTransform, tdApplyScreenTransform); } } } @@ -895,6 +994,9 @@ static void tdFiniPluginForDisplay (CompPlugin *p, CompDisplay *d) UNWRAP(tds, s, donePaintScreen); UNWRAP(tds, s, preparePaintScreen); UNWRAP(tds, s, initWindowWalker); + + UNWRAP (tds, s, applyScreenTransform); + } cubeDisplayPrivateIndex = -1;