Commit 28a895184b561b9054a55b705eb3aeb5d7dc2df2
authorMichel Pollet <buserror@gmail.com>
Fri, 15 Jun 2012 08:17:47 +0000 (09:17 +0100)
committerMichel Pollet <buserror@gmail.com>
Fri, 15 Jun 2012 08:17:47 +0000 (09:17 +0100)
Also dirties parent object

Signed-off-by: Michel Pollet <buserror@gmail.com>
2 files changed:
examples/shared/libc3/src/c3geometry.c
examples/shared/libc3/src/c3geometry.h

index 9c5d359bb3030f40c3b9f480d1715fa7e53a06c4..2b62d5bff376e8f40df181b889c0b4ff27ab8b29 100644 (file)
@@ -176,10 +176,9 @@ c3geometry_factor(
                c3f tolerance,
                c3f normaltolerance)
 {
-       printf("%s Start geometry has %d vertices and %d indexes\n", __func__,
-                       g->vertice.count, g->indices.count);
-       printf("%s Start geometry has %d normals and %d tex\n", __func__,
-                       g->normals.count, g->textures.count);
+       printf("%s has %d/%d/%d vertices/normals/tex and %d indexes\n", __func__,
+                       g->vertice.count, g->normals.count, g->textures.count,
+                       g->indices.count);
 
        c3f tolerance2 = tolerance * tolerance;
 
@@ -246,8 +245,18 @@ c3geometry_factor(
                g->colorf.count = output;
                c3colorf_array_realloc(&g->colorf, output);
        }
-       g->dirty = 1;
+       c3geometry_set_dirty(g, 1);
 
-       printf("%s end geometry has %d vertices and %d indexes\n",  __func__,
+       printf("%s converted to %d vertices and %d indexes\n",  __func__,
                        g->vertice.count, g->indices.count);
 }
+
+void
+c3geometry_set_dirty(
+               c3geometry_p g,
+               int dirty )
+{
+       g->dirty = dirty;
+       if (dirty && g->object)
+               c3object_set_dirty(g->object, 1);
+}
index 18d26deeff99e8414f3bf5d2c5849590e4adac6a..548f22c7b4e6243f9a189e1802aaff590084da28 100644 (file)
@@ -94,7 +94,8 @@ typedef struct c3geometry_type_t {
 typedef struct c3geometry_t {
        c3geometry_type_t       type;   // geometry type
        int                                     dirty : 1,
-                                               custom : 1;             // has a custom driver
+                                               custom : 1,             // has a custom driver
+                                               hidden : 8;             // hidden from context_view, bitfield
        str_p                           name;   // optional
        c3apiobject_t           bid;    // buffer id for opengl
 
@@ -160,6 +161,15 @@ void
 c3geometry_draw(
                c3geometry_p g );
 
+//! Sets or clear geometry dirty bit
+/*
+ * This will dirty parent objects if set to 1
+ */
+void
+c3geometry_set_dirty(
+               c3geometry_p g,
+               int dirty );
+
 /*
  * if not present, create an index array, and collapses
  * the vertex array by removing vertices that are within