Commit Graph

7 Commits

Author SHA1 Message Date
Robert Bragg
680f63a48c Remove all internal includes of cogl.h
The cogl.h header is meant to be the public header for including the 1.x
api used by Clutter so we should stop using that as a convenient way to
include all likely prototypes and typedefs. Actually we already do a
good job of listing the specific headers we depend on in each of the .c
files we have so mostly this patch just strip out the redundant
includes for cogl.h with a few fixups where that broke the build.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:45 +00:00
Robert Bragg
ee940a3d0d Move all types/prototypes from cogl.h -> cogl[1]-context.h
So we can get to the point where cogl.h is merely an aggregation of
header includes for the 1.x api this moves all the function prototypes
and type definitions into a cogl-context.h and a new cogl1-context.h.

Ideally no code internally should ever need to include cogl.h as it just
represents the public facing header for accessing the 1.x api which
should only be used by Clutter.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:44 +00:00
Robert Bragg
e163f1ca1a Remove CoglVector3 type and use float * instead
It proved to be inconvenient that we had a special CoglVector3 typedef
for vectors instead of just accepting pointers to float arrays because
you'd so often end up having to make awkward casts from another vector
type into a CoglVector3 and then cast back again. We're hoping that
taking float pointers instead will lead to less unnecessary casting.
2012-01-16 18:27:19 +00:00
Robert Bragg
b72f255c0a Start to reduce dependence on glib
Since we've had several developers from admirable projects say they
would like to use Cogl but would really prefer not to pull in
gobject,gmodule and glib as extra dependencies we are investigating if
we can get to the point where glib is only an optional dependency.
Actually we feel like we only make minimal use of glib anyway, so it may
well be quite straightforward to achieve this.

This adds a --disable-glib configure option that can be used to disable
features that depend on glib.

Actually --disable-glib doesn't strictly disable glib at this point
because it's more helpful if cogl continues to build as we make
incremental progress towards this.

The first use of glib that this patch tackles is the use of
g_return_val_if_fail and g_return_if_fail which have been replaced with
equivalent _COGL_RETURN_VAL_IF_FAIL and _COGL_RETURN_IF_FAIL macros.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Robert Bragg
b8b37f6c41 quaternion: fix init_from_array and get_rotation_axis
In cogl_quaternion_init_from_array we were passing the address of the x
component as the destination for memcpy, but that was wrong at least
because w is actually the first member in the structure.  Another
concern raised was whether it was safe to assume that there was no
padding within the CoglQuaternion struct with some compilers so we also
switch to explicitly indexing each element of the array we want to copy.
In practice I think it's pretty safe to assume that padding will only be
introduced to ensure members are naturally aligned, but being explicit
is readable and it can't hurt to be extra cautious.

Another good catch in bug #655228 was that in
cogl_quaternion_get_rotation_axis we had a copy and paste error at the
end where we finally extract the axis and we were repeatedly calculating
just the x component. Now we calculate the y and z components too.

Thanks to Bug #655228 for identifying these issues.

https://bugzilla.gnome.org/show_bug.cgi?id=655228

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-27 18:21:27 +01:00
Robert Bragg
df1915d957 math: Adds an experimental euler API
This adds an experimental CoglEuler data type and the following new
functions:

    cogl_euler_init
    cogl_euler_init_from_matrix
    cogl_euler_init_from_quaternion
    cogl_euler_equal
    cogl_euler_copy
    cogl_euler_free
    cogl_quaternion_init_from_euler

Since this is experimental API you need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h
2011-05-16 14:12:42 +01:00
Robert Bragg
d1434d1c33 math: Adds an experimental quaternion API
This adds an experimental quaternion utility API. It's not yet fully
documented but it's complete enough that people can start to experiment
with using it. It adds the following functions:

    cogl_quaternion_init_identity
    cogl_quaternion_init
    cogl_quaternion_init_from_angle_vector
    cogl_quaternion_init_from_array
    cogl_quaternion_init_from_x_rotation
    cogl_quaternion_init_from_y_rotation
    cogl_quaternion_init_from_z_rotation
    cogl_quaternion_equal
    cogl_quaternion_copy
    cogl_quaternion_free
    cogl_quaternion_get_rotation_angle
    cogl_quaternion_get_rotation_axis
    cogl_quaternion_normalize
    cogl_quaternion_dot_product
    cogl_quaternion_invert
    cogl_quaternion_multiply
    cogl_quaternion_pow
    cogl_quaternion_slerp
    cogl_quaternion_nlerp
    cogl_quaternion_squad
    cogl_get_static_identity_quaternion
    cogl_get_static_zero_quaternion

Since it's experimental API you'll need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h.
2011-05-16 14:11:47 +01:00