[beryl-commits] r1485 - branches/beryl-3d-plugin
roico at server.beryl-project.org
roico at server.beryl-project.org
Sat Dec 2 00:22:52 CET 2006
Author: roico
Date: 2006-12-02 00:22:52 +0100 (Sat, 02 Dec 2006)
New Revision: 1485
Modified:
branches/beryl-3d-plugin/3d.c
Log:
initial work on fixing 3d with inside cube.
Modified: branches/beryl-3d-plugin/3d.c
===================================================================
--- branches/beryl-3d-plugin/3d.c 2006-12-01 16:32:53 UTC (rev 1484)
+++ branches/beryl-3d-plugin/3d.c 2006-12-01 23:22:52 UTC (rev 1485)
@@ -56,16 +56,20 @@
#define TD_DISABLE_BACKFACE_CULLING_DEFAULT TRUE
+#define TD_DISABLE_CAPS_IN_INSIDE_CUBE_DEFAULT TRUE
+
#define TD_SCREEN_OPTION_SPACE 0
#define TD_SCREEN_OPTION_SPEED 1
#define TD_SCREEN_OPTION_CREATE_MIPMAPS 2
#define TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING 3
-#define TD_SCREEN_OPTION_NUM 4
+#define TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE 4
+#define TD_SCREEN_OPTION_NUM 5
#define SPEED (tds->opt[TD_SCREEN_OPTION_SPEED].value.f)
#define SPACE (tds->opt[TD_SCREEN_OPTION_SPACE].value.f)
#define CREATE_MIPMAPS (tds->opt[TD_SCREEN_OPTION_CREATE_MIPMAPS].value.b)
#define DISABLE_BACKFACE_CULLING (tds->opt[TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING].value.b)
+#define DISABLE_CAPS (tds->opt[TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE].value.b)
static int displayPrivateIndex;
@@ -115,13 +119,17 @@
PaintWindowProc paintWindow;
RevertReorder* revertReorder;
-
+
+ float maxZ;
+
int currentViewportNum;
float xMove;
int mmModeAtom;
MultiMonitorMode currentMmMode;
+ int insideAtom;
+
Bool currentDifferentResolutions;
int currentScreenNum;
@@ -239,7 +247,7 @@
#define LEFT_VIEWPORT(w) VIEWPORT( (w)->attrib.x + 1, (w)->screen)
#define RIGHT_SCREEN(w) SCREEN( (w)->attrib.x + (w)->attrib.width -1, (w)->screen)
-#define LEFT_SCREEN(w) SCREEN((w)->attrib.x + 1, (w)->screen)
+#define LEFT_SCREEN(w) SCREEN( (w)->attrib.x + 1, (w)->screen)
#define IS_IN_VIEWPORT(w, i) ( ( LEFT_VIEWPORT(w) > RIGHT_VIEWPORT(w) && !(LEFT_VIEWPORT(w) > i && i > RIGHT_VIEWPORT(w)) ) \
|| ( LEFT_VIEWPORT(w) <= i && i <= RIGHT_VIEWPORT(w) ) )
@@ -370,7 +378,7 @@
tds->currentViewportNum = screen->hsize;
tds->currentMmMode = IPCS_GetInt (IPCS_OBJECT(screen), tds->mmModeAtom);
tds->currentScreenNum = screen->nOutputDev;
- tds->currentDifferentResolutions = differentResolutions(screen);
+ tds->currentDifferentResolutions = differentResolutions(screen);
if( MULTISCREENCUBE_MODE )
@@ -409,7 +417,9 @@
for(i=0; i<screen->hsize; i++)
lastInViewport[i] = NULL;
-
+
+ tds->maxZoom = 0.0f;
+
for(w = screen->windows; w; w = w->next)
{
if(!windowIs3D(w))
@@ -430,7 +440,13 @@
}
tdw->z = maxZoom + SPACE;
+
+ if(tdw->z > tds->maxZ)
+ tds->maxZ = tdw->z;
}
+
+ if( tds->maxZ > 0.0f && IPCS_GetBool (IPCS_OBJECT(screen), tds->insideAtom) && DISABLE_CAPS)
+ compDisplaySetRequestFlagForPlugin (screen->display, "3d", "NO_CUBE_CAPS");
reorder(screen);
@@ -612,8 +628,8 @@
If FTB is already in mask, then the viewport is reversed, and all windows should be reversed.
If BTF is in mask, the viewport isn't reversed, but some of the windows there might be, so we set FTB in addition to BTF, and check for each window what mode it should use...*/
- if(mask & PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK)
- {
+ if((mask & PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK) && !IPCS_GetBool (IPCS_OBJECT(s), tds->insideAtom))
+ {
tds->reorderWindowPainting = TRUE;
mask |= PAINT_SCREEN_ORDER_FRONT_TO_BACK_MASK;
@@ -667,6 +683,7 @@
TD_SCREEN (s);
compDisplayClearRequestFlagForPlugin (s->display, "3d", "DRAW_ALL_FACES");
+ compDisplayClearRequestFlagForPlugin (s->display, "3d", "NO_CUBE_CAPS");
if( DO_3D(s->display) || tds->tdWindowExists)
{
@@ -681,7 +698,13 @@
tdw = GET_TD_WINDOW (w, GET_TD_SCREEN (w->screen, GET_TD_DISPLAY (w->screen->display)));
if ( DO_3D(s->display) )
- aim = tdw->z;
+ {
+ if( IPCS_GetBool (IPCS_OBJECT(s), tds->insideAtom) )
+ aim = tdw->z - tds->maxZ;
+
+ else
+ aim = tdw->z;
+ }
if( fabs( tdw->currentZ - aim ) < SPEED)
tdw->currentZ = aim;
@@ -741,7 +764,7 @@
o->group = N_("");
o->subGroup = N_("");
o->displayHints = "";
- o->longDesc = "create mipmaps";
+ o->longDesc = "Create mipmaps.";
o->type = CompOptionTypeBool;
o->value.f = TD_CREATE_MIPMAPS_DEFAULT;
@@ -751,9 +774,19 @@
o->group = N_("");
o->subGroup = N_("");
o->displayHints = "";
- o->longDesc = "Disable Backface Culling";
+ o->longDesc = "Disable Backface Culling.";
o->type = CompOptionTypeBool;
o->value.f = TD_DISABLE_BACKFACE_CULLING_DEFAULT;
+
+ o = &tds->opt[TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE];
+ o->name = "nocaps";
+ o->shortDesc = "Disable caps in inside cube";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->longDesc = "Disable cube caps when inside cube mode is used.";
+ o->type = CompOptionTypeBool;
+ o->value.f = TD_DISABLE_CAPS_IN_INSIDE_CUBE_DEFAULT;
}
static CompOption *
@@ -806,6 +839,7 @@
break;
case TD_SCREEN_OPTION_DISABLE_BACKFACE_CULLING:
+ case TD_SCREEN_OPTION_DISABLE_CAPS_IN_INSIDE_CUBE:
if(compSetBoolOption(o, value))
return TRUE;
break;
@@ -880,6 +914,9 @@
tds->mmModeAtom = IPCS_GetAtom (IPCS_OBJECT (s), IPCS_INT,
"MM_MODE", TRUE);
+ tds->insideAtom = IPCS_GetAtom (IPCS_OBJECT (s), IPCS_BOOL,
+ "INSIDE", TRUE);
+
tds->currentViewportNum = s->hsize;
tds->currentMmMode = IPCS_GetInt (IPCS_OBJECT(s), tds->mmModeAtom);
tds->currentScreenNum = s->nOutputDev;
More information about the commits
mailing list