1
0
Fork 0
Commit graph

1747 commits

Author SHA1 Message Date
Robert Bragg
aee2589cc6 [doc] Hooks up cogl-material reference documentation
Adds some more gtk-doc comments to cogl-material.h, and adds a new section to
cogl-sections.txt
2008-12-22 16:35:52 +00:00
Robert Bragg
eb3b48e9ff Updates previous GLES multi-texturing code to use CoglMaterial
test-cogl-material now runs on GLES 1 using the PVR GLES1 SDK (though since
only 2 texture units are supported the third rotating light map doesn't show)

Note: It currently doesn't build for GLES 2.0
2008-12-22 16:35:52 +00:00
Robert Bragg
40b0bb4e95 Adds a CoglMaterial abstraction, which includes support for multi-texturing
My previous work to provide muti-texturing support has been extended into
a CoglMaterial abstraction that adds control over the texture combine
functions (controlling how multiple texture layers are blended together),
the gl blend function (used for blending the final primitive with the
framebuffer), the alpha function (used to discard fragments based on
their alpha channel), describing attributes such as a diffuse, ambient and
specular color (for use with the standard OpenGL lighting model), and
per layer rotations. (utilizing the new CoglMatrix utility API)

For now the only way this abstraction is exposed is via a new
cogl_material_rectangle function, that is similar to cogl_texture_rectangle
but doesn't take a texture handle (the source material is pulled from
the context), and the array of texture coordinates is extended to be able
to supply coordinates for each layer.

Note: this function doesn't support sliced textures; supporting sliced
textures is a non trivial problem, considering the ability to rotate layers.
Note: cogl_material_rectangle, has quite a few workarounds, for a number of
other limitations within Cogl a.t.m.
Note: The GLES1/2 multi-texturing support has yet to be updated to use
the material abstraction.
2008-12-22 16:35:52 +00:00
Robert Bragg
63047e1907 [doc] Hooks up cogl-matrix reference documentation
Adds a few more gtk-doc notes to cogl-matrix.h, and adds a new section to
cogl-sections.txt
2008-12-22 16:35:52 +00:00
Robert Bragg
fa8d6dc69b Adds CoglMatrix utility code 2008-12-22 16:35:52 +00:00
Robert Bragg
fc7a86fd0d [tests] Adds an interactive unit test for multi-texturing
This simply gives an example of blending a red o-hand logo with an alpha mask
and a changing light map.
2008-12-22 16:35:51 +00:00
Robert Bragg
ea643ca0f8 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
Multitexturing allows blending multiple layers of texture data when texturing
some geometry. A common use is for pre-baked light maps which can give nice
lighting effects relativly cheaply. Another is for dot-3 bump mapping, and
another is applying alpha channel masks.

The dot-3 bump mapping would be really nice one day, but currently cogl doesn't
support lighting so that's not dealt with in this patch.

notable limitations:
- It can only texture rectangles a.t.m - and like cogl_texture_rectangle there
is no support for rotated texturing.
- Sliced textures are not supported. I think I've figured out how to handle
layers with different slice sizes at least for rectangular geometry, but I'm
not sure how complex it becomes once rotations are possible and texturing
arbitrary cogl_polygons.
- Except for this new API, cogl still doesn't know about more than one texture
unit, and so has no way of caching any enables related to other units. So that
things don't break it's currently necessary to disable anything to do with
additional units as soon as we are done with them which isn't ideal.
- No clutter API yet.
2008-12-22 16:35:51 +00:00
Owen Taylor
6a980793c6 Return something reasonable from clutter_x11_handle_event()
Instead of returning CLUTTER_X11_FILTER_CONTINUE always from
clutter_x11_handle_event() return CLUTTER_X11_FILTER_REMOVE if
the event was on a stage and translated to a ClutterEvent.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2008-12-22 13:11:59 +00:00
Robert Bragg
8e88a487d9 [gitignore] Adds *.swn + *.swo (Vim files) & *.orig + *.reg (patch conflicts) 2008-12-21 21:52:58 +00:00
Robert Bragg
3a6ffe3b7d [build] Replaces use of #include <cairo/cairo.h> with #include <cairo.h>
The cairo pkg-config is crafted such that #include <cairo.h> should be used.
If building with a private build of cairo installed to a custom prefix
<cairo/cairo.h> can cause an un-intended cairo header to be picked up during
compilation due to /usr/include being in the header search path.
2008-12-21 21:52:50 +00:00
Robert Bragg
c700d4c9a1 [tests] Ensures that test-viewport.c is built
test-viewport.c wasn't listed correctly in the UNIT_TESTS variable
(it was missing the .c extension, and so it wasn't being built.)
2008-12-21 14:07:35 +00:00
Robert Bragg
a40666469d [tests] Ensure that test-launcher.sh is found for out of tree builds
When building out of tree the generated scripts for the unit tests
need to explicitly reference the original src dir to be able to find
test-launcher.sh, like this:
 $(top_srcdir)/tests/conform/test-launcher.sh

Also test-launcher.sh now passes -m slow --verbose to gtester. Without
-m slow then the wrappers dont work for some of the timeline tests.
2008-12-21 14:07:22 +00:00
Emmanuele Bassi
4e493d1937 Avoid masking math.h exported variables
Our beloved math.h exports, from bits/mathcalls.h, a bare "y1" symbol.
Apparently, it's unthinkable for code including <math.h> to also declare
arguments or variable named "y0", "y1" and "yn".

Anyway, the quick fix already used elsewhere in Clutter's codebase is
to rename the colliding variables "y_0", "y_1" and "y_n" - and
obviously everything similar to them as well, using the same pattern.
2008-12-19 18:21:36 +00:00
Emmanuele Bassi
42bba13135 [docs] Remove a duplicate definition
ClutterScriptable was defined twice inside the sections file.
2008-12-19 17:49:57 +00:00
Emmanuele Bassi
c93cd4a096 [docs] Documentation fixes for CairoTexture
Sync up the arguments name inside the gtk-doc annotations with their
name inside the function declaration in the header file.
2008-12-19 17:48:30 +00:00
Emmanuele Bassi
2f23003425 Whitespace fixes
Let's try to honour the coding style document, now that we have one.
2008-12-19 17:44:24 +00:00
Emmanuele Bassi
81541e6940 [docs] Parameter naming fixes
The name of the parameter in the header and the one in the gtk-doc
annotation on top of a function must match.

Unfortunately, there is an index() function declared inside strings.h
which makes gcc complain for the "index" argument as soon as we
enable the extra compiler flags we use when distchecking.

Hence, we need to rename "index" to "index_" in the header and in
the source files.
2008-12-19 17:41:44 +00:00
Emmanuele Bassi
2e98fa46df [docs] Add last few missing symbols to the sections file 2008-12-19 17:30:50 +00:00
Emmanuele Bassi
cc52bbce0b [docs] Add shader symbols to their sections 2008-12-19 17:28:42 +00:00
Emmanuele Bassi
6a4a5e0a3b [docs] Add ClutterPath unused symbols
Add the symbols that gtk-doc can track to the sections file.
2008-12-19 17:25:18 +00:00
Emmanuele Bassi
4094590a52 [docs] Fix a typo in the binding pool section 2008-12-19 17:21:30 +00:00
Emmanuele Bassi
8d98c28dfa Merge branch 'cairo-texture'
* cairo-texture:
  [cairo-texture] Remove the construct only restriction on surface size
  [cairo-texture] Silently discard 0x0 surfaces
  Re-indent ClutterPath header
  Add a test case for the new cairo path functions
  Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
  Warn instead of returning in the IN_PAINT check
  Small documentation fixes
  Print a warning when creating a cairo_t while painting
  Do not set the IN_PAINT flag inside the Stage paint
  Set the IN_PAINT private flag
  [docs] Add ClutterCairoTexture to the API reference
  Add ClutterCairoTexture
  Require Cairo as a Clutter dependency

Conflicts:

  Fix merge conflict in clutter/clutter-path.h
2008-12-19 16:44:40 +00:00
Neil Roberts
64de0411ea [cairo-texture] Remove the construct only restriction on surface size
It is possible to change the surface size after construction with
clutter_cairo_texture_set_surface_size so it doesn't seem right to
restrict changing the properties.

clutter_cairo_texture_resize_surface_internal is called in a handler
for the notify signal. It is called there rather than directly in the
set_property handler so that changing both properties in a single
g_object_set will only cause one resize. The constructed override is
no longer needed.

resize_surface_internal will now bail out if the size of the surface
is already the right size.
2008-12-19 15:35:14 +00:00
Emmanuele Bassi
5560157428 [docs] Fix a copy-and-paste typo in the coding style 2008-12-18 18:14:22 +00:00
Emmanuele Bassi
b63b1584bd [docs] Add coding style document
We should formalise the current coding style of Clutter for
third parties that wish to start hacking and contribute back
patches.
2008-12-18 18:03:43 +00:00
Robert Bragg
5e0daa8ecd Improves tfp performance on Nvidia
Some drivers (e.g. Nvidia) get upset if you try to create multiple glx pixmaps
for the same server side pixmap object, even though you might have unique
client side names, we now avoid hitting this problem by destroying the current
glx pixmap early within clutter_glx_texture_pixmap_create_glx_pixmap.
2008-12-18 17:54:35 +00:00
Neil Roberts
9cd92fc540 [test-scale] Add a label showing the gravity
A label is now displayed under the rectangle showing the current
gravity. The text for the gravity is taken from the GEnumClass. This
makes it easier to verify that the test is working correctly.
2008-12-18 17:40:36 +00:00
Neil Roberts
4168ed09de Fix calculation in clutter_cubic_bezier
The calculation for cubic bezier curves had an extra multiplication by
3 which was causing the curve to go over 1.0 very quickly. This had
the affect of making test-animation appear to complete much before the
completed signal is emitted.
2008-12-18 12:20:46 +00:00
Neil Roberts
2bf815131a [clutter-interval] Fix calculation of interval for unsigned types
The patch makes it cast to double before subtracting the original
value from the target value. Otherwise if the target value is less
than the original value then the subtraction will overflow and the
factor will be multiplied by a very large number instead of the
desired interval.

The problem is demonstrable using the border-width property of
ClutterRectangle.
2008-12-17 19:26:24 +00:00
Emmanuele Bassi
e130e0c9b3 [cairo-texture] Silently discard 0x0 surfaces
The current CairoTexture can be created with a surface size of 0
by 0 pixels, but a warning will be printed.

Worse, the surface can be resized to be 0 by 0 pixels without a
warning. The :surface-width and :surface-height properties accept
a minimum value of 0, and not check is performed on either the
constructor or set_surface_size() parameters to enforce the "greater
than zero" rule.

The correct and consistent behaviour is to allow a 0 by 0 pixels
surface size everywhere; inside surface_resize_internal(), the
current surface will be destroyed and if either :surface-width or
:surface-height are set to 0, the resizing terminates.

Attempting to create a Cairo context from a CairoTexture with
either :surface-width or :surface-height set to 0 will result in
a warning.

This allows:

  - creating a CairoTexture with :surface-width or :surface-height
    set to zero and delaying the surface resize at a later point;
  - resizing the surface to 0 by 0 pixels to destroy the image
    surface used internally;
  - increase the consistency in the usage of CairoTexture.
2008-12-17 15:58:11 +00:00
Neil Roberts
140e4e1be2 Minor fix to documentation for clutter_actor_get_anchor_point
In both versions of clutter_actor_get_anchor_point the description of
the @anchor_y parameter was slightly wrong in different ways.
2008-12-17 15:05:08 +00:00
Emmanuele Bassi
335b650d0b [tests] Create a real file for each test unit
Currently, the conformance test suite creates symbolic links pointing
to a wrapper script that just parses the name used to invoke it and
calls the gtester with the correct path.

Unfortunately, this presents two issues:

        - it does not really work on file systems that do not
          support symbolic links
        - it leaves behind the symbolic links, which cannot
          be automatically cleaning by 'make clean'

Both can be solved by creating a small script that invokes the wrapper
one with the test unit path.

The Makefile will use test-conform to extract the unit test paths
and generate a list that will be iterated over to create the
executable name (using the "test-name" convention also used by the
interactive tests, instead of "test_name"); the executable is then
just a simple shell script that invokes the wrapper script passing
the unit test path on the command line. The wrapper script will
use the first argument to work correctly, so it could be simply
executed like:

        ./test-wrapper.sh /path/to/unit_test

Which is another improvement over the current implementation, where
the wrapper script does not work when invoked directly.
2008-12-17 14:08:08 +00:00
Neil Roberts
ff92cc9766 Convert clutter_path_get_position to take a gdouble instead of an alpha value
The gdouble value represents an interval along the path from 0.0 to
1.0. This makes more sense than using an alpha value because paths are
not directly related to ClutterAlphas and the rest of the Clutter API
tends to expose gdouble arguments.
2008-12-16 15:39:53 +00:00
Neil Roberts
c68cf3564e [test-paint-wrapper] Use a separate paint guard for each actor
Since commit c7c5cf9b ClutterCloneTexture causes an extra paint of the
source actor during the paint run of the cloned texture if the source
is not yet visible. When the stage is first shown it is redrawn
immediatly before it is mapped which means get_paint_visibility will
fail on the source actor so the inner paint will be run. The paint
guards were a global variable so they didn't cope with a second actor
being painted.

The breakage didn't occur until commit d510a4b0 because
get_paint_visibility was also broken.
2008-12-15 16:33:45 +00:00
Emmanuele Bassi
ca310d49ca Re-indent ClutterPath header
Match the indentation and style of the other Clutter headers.
2008-12-15 15:00:37 +00:00
Emmanuele Bassi
f6feed4386 Fix a typo in the ClutterParamSpecFixed declaration
The ClutterParamSpecFixed constructor is declared in the header
as taking ClutterFixed values, but the implementation takes
ClutterUnit values instead. This obviously works because fixed
and units are exactly the same type.

This commit fixes the wrong parameters.
2008-12-15 14:29:59 +00:00
Emmanuele Bassi
b2f4363d95 Remove a double semi-colon typo
Fixes bug 1351 - Extra ; in clutter-behaviour-ellipse.c

Thanks to Haakon Sporsheim.
2008-12-13 11:53:03 +00:00
Neil Roberts
4e0073cd50 Fix the gtk-doc for some properties in ClutterActor
Some of the properties were specified as ClutterActor::property (with
two colons) but gtk-doc expects one colon so the documentation is not
parsed.
2008-12-12 22:47:46 +00:00
Neil Roberts
cd1992181c Fix the definition of clutter_actor_set_scale to match the declaration
Trivial change to declare the parameter as gdouble instead of double
so that it matches the header.
2008-12-12 17:38:53 +00:00
Neil Roberts
965ec27620 Add a test case for the new cairo path functions
The nodes of the test path have been reordered because Cairo coalesces
multiple move operations into a single move so the comparison would
fail if the two move nodes are consecutive.
2008-12-12 14:32:07 +00:00
Neil Roberts
a462d19e14 Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
See bug #1325.

Added doc for new cairo path functions to clutter-sections.txt
2008-12-12 14:31:43 +00:00
Emmanuele Bassi
0e1a3c2124 Warn instead of returning in the IN_PAINT check
It's conceivable that a warning should be deemed enough, instead
of just returning a NULL cairo_t when creating a context for the
CairoTexture actor.
2008-12-12 11:42:16 +00:00
Emmanuele Bassi
4d34872dea Small documentation fixes
Fix the CairoTexture description, and some of the comments inside
the code, especially with regards to the alpha channel unpremultiplication
that we have to perform each time we upload the image surface to
GL.
2008-12-11 15:51:24 +00:00
Emmanuele Bassi
cf9dea7cf6 Print a warning when creating a cairo_t while painting
If you create a Cairo context in the middle of a paint run and then
you destroy it, the CairoTexture will have to upload the contents of
the image surface to the GL pipeline. This usually leads to slow
downs and general performance degradation.

ClutterCairoTexture will warn to the console if Clutter has been
compiled with the debug messages and if create() or create_region()
are called while an actor is in the middle of a paint.
2008-12-11 15:48:43 +00:00
Emmanuele Bassi
1b88122873 Do not set the IN_PAINT flag inside the Stage paint
Since the CLUTTER_ACTOR_IN_PAINT private flag is set as part
of the paint process by clutter_actor_paint(), there is no
need to set it inside the ClutterStage paint function.
2008-12-11 15:41:25 +00:00
Emmanuele Bassi
3f2c9fe6b3 Set the IN_PAINT private flag
When calling clutter_actor_paint() we should be setting the
CLUTTER_ACTOR_IN_PAINT private flag. This allows signalling
to each Actor subclass that we are effectively in the middle
of a paint sequence. Actor subclasses can check for this
private flag and act based on its presence - for instance to
avoid recursion, or to detect performance degradation cases.
2008-12-11 15:39:28 +00:00
Emmanuele Bassi
99bcf731cb [docs] Add ClutterCairoTexture to the API reference 2008-12-11 15:37:21 +00:00
Emmanuele Bassi
e934ad03ca Add ClutterCairoTexture
Move the ClutterCairo actor from a separate library to an in-tree
actor.

ClutterCairoTexture is a simple texture subclass that allows you
to retrieve a Cairo context for a private image surface. When the
Cairo context is destroyed it will cause the image surface
contents to be uploaded to a GL texture.

The image surface used is not hardware accelerated.
2008-12-11 15:34:47 +00:00
Emmanuele Bassi
49e762a291 Require Cairo as a Clutter dependency
Cairo has been an indirect dependency for Clutter since 0.8, through
the PangoCairo API.

Now we explicitly depend on Cairo in order to merge the clutter-cairo
API into Clutter core.
2008-12-11 15:22:42 +00:00
Emmanuele Bassi
4973b684a6 Resort the main Clutter include file
Just for overall sanity we keep the include file sorted.
2008-12-11 11:11:11 +00:00