Update of /cvsroot/playerstage/code/stage/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26972/src

Modified Files:
      Tag: opengl
        model.c stage.h stage_internal.h world.c 
Log Message:
DOES NOT BUILD

Index: world.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/world.c,v
retrieving revision 1.63.4.2
retrieving revision 1.63.4.3
diff -C2 -d -r1.63.4.2 -r1.63.4.3
*** world.c     20 Dec 2006 03:01:13 -0000      1.63.4.2
--- world.c     23 Dec 2006 01:45:54 -0000      1.63.4.3
***************
*** 341,345 ****
    // there can't be more models than sections, so we'll use the number
    // of sections to build an intersection test array
!   world->intersections = calloc( section_count*section_count, sizeof(unsigned 
short) );
    
    world->section_count = section_count;
--- 341,346 ----
    // there can't be more models than sections, so we'll use the number
    // of sections to build an intersection test array
!   //world->intersections = calloc( section_count*section_count, 
sizeof(unsigned short) );
!   world->intersections = calloc( 1024*1024, sizeof(unsigned short) );
    
    world->section_count = section_count;

Index: stage_internal.h
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/stage_internal.h,v
retrieving revision 1.58.2.3
retrieving revision 1.58.2.4
diff -C2 -d -r1.58.2.3 -r1.58.2.4
*** stage_internal.h    22 Dec 2006 23:56:57 -0000      1.58.2.3
--- stage_internal.h    23 Dec 2006 01:45:54 -0000      1.58.2.4
***************
*** 227,231 ****
        coordinates */
      //stg_endpoint_t endpts[6]; // in order {xmin,xmax,ymin,ymax,zmin,zmax}
!     stg_endpoint_bbox_t epbbox;
  
  
--- 227,231 ----
        coordinates */
      //stg_endpoint_t endpts[6]; // in order {xmin,xmax,ymin,ymax,zmin,zmax}
!     //stg_endpoint_bbox_t epbbox;
  
  

Index: model.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/model.c,v
retrieving revision 1.153.2.3
retrieving revision 1.153.2.4
diff -C2 -d -r1.153.2.3 -r1.153.2.4
*** model.c     22 Dec 2006 23:56:57 -0000      1.153.2.3
--- model.c     23 Dec 2006 01:45:54 -0000      1.153.2.4
***************
*** 299,326 ****
     
  
- void endpoint_pair_set_bounds(  stg_endpoint_pair_t* pair, double min, double 
max )
- {
-   pair->min.value = min;
-   pair->max.value = max;
- }
  
! void endpoint_pair_init( stg_endpoint_pair_t* pair, stg_model_t* mod, double 
min, double max )
  {
!   memset( pair, 0, sizeof(stg_endpoint_pair_t));
    
!   pair->min.type = STG_BEGIN; 
!   pair->min.mod = mod;
    
!   pair->max.type = STG_BEGIN; 
!   pair->max.mod = mod;
  
!   endpoint_pair_set_bounds( pair, min, max );
  }
  
! void endpoint_bbox_set_bounds( stg_endpoint_bbox_t* bbox, 
!                              double xmin, double xmax,
!                              double ymin, double ymax,
!                              double zmin, double zmax )
  {
    bbox->x.min.value = xmin;
    bbox->x.max.value = xmax;
--- 299,343 ----
     
  
  
! // add a polygon in world coordinates
! stg_endpoint_t* world_polygon_register( stg_world_t* world, 
!                                       stg_polygon_t* poly )
  {
!   // create the 6 endpoints that represent the global bounding box of
!   // this polygon
!   stg_endpoint_t* epts = calloc( sizeof(stg_endpoint_bbox_t), 6 );
    
!   int i;
!   for( i=0; i<6; i++ )
!     {
!       epts[i].type = i % 2; // 0 == STG_BEGIN, 1 == STG_END
!       epts[i].poly = poly;
!       epts[i].value = poly->bounds[i];
!     }
    
!   // add this model's endpoints to the world's lists
!   world->endpts.x = insert_endpoint( world->endpts.x, &epts[0] );
!   world->endpts.x = insert_endpoint( world->endpts.x, &epts[1] );
!   world->endpts.y = insert_endpoint( world->endpts.y, &epts[2] );
!   world->endpts.y = insert_endpoint( world->endpts.y, &epts[3] );
!   world->endpts.z = insert_endpoint( world->endpts.z, &epts[4] );
!   world->endpts.z = insert_endpoint( world->endpts.z, &epts[5] );  
!   
!   return epts;
! }
  
! void world_polygon_unregister( stg_world_t* world, 
!                              stg_polygon_t* poly )
! {
!   // TODO
  }
  
! // the polygon must have previously been registered
! void world_polygon_update( stg_world_t* world, stg_polygon_t* polygon )
!      
  {
+   // recalcuate the global bounding box of the polygon
+   
+ 
    bbox->x.min.value = xmin;
    bbox->x.max.value = xmax;
***************
*** 332,335 ****
--- 349,353 ----
  
  
+ 
  stg_model_t* stg_model_create( stg_world_t* world, 
                               stg_model_t* parent,
***************
*** 423,445 ****
  
  
! 
!   int i;
!   for( i=0; i<6; i++ )
!     {
!       mod->endpts[i].mod = mod;
!       mod->endpts[i].type = i % 2; // 0 is STG_BEGIN, 1 is STG_END
!       mod->endpts[i].value = 0.0;
!       mod->endpts[i].prev = NULL;
!       mod->endpts[i].next = NULL;
!     }
  
    // add this model's endpoints to the world's lists
!   world->endpts.x = prepend_endpoint( world->endpts.x, &mod->endpts.x.min );
!   world->endpts.x = prepend_endpoint( world->endpts.x, &mod->endpts.x.max );
!   world->endpts.y = prepend_endpoint( world->endpts.y, &mod->endpts.y.min );
!   world->endpts.y = prepend_endpoint( world->endpts.y, &mod->endpts.y.max );
!   world->endpts.z = prepend_endpoint( world->endpts.z, &mod->endpts.z.min );
!   world->endpts.z = prepend_endpoint( world->endpts.z, &mod->endpts.z.max );
! 
  
    //print_endpoint_list( "XLIST", world->endpts.x  );
--- 441,448 ----
  
  
!   endpoint_bbox_init( &mod->epbbox, mod, 0,0,0,0,0,0 );
  
    // add this model's endpoints to the world's lists
!   world_add_endpoint_bbox( mod->world, &mod->epbbox );
  
    //print_endpoint_list( "XLIST", world->endpts.x  );
***************
*** 876,924 ****
  }
  
! // careful: no error checking - this must be fast
! GList* list_link_left( GList* head, GList* link )
! {
!   assert( head );
!   assert( link );
!   assert( link->prev );
    
!   GList *a = link->prev->prev;
!   GList *b = link->prev;
!   GList *c = link;
!   GList *d = link->next;
  
!   if( a ) a->next = c; else head = c;
!   if( d ) d->prev = b;
  
!   b->prev = c;
!   b->next = d;
!   c->prev = a;
!   c->next = b;
  
!   return head;
! }
  
!   // careful: no error checking - this must be fast
! GList* list_link_right( GList* head, GList* link )
! {
!   assert( head );
!   assert( link );
!   assert( link->next );
  
!   GList *a = link->prev;
!   GList *b = link;
!   GList *c = link->next;
!   GList *d = link->next->next;
  
!   if( a ) a->next = c; else head = c;
!   if( d ) d->prev = b;
  
!   b->prev = c;
!   b->next = d;
!   c->prev = a;
!   c->next = b;
   
!   return head;
! }
  
  static inline stg_endpoint_t* endpoint_right_intersect( stg_endpoint_t* head, 
 stg_endpoint_t* ep )
--- 879,927 ----
  }
  
! /* // careful: no error checking - this must be fast */
! /* GList* list_link_left( GList* head, GList* link ) */
! /* { */
! /*   assert( head ); */
! /*   assert( link ); */
! /*   assert( link->prev ); */
    
! /*   GList *a = link->prev->prev; */
! /*   GList *b = link->prev; */
! /*   GList *c = link; */
! /*   GList *d = link->next; */
  
! /*   if( a ) a->next = c; else head = c; */
! /*   if( d ) d->prev = b; */
  
! /*   b->prev = c; */
! /*   b->next = d; */
! /*   c->prev = a; */
! /*   c->next = b; */
  
! /*   return head; */
! /* } */
  
! /*   // careful: no error checking - this must be fast */
! /* GList* list_link_right( GList* head, GList* link ) */
! /* { */
! /*   assert( head ); */
! /*   assert( link ); */
! /*   assert( link->next ); */
  
! /*   GList *a = link->prev; */
! /*   GList *b = link; */
! /*   GList *c = link->next; */
! /*   GList *d = link->next->next; */
  
! /*   if( a ) a->next = c; else head = c; */
! /*   if( d ) d->prev = b; */
  
! /*   b->prev = c; */
! /*   b->next = d; */
! /*   c->prev = a; */
! /*   c->next = b; */
   
! /*   return head; */
! /* } */
  
  static inline stg_endpoint_t* endpoint_right_intersect( stg_endpoint_t* head, 
 stg_endpoint_t* ep )
***************
*** 937,956 ****
  }    
  
- static inline stg_endpoint_t* move_endpoint_pair( stg_endpoint_t* list, 
-                                                 stg_endpoint_pair_t* pair )
- {
-   list = bubble( list, &pair.min );
-   list = bubble( list, &pair.max );
-   return list;
- }
- 
- 
- static inline void world_move_endpoint_bbox( stg_world_t* world, 
stg_endpoint_bbox_t* epbbox )
- {
-   world->endpts.x = move_endpoint_pair( world->endpts.x, &epbbox.x );
-   world->endpts.y = move_endpoint_pair( world->endpts.y, &epbbox.y );
-   world->endpts.z = move_endpoint_pair( world->endpts.y, &epbbox.z );
- }
- 
  // locally shifts the endpoint into order in its list. returns the
  // head of the list, which may have changed
--- 940,943 ----
***************
*** 966,1009 ****
  }
  
! void model_update_bbox( stg_model_t* mod )
  {
!   //printf( "UPDATE BBOX for model %s\n", mod->token );
  
!   stg_pose_t gpose;
!   stg_model_get_global_pose( mod, &gpose );
  
-   double dx_x =  fabs(mod->geom.size.x * cos(gpose.a)); 
-   double dx_y =  fabs(mod->geom.size.y * sin(gpose.a));
-   double dx = dx_x + dx_y;
  
!   double dy_x = fabs(mod->geom.size.x * sin(gpose.a));
!   double dy_y = fabs(mod->geom.size.y * cos(gpose.a));
!   double dy = dy_x + dy_y;
  
!   double dz = mod->geom.size.z;
  
!   // stuff these data into the endpoint structures
!   mod->epbbox.x.min.value = gpose.x - dx/2.0;
!   mod->epbbox.x.max..value = gpose.x + dx/2.0;
!   mod->epbbox.y.min.value = gpose.y - dy/2.0;
!   mod->epbbox.y.max.value = gpose.y + dy/2.0;
!   mod->epbbox.z.min.value = gpose.z;
!   mod->epbbox.z.max.value = gpose.z + dz;
  
!   // bubble sort the end points of the bounding box in the lists along
!   // each axis - bubble sort is VERY fast because we usually don't
!   // move, but occasionally move 1 place left or right
    
!   world_move_endpoint_bbox( mod->world, &mod->epbbox );
  
- /*   mod->world->endpts.x = bubble( mod->world->endpts.x, &mod->endpts.x.min 
); */
- /*   mod->world->endpts.x = bubble( mod->world->endpts.x, &mod->endpts.x.max 
); */
- /*   mod->world->endpts.y = bubble( mod->world->endpts.y, &mod->endpts[2] ); 
*/
- /*   mod->world->endpts.y = bubble( mod->world->endpts.y, &mod->endpts[3] ); 
*/
- /*   mod->world->endpts.z = bubble( mod->world->endpts.z, &mod->endpts[4] ); 
*/
- /*   mod->world->endpts.z = bubble( mod->world->endpts.z, &mod->endpts[5] ); 
*/
  
!   //world_intercept_array_print( mod->world );
! }
  
  void stg_model_set_pose( stg_model_t* mod, stg_pose_t* pose )
--- 953,1002 ----
  }
  
! 
! static inline void world_move_endpoint( stg_world_t* world, stg_endpoint_t* 
epts )
  {
!   // bubble sort the end points of the bounding box in the lists along
!   // each axis - bubble sort is VERY fast because we usually don't
!   // move, but occasionally move 1 place left or right
  
!   world->endpts.x = bubble( world->endpts.x, &epts[0] );
!   world->endpts.x = bubble( world->endpts.x, &epts[1] );
!   world->endpts.y = bubble( world->endpts.y, &epts[2] );
!   world->endpts.y = bubble( world->endpts.y, &epts[3] );
!   world->endpts.z = bubble( world->endpts.z, &epts[4] );
!   world->endpts.z = bubble( world->endpts.z, &epts[5] );
! }
  
  
! /* void model_update_bbox( stg_model_t* mod ) */
! /* { */
! /*   //printf( "UPDATE BBOX for model %s\n", mod->token ); */
  
! /*   stg_pose_t gpose; */
! /*   stg_model_get_global_pose( mod, &gpose ); */
  
! /*   double dx_x =  fabs(mod->geom.size.x * cos(gpose.a));  */
! /*   double dx_y =  fabs(mod->geom.size.y * sin(gpose.a)); */
! /*   double dx = dx_x + dx_y; */
  
! /*   double dy_x = fabs(mod->geom.size.x * sin(gpose.a)); */
! /*   double dy_y = fabs(mod->geom.size.y * cos(gpose.a)); */
! /*   double dy = dy_x + dy_y; */
! 
! /*   double dz = mod->geom.size.z; */
! 
! /*   // stuff these data into the endpoint structures */
! /* /\*   mod->epbbox.x.min.value = gpose.x - dx/2.0; *\/ */
! /* /\*   mod->epbbox.x.max.value = gpose.x + dx/2.0; *\/ */
! /* /\*   mod->epbbox.y.min.value = gpose.y - dy/2.0; *\/ */
! /* /\*   mod->epbbox.y.max.value = gpose.y + dy/2.0; *\/ */
! /* /\*   mod->epbbox.z.min.value = gpose.z; *\/ */
! /* /\*   mod->epbbox.z.max.value = gpose.z + dz; *\/ */
    
! /* /\*   world_move_endpoint_bbox( mod->world, &mod->epbbox ); *\/ */
  
  
! /*   //world_intercept_array_print( mod->world ); */
! /* } */
  
  void stg_model_set_pose( stg_model_t* mod, stg_pose_t* pose )
***************
*** 1020,1029 ****
        memcpy( &mod->pose, pose, sizeof(stg_pose_t));
        
!       model_update_bbox( mod );
  
        // TODO - can we do this less frequently? maybe not...
!       GList *it;
!       for( it=mod->children; it; it=it->next )
!       model_update_bbox( (stg_model_t*)it->data );
  
        double hitx, hity;
--- 1013,1022 ----
        memcpy( &mod->pose, pose, sizeof(stg_pose_t));
        
!       //model_update_bbox( mod );
  
        // TODO - can we do this less frequently? maybe not...
!       //GList *it;
!       //for( it=mod->children; it; it=it->next )
!       //model_update_bbox( (stg_model_t*)it->data );
  
        double hitx, hity;
***************
*** 1060,1064 ****
    stg_polygons_normalize( mod->polygons, mod->polygons_count, 
                          geom->size.x, geom->size.y );
!   model_update_bbox( mod );
    
    model_change( mod, &mod->polygons );
--- 1053,1057 ----
    stg_polygons_normalize( mod->polygons, mod->polygons_count, 
                          geom->size.x, geom->size.y );
!   //model_update_bbox( mod );
    
    model_change( mod, &mod->polygons );
***************
*** 1244,1247 ****
--- 1237,1247 ----
        // add the polys to the endpoint lists
  
+       int p;
+       for ( p=0; p<poly_count; p++ )
+       {
+         endpoint_bbox_init( &polys[p].epbbox, mod, 0,1,0,1,0,1 );
+         world_add_endpoint_bbox( mod->world, &polys[p].epbbox );
+       }      
+ 
      }
  

Index: stage.h
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/stage.h,v
retrieving revision 1.189.2.3
retrieving revision 1.189.2.4
diff -C2 -d -r1.189.2.3 -r1.189.2.4
*** stage.h     22 Dec 2006 23:56:57 -0000      1.189.2.3
--- stage.h     23 Dec 2006 01:45:54 -0000      1.189.2.4
***************
*** 313,317 ****
      stg_endpoint_type_t type;
      stg_meters_t value;
-     stg_model_t* mod;
      stg_polygon_t* polygon; //< the polygon that contains this endpoint
      
--- 313,316 ----
***************
*** 324,341 ****
      
    } stg_endpoint_t;
!   
!   typedef struct {
!     stg_endpoint_t min, max;
!   } stg_endpoint_pair_t;
!   
!   typedef struct
!   {
!     stg_endpoint_pair_t x,y,z;
!   } stg_endpoint_bbox_t;
!     
  
    /** define a polygon: a set of connected vertices drawn with a
        color. Can be drawn filled or unfilled. */
!   typedef struct stg_polygon
    {
      /// pointer to an array of points
--- 323,331 ----
      
    } stg_endpoint_t;
!       
  
    /** define a polygon: a set of connected vertices drawn with a
        color. Can be drawn filled or unfilled. */
!   struct stg_polygon
    {
      /// pointer to an array of points
***************
*** 354,364 ****
      stg_model_t* mod;
  
!     /// axis-aligned bounding volume
!     stg_bbox3d_t bbox;
! 
!     stg_endpoint_bbox_t epbbox;
  
      void* _data; // temporary internal use only
!   };// stg_polygon_t; 
  
    
--- 344,352 ----
      stg_model_t* mod;
  
!     /// 3D axis-aligned global bounding volume
!     double bounds[6]; 
  
      void* _data; // temporary internal use only
!   }; 
  
    


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to