summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/cube.c
diff options
context:
space:
mode:
authorkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-10 12:14:22 +0000
committerkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-10 12:14:22 +0000
commite762e3b344fd43aea9d144d7b957d59bcada32b1 (patch)
treef2504fcb131bb0c78c86cc35e1f4e37cba01ea0d /beryl-plugins/src/cube.c
parent9add3494bcc79d379680acf27f349d96386f098f (diff)
downloadmarex-dev-e762e3b344fd43aea9d144d7b957d59bcada32b1.tar.gz
marex-dev-e762e3b344fd43aea9d144d7b957d59bcada32b1.tar.bz2
core+cube: Anisotropic filtering option, patch by wolf. Closes #1282
git-svn-id: file:///beryl/trunk@3907 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/cube.c')
-rw-r--r--beryl-plugins/src/cube.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/beryl-plugins/src/cube.c b/beryl-plugins/src/cube.c
index 44e9bae..8654ca4 100644
--- a/beryl-plugins/src/cube.c
+++ b/beryl-plugins/src/cube.c
@@ -130,6 +130,7 @@ static char *cubeImages[] = {
#define CUBE_TIMESTEP_PRECISION 0.1f
#define CUBE_MIPMAP_DEFAULT FALSE
+#define CUBE_ANISOTROPIC_DEFAULT FALSE
#define CUBE_VIEWPORT_SLIDE_DEFAULT FALSE
#define CUBE_VIEWPORT_SLIDE_NO3D_DEFAULT FALSE
@@ -189,7 +190,8 @@ typedef struct _CubeDisplay
#define CUBE_TRANSPARENT_MANUALONLY 25
#define CUBE_SCREEN_OPTION_UNFOLD_ZOOM_DISTANCE 26
#define CUBE_SCREEN_OPTION_STUCK_TO_SCREEN 27
-#define CUBE_SCREEN_OPTION_NUM 28
+#define CUBE_SCREEN_OPTION_ANISOTROPIC 28
+#define CUBE_SCREEN_OPTION_NUM 29
typedef struct _CubeCapInfo
{
@@ -1108,6 +1110,10 @@ cubeSetScreenOption(CompScreen * screen, char *name, CompOptionValue * value)
if (compSetBoolOption(o, value))
return TRUE;
break;
+ case CUBE_SCREEN_OPTION_ANISOTROPIC:
+ if (compSetBoolOption(o, value))
+ return TRUE;
+ break;
case CUBE_SCREEN_OPTION_UNFOLD_ZOOM_DISTANCE:
if (compSetFloatOption(o, value))
{
@@ -1395,6 +1401,17 @@ static void cubeScreenInitOptions(CubeScreen * cs)
o->type = CompOptionTypeBool;
o->value.b = CUBE_MIPMAP_DEFAULT;
+ o = &cs->opt[CUBE_SCREEN_OPTION_ANISOTROPIC];
+ o->advanced = False;
+ o->name = "anisotropic";
+ o->group = N_("Options");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Anisotropic filtering");
+ o->longDesc =
+ N_("Use anisotropic filtering to enhance quality of mipmaps.");
+ o->type = CompOptionTypeBool;
+ o->value.b = CUBE_ANISOTROPIC_DEFAULT;
o = &cs->opt[CUBE_SCREEN_OPTION_VIEWPORT_SLIDE];
o->advanced = False;
@@ -2319,6 +2336,7 @@ cubePaintTransformedScreen(CompScreen * s,
GLenum filter;
unsigned int newMask;
int num = 0, j;
+ Bool anisotropic;
if (cs->opt[CUBE_SCREEN_OPTION_TRANSPARENT].value.b &&
(cs->desktopOpacity != OPAQUE || s->berylDesktopManaged))
@@ -2342,6 +2360,9 @@ cubePaintTransformedScreen(CompScreen * s,
if (cs->opt[CUBE_SCREEN_OPTION_MIPMAP].value.b)
s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
+ anisotropic = s->display->textureAnisotropic;
+ if (s->anisotropicFiltering && cs->opt[CUBE_SCREEN_OPTION_ANISOTROPIC].value.b)
+ s->display->textureAnisotropic = TRUE;
for (i = 0; i < fc; i++)
if (faces[i].rev)
@@ -2366,6 +2387,7 @@ cubePaintTransformedScreen(CompScreen * s,
}
s->display->textureFilter = filter;
+ s->display->textureAnisotropic = anisotropic;
if (disabledCull)
{
@@ -2512,6 +2534,10 @@ cubePaintTransformedScreen(CompScreen * s,
if (cs->opt[CUBE_SCREEN_OPTION_MIPMAP].value.b)
s->display->textureFilter = GL_LINEAR_MIPMAP_LINEAR;
+ anisotropic = s->display->textureAnisotropic;
+ if (s->anisotropicFiltering && cs->opt[CUBE_SCREEN_OPTION_ANISOTROPIC].value.b)
+ s->display->textureAnisotropic = TRUE;
+
if (cs->invert == 1)
{
num = 0;
@@ -2542,6 +2568,7 @@ cubePaintTransformedScreen(CompScreen * s,
}
s->display->textureFilter = filter;
+ s->display->textureAnisotropic = anisotropic;
WRAP(cs, s, paintTransformedScreen, cubePaintTransformedScreen);