From 984e04cae8139de268686158ff627d843bab777a Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 2 Jul 2010 13:33:06 +0100 Subject: [PATCH] Make the material functions for setting the p wrap mode public Now that we have 3D texture support it makes sense to expose the wrap mode for the p coordinate. --- clutter/cogl/cogl/cogl-material-private.h | 10 -------- clutter/cogl/cogl/cogl-material.c | 15 +++++------- clutter/cogl/cogl/cogl-material.h | 38 +++++++++++++++++++++++++++---- clutter/cogl/cogl/cogl-vertex-buffer.c | 2 +- doc/reference/cogl/cogl-sections.txt | 2 ++ 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/clutter/cogl/cogl/cogl-material-private.h b/clutter/cogl/cogl/cogl-material-private.h index 9a52aaa..cb6b228 100644 --- a/clutter/cogl/cogl/cogl-material-private.h +++ b/clutter/cogl/cogl/cogl-material-private.h @@ -814,16 +814,6 @@ _cogl_material_journal_ref (CoglMaterial *material); void _cogl_material_journal_unref (CoglMaterial *material); -/* TODO: These should be made public once we add support for 3D - textures in Cogl */ -void -_cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, - int layer_index, - CoglMaterialWrapMode mode); - -CoglMaterialWrapMode -_cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer); - void _cogl_material_set_user_program (CoglMaterial *material, CoglHandle program); diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c index 82b50e3..6fc658c 100644 --- a/clutter/cogl/cogl/cogl-material.c +++ b/clutter/cogl/cogl/cogl-material.c @@ -2356,8 +2356,6 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material, authority->wrap_mode_p); } -/* TODO: this should be made public once we add support for 3D - textures in Cogl */ /* The rationale for naming the third texture coordinate 'p' instead of OpenGL's usual 'r' is that 'r' conflicts with the usual naming of the 'red' component when treating a vector as a color. Under @@ -2371,9 +2369,9 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material, the w component conflicts with the w component of a position vertex. */ void -_cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, - int layer_index, - CoglMaterialWrapMode mode) +cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode) { CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES; CoglMaterialLayer *layer; @@ -2505,7 +2503,7 @@ cogl_material_get_layer_wrap_mode_t (CoglMaterial *material, int layer_index) } CoglMaterialWrapMode -_cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer) +cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer) { CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES; CoglMaterialLayer *authority = @@ -2514,9 +2512,8 @@ _cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer) return internal_to_public_wrap_mode (authority->wrap_mode_p); } -/* TODO: make this public when we expose 3D textures. */ CoglMaterialWrapMode -_cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, int layer_index) +cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, int layer_index) { CoglMaterialLayer *layer; @@ -2530,7 +2527,7 @@ _cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, int layer_index) * material. */ layer = _cogl_material_get_layer (material, layer_index); - return _cogl_material_layer_get_wrap_mode_p (layer); + return cogl_material_layer_get_wrap_mode_p (layer); } static void diff --git a/clutter/cogl/cogl/cogl-material.h b/clutter/cogl/cogl/cogl-material.h index f94eda6..b72ca32 100644 --- a/clutter/cogl/cogl/cogl-material.h +++ b/clutter/cogl/cogl/cogl-material.h @@ -998,15 +998,32 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material, CoglMaterialWrapMode mode); /** + * cogl_material_set_layer_wrap_mode_p: + * @material: A #CoglMaterial object + * @layer_index: the layer number to change. + * @mode: the new wrap mode + * + * Sets the wrap mode for the 'p' coordinate of texture lookups on + * this layer. 'p' is the third coordinate. + * + * Since: 1.4 + */ +void +cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, + int layer_index, + CoglMaterialWrapMode mode); + +/** * cogl_material_set_layer_wrap_mode: * @material: A #CoglMaterial object * @layer_index: the layer number to change. * @mode: the new wrap mode * - * Sets the wrap mode for both coordinates of texture lookups on this - * layer. This is equivalent to calling - * cogl_material_set_layer_wrap_mode_s() and - * cogl_material_set_layer_wrap_mode_t() separately. + * Sets the wrap mode for all three coordinates of texture lookups on + * this layer. This is equivalent to calling + * cogl_material_set_layer_wrap_mode_s(), + * cogl_material_set_layer_wrap_mode_t() and + * cogl_material_set_layer_wrap_mode_p() separately. * * Since: 1.4 */ @@ -1041,6 +1058,19 @@ cogl_material_layer_get_wrap_mode_s (CoglMaterialLayer *layer); CoglMaterialWrapMode cogl_material_layer_get_wrap_mode_t (CoglMaterialLayer *layer); +/** + * cogl_material_layer_get_wrap_mode_p: + * @layer: A #CoglMaterialLayer object + * + * Gets the wrap mode for the 'p' coordinate of texture lookups on + * this layer. 'p' is the third coordinate. + * + * Return value: the wrap mode value for the p coordinate. + * + * Since: 1.4 + */ +CoglMaterialWrapMode +cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer); /* XXX: should this be CoglMaterialDepthTestFunction? * It makes it very verbose but would be consistent with diff --git a/clutter/cogl/cogl/cogl-vertex-buffer.c b/clutter/cogl/cogl/cogl-vertex-buffer.c index bea7288..54e4882 100644 --- a/clutter/cogl/cogl/cogl-vertex-buffer.c +++ b/clutter/cogl/cogl/cogl-vertex-buffer.c @@ -1682,7 +1682,7 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer) COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT; options.flags |= COGL_MATERIAL_FLUSH_WRAP_MODE_OVERRIDES; } - if (_cogl_material_layer_get_wrap_mode_p (layer) == + if (cogl_material_layer_get_wrap_mode_p (layer) == COGL_MATERIAL_WRAP_MODE_AUTOMATIC) { options.wrap_mode_overrides.values[i].p = diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt index e88d84d..fba207d 100644 --- a/doc/reference/cogl/cogl-sections.txt +++ b/doc/reference/cogl/cogl-sections.txt @@ -517,8 +517,10 @@ CoglMaterialWrapMode cogl_material_set_layer_wrap_mode cogl_material_set_layer_wrap_mode_s cogl_material_set_layer_wrap_mode_t +cogl_material_set_layer_wrap_mode_p cogl_material_layer_get_wrap_mode_s cogl_material_layer_get_wrap_mode_t +cogl_material_layer_get_wrap_mode_p cogl_blend_string_error_get_type cogl_blend_string_error_quark -- 2.7.4