c3context: Added a view draw callback
authorMichel Pollet <buserror@gmail.com>
Tue, 12 Jun 2012 17:33:52 +0000 (18:33 +0100)
committerMichel Pollet <buserror@gmail.com>
Tue, 12 Jun 2012 17:33:52 +0000 (18:33 +0100)
Unused for now, prepares a view to be drawn

Signed-off-by: Michel Pollet <buserror@gmail.com>
examples/shared/libc3/src/c3context.c
examples/shared/libc3/src/c3context.h
examples/shared/libc3/src/c3driver_context.h

index 8a85c93..af8e901 100644 (file)
@@ -148,7 +148,11 @@ c3context_draw(
 {
        c3context_project(c);
 
-       c3geometry_array_p  array = &c3context_view_get(c)->projected;
+       c3context_view_p v = c3context_view_get(c);
+
+       C3_DRIVER(c, context_view_draw, v);
+
+       c3geometry_array_p  array = &v->projected;
        for (int gi = 0; gi < array->count; gi++) {
                c3geometry_p g = array->e[gi];
                c3geometry_draw(g);
index 93514cf..aac6be8 100644 (file)
@@ -39,6 +39,7 @@ typedef struct c3context_view_t {
                                dirty : 1;
        c3vec2          size;                                   // in pixels. for fbo/textures/window
        c3cam_t         cam;
+       c3mat4          projection;                             // projection matrix
 
        c3geometry_array_t      projected;
        struct {
@@ -56,7 +57,6 @@ DECLARE_C_ARRAY(c3context_view_t, c3context_view_array, 4);
  * This is a wrapper around a "top level object", the list of projected
  * geometries is kept, purged and resorted if the root object becomes
  * dirty
- * TODO: Add the camera/eye/arcball control there
  */
 typedef struct c3context_t {
        int     current;
@@ -129,5 +129,4 @@ c3context_view_set(
                c->current = view;
 }
 
-
 #endif /* __C3CONTEXT_H___ */
index 64d2449..221b026 100644 (file)
@@ -28,6 +28,7 @@
 struct c3context_t;
 struct c3driver_context_t;
 struct c3geometry_t;
+struct c3context_view_t;
 
 typedef struct c3driver_context_t {
        /*
@@ -47,6 +48,14 @@ typedef struct c3driver_context_t {
                        const struct c3driver_context_t *d,
                        struct c3geometry_t * g);
 
+       /*
+        * Called when starting to draw a context view(point)
+        */
+       void (*context_view_draw)(
+                       struct c3context_t * c,
+                       const struct c3driver_context_t *d,
+                       struct c3context_view_t * ctx);
+
        /*
         * called when a geometry is disposed of, let the application
         * delete resources like textures etc