From: Michel Pollet Date: Tue, 12 Jun 2012 17:33:52 +0000 (+0100) Subject: c3context: Added a view draw callback X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=d63b5c761a663ecccd8f2d6969016a8b596a61e7;p=simavr c3context: Added a view draw callback Unused for now, prepares a view to be drawn Signed-off-by: Michel Pollet --- diff --git a/examples/shared/libc3/src/c3context.c b/examples/shared/libc3/src/c3context.c index 8a85c93..af8e901 100644 --- a/examples/shared/libc3/src/c3context.c +++ b/examples/shared/libc3/src/c3context.c @@ -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); diff --git a/examples/shared/libc3/src/c3context.h b/examples/shared/libc3/src/c3context.h index 93514cf..aac6be8 100644 --- a/examples/shared/libc3/src/c3context.h +++ b/examples/shared/libc3/src/c3context.h @@ -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___ */ diff --git a/examples/shared/libc3/src/c3driver_context.h b/examples/shared/libc3/src/c3driver_context.h index 64d2449..221b026 100644 --- a/examples/shared/libc3/src/c3driver_context.h +++ b/examples/shared/libc3/src/c3driver_context.h @@ -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