static void tdPaintViewport (CompScreen *s, const ScreenPaintAttrib *sAttrib, const CompTransform *transform, Region region, CompOutput *output, unsigned int mask) { TD_SCREEN (s); CUBE_SCREEN (s); if (cs->paintOrder == BTF) { UNWRAP (tds, cs, paintViewport); (*cs->paintViewport) (s, sAttrib, transform, region, output, mask); WRAP (tds, cs, paintViewport, tdPaintViewport); } if (tds->active) { CompTransform mTransform; CompTransform screenSpace; CompTransform screenSpaceOffset; CompWindow *w; tdWindow *tdw; CompWalker walk; float wDepth = 0.0; float pointZ = cs->invert * cs->distance; int offX, offY; unsigned int newMask; CompVector vPoints[3] = { { .v = { -0.5, 0.0, pointZ, 1.0 } }, { .v = { 0.0, 0.5, pointZ, 1.0 } }, { .v = { 0.0, 0.0, pointZ, 1.0 } } };
static void tdPreparePaintScreen (CompScreen *s, int msSinceLastPaint) { CompWindow *w; Bool active; TD_SCREEN (s); CUBE_SCREEN (s); active = (cs->rotationState != RotationNone) && s->hsize > 2 && !(tdGetManualOnly(s) && (cs->rotationState != RotationManual)); if (active || tds->basicScale != 1.0) { float maxDiv = (float) tdGetMaxWindowSpace (s) / 100; float minScale = (float) tdGetMinCubeSize (s) / 100; float x, progress; (*cs->getRotation) (s, &x, &x, &progress); tds->maxDepth = 0; for (w = s->windows; w; w = w->next) { TD_WINDOW (w); tdw->is3D = FALSE; tdw->depth = 0; if (!windowIs3D (w)) continue; tdw->is3D = TRUE; tds->maxDepth++; tdw->depth = tds->maxDepth; } minScale = MAX (minScale, 1.0 - (tds->maxDepth * maxDiv)); tds->basicScale = 1.0 - ((1.0 - minScale) * progress); tds->damage = (progress != 0.0 && progress != 1.0); } else { tds->basicScale = 1.0; } /* comparing float values with != is error prone, so better cache the comparison and allow a small difference */ tds->active = (fabs (tds->basicScale - 1.0f) > 1e-4); tds->currentScale = tds->basicScale; UNWRAP (tds, s, preparePaintScreen); (*s->preparePaintScreen) (s, msSinceLastPaint); WRAP (tds, s, preparePaintScreen, tdPreparePaintScreen); cs->paintAllViewports |= tds->active; }
static void snowglobeClearTargetOutput (CompScreen *s, float xRotate, float vRotate) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); UNWRAP (as, cs, clearTargetOutput); (*cs->clearTargetOutput) (s, xRotate, vRotate); WRAP (as, cs, clearTargetOutput, snowglobeClearTargetOutput); glClear (GL_DEPTH_BUFFER_BIT); }
static void cubemodelClearTargetOutput (CompScreen *s, float xRotate, float vRotate) { CUBEMODEL_SCREEN (s); CUBE_SCREEN (s); UNWRAP (cms, cs, clearTargetOutput); (*cs->clearTargetOutput) (s, xRotate, vRotate); WRAP (cms, cs, clearTargetOutput, cubemodelClearTargetOutput); glClear (GL_DEPTH_BUFFER_BIT); }
void initializeWorldVariables(CompScreen *s) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); as->speedFactor = snowglobeGetSpeedFactor(s); as->hsize = s->hsize * cs->nOutput; as->arcAngle = 360.0f / as->hsize; as->radius = cs->distance/sinf(0.5*(PI-as->arcAngle*toRadians)); as->distance = cs->distance; }
static void cubemodelFiniScreen (CompPlugin *p, CompScreen *s) { CUBEMODEL_SCREEN (s); CUBE_SCREEN (s); freeCubemodel (s); UNWRAP (cms, s, donePaintScreen); UNWRAP (cms, s, preparePaintScreen); UNWRAP (cms, cs, clearTargetOutput); UNWRAP (cms, cs, paintInside); free (cms); }
static void snowglobeFiniScreen (CompPlugin *p, CompScreen *s) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); freeSnowglobe(s); UNWRAP (as, s, donePaintScreen); UNWRAP (as, s, preparePaintScreen); UNWRAP (as, cs, clearTargetOutput); UNWRAP (as, cs, paintInside); free(as); }
static Bool cubemodelInitScreen (CompPlugin *p, CompScreen *s) { static const float ambient[] = { 0.0, 0.0, 0.0, 0.0 }; static const float diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; static const float specular[] = { 0.6, 0.6, 0.6, 1.0 }; CubemodelScreen *cms; CUBEMODEL_DISPLAY (s->display); CUBE_SCREEN (s); cms = malloc (sizeof (CubemodelScreen)); if (!cms) return FALSE; s->base.privates[cmd->screenPrivateIndex].ptr = cms; cms->damage = FALSE; glLightfv (GL_LIGHT1, GL_AMBIENT, ambient); glLightfv (GL_LIGHT1, GL_DIFFUSE, diffuse); glLightfv (GL_LIGHT1, GL_SPECULAR, specular); initCubemodel (s); cubemodelSetModelFilenameNotify (s, cubemodelLoadingOptionChange); cubemodelSetModelAnimationNotify (s, cubemodelLoadingOptionChange); cubemodelSetModelScaleFactorNotify (s, cubemodelModelOptionChange); cubemodelSetModelXOffsetNotify (s, cubemodelModelOptionChange); cubemodelSetModelYOffsetNotify (s, cubemodelModelOptionChange); cubemodelSetModelZOffsetNotify (s, cubemodelModelOptionChange); cubemodelSetModelRotationPlaneNotify (s, cubemodelModelOptionChange); cubemodelSetModelRotationRateNotify (s, cubemodelModelOptionChange); cubemodelSetModelFpsNotify (s, cubemodelModelOptionChange); cubemodelSetRescaleWidthNotify (s, cubemodelModelOptionChange); WRAP (cms, s, donePaintScreen, cubemodelDonePaintScreen); WRAP (cms, s, preparePaintScreen, cubemodelPreparePaintScreen); WRAP (cms, cs, clearTargetOutput, cubemodelClearTargetOutput); WRAP (cms, cs, paintInside, cubemodelPaintInside); return TRUE; }
void updateGround (CompScreen *s, float time) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); int sDiv = snowglobeGetGridQuality (s); int size = s->hsize * cs->nOutput; Bool update = FALSE; if (!as->ground) { as->ground = genWater (size, sDiv, cs->distance, -0.5); update = TRUE; } if (!as->ground) return; if (as->ground->size != size || as->ground->sDiv != sDiv || as->ground->distance != cs->distance) { freeWater (as->ground); as->ground = genWater (size, sDiv, cs->distance, -0.5); update = TRUE; if (!as->ground) return; } if (!update) return; as->ground->wave1 = (float)(rand() & 15) / 15.0; as->ground->wave2 = (float)(rand() & 15) / 15.0; as->ground->bh = -0.45; as->ground->wa = 0.1; as->ground->swa = 0.02; as->ground->wf = 2.0; as->ground->swf = 10.0; updateHeight (as->ground); }
static void initWorldVariables (CompScreen *s) { CUBEMODEL_SCREEN (s); CUBE_SCREEN (s); cms->hsize = s->hsize * cs->nOutput; cms->arcAngle = 360.0f / cms->hsize; cms->radius = cs->distance / cosf (0.5 * (cms->arcAngle * toRadians)); cms->topDistance = cs->distance; if (cubemodelGetRescaleWidth (s)) cms->ratio = (float) s->width / (float) s->height; else cms->ratio = 1; cms->sideDistance = cms->topDistance * cms->ratio; }
static Bool snowglobeInitScreen (CompPlugin *p, CompScreen *s) { static const float ambient[] = { 0.3, 0.3, 0.3, 1.0 }; static const float diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; static const float position[] = { 0.0, 1.0, 0.0, 0.0 }; SnowglobeScreen *as; SNOWGLOBE_DISPLAY (s->display); CUBE_SCREEN (s); as = malloc(sizeof(SnowglobeScreen)); if (!as) return FALSE; s->base.privates[ad->screenPrivateIndex].ptr = as; as->damage = FALSE; glLightfv(GL_LIGHT1, GL_AMBIENT, ambient); glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT1, GL_POSITION, position); initSnowglobe(s); snowglobeSetSpeedFactorNotify(s, snowglobeSpeedFactorOptionChange); snowglobeSetNumSnowflakesNotify(s, snowglobeScreenOptionChange); snowglobeSetSnowflakeSizeNotify(s, snowglobeScreenOptionChange); WRAP (as, s, donePaintScreen, snowglobeDonePaintScreen); WRAP (as, s, preparePaintScreen, snowglobePreparePaintScreen); WRAP (as, cs, clearTargetOutput, snowglobeClearTargetOutput); WRAP (as, cs, paintInside, snowglobePaintInside); return TRUE; }
void updateWater (CompScreen *s, float time) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); int sDiv = 0; int size = s->hsize * cs->nOutput; if (!as->water) as->water = genWater (size, sDiv, cs->distance, -0.5); if (!as->water) return; if (as->water->size != size || as->water->sDiv != sDiv || as->water->distance != cs->distance) { freeWater (as->water); as->water = genWater (size, sDiv, cs->distance, -0.5); if (!as->water) return; } as->water->wave1 += 0; as->water->wave2 += 0; as->water->wave1 = 0; as->water->wave2 = 0; as->water->bh = 0.5; as->water->wa = 0.0; as->water->swa = 0.0; as->water->wf = 0.0; as->water->swf = 0.0; }
static Bool tdPaintWindowWithDepth (CompWindow *w, const WindowPaintAttrib *attrib, const CompTransform *transform, Region region, unsigned int mask) { Bool wasCulled; Bool status; int wx, wy, ww, wh; int bevel, cull, cullInv, temp; CompScreen *s = w->screen; CompVector point, tPoint; unsigned short *c; TD_SCREEN (s); TD_WINDOW (w); CUBE_SCREEN (s); wasCulled = glIsEnabled (GL_CULL_FACE); wx = w->attrib.x - w->input.left; wy = w->attrib.y - w->input.top; ww = w->width + w->input.left + w->input.right; wh = w->height + w->input.top + w->input.bottom; bevel = tdGetBevel (s); glGetIntegerv (GL_CULL_FACE_MODE, &cull); cullInv = (cull == GL_BACK)? GL_FRONT : GL_BACK; if (ww && wh && !(mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) && ((cs->paintOrder == FTB && tdw->ftb) || (cs->paintOrder == BTF && !tdw->ftb))) { /* Paint window depth. */ glPushMatrix (); glLoadIdentity (); if (cs->paintOrder == BTF) glCullFace (cullInv); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (w->id == s->display->activeWindow) c = tdGetWidthColor (s); else c = tdGetWidthColorInactive (s); temp = c[3] * w->paint.opacity; temp /= 0xffff; glColor4us (c[0], c[1], c[2], temp); point.z = 0.0f; point.w = 1.0f; glBegin (GL_QUADS); /* Top */ ADDQUAD (wx + ww - DOBEVEL (Topleft), wy + 0.01, wx + DOBEVEL (Topright), wy + 0.01); /* Bottom */ ADDQUAD (wx + DOBEVEL (Bottomleft), wy + wh - 0.01, wx + ww - DOBEVEL (Bottomright), wy + wh - 0.01); /* Left */ ADDQUAD (wx + 0.01, wy + DOBEVEL (Topleft), wx + 0.01, wy + wh - DOBEVEL (Bottomleft)); /* Right */ ADDQUAD (wx + ww - 0.01, wy + wh - DOBEVEL (Topright), wx + ww - 0.01, wy + DOBEVEL (Bottomright)); /* Top left bevel */ if (tdGetBevelTopleft (s)) { ADDBEVELQUAD (wx + bevel / 2.0f, wy + bevel - bevel / 1.2f, wx, wy + bevel, &tds->bTransform, transform); ADDBEVELQUAD (wx + bevel / 2.0f, wy + bevel - bevel / 1.2f, wx + bevel, wy, transform, &tds->bTransform); } /* Bottom left bevel */ if (tdGetBevelBottomleft (s)) { ADDBEVELQUAD (wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx, wy + wh - bevel, transform, &tds->bTransform); ADDBEVELQUAD (wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx + bevel, wy + wh, &tds->bTransform, transform); } /* Bottom right bevel */ if (tdGetBevelBottomright (s)) { ADDBEVELQUAD (wx + ww - bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx + ww - bevel, wy + wh, transform, &tds->bTransform); ADDBEVELQUAD (wx + ww - bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx + ww, wy + wh - bevel, &tds->bTransform, transform); } /* Top right bevel */ if (tdGetBevelTopright (s)) { ADDBEVELQUAD (wx + ww - bevel, wy, wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f, transform, &tds->bTransform); ADDBEVELQUAD (wx + ww, wy + bevel, wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f, &tds->bTransform, transform); } glEnd (); glColor4usv (defaultColor); glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glPopMatrix (); if (cs->paintOrder == BTF) glCullFace (cull); } UNWRAP(tds, s, paintWindow); if (cs->paintOrder == BTF) status = (*s->paintWindow) (w, attrib, transform, region, mask); else status = (*s->paintWindow) (w, attrib, &tds->bTransform, region, mask | PAINT_WINDOW_TRANSFORMED_MASK); WRAP (tds, s, paintWindow, tdPaintWindow); return status; }
static void cubemodelPaintInside (CompScreen *s, const ScreenPaintAttrib *sAttrib, const CompTransform *transform, CompOutput *output, int size) { int i; static const float matShininess[] = { 60.0 }; static const float matSpecular[] = { 0.6, 0.6, 0.6, 1.0 }; static const float matDiffuse[] = { 1.0, 1.0, 1.0, 1.0 }; static const float matAmbient[] = { 0.8, 0.8, 0.9, 1.0 }; static const float lmodelLocalviewer[] = { 0.0 }; static float lmodelTwoside[] = { 0.0 }; static float lmodelAmbient[] = { 0.4, 0.4, 0.4, 0.4 }; static float lmodelDiffuse[] = { 1.0, 1.0, 1.0, 1.0 }; static float lmodelSpecular[]= { 0.6, 0.6, 0.6, 0.6 }; ScreenPaintAttrib sA = *sAttrib; CompTransform mT = *transform; Bool enabledCull; int cull; float scale, outputRatio = 1.0f; CUBEMODEL_SCREEN (s); CUBE_SCREEN (s); if (cms->hsize != s->hsize * cs->nOutput) { initWorldVariables (s); updateModel (s, 0, cms->numModels); } sA.yRotate += cs->invert * (360.0f / size) * (cs->xRotations - (s->x* cs->nOutput)); (*s->applyScreenTransform) (s, &sA, output, &mT); glPushMatrix (); if (cubemodelGetRotateLighting (s)) setLightPosition (s, GL_LIGHT1); glLoadMatrixf (mT.m); if (!cubemodelGetRotateLighting (s)) setLightPosition (s, GL_LIGHT1); glTranslatef (cs->outputXOffset, -cs->outputYOffset, 0.0f); glScalef (cs->outputXScale, cs->outputYScale, 1.0f); glPushAttrib (GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT | GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT); glEnable (GL_BLEND); glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); lmodelAmbient[0] = cubemodelGetLightAmbient (s); lmodelDiffuse[0] = cubemodelGetLightDiffuse (s); lmodelSpecular[0] = cubemodelGetLightSpecular (s); for (i = 1; i < 4; i++) { lmodelAmbient[i] = lmodelAmbient[0]; lmodelDiffuse[i] = lmodelDiffuse[0]; lmodelSpecular[i] = lmodelSpecular[0]; } lmodelTwoside[0] = (cubemodelGetRenderFrontAndBack (s) ? 1.0f : 0.0f); glLightModelfv (GL_LIGHT_MODEL_LOCAL_VIEWER, lmodelLocalviewer); glLightModelfv (GL_LIGHT_MODEL_TWO_SIDE, lmodelTwoside); glLightModelfv (GL_LIGHT_MODEL_AMBIENT, lmodelAmbient); glLightfv (GL_LIGHT1, GL_DIFFUSE, lmodelDiffuse); glLightfv (GL_LIGHT1, GL_SPECULAR, lmodelSpecular); enabledCull = glIsEnabled (GL_CULL_FACE); glGetIntegerv (GL_CULL_FACE_MODE, &cull); glEnable (GL_CULL_FACE); glCullFace (~cull & (GL_FRONT | GL_BACK)); glCullFace (cull); glPushMatrix (); glColor4usv (defaultColor); glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS, matShininess); glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, matSpecular); glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, matDiffuse); glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, matAmbient); glEnable (GL_NORMALIZE); glEnable (GL_DEPTH_TEST); glEnable (GL_COLOR_MATERIAL); glEnable (GL_LIGHTING); glEnable (GL_LIGHT1); glDisable (GL_LIGHT0); glDepthFunc (GL_LEQUAL); /* for transparency maps */ glShadeModel(GL_SMOOTH); glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); scale = cs->distance; if (cubemodelGetRescaleWidth (s)) { if (cs->moMode == CUBE_MOMODE_AUTO && cs->nOutput < s->nOutputDev) outputRatio = (float) s->width / (float) s->height; else outputRatio = (float) output->width / (float) output->height; } glScalef (scale / outputRatio, scale, scale / outputRatio); glPushMatrix (); glColor4f (1.0, 1.0, 1.0, 1.0); for (i = 0; i < cms->numModels; i++) { glPushMatrix (); cubemodelDrawModelObject (s, cms->models[i], cubemodelGetGlobalModelScaleFactor (s)); glPopMatrix (); } glPopMatrix (); glPopMatrix (); glDisable (GL_LIGHT1); glDisable (GL_NORMALIZE); if (!s->lighting) glDisable (GL_LIGHTING); glDisable (GL_DEPTH_TEST); if (enabledCull) glDisable (GL_CULL_FACE); glPopMatrix (); glPopAttrib (); cms->damage = TRUE; UNWRAP (cms, cs, paintInside); (*cs->paintInside) (s, sAttrib, transform, output, size); WRAP (cms, cs, paintInside, cubemodelPaintInside); }
static void snowglobePaintInside (CompScreen *s, const ScreenPaintAttrib *sAttrib, const CompTransform *transform, CompOutput *output, int size) { SNOWGLOBE_SCREEN (s); CUBE_SCREEN (s); int i; as->waterHeight = 50000; if (as->hsize!=s->hsize) updateSnowglobe (s); static const float mat_shininess[] = { 60.0 }; static const float mat_specular[] = { 0.8, 0.8, 0.8, 1.0 }; static const float mat_diffuse[] = { 0.46, 0.66, 0.795, 1.0 }; static const float mat_ambient[] = { 0.1, 0.1, 0.3, 1.0 }; static const float lmodel_ambient[] = { 1.0, 1.0, 1.0, 1.0 }; static const float lmodel_localviewer[] = { 0.0 }; ScreenPaintAttrib sA = *sAttrib; CompTransform mT = *transform; if (snowglobeGetShowWater(s)) updateHeight(as->water); sA.yRotate += cs->invert * (360.0f / size) * (cs->xRotations - (s->x* cs->nOutput)); (*s->applyScreenTransform)(s, &sA, output, &mT); glPushMatrix(); glLoadMatrixf(mT.m); glTranslatef(cs->outputXOffset, -cs->outputYOffset, 0.0f); glScalef(cs->outputXScale, cs->outputYScale, 1.0f); Bool enabledCull = FALSE; glPushAttrib(GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT | GL_LIGHTING_BIT); glEnable(GL_BLEND); if (glIsEnabled(GL_CULL_FACE)) { enabledCull = TRUE; } int cull; glGetIntegerv(GL_CULL_FACE_MODE, &cull); glEnable(GL_CULL_FACE); glCullFace(~cull & (GL_FRONT | GL_BACK)); if (snowglobeGetShowWater(s)) { glColor4usv(snowglobeGetWaterColor(s)); drawWater(as->water, TRUE, FALSE); } glCullFace(cull); if (snowglobeGetShowGround(s)) { glColor4f(0.8, 0.8, 0.8, 1.0); drawGround(NULL, as->ground); } glPushMatrix(); glColor4usv(defaultColor); glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_localviewer); glEnable(GL_NORMALIZE); glEnable(GL_LIGHTING); glEnable(GL_LIGHT1); glEnable(GL_LIGHT0); glEnable(GL_COLOR_MATERIAL); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); for (i = 0; i < as->numSnowflakes; i++) { glPushMatrix(); SnowflakeTransform(&(as->snow[i])); float scale = 0.01*as->snow[i].size; glScalef(scale, scale, scale); initDrawSnowflake(); glCallList(as->snowflakeDisplayList); finDrawSnowflake(); glPopMatrix(); } if (snowglobeGetShowSnowman(s)) { glPushMatrix(); float bottom = -0.5; if (snowglobeGetShowGround(s)) bottom = getHeight(as->ground, 0, 0); glTranslatef(0, bottom, 0); float scale = 0.4*snowglobeGetSnowmanSize(s)*(0.5-bottom); glScalef(scale, scale, scale); glColor4f(1.0, 1.0, 1.0, 1.0); DrawSnowman(0); glPopMatrix(); } glPopMatrix(); if (snowglobeGetShowWater(s)) { glEnable(GL_CULL_FACE); glColor4usv(snowglobeGetWaterColor(s)); drawWater(as->water, snowglobeGetShowWater(s), 0); } if (snowglobeGetShowGround(s)) { glColor4f(0.8, 0.8, 0.8, 1.0); drawBottomGround(s->hsize * cs->nOutput, cs->distance, -0.4999); } glDisable(GL_LIGHT1); glDisable(GL_NORMALIZE); if (!s->lighting) glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); if (enabledCull) glDisable(GL_CULL_FACE); glPopMatrix(); glPopAttrib(); as->damage = TRUE; UNWRAP (as, cs, paintInside); (*cs->paintInside)(s, sAttrib, transform, output, size); WRAP (as, cs, paintInside, snowglobePaintInside); }
static Bool tdPaintWindowWithDepth (CompWindow *w, const WindowPaintAttrib *attrib, const CompTransform *transform, Region region, unsigned int mask) { //Bool wasCulled; Bool status; int wx, wy, ww, wh; int bevel, cull, cullInv, temp; CompScreen *s = w->screen; CompVector point, tPoint; unsigned short c[4]; TD_SCREEN (s); TD_WINDOW (w); CUBE_SCREEN (s); //wasCulled = glIsEnabled (GL_CULL_FACE); wx = w->attrib.x - w->input.left; wy = w->attrib.y - w->input.top; ww = w->width + w->input.left + w->input.right; wh = w->height + w->input.top + w->input.bottom; const BananaValue * option_bevel = bananaGetOption (bananaIndex, "bevel", s->screenNum); bevel = option_bevel->i; glGetIntegerv (GL_CULL_FACE_MODE, &cull); cullInv = (cull == GL_BACK)? GL_FRONT : GL_BACK; if (ww && wh && !(mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) && ((cs->paintOrder == FTB && tdw->ftb) || (cs->paintOrder == BTF && !tdw->ftb))) { /* Paint window depth. */ glPushMatrix (); glLoadIdentity (); if (cs->paintOrder == BTF) glCullFace (cullInv); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (w->id == display.activeWindow) { const BananaValue * option_width_color = bananaGetOption (bananaIndex, "width_color", s->screenNum); stringToColor (option_width_color->s, c); } else { const BananaValue * option_width_color_inactive = bananaGetOption (bananaIndex, "width_color_inactive", s->screenNum); stringToColor (option_width_color_inactive->s, c); } temp = c[3] * w->paint.opacity; temp /= 0xffff; glColor4us (c[0], c[1], c[2], temp); point.z = 0.0f; point.w = 1.0f; glBegin (GL_QUADS); /* Top */ ADDQUAD (wx + ww - dobevel ("bevel_topleft", bevel), wy + 0.01, wx + dobevel ("bevel_topright", bevel), wy + 0.01); /* Bottom */ ADDQUAD ( wx + dobevel ("bevel_bottomleft", bevel), wy + wh - 0.01, wx + ww - dobevel ("bevel_bottomright", bevel), wy + wh - 0.01); /* Left */ ADDQUAD (wx + 0.01, wy + dobevel ("bevel_topleft", bevel), wx + 0.01, wy + wh - dobevel ("bevel_bottomleft", bevel)); /* Right */ ADDQUAD (wx + ww - 0.01, wy + wh - dobevel ("bevel_topright", bevel), wx + ww - 0.01, wy + dobevel ("bevel_bottomright", bevel)); const BananaValue * option_bevel_topleft = bananaGetOption (bananaIndex, "bevel_topleft", s->screenNum); /* Top left bevel */ if (option_bevel_topleft->b) { ADDBEVELQUAD (wx + bevel / 2.0f, wy + bevel - bevel / 1.2f, wx, wy + bevel, &tds->bTransform, transform); ADDBEVELQUAD (wx + bevel / 2.0f, wy + bevel - bevel / 1.2f, wx + bevel, wy, transform, &tds->bTransform); } const BananaValue * option_bevel_bottomleft = bananaGetOption (bananaIndex, "bevel_bottomleft", s->screenNum); /* Bottom left bevel */ if (option_bevel_bottomleft->b) { ADDBEVELQUAD (wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx, wy + wh - bevel, transform, &tds->bTransform); ADDBEVELQUAD (wx + bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx + bevel, wy + wh, &tds->bTransform, transform); } const BananaValue * option_bevel_bottomright = bananaGetOption (bananaIndex, "bevel_bottomright", s->screenNum); /* Bottom right bevel */ if (option_bevel_bottomright->b) { ADDBEVELQUAD (wx + ww - bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx + ww - bevel, wy + wh, transform, &tds->bTransform); ADDBEVELQUAD (wx + ww - bevel / 2.0f, wy + wh - bevel + bevel / 1.2f, wx + ww, wy + wh - bevel, &tds->bTransform, transform); } const BananaValue * option_bevel_topright = bananaGetOption (bananaIndex, "bevel_topright", s->screenNum); /* Top right bevel */ if (option_bevel_topright->b) { ADDBEVELQUAD (wx + ww - bevel, wy, wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f, transform, &tds->bTransform); ADDBEVELQUAD (wx + ww, wy + bevel, wx + ww - bevel / 2.0f, wy + bevel - bevel / 1.2f, &tds->bTransform, transform); } glEnd (); glColor4usv (defaultColor); glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glPopMatrix (); if (cs->paintOrder == BTF) glCullFace (cull); } UNWRAP(tds, s, paintWindow); if (cs->paintOrder == BTF) status = (*s->paintWindow) (w, attrib, transform, region, mask); else status = (*s->paintWindow) (w, attrib, &tds->bTransform, region, mask | PAINT_WINDOW_TRANSFORMED_MASK); WRAP (tds, s, paintWindow, tdPaintWindow); return status; }