--- libgender/entity.h 2004/10/04 02:06:57 1.13 +++ libgender/entity.h 2004/10/05 03:39:47 1.17 @@ -17,7 +17,7 @@ vector o; box bbox; - virtual void update_bbox (); + virtual void update (); virtual void show () { world.add (this); }; void hide (); void display (draw_context &ctx); @@ -28,8 +28,14 @@ }; struct entity_container : entity_base, protected vector { - void add (entity_base *e) { push_back (e); e->parent = this; } - void update_bbox (); + void add (entity_base *e) + { + push_back (e); + e->parent = this; + update (); + } + + void update (); void show (); void draw (draw_context &ctx); ~entity_container (); @@ -44,6 +50,7 @@ { this->e = e; e->parent = this; + update (); } void remove () @@ -54,7 +61,7 @@ entity_base *content () { return e; }; - void update_bbox (); + void update (); void show (); void draw (draw_context &ctx); ~entity_filter (); @@ -86,7 +93,7 @@ template struct entity_opengl1d : entity_opengl, vector { - void update_bbox (); + void update (); void draw (draw_context &ctx); }; @@ -96,7 +103,6 @@ void set (const vector &v); void draw (draw_context &ctx); - }; typedef entity_opengl1d entity_points; @@ -111,13 +117,18 @@ typedef entity_opengl2d entity_polygon; struct entity_transform : entity_filter { - gl_matrix m; +protected: + matrix m; + void renormalize (); +public: entity_transform (); - void update_bbox (); + void update (); void show (); void draw (draw_context &ctx); + void set_matrix (const matrix &xfrm); + void update (const matrix &xfrm); }; struct entity_anim : entity_transform {