material: Adds _get_layer_combine_constant API

This adds an internal _cogl_material_get_layer_combine_constant function
so we can query the current layer combine constant back. We should
probably make this a public property getter, but for now we just need
this so we can read the constant in the arbfp backend.
This commit is contained in:
Robert Bragg 2010-09-13 21:21:09 +01:00
parent c9ac838fad
commit bc187dc31e
2 changed files with 31 additions and 0 deletions

View File

@ -913,5 +913,10 @@ _cogl_material_foreach_layer (CoglMaterial *material,
int
_cogl_material_layer_get_unit_index (CoglMaterialLayer *layer);
void
_cogl_material_get_layer_combine_constant (CoglMaterial *material,
int layer_index,
float *constant);
#endif /* __COGL_MATERIAL_PRIVATE_H */

View File

@ -4875,6 +4875,32 @@ changed:
handle_automatic_blend_enable (material, COGL_MATERIAL_STATE_LAYERS);
}
void
_cogl_material_get_layer_combine_constant (CoglMaterial *material,
int layer_index,
float *constant)
{
CoglMaterialLayerState change =
COGL_MATERIAL_LAYER_STATE_COMBINE_CONSTANT;
CoglMaterialLayer *layer;
CoglMaterialLayer *authority;
g_return_if_fail (cogl_is_material (material));
/* Note: this will ensure that the layer exists, creating one if it
* doesn't already.
*
* Note: If the layer already existed it's possibly owned by another
* material. If the layer is created then it will be owned by
* material. */
layer = _cogl_material_get_layer (material, layer_index);
/* FIXME: we shouldn't ever construct a layer in a getter function */
authority = _cogl_material_layer_get_authority (layer, change);
memcpy (constant, authority->big_state->texture_combine_constant,
sizeof (float) * 4);
}
void
cogl_material_set_layer_matrix (CoglMaterial *material,
int layer_index,