Commit d63b5c761a663ecccd8f2d6969016a8b596a61e7
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>
3 files changed:
examples/shared/libc3/src/c3context.c
examples/shared/libc3/src/c3context.h
examples/shared/libc3/src/c3driver_context.h

index 8a85c93f216438c525f09f0a9786d34336488419..af8e901901845e3fd9b84f1fa405e398f3d3c30b 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 93514cf264914ec8e5d89395567e4c9a77308acf..aac6be8e8325978b6f9cdff3ec9a19cf31b80df6 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 64d24495a868693ab74aa25bef490d93d5ee728f..221b026a56e4160d198c6cb78029ff1d29971eb9 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