[cogl-material] Support string based blending and layer combine descriptions

Setting up layer combine functions and blend modes is very awkward to do
programatically.  This adds a parser for string based descriptions which are
more consise and readable.

E.g. a material layer combine function could now be given as:
  "RGBA = ADD (TEXTURE[A], PREVIOUS[RGB])"
or
  "RGB = REPLACE (PREVIOUS)"
  "A = MODULATE (PREVIOUS, TEXTURE)"

The simple syntax and grammar are only designed to expose standard fixed
function hardware, more advanced combining must be done with shaders.

This includes standalone documentation of blend strings covering the aspects
that are common to blending and texture combining, and adds documentation
with examples specific to the new cogl_material_set_blend() and
cogl_material_layer_set_combine() functions.

Note: The hope is to remove the now redundant bits of the material API
before 1.0
This commit is contained in:
Robert Bragg
2009-05-11 00:40:41 +01:00
parent ef1a771fde
commit 33994caa71
22 changed files with 2404 additions and 84 deletions

View File

@ -39,7 +39,8 @@ static const GDebugKey cogl_debug_keys[] = {
{ "draw", COGL_DEBUG_DRAW },
{ "pango", COGL_DEBUG_PANGO },
{ "rectangles", COGL_DEBUG_RECTANGLES },
{ "handle", COGL_DEBUG_HANDLE }
{ "handle", COGL_DEBUG_HANDLE },
{ "blend-strings", COGL_DEBUG_BLEND_STRINGS }
};
static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);