Update of /cvsroot/playerstage/code/stage/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18720/src
Modified Files:
Tag: opengl
gui_gl.c model.c p_driver.cc stage.h stage_internal.h
Log Message:
Foo
Index: p_driver.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/p_driver.cc,v
retrieving revision 1.37.4.2
retrieving revision 1.37.4.3
diff -C2 -d -r1.37.4.2 -r1.37.4.3
*** p_driver.cc 20 Dec 2006 03:01:13 -0000 1.37.4.2
--- p_driver.cc 22 Dec 2006 23:56:57 -0000 1.37.4.3
***************
*** 153,156 ****
--- 153,162 ----
#include "zoo_driver.h"
+ const char* copyright_notice =
+ "\n * Part of the Player Project [http://playerstage.sourceforge.net]\n"
+ " * Copyright 2000-2006 Richard Vaughan, Brian Gerkey, Andrew Howard \n"
+ " * and contributors. Released under the GNU General Public License v2.\n"
+ " **\n";
+
#define STG_DEFAULT_WORLDFILE "default.world"
#define DRIVER_ERROR(X) printf( "Stage driver error: %s\n", X )
***************
*** 194,200 ****
if( !player_quiet_startup )
{
! puts( "\n * Part of the Player/Stage Project
[http://playerstage.sourceforge.net]\n"
! " * Copyright 2000-2006 Richard Vaughan, Andrew Howard, Brian
Gerkey\n"
! " * and contributors. Released under the GNU General Public License
v2." );
}
--- 200,204 ----
if( !player_quiet_startup )
{
! puts( copyright_notice );
}
Index: gui_gl.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/gui_gl.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** gui_gl.c 20 Dec 2006 03:01:13 -0000 1.1.2.3
--- gui_gl.c 22 Dec 2006 23:56:57 -0000 1.1.2.4
***************
*** 1170,1175 ****
//for( p=0; p<mod->polygons_count; p++ )
{
!
! stg_endpoint_t* endpts = mod->endpts;
// model's body color
--- 1170,1179 ----
//for( p=0; p<mod->polygons_count; p++ )
{
! double xmin = mod->epbbox.x.min.value;
! double xmax = mod->epbbox.x.max.value;
! double ymin = mod->epbbox.y.min.value;
! double ymax = mod->epbbox.y.max.value;
! double zmin = mod->epbbox.z.min.value;
! double zmax = mod->epbbox.z.max.value;
// model's body color
***************
*** 1178,1220 ****
// draw rectangles on the axes indicating the extent of bboxes.
glBegin(GL_LINE_LOOP );
! glVertex3f( endpts[0].value, 0, endpts[4].value);
! glVertex3f( endpts[0].value, 0, endpts[5].value);
! glVertex3f( endpts[1].value, 0, endpts[5].value);
! glVertex3f( endpts[1].value, 0, endpts[4].value);
glEnd();
glBegin(GL_LINE_LOOP );
! glVertex3f( 0, endpts[2].value, endpts[4].value);
! glVertex3f( 0, endpts[2].value, endpts[5].value);
! glVertex3f( 0, endpts[3].value, endpts[5].value);
! glVertex3f( 0, endpts[3].value, endpts[4].value);
glEnd();
// bottom rectangle
glBegin(GL_LINE_LOOP );
! glVertex3f( endpts[0].value, endpts[2].value, endpts[4].value );
! glVertex3f( endpts[0].value, endpts[3].value, endpts[4].value );
! glVertex3f( endpts[1].value, endpts[3].value, endpts[4].value );
! glVertex3f( endpts[1].value, endpts[2].value, endpts[4].value );
glEnd();
// top rectangle
glBegin(GL_LINE_LOOP );
! glVertex3f( endpts[0].value, endpts[2].value, endpts[5].value );
! glVertex3f( endpts[0].value, endpts[3].value, endpts[5].value );
! glVertex3f( endpts[1].value, endpts[3].value, endpts[5].value );
! glVertex3f( endpts[1].value, endpts[2].value, endpts[5].value );
glEnd();
// verticals
glBegin( GL_LINES );
! glVertex3f( endpts[0].value, endpts[2].value, endpts[4].value );
! glVertex3f( endpts[0].value, endpts[2].value, endpts[5].value );
! glVertex3f( endpts[1].value, endpts[2].value, endpts[4].value );
! glVertex3f( endpts[1].value, endpts[2].value, endpts[5].value );
! glVertex3f( endpts[0].value, endpts[3].value, endpts[4].value );
! glVertex3f( endpts[0].value, endpts[3].value, endpts[5].value );
! glVertex3f( endpts[1].value, endpts[3].value, endpts[4].value );
! glVertex3f( endpts[1].value, endpts[3].value, endpts[5].value );
glEnd();
--- 1182,1224 ----
// draw rectangles on the axes indicating the extent of bboxes.
glBegin(GL_LINE_LOOP );
! glVertex3f( xmin, 0, zmin);
! glVertex3f( xmin, 0, zmax);
! glVertex3f( xmax, 0, zmax);
! glVertex3f( xmax, 0, zmin);
glEnd();
glBegin(GL_LINE_LOOP );
! glVertex3f( 0, ymin, zmin);
! glVertex3f( 0, ymin, zmax);
! glVertex3f( 0, ymax, zmax);
! glVertex3f( 0, ymax, zmin);
glEnd();
// bottom rectangle
glBegin(GL_LINE_LOOP );
! glVertex3f( xmin, ymin, zmin );
! glVertex3f( xmin, ymax, zmin );
! glVertex3f( xmax, ymax, zmin );
! glVertex3f( xmax, ymin, zmin );
glEnd();
// top rectangle
glBegin(GL_LINE_LOOP );
! glVertex3f( xmin, ymin, zmax );
! glVertex3f( xmin, ymax, zmax );
! glVertex3f( xmax, ymax, zmax );
! glVertex3f( xmax, ymin, zmax );
glEnd();
// verticals
glBegin( GL_LINES );
! glVertex3f( xmin, ymin, zmin );
! glVertex3f( xmin, ymin, zmax );
! glVertex3f( xmax, ymin, zmin );
! glVertex3f( xmax, ymin, zmax );
! glVertex3f( xmin, ymax, zmin );
! glVertex3f( xmin, ymax, zmax );
! glVertex3f( xmax, ymax, zmin );
! glVertex3f( xmax, ymax, zmax );
glEnd();
Index: stage_internal.h
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/stage_internal.h,v
retrieving revision 1.58.2.2
retrieving revision 1.58.2.3
diff -C2 -d -r1.58.2.2 -r1.58.2.3
*** stage_internal.h 20 Dec 2006 03:01:13 -0000 1.58.2.2
--- stage_internal.h 22 Dec 2006 23:56:57 -0000 1.58.2.3
***************
*** 128,149 ****
} stg_type_record_t;
- typedef enum {
- STG_BEGIN=0,
- STG_END
- } stg_endpoint_type_t;
-
- typedef struct stg_endpoint {
- stg_endpoint_type_t type;
- stg_meters_t value;
- stg_model_t* mod;
-
- //GList* list; // endpoints are usually stored in a list. this can
- // be used to access the endpoint in the list
- // directly
-
- // endpoints are stored in linked lists
- struct stg_endpoint *next, *prev;
-
- } stg_endpoint_t;
typedef struct {
--- 128,131 ----
***************
*** 244,248 ****
/** specify an axis-aligned 3d bounding box in global
coordinates */
! stg_endpoint_t endpts[6]; // in order {xmin,xmax,ymin,ymax,zmin,zmax}
// TODO - optionally thread-safe version allow exclusive access
--- 226,232 ----
/** specify an axis-aligned 3d bounding box in global
coordinates */
! //stg_endpoint_t endpts[6]; // in order {xmin,xmax,ymin,ymax,zmin,zmax}
! stg_endpoint_bbox_t epbbox;
!
// TODO - optionally thread-safe version allow exclusive access
Index: model.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/model.c,v
retrieving revision 1.153.2.2
retrieving revision 1.153.2.3
diff -C2 -d -r1.153.2.2 -r1.153.2.3
*** model.c 20 Dec 2006 03:01:13 -0000 1.153.2.2
--- model.c 22 Dec 2006 23:56:57 -0000 1.153.2.3
***************
*** 298,301 ****
--- 298,335 ----
/* } */
+
+ 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;
+ bbox->y.min.value = ymin;
+ bbox->y.max.value = ymax;
+ bbox->z.min.value = zmin;
+ bbox->z.max.value = zmax;
+ }
+
+
stg_model_t* stg_model_create( stg_world_t* world,
stg_model_t* parent,
***************
*** 388,391 ****
--- 422,427 ----
mod->gui_mask = mod->parent ? 0 : STG_DEFAULT_MASK;
+
+
int i;
for( i=0; i<6; i++ )
***************
*** 399,408 ****
// add this model's endpoints to the world's lists
! world->endpts.x = prepend_endpoint( world->endpts.x, &mod->endpts[0]);
! world->endpts.x = prepend_endpoint( world->endpts.x, &mod->endpts[1]);
! world->endpts.y = prepend_endpoint( world->endpts.y, &mod->endpts[2]);
! world->endpts.y = prepend_endpoint( world->endpts.y, &mod->endpts[3]);
! world->endpts.z = prepend_endpoint( world->endpts.z, &mod->endpts[4]);
! world->endpts.z = prepend_endpoint( world->endpts.z, &mod->endpts[5]);
--- 435,444 ----
// 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 );
***************
*** 901,904 ****
--- 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
***************
*** 932,941 ****
// stuff these data into the endpoint structures
! mod->endpts[0].value = gpose.x - dx/2.0;
! mod->endpts[1].value = gpose.x + dx/2.0;
! mod->endpts[2].value = gpose.y - dy/2.0;
! mod->endpts[3].value = gpose.y + dy/2.0;
! mod->endpts[4].value = gpose.z;
! mod->endpts[5].value = gpose.z + dz;
// bubble sort the end points of the bounding box in the lists along
--- 984,993 ----
// 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
***************
*** 943,952 ****
// move, but occasionally move 1 place left or right
! mod->world->endpts.x = bubble( mod->world->endpts.x, &mod->endpts[0] );
! mod->world->endpts.x = bubble( mod->world->endpts.x, &mod->endpts[1] );
! 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 );
--- 995,1006 ----
// 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 );
***************
*** 1187,1190 ****
--- 1241,1247 ----
// if the model has some non-zero
stg_model_map( mod, 1 ); // map the model into the matrix with the new
polys
+
+ // add the polys to the endpoint lists
+
}
Index: stage.h
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/stage.h,v
retrieving revision 1.189.2.2
retrieving revision 1.189.2.3
diff -C2 -d -r1.189.2.2 -r1.189.2.3
*** stage.h 20 Dec 2006 03:01:13 -0000 1.189.2.2
--- stage.h 22 Dec 2006 23:56:57 -0000 1.189.2.3
***************
*** 301,307 ****
*/
/** define a polygon: a set of connected vertices drawn with a
color. Can be drawn filled or unfilled. */
! typedef struct
{
/// pointer to an array of points
--- 301,341 ----
*/
+ typedef enum {
+ STG_BEGIN=0,
+ STG_END
+ } stg_endpoint_type_t;
+
+
+ // forward declaration
+ typedef struct stg_polygon stg_polygon_t;
+
+ typedef struct stg_endpoint {
+ stg_endpoint_type_t type;
+ stg_meters_t value;
+ stg_model_t* mod;
+ stg_polygon_t* polygon; //< the polygon that contains this endpoint
+
+ //GList* list; // endpoints are usually stored in a list. this can
+ // be used to access the endpoint in the list
+ // directly
+
+ // endpoints are stored in linked lists
+ struct stg_endpoint *next, *prev;
+
+ } 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,328 ****
stg_bbox3d_t bbox;
void* _data; // temporary internal use only
! } stg_polygon_t;
--- 357,364 ----
stg_bbox3d_t bbox;
+ stg_endpoint_bbox_t epbbox;
+
void* _data; // temporary internal use only
! };// stg_polygon_t;
-------------------------------------------------------------------------
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