From ae554a5061b64ee7b4d157f91467c19ce74495fa Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 16 Mar 2012 12:05:11 +0000 Subject: [PATCH] Rename 'bilinear' scaling filter to 'trilinear' Yes, it's not really the proper GL name for a linear-on-every-axis of a texture plus linear-between-mipmap-levels minification filter, but it has three redeeming qualities as a name: - LINEAR_MIPMAP_LINEAR sucks, as it introduces GL concepts like mipmaps in the API naming, while we're trying to avoid that; - people using GL already know what 'trilinear' means in this context without going all Khronos on their asses; - we're using 2D textures anyway, so 'linear on two axes and linear between mipmap levels' can be effectively approximated to 'trilinear'. I mean, if even the OpenGL official wiki says: Unfortunately, what most people think of as "trilinear" is not linear filtering of a 3D texture, but what in OpenGL terms is GL_LINEAR mag filter and GL_LINEAR_MIPMAP_LINEAR in the min filter in a 2D texture. That is, it is bilinear filtering of each appropriate mipmap level, and doing a third linear filter between the adjacent mipmap levels. Hence the term "trilinear". -- http://www.opengl.org/wiki/Texture then the horse has already been flogged to death, and I don't intend to be accused of necrophilia and sadism by flogging it some more. Prior art: every single GL tutorial in the history of ever; CoreAnimation's scaling filter enumerations. If people want to start using 1D or 3D textures they they are probably going to be using Cogl API directly, and that has the GL naming scheme for minification and magnification filters anyway. --- clutter/clutter-actor.c | 2 +- clutter/clutter-enums.h | 7 ++++--- clutter/clutter-paint-nodes.c | 2 +- tests/interactive/test-canvas.c | 2 +- tests/interactive/test-image-box.c | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 2148eb5a9..b31a224f9 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -167,7 +167,7 @@ * * /* the cogl_texture variable is set elsewhere */ * node = clutter_texture_node_new (cogl_texture, CLUTTER_COLOR_White, - * CLUTTER_SCALING_FILTER_BILINEAR, + * CLUTTER_SCALING_FILTER_TRILINEAR, * CLUTTER_SCALING_FILTER_LINEAR); * * /* paint the content of the node using the allocation */ diff --git a/clutter/clutter-enums.h b/clutter/clutter-enums.h index 38e5dfd7e..bf3dea5a8 100644 --- a/clutter/clutter-enums.h +++ b/clutter/clutter-enums.h @@ -1153,8 +1153,9 @@ typedef enum { * ClutterScalingFilter: * @CLUTTER_SCALING_FILTER_LINEAR: Linear interpolation filter * @CLUTTER_SCALING_FILTER_NEAREST: Nearest neighbor interpolation filter - * @CLUTTER_SCALING_FILTER_BILINEAR: Bilinear minification filter; this - * filter enables mipmap generation. + * @CLUTTER_SCALING_FILTER_TRILINEAR: Trilinear minification filter, with + * mipmap generation; this filter linearly interpolates on every axis, + * as well as between mipmap levels. * * The scaling filters to be used with the #ClutterActor:minification-filter * and #ClutterActor:magnification-filter properties. @@ -1164,7 +1165,7 @@ typedef enum { typedef enum { CLUTTER_SCALING_FILTER_LINEAR, CLUTTER_SCALING_FILTER_NEAREST, - CLUTTER_SCALING_FILTER_BILINEAR + CLUTTER_SCALING_FILTER_TRILINEAR } ClutterScalingFilter; G_END_DECLS diff --git a/clutter/clutter-paint-nodes.c b/clutter/clutter-paint-nodes.c index be7a23166..1dc6f136f 100644 --- a/clutter/clutter-paint-nodes.c +++ b/clutter/clutter-paint-nodes.c @@ -622,7 +622,7 @@ clutter_scaling_filter_to_cogl_pipeline_filter (ClutterScalingFilter filter) case CLUTTER_SCALING_FILTER_LINEAR: return COGL_PIPELINE_FILTER_LINEAR; - case CLUTTER_SCALING_FILTER_BILINEAR: + case CLUTTER_SCALING_FILTER_TRILINEAR: return COGL_PIPELINE_FILTER_LINEAR_MIPMAP_LINEAR; } diff --git a/tests/interactive/test-canvas.c b/tests/interactive/test-canvas.c index a452df697..01f11c9e1 100644 --- a/tests/interactive/test-canvas.c +++ b/tests/interactive/test-canvas.c @@ -105,7 +105,7 @@ test_canvas_main (int argc, char *argv[]) actor = clutter_actor_new (); clutter_actor_set_content (actor, canvas); clutter_actor_set_content_scaling_filters (actor, - CLUTTER_SCALING_FILTER_BILINEAR, + CLUTTER_SCALING_FILTER_TRILINEAR, CLUTTER_SCALING_FILTER_LINEAR); clutter_actor_add_child (stage, actor); diff --git a/tests/interactive/test-image-box.c b/tests/interactive/test-image-box.c index 4410a49c8..f35363c6c 100644 --- a/tests/interactive/test-image-box.c +++ b/tests/interactive/test-image-box.c @@ -87,7 +87,7 @@ test_image_box_main (int argc, char *argv[]) g_object_unref (pixbuf); clutter_actor_set_content_scaling_filters (box, - CLUTTER_SCALING_FILTER_BILINEAR, + CLUTTER_SCALING_FILTER_TRILINEAR, CLUTTER_SCALING_FILTER_LINEAR); clutter_actor_set_content_gravity (box, gravities[n_gravities - 1].gravity); clutter_actor_set_content (box, image);