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.
This commit is contained in:
Emmanuele Bassi 2012-03-16 12:05:11 +00:00
parent b44290c436
commit ae554a5061
5 changed files with 8 additions and 7 deletions

View File

@ -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 */

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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);