Commit Graph

350 Commits

Author SHA1 Message Date
Emmanuele Bassi
77579bbc5f [tests] Animate the color during easing
The easing modes test should also tweak the color to show the
progress of the animation.
2009-03-11 22:12:36 +00:00
Emmanuele Bassi
6bee140e74 [tests] Use floats, not ClutterFixed
The COGL API expects floats, not ClutterFixed, so we need
to use the right type when calling it.
2009-03-10 12:38:04 +00:00
Emmanuele Bassi
52811b240f [stage] Coalesce fog and perspective API
The fog and perspective API is currently split in two parts:

  - the floating point version, using values

  - the fixed point version, using structures

The relative properties are using the structure types, since they
are meant to set multiple values at the same time. Instead of
using bare values, the whole API should be coalesced into two
simple calls using structures to match the GObject properties.

Thus:

  clutter_stage_set_fog (ClutterStage*, const ClutterFog*)
  clutter_stage_get_fog (ClutterStage*, ClutterFog*)

  clutter_stage_set_perspective (ClutterStage*, const ClutterPerspective*)
  clutter_stage_get_perspective (ClutterStage*, ClutterPerspective*)

Which supercedes the fixed point and floating point variants.

More importantly, both ClutterFog and ClutterPerspective should
using floating point values, since that's what get passed to
COGL anyway.

ClutterFog should also drop the "density" member, since ClutterStage
only allows linear fog; non-linear fog distribution can be achieved
using a signal handler and calling cogl_set_fog() directly; this keeps
the API compact yet extensible.

Finally, there is no ClutterStage:fog so it should be added.
2009-03-10 12:38:03 +00:00
Emmanuele Bassi
fc40d75956 [tests] Test CoglFixed, not ClutterFixed
We really want to test the CoglFixed implementation, not the
to-be-deprecated ClutterFixed one.
2009-03-10 12:38:03 +00:00
Emmanuele Bassi
7d674db9d2 Clean up of the ClutterColor API
The ClutterColor API has some inconsistencies:

  - the string deserialization function does not match the rest of
    the conversion function naming policy; the naming should be:

        clutter_color_parse()   ->      clutter_color_from_string()

    and the first parameter should be the ClutterColor that will
    be set from the string, not the string itself (a GDK-ism).

  - the fixed point API should not be exposed, especially in the
    form of ClutterFixed values

  - the non-fixed point HLS conversion functions do not make any
    sense. The values returned should be:

      hue        := range [ 0, 360 ]
      luminance  := range [ 0,   1 ]
      saturation := range [ 0,   1 ]

    like the current fixed point API does. Returning a value in
    the [ 0, 255 ] range is completely useless

  - the clutter_color_equal() should be converted for its use inside
    a GHashTable; a clutter_color_hash() should be added as well

  - the second parameter of the clutter_color_shade() function should
    be the shading factor, not the result (another GDK-ism). this way
    the function call can be translated from this:

      color.shade(out result, factor)

    to the more natural:

      color.shade(factor, out result)

This somewhat large commit fixes all these issues and updates the
internal users of the API.
2009-03-10 12:38:02 +00:00
Neil Roberts
3425331cc1 [tests/tools] Don't install libdisable-npots.so
The libdisable-npots library is just used as a helper as part of
make test so it should not be installed.

If noinst_* is used then automake will generate a static library but
this won't work with LD_PRELOAD so we then need an extra custom rule
to link that into a shared library. The custom rule uses the $(LINK)
Makefile var which gets put in the Makefile because of the static
library. We pass libtool a stub -rpath option which causes it to
generate a shared library.
2009-02-24 17:04:05 +00:00
Robert Bragg
62ac234ca9 [test-vertex-buffer-contiguous] Improves the texturing test
The test now explicitly reads back from the framebuffer to sanity check that
texturing is happening as expected, and it now uses a fixed 2x2 texture instead
of redhand.png since redhand.png doesn't have a power of two size which can
cause the vertex buffer code to complain on hardware not supporting npot
textures.
2009-02-23 16:38:43 +00:00
Emmanuele Bassi
f4222c3cfc [build] Do not overwrite BUILT_SOURCES
The conformance test suite Makefile template already defines the
BUILT_SOURCES variable, so we need to append redhand.png to it.
2009-02-19 17:24:06 +00:00
Emmanuele Bassi
c229de8dde [tests] Add TEST_CONFORM_TODO macro
The TEST_CONFORM_TODO macro is a simple placeholder macro that
adds the test function to the "/todo" namespace and skips the
test.

It can be used for tests that are known to fail because of bugs
that haven't been fixed yet, or because of features not yet
implemented.
2009-02-19 17:21:55 +00:00
Neil Roberts
1ead85f6f6 [tests/conform] Copy in redhand.png
test-vertex-buffer-configuous now needs redhand.png so it should be
copied in to the build directory. This is copied from similar code in
the tests/interactive Makefile.
2009-02-19 17:19:34 +00:00
Damien Lespiau
8eec75efde [build] Beautify autotools' output
Use shave (http://git.lespiau.name/cgit/shave) to make compilation more
human friendly.
2009-02-18 17:38:34 +00:00
Damien Lespiau
468b6210b4 [gitignore] update gitignore files for tests/ 2009-02-18 17:38:34 +00:00
Robert Bragg
2b5a72dde5 [Cogl] cogl_clip_{set*,unset} renamed to cogl_clip_{push*,pop}
This is so they self document the stacking semantics of the cogl clip API
2009-02-18 16:00:51 +00:00
Emmanuele Bassi
e16e9b8bfc [tests] Add conformance tests for ClutterModel
ClutterModel has an interactive test but lacks a conformance
unit for automatic testing.

This is the beginning of that unit, which covers the population
and iteration over a ListModel.
2009-02-14 11:45:27 +00:00
Emmanuele Bassi
28dd557d8f [tests] Add TEST_CONFORM_SKIP() macro
Sometimes a test unit should not be executed depending on a
condition. It would be good to have a macro doing this, along
with TEST_CONFORM_SIMPLE().

Additionally, the skipped unit should be added to a specific
namespace, so that any coverage report will be able to catch it.

For this reason, here's TEST_CONFORM_SKIP() which follows the
syntax:

  TEST_CONFORM_SKIP (condition, namespace, function);

If condition evaluates to FALSE the test is skipped and the
unit added to the "/skipped" namespace.
2009-02-14 11:41:55 +00:00
Robert Bragg
41ef2ef587 [tests] Some improvements for test-pixmap
The test no longer requires an XID argument to run; instead it creates its
own X Window. The test now also aims to demonstrate whether mipmapping is
working, and clearly informs you if fallbacks are being used for GLX tfp.
2009-02-11 13:08:17 +00:00
Robert Bragg
d01e3cd802 [cogl-vertex-buffer] Some fixes for texturing and color arrays
Fixes some blending issues when using color arrays since we were
conflicting with the cogl_enable state + fixes a texture layer
validation bug.

Adds a basic textured triangle to test-vertex-buffer-contiguous.
2009-02-09 14:15:06 +00:00
Neil Roberts
51edcc5251 Added a test for non-power-of-two sized textures
The test simply creates an odd sized texture with different colors at
each of the four corners. It then renders the texture and verifies
that the colors are the expected values. This should help ensure that
the sliced texture rendering code is working properly.
2009-02-09 12:48:58 +00:00
Emmanuele Bassi
9cf02bfdb9 [text] Rename :alignment to :line-alignment
The :alignment property is prone to generate confusion: developers
will set it thinking that the contents of a ClutterText will
automagically align themselves.

Instead of using the generic term :alignment, and following the
GTK+ convention, we should use a more specific term, conveying the
actual effect of the property: alignment of the lines with respect
to each other, and not to the overall allocated area.

See bug 1428:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1428
2009-02-05 19:54:48 +00:00
Emmanuele Bassi
52d04b5750 [tests] Update the text-field interactive test
We should also display the results of calling set_markup() or
set_use_markup() on ClutterText actors.
2009-02-02 12:07:28 +00:00
Robert Bragg
ef4052c18d Changes cogl_rectangle to take x1, y1, x2, y2 args not x1, y1, width, height
This makes it consistent with cogl_rectangle_with_{multi,}texture_coords.
Notably the reason cogl_rectangle_with_{multi,}texture_coords wasn't changed
instead is that the former approach lets you describe back facing rectangles.
(though technically you could pass negative width/height values to achieve
 this; it doesn't seem as neat.)
2009-01-28 17:20:15 +00:00
Neil Roberts
3e68b23ea8 Merge branch 'scale-center'
Bug 1349 - Using the anchor point to set the scale center is messy

The branch adds an extra center point for scaling which can be used
for example to set a scale about the center without affecting the
position of the actor.

The scale center can be specified as a unit offset from the origin or
as a gravity. If specified as a gravity it will be stored as a
fraction of the actor's size so that the position will track when the
actor changes size.

The anchor point and rotation centers have been modified so they can
be set with a gravity in the same way. However, only the Z rotation
exposes a property to set using a gravity because the other two
require a Z coordinate which doesn't make sense to interpret as a
fraction of the actor's width or height.

Conflicts:

	clutter/clutter-actor.c
2009-01-28 15:39:51 +00:00
Neil Roberts
561c441241 [text-backface-culling] Fix width/height parameters to cogl_rectangle
During the upgrade to cogl material, test-backface-culling was
switched to use cogl_rectangle instead of cogl_texture_rectangle to
draw the textures. However, cogl_rectangle takes a width and height
instead of the the top-left and bottom-right vertices so the
rectangles were being drawn in the wrong place.
2009-01-28 12:24:11 +00:00
Emmanuele Bassi
3cfc7fb1ca Merge branch 'generic-actor-clone'
* generic-actor-clone:
  Remove CloneTexture from the API
  [tests] Clean up the Clone interactive test
  Rename ActorClone to Clone/2
  Rename ActorClone to Clone/1
  Improves the unit test to verify more awkward scaling and some corresponding fixes
  Implements a generic ClutterActorClone that doesn't need fbos.
2009-01-27 16:14:35 +00:00
Emmanuele Bassi
a688b1db01 Fallout from cogl-material merge
When enabling the maintainer CFLAGS the compiler got very angry
at the code that has been merged.
2009-01-27 16:02:04 +00:00
Robert Bragg
e9a45c7744 Merge branch 'cogl-material'
Conflicts:

	clutter/cogl/gl/cogl-texture.c
	clutter/cogl/gles/cogl-primitives.c

* cogl-material:
 clutter-{clone-,}texture weren't updating their material opacity.
 Updates GLES1 support for CoglMaterial
 Normalizes gl vs gles code in preperation for synching material changes
 Removes cogl_blend_func and cogl_alpha_func
 Fully integrates CoglMaterial throughout the rest of Cogl
 [cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
 [cogl-material] Make the user_tex_coords parameter of _rectangle const
 [test-cogl-material] Remove return value from material_rectangle_paint
 Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
 [cogl-material] improvements for cogl_material_rectangle
 [cogl-material] Adds a cogl_material_set_color function
 [cogl-material] Some improvements for how we sync CoglMaterial state with OpenGL
 [cogl-material] Converts clutter-texture/clutter-clone-texture to the material API
 [doc] Hooks up cogl-material reference documentation
 Updates previous GLES multi-texturing code to use CoglMaterial
 Adds a CoglMaterial abstraction, which includes support for multi-texturing
 [doc] Hooks up cogl-matrix reference documentation
 Adds CoglMatrix utility code
 [tests] Adds an interactive unit test for multi-texturing
 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
2009-01-27 15:19:34 +00:00
Emmanuele Bassi
86e95a779a Remove CloneTexture from the API
ClutterClone supercedes ClutterCloneTexture, since it can clone
every kind of actor -- including composite ones.

This is another "brain surgery with a shotgun" kind of commit: it
removes CloneTexture and updates every test case using CloneTexture
to ClutterClone. The API fallout is minimal, luckily for us.
2009-01-27 15:18:45 +00:00
Robert Bragg
9266e110de Removes test-simple from tests/interactive/Makefile.am
The addition was accidental
2009-01-27 15:17:16 +00:00
Emmanuele Bassi
cd5c1bd98b [tests] Clean up the Clone interactive test
Do not assume the default stage, and store more data inside the
"application" structure that gets passed around instead of relying
on macros.
2009-01-27 14:36:12 +00:00
Robert Bragg
5985eef44c Fully integrates CoglMaterial throughout the rest of Cogl
This glues CoglMaterial in as the fundamental way that Cogl describes how to
fill in geometry.

It adds cogl_set_source (), which is used to set the material which will be
used by all subsequent drawing functions

It adds cogl_set_source_texture as a convenience for setting up a default
material with a single texture layer, and cogl_set_source_color is now also
a convenience for setting up a material with a solid fill.

"drawing functions" include, cogl_rectangle, cogl_texture_rectangle,
cogl_texture_multiple_rectangles, cogl_texture_polygon (though the
cogl_texture_* funcs have been renamed; see below for details),
cogl_path_fill/stroke and cogl_vertex_buffer_draw*.

cogl_texture_rectangle, cogl_texture_multiple_rectangles and
cogl_texture_polygon no longer take a texture handle; instead the current
source material is referenced. The functions have also been renamed to:
cogl_rectangle_with_texture_coords, cogl_rectangles_with_texture_coords
and cogl_polygon respectivly.

Most code that previously did:
  cogl_texture_rectangle (tex_handle, x, y,...);
needs to be changed to now do:
  cogl_set_source_texture (tex_handle);
  cogl_rectangle_with_texture_coords (x, y,....);

In the less likely case where you were blending your source texture with a color
like:
  cogl_set_source_color4ub (r,g,b,a); /* where r,g,b,a isn't just white */
  cogl_texture_rectangle (tex_handle, x, y,...);
you will need your own material to do that:
  mat = cogl_material_new ();
  cogl_material_set_color4ub (r,g,b,a);
  cogl_material_set_layer (mat, 0, tex_handle));
  cogl_set_source_material (mat);

Code that uses the texture coordinates, 0, 0, 1, 1 don't need to use
cog_rectangle_with_texure_coords since these are the coordinates that
cogl_rectangle will use.

For cogl_texture_polygon; as well as dropping the texture handle, the
n_vertices and vertices arguments were transposed for consistency. So
code previously written as:
  cogl_texture_polygon (tex_handle, 3, verts, TRUE);
need to be written as:
  cogl_set_source_texture (tex_handle);
  cogl_polygon (verts, 3, TRUE);

All of the unit tests have been updated to now use the material API and
test-cogl-material has been renamed to test-cogl-multitexture since any
textured quad is now technically a test of CoglMaterial but this test
specifically creates a material with multiple texture layers.

Note: The GLES backend has not been updated yet; that will be done in a
following commit.
2009-01-27 14:26:39 +00:00
Emmanuele Bassi
86e4e89bf1 Rename ActorClone to Clone/2
Step two: rename the object and its methods.

While we're at it, adhere more strictly to the coding style
practises; rename :clone-source to :source; add a setter method
for the :source property; take a reference on the source actor
to avoid it disappearing while we're still accessing it.
2009-01-27 14:24:31 +00:00
Emmanuele Bassi
00a4549eb1 [tests] Remove an unused variable
This fixes a compiler warning.
2009-01-27 13:22:47 +00:00
Emmanuele Bassi
0616237064 [tests] Assert as soon as possible
In order to give a usable location of the errors in the test
suite, we need to assert() as soon as possible.
2009-01-27 09:51:45 +00:00
Neil Roberts
8e437e838f Simplify test-cogl-primitives
This removes a lot of code from test-cogl-primitives to make it easier
to follow. The TestCoglBox custom actor has gone and instead a blank
ClutterGroup is created with a paint signal handler.

Instead of rendering constantly and updating when a GTimer elapses a
second, a ClutterTimeline is used with 1 fps and a new redraw is
queued every frame.

The custom main loop is replaced with a regular call to clutter_main.
This fixes the close button of the stage window so you can quit
without having to press Ctrl+C.
2009-01-23 23:55:44 +00:00
Neil Roberts
343b0ed67e [test-cogl-primitives] Remove trailing whitespace 2009-01-23 23:41:26 +00:00
Neil Roberts
5acff562b4 [test-anchors] Add tests for the rotation centers
The rotation centers are now tested in a similar way to the anchor
point and scale centers.

The notification handling code has been simplified a bit to handle the
increased amount of properties.
2009-01-23 18:41:41 +00:00
Neil Roberts
a8a986a1a2 [test-anchors] Add tests for the scale center
A separate set of tests for the scale center have been added that work
in a similar way to the anchor point tests.
2009-01-23 18:41:41 +00:00
Neil Roberts
7818eb704d Add a conformance test for the anchor point
This verifies that the anchor point can be set from a gravity and then
it moves when the anchor point changes size.
2009-01-23 18:41:40 +00:00
Neil Roberts
d64ff5c9f0 [test-text] Use g_setenv instead of setenv
setenv doesn't appear to be available on Windows so it fails to
compile.
2009-01-23 18:20:46 +00:00
Robert Bragg
3d07e34cc5 Merge commit 'origin/master' into cogl-material
Conflicts:

	clutter/clutter-texture.c
	clutter/cogl/cogl-texture.h
	clutter/cogl/cogl.h.in
	clutter/cogl/common/Makefile.am
	clutter/cogl/gl/Makefile.am
	clutter/cogl/gles/Makefile.am
	clutter/cogl/gles/cogl-gles2-wrapper.c
	clutter/cogl/gles/cogl-gles2-wrapper.h
2009-01-23 15:23:49 +00:00
Emmanuele Bassi
ae40bd37c7 Clean up the test reports
Since we override the clean-generic target in order to remove
the shell scripts we create for each conformance test unit, we
cannot use CLEANFILES to remove the test reports.
2009-01-23 13:29:55 +00:00
Emmanuele Bassi
915d9ec7ca Split maintainer-flags from the compiler flags
The maintainer compiler flags we use trigger warnings and errors
in the autogenerated code that gtk-doc creates to scan the header
and source files. Since we cannot control that, and we must run
a distcheck with both --enable-gtk-doc and --enable-maintainer-flags
turned on, we need to use less-strict compiler flags when inside
the doc/reference subdirectories.

The way to do this is to split the maintainer compiler flags into
their own Makefile variable, called MAINTAINER_CFLAGS. The we
can use $(MAINTAINER_CFLAGS) in the INCLUDES or _CFLAGS sections
of each part of the source directories we wish to check with the
anal retentiveness suited for maintainers.
2009-01-23 13:09:51 +00:00
Emmanuele Bassi
20973bd29f Fix compiler warnings
The maintainer-flags option discovered the usual amount of
collisions and compiler warnings we have to fix in order to
get distcheck to pass.
2009-01-23 13:08:46 +00:00
Emmanuele Bassi
792ffa1538 Merge branch 'float-alpha-value'
* float-alpha-value:
  [script] Parse easing modes by name
  [docs] Update the easing modes documentation
  [animation] Implement new easing functions
  [animation] Move the alpha value to floating point
2009-01-23 12:10:50 +00:00
Emmanuele Bassi
1b242e3550 [tests] Use the right value in cogl_texture_new*
The correct symbol for disabling the flags when creating a new
COGL texture is COGL_TEXTURE_NONE.
2009-01-22 16:54:49 +00:00
Emmanuele Bassi
07689865fe [tests] Update the tests calling cogl_texture_new_*
The tests calling any of the cogl_texture_new_* family of functions
must be updated to the new constructor syntax.
2009-01-21 10:14:29 +00:00
Robert Bragg
e338245827 Renames the mesh api to the "vertex buffer api".
This better reflects the fact that the api manages sets of vertex attributes,
and the attributes really have no implied form. It is only when you use the
attributes to draw that they become mesh like; when you specify how they should
be interpreted, e.g. as triangle lists or fans etc. This rename frees up the
term "mesh", which can later be applied to a concept slightly more fitting.
E.g. at some point it would be nice to have a higher level abstraction that
sits on top of cogl vertex buffers that adds the concept of faces. (Somthing
like Blender's mesh objects.) There have also been some discussions over
particle engines, and these can be defined in terms of emitter faces; so some
other kind of mesh abstraction might be usefull here.
2009-01-20 22:29:35 +00:00
Robert Bragg
3014d4ff8a Merge branch 'cogl-float'
Okey; to summarise the changes...

We have converted Clutter and Cogl over to using floating point internally
instead of 16.16 fixed, but we have maintained the cogl-fixed API as a
utility to applications in case they want to implement their own optimizations.

The Clutter API has not changed (though ClutterFixed and ClutterUnit are now
internally floats) but all Cogl entry points have been changed to accept floats
now instead of CoglFixed.

To summarise the rationale...

There have been a number of issues with using fixed point though out Clutter
and Cogl including: lack of precision, lack of range, excessive format
conversion (GPUs tend to work nativly with IEEE floats) and maintainability.
One of the main arguments for fixed point - performance - hasn't shown
itself to be serious in practice so far since we seem to be more limited
by GPU performance and making improvements regarding how we submit data to
OpenGL[ES]/the GPU has had a more significant impact.

Ref: The recent multiple rectangle queuing changes + the
cogl-texture-agressive-batching branch which show significant performance
gains, and that recent tests on the ipodtouch (ARM + MBX) also showed no
loss of performance running with floats.

So finally; please forgive the inevitable fallout, this is a far reaching
change. There are still a few known issues with the fixed to float
conversion but enough works for all our conformance tests to pass, and the
remaining issues hopefully wont be too tricky to solve. For reference two
tags will be available either side of this change: "cogl-fixed-end" and
"cogl-float-start"
2009-01-20 18:47:50 +00:00
Emmanuele Bassi
ac1a0d568e [script] Parse easing modes by name
The easing modes for a ClutterAlpha can either be parsed by using
the enumeration "nickname" (the shorthand form of the enumeration
value) or by using the common naming policy used in other
animation frameworks, like:

        easeInCubic
        easeOutElastic
        easeInOutBounce
2009-01-20 18:24:58 +00:00
Emmanuele Bassi
ec3b1a7b90 [animation] Implement new easing functions
Instead of using our own homegrown alpha functions, we should
use the easing functions also shared by other animation frameworks,
like jQuery and Tween, in the interests of code portability.

The easing functions have been defined by Robert Penner and
are divided into three categories:

        In    Out     InOut

Each category has a particular curve:

        Quadratic
        Cubic
        Quartic
        Quintic
        Sinusoidal
        Exponential
        Circular

In addition, there are "physical" curves:

        Elastic
        Back (overshooting cubic)
        Bounce (exponentially decaying parabolic)

Finally, the Linear curve is also provided as a reference.

The functions are private, and are meant to be used only
through their logical id as provided by the AnimationMode
enumeration.

The tests should be updated as well to match the new
easing functions.
2009-01-20 17:57:30 +00:00