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.
This commit is contained in:
Neil Roberts 2010-07-02 13:33:06 +01:00
parent ec718d4ca4
commit 671abec8b7
5 changed files with 43 additions and 24 deletions

View File

@ -814,16 +814,6 @@ _cogl_material_journal_ref (CoglMaterial *material);
void void
_cogl_material_journal_unref (CoglMaterial *material); _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 void
_cogl_material_set_user_program (CoglMaterial *material, _cogl_material_set_user_program (CoglMaterial *material,
CoglHandle program); CoglHandle program);

View File

@ -2356,8 +2356,6 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material,
authority->wrap_mode_p); 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 /* The rationale for naming the third texture coordinate 'p' instead
of OpenGL's usual 'r' is that 'r' conflicts with the usual naming 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 of the 'red' component when treating a vector as a color. Under
@ -2371,7 +2369,7 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material,
the w component conflicts with the w component of a position the w component conflicts with the w component of a position
vertex. */ vertex. */
void void
_cogl_material_set_layer_wrap_mode_p (CoglMaterial *material, cogl_material_set_layer_wrap_mode_p (CoglMaterial *material,
int layer_index, int layer_index,
CoglMaterialWrapMode mode) CoglMaterialWrapMode mode)
{ {
@ -2505,7 +2503,7 @@ cogl_material_get_layer_wrap_mode_t (CoglMaterial *material, int layer_index)
} }
CoglMaterialWrapMode 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; CoglMaterialLayerState change = COGL_MATERIAL_LAYER_STATE_WRAP_MODES;
CoglMaterialLayer *authority = 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); return internal_to_public_wrap_mode (authority->wrap_mode_p);
} }
/* TODO: make this public when we expose 3D textures. */
CoglMaterialWrapMode 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; CoglMaterialLayer *layer;
@ -2530,7 +2527,7 @@ _cogl_material_get_layer_wrap_mode_p (CoglMaterial *material, int layer_index)
* material. */ * material. */
layer = _cogl_material_get_layer (material, layer_index); 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 static void

View File

@ -997,16 +997,33 @@ cogl_material_set_layer_wrap_mode_t (CoglMaterial *material,
int layer_index, int layer_index,
CoglMaterialWrapMode mode); 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: * cogl_material_set_layer_wrap_mode:
* @material: A #CoglMaterial object * @material: A #CoglMaterial object
* @layer_index: the layer number to change. * @layer_index: the layer number to change.
* @mode: the new wrap mode * @mode: the new wrap mode
* *
* Sets the wrap mode for both coordinates of texture lookups on this * Sets the wrap mode for all three coordinates of texture lookups on
* layer. This is equivalent to calling * this layer. This is equivalent to calling
* cogl_material_set_layer_wrap_mode_s() and * cogl_material_set_layer_wrap_mode_s(),
* cogl_material_set_layer_wrap_mode_t() separately. * cogl_material_set_layer_wrap_mode_t() and
* cogl_material_set_layer_wrap_mode_p() separately.
* *
* Since: 1.4 * Since: 1.4
*/ */
@ -1041,6 +1058,19 @@ cogl_material_layer_get_wrap_mode_s (CoglMaterialLayer *layer);
CoglMaterialWrapMode CoglMaterialWrapMode
cogl_material_layer_get_wrap_mode_t (CoglMaterialLayer *layer); 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? /* XXX: should this be CoglMaterialDepthTestFunction?
* It makes it very verbose but would be consistent with * It makes it very verbose but would be consistent with

View File

@ -1682,7 +1682,7 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT; COGL_MATERIAL_WRAP_MODE_OVERRIDE_REPEAT;
options.flags |= COGL_MATERIAL_FLUSH_WRAP_MODE_OVERRIDES; 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) COGL_MATERIAL_WRAP_MODE_AUTOMATIC)
{ {
options.wrap_mode_overrides.values[i].p = options.wrap_mode_overrides.values[i].p =

View File

@ -517,8 +517,10 @@ CoglMaterialWrapMode
cogl_material_set_layer_wrap_mode cogl_material_set_layer_wrap_mode
cogl_material_set_layer_wrap_mode_s cogl_material_set_layer_wrap_mode_s
cogl_material_set_layer_wrap_mode_t 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_s
cogl_material_layer_get_wrap_mode_t cogl_material_layer_get_wrap_mode_t
cogl_material_layer_get_wrap_mode_p
<SUBSECTION Private> <SUBSECTION Private>
cogl_blend_string_error_get_type cogl_blend_string_error_get_type
cogl_blend_string_error_quark cogl_blend_string_error_quark