Update of /cvsroot/playerstage/code/stage/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2738
Modified Files:
Tag: opengl
gui_gl.c gui_gtk.cc matrix.c model.cc model_laser.cc
model_load.cc raytrace.cc stage.c stage_internal.h stest.cc
Log Message:
cleaned up graphics code for ranger & laser
Index: stest.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/stest.cc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** stest.cc 17 Jul 2007 05:26:44 -0000 1.1.2.3
--- stest.cc 18 Jul 2007 06:19:27 -0000 1.1.2.4
***************
*** 82,87 ****
while( (stg_world_update( world,0 )==0) )
{
- ranger->Print( NULL );
-
// get some laser data
size_t laser_sample_count = laser->sample_count;
--- 82,85 ----
***************
*** 90,94 ****
if( laserdata == NULL )
continue;
-
// THIS IS ADAPTED FROM PLAYER'S RANDOMWALK C++ EXAMPLE
--- 88,91 ----
***************
*** 146,150 ****
newturnrate = DTOR(randint);
! randcount = 20;
}
randcount--;
--- 143,147 ----
newturnrate = DTOR(randint);
! randcount = 50;
}
randcount--;
Index: model_laser.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/model_laser.cc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** model_laser.cc 17 Jul 2007 05:26:44 -0000 1.1.2.6
--- model_laser.cc 18 Jul 2007 06:19:26 -0000 1.1.2.7
***************
*** 35,39 ****
#define STG_DEFAULT_LASER_FOV M_PI
#define STG_DEFAULT_LASER_SAMPLES 180
! #define STG_DEFAULT_LASER_INTERVAL_MS 200
#define STG_DEFAULT_LASER_RESOLUTION 1
--- 35,39 ----
#define STG_DEFAULT_LASER_FOV M_PI
#define STG_DEFAULT_LASER_SAMPLES 180
! #define STG_DEFAULT_LASER_INTERVAL_MS 100
#define STG_DEFAULT_LASER_RESOLUTION 1
***************
*** 121,124 ****
--- 121,125 ----
sample_count = wf->ReadInt( id, "samples", sample_count );
samples = g_renew( stg_laser_sample_t, samples, sample_count );
+ bzero( samples, sizeof(stg_laser_sample_t) * sample_count );
range_min = wf->ReadLength( id, "range_min", range_min);
***************
*** 198,203 ****
if( resolution > 1 )
{
! for( int t=resolution; t<sample_count; t+=resolution )
! for( int g=1; g<resolution; g++ )
{
if( t >= sample_count )
--- 199,204 ----
if( resolution > 1 )
{
! for( unsigned int t=resolution; t<sample_count; t+=resolution )
! for( unsigned int g=1; g<resolution; g++ )
{
if( t >= sample_count )
***************
*** 217,259 ****
}
- // rebuild the graphics for this data
- glNewList( dl_data, GL_COMPILE );
- //
- if( samples && sample_count )
- {
- // do alpha properly
- glDepthMask( GL_FALSE );
-
- glPushMatrix();
- glTranslatef( 0,0, geom.size.z/2.0 ); // shoot the laser beam out at
the right height
-
- // pack the laser hit points into a vertex array for fast rendering
- static float* pts = NULL;
- pts = (float*)g_realloc( pts, 2 * (sample_count+1) * sizeof(float));
-
- pts[0] = 0.0;
- pts[1] = 0.0;
-
- for( int s=0; s<sample_count; s++ )
- {
- double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
- pts[2*s+2] = (float)(samples[s].range * cos(ray_angle) );
- pts[2*s+3] = (float)(samples[s].range * sin(ray_angle) );
- }
-
- glEnableClientState( GL_VERTEX_ARRAY );
- glVertexPointer( 2, GL_FLOAT, 0, pts );
-
- glColor4f( 0, 0, 1, 0.1 );
- glPolygonMode( GL_FRONT_AND_BACK, world->win->show_alpha ? GL_FILL :
GL_LINES );
- glDrawArrays( GL_POLYGON, 0, sample_count+1 );
-
- glPopMatrix();
- glDepthMask( GL_TRUE );
- }
-
- glEndList();
! world->win->dirty = true;
#if TIMING
--- 218,223 ----
}
! data_dirty = true;
#if TIMING
***************
*** 292,316 ****
}
! //void StgModelLaser::GuiGenerateData( void )
! //{
! //puts ("GL laser data" );
- //make_dirty(mod);
! /* // loop through again, drawing bright boxes on top of the polygon */
! /* for( s=0; s<sample_count; s++ ) */
! /* { */
! /* // if this hit point is bright, we draw a little box */
! /* if( samples[s].reflectance > 0 ) */
! /* { */
! /* stg_rtk_fig_color_rgb32( fg, bright_color ); */
! /* stg_rtk_fig_rectangle( fg, */
! /* points[1+s].x, points[1+s].y, 0, */
! /* 0.04, 0.04, 1 ); */
! /* stg_rtk_fig_color_rgb32( fg, laser_color ); */
! /* } */
! /* } */
--- 256,352 ----
}
+ void StgModelLaser::Print( char* prefix )
+ {
+ StgModel::Print( prefix );
+
+ printf( "\tRanges[ " );
+
+ for( unsigned int i=0; i<sample_count; i++ )
+ printf( "%.2f ", samples[i].range );
+ puts( " ]" );
! printf( "\tReflectance[ " );
!
! for( unsigned int i=0; i<sample_count; i++ )
! printf( "%.2f ", samples[i].reflectance );
! puts( " ]" );
! }
!
! void StgModelLaser::DListData( void )
! {
! // rebuild the graphics for this data
! glNewList( dl_data, GL_COMPILE );
!
! if( samples && sample_count )
! {
!
! glPushMatrix();
! glTranslatef( 0,0, geom.size.z/2.0 ); // shoot the laser beam out at
the right height
!
! // pack the laser hit points into a vertex array for fast rendering
! static float* pts = NULL;
! pts = (float*)g_realloc( pts, 2 * (sample_count+1) * sizeof(float));
!
! pts[0] = 0.0;
! pts[1] = 0.0;
!
! push_color_rgba( 0, 0, 1, 0.5 );
!
! for( unsigned int s=0; s<sample_count; s++ )
! {
! double ray_angle = (s * (fov / (sample_count-1))) - fov/2.0;
! pts[2*s+2] = (float)(samples[s].range * cos(ray_angle) );
! pts[2*s+3] = (float)(samples[s].range * sin(ray_angle) );
!
! // if the sample is unusually bright, draw a little blob
! if( samples[s].reflectance > 0 )
! {
! glPointSize( 4.0 );
! glBegin( GL_POINTS );
! glVertex2f( pts[2*s+2], pts[2*s+3] );
! glEnd();
! }
!
! }
! pop_color();
!
! glPointSize( 1.0 );
!
! glEnableClientState( GL_VERTEX_ARRAY );
! glVertexPointer( 2, GL_FLOAT, 0, pts );
!
!
! if( world->win->show_alpha )
! {
! glDepthMask( GL_FALSE );
!
! glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
! push_color_rgba( 0, 0, 1, 0.1 );
! glDrawArrays( GL_POLYGON, 0, sample_count+1 );
! pop_color();
!
! push_color_rgba( 0, 0, 0, 1.0 );
! glDrawArrays( GL_POINTS, 0, sample_count+1 );
! pop_color();
!
! glDepthMask( GL_TRUE );
! }
! else
! {
! glPolygonMode( GL_FRONT_AND_BACK, GL_LINES );
! push_color_rgb( 0, 0, 1 );
! glDrawArrays( GL_POLYGON, 0, sample_count+1 );
! pop_color();
! }
!
! glPopMatrix();
! }
!
! glEndList();
! }
!
Index: stage.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/stage.c,v
retrieving revision 1.89.2.6
retrieving revision 1.89.2.7
diff -C2 -d -r1.89.2.6 -r1.89.2.7
*** stage.c 8 Jul 2007 01:44:09 -0000 1.89.2.6
--- stage.c 18 Jul 2007 06:19:27 -0000 1.89.2.7
***************
*** 392,397 ****
void pb_set_rect( GdkPixbuf* pb, int x, int y, int width, int height, uint8_t
val )
{
! int pbwidth = gdk_pixbuf_get_width(pb);
! int pbheight = gdk_pixbuf_get_height(pb);
int bytes_per_sample = gdk_pixbuf_get_bits_per_sample (pb) / 8;
int num_samples = gdk_pixbuf_get_n_channels(pb);
--- 392,397 ----
void pb_set_rect( GdkPixbuf* pb, int x, int y, int width, int height, uint8_t
val )
{
! //int pbwidth = gdk_pixbuf_get_width(pb);
! //int pbheight = gdk_pixbuf_get_height(pb);
int bytes_per_sample = gdk_pixbuf_get_bits_per_sample (pb) / 8;
int num_samples = gdk_pixbuf_get_n_channels(pb);
***************
*** 422,427 ****
int stg_rotrects_from_image_file( const char* filename,
stg_rotrect_t** rects,
! int* rect_count,
! int* widthp, int* heightp )
{
// TODO: make this a parameter
--- 422,428 ----
int stg_rotrects_from_image_file( const char* filename,
stg_rotrect_t** rects,
! unsigned int* rect_count,
! unsigned int* widthp,
! unsigned int* heightp )
{
// TODO: make this a parameter
Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/model.cc,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** model.cc 17 Jul 2007 05:26:43 -0000 1.1.2.6
--- model.cc 18 Jul 2007 06:19:26 -0000 1.1.2.7
***************
*** 1,37 ****
#define _GNU_SOURCE
#include <limits.h>
#include <assert.h>
#include <math.h>
! //#include <string.h> // for strdup(3)
!
! //#define DEBUG
#include "stage_internal.h"
#include "model.hh"
#include "gui.h"
- #include <GL/gl.h>
// basic model
! #define STG_DEFAULT_MASS 10.0 // kg
! #define STG_DEFAULT_GEOM_SIZEX 1.0 // 1m square by default
! #define STG_DEFAULT_GEOM_SIZEY 1.0
! #define STG_DEFAULT_GEOM_SIZEZ 1.0
! #define STG_DEFAULT_OBSTACLERETURN TRUE
! #define STG_DEFAULT_LASERRETURN LaserVisible
! #define STG_DEFAULT_RANGERRETURN TRUE
! #define STG_DEFAULT_BLOBRETURN TRUE
#define STG_DEFAULT_COLOR (0xFF0000) // red
#define STG_DEFAULT_ENERGY_CAPACITY 1000.0
#define STG_DEFAULT_ENERGY_CHARGEENABLE 1
- #define STG_DEFAULT_ENERGY_PROBERANGE 0.0
#define STG_DEFAULT_ENERGY_GIVERATE 0.0
#define STG_DEFAULT_ENERGY_TRICKLERATE 0.1
! #define STG_DEFAULT_MASK (STG_MOVE_TRANS | STG_MOVE_ROT)
! #define STG_DEFAULT_NOSE FALSE
! #define STG_DEFAULT_GRID FALSE
! #define STG_DEFAULT_OUTLINE TRUE
#define STG_DEFAULT_MAP_RESOLUTION 0.1
!
//extern int _stg_disable_gui;
--- 1,38 ----
#define _GNU_SOURCE
+ //#define DEBUG
+
#include <limits.h>
#include <assert.h>
#include <math.h>
! #include <GL/gl.h>
#include "stage_internal.h"
#include "model.hh"
#include "gui.h"
// basic model
!
! #define STG_DEFAULT_BLOBRETURN true
! #define STG_DEFAULT_BOUNDARY true
#define STG_DEFAULT_COLOR (0xFF0000) // red
#define STG_DEFAULT_ENERGY_CAPACITY 1000.0
#define STG_DEFAULT_ENERGY_CHARGEENABLE 1
#define STG_DEFAULT_ENERGY_GIVERATE 0.0
+ #define STG_DEFAULT_ENERGY_PROBERANGE 0.0
#define STG_DEFAULT_ENERGY_TRICKLERATE 0.1
! #define STG_DEFAULT_GEOM_SIZEX 1.0 // 1m square by default
! #define STG_DEFAULT_GEOM_SIZEY 1.0
! #define STG_DEFAULT_GEOM_SIZEZ 1.0
! #define STG_DEFAULT_GRID false
! #define STG_DEFAULT_GRIPPERRETURN false
! #define STG_DEFAULT_LASERRETURN LaserVisible
#define STG_DEFAULT_MAP_RESOLUTION 0.1
! #define STG_DEFAULT_MASK (STG_MOVE_TRANS | STG_MOVE_ROT)
! #define STG_DEFAULT_MASS 10.0 // kg
! #define STG_DEFAULT_NOSE false
! #define STG_DEFAULT_OBSTACLERETURN true
! #define STG_DEFAULT_OUTLINE true
! #define STG_DEFAULT_RANGERRETURN true
//extern int _stg_disable_gui;
***************
*** 162,166 ****
// force recreation of display lists before drawing
! dirty = true;
//Map( 1 );
--- 163,167 ----
// force recreation of display lists before drawing
! body_dirty = true;
//Map( 1 );
***************
*** 268,272 ****
this->wf = wf;
this->id = id; // id is also our worldfile entity number, always unique
! this->disabled = FALSE;
this->world = world;
this->parent = parent;
--- 269,273 ----
this->wf = wf;
this->id = id; // id is also our worldfile entity number, always unique
! this->disabled = false;
this->world = world;
this->parent = parent;
***************
*** 274,278 ****
this->d_list = NULL;
this->blocks = NULL;
! this->dirty = true;
this->gpose_dirty = true;
--- 275,280 ----
this->d_list = NULL;
this->blocks = NULL;
! this->body_dirty = true;
! this->data_dirty = true;
this->gpose_dirty = true;
***************
*** 315,323 ****
//printf( "model has token \"%s\" and typestr \"%s\"\n",
// this->token, this->typestr );
!
!
g_hash_table_insert( tbl, (gpointer)typestr, (gpointer)++typecnt);
-
// initialize the table of callbacks that are triggered when a
// model's fields change
--- 317,323 ----
//printf( "model has token \"%s\" and typestr \"%s\"\n",
// this->token, this->typestr );
!
g_hash_table_insert( tbl, (gpointer)typestr, (gpointer)++typecnt);
// initialize the table of callbacks that are triggered when a
// model's fields change
***************
*** 328,339 ****
this->geom.size.z = STG_DEFAULT_GEOM_SIZEX;
! this->obstacle_return = 1;
! this->ranger_return = 1;
! this->blob_return = 1;
! this->laser_return = LaserVisible;
! this->gripper_return = 0;
! this->boundary = 0;
! this->color = 0xFF0000; // red;
! this->map_resolution = 0.1; // meters
this->gui_nose = STG_DEFAULT_NOSE;
this->gui_grid = STG_DEFAULT_GRID;
--- 328,339 ----
this->geom.size.z = STG_DEFAULT_GEOM_SIZEX;
! this->obstacle_return = STG_DEFAULT_OBSTACLERETURN;
! this->ranger_return = STG_DEFAULT_RANGERRETURN;
! this->blob_return = STG_DEFAULT_BLOBRETURN;
! this->laser_return = STG_DEFAULT_LASERRETURN;
! this->gripper_return = STG_DEFAULT_GRIPPERRETURN;
! this->boundary = STG_DEFAULT_BOUNDARY;
! this->color = STG_DEFAULT_COLOR;
! this->map_resolution = STG_DEFAULT_MAP_RESOLUTION; // meters
this->gui_nose = STG_DEFAULT_NOSE;
this->gui_grid = STG_DEFAULT_GRID;
***************
*** 404,408 ****
}
! // returns TRUE if model [testmod] is a descendent of model [mod]
bool StgModel::IsDescendent( StgModel* testmod )
{
--- 404,408 ----
}
! // returns true if model [testmod] is a descendent of model [mod]
bool StgModel::IsDescendent( StgModel* testmod )
{
***************
*** 601,606 ****
void StgModel::Print( char* prefix )
{
! printf( "%s model %d:%d:%s\n",
! prefix ? prefix : "",
world->id,
id,
--- 601,610 ----
void StgModel::Print( char* prefix )
{
! if( prefix )
! printf( "%s model ", prefix );
! else
! printf( "Model ");
!
! printf( "%d:%d:%s\n",
world->id,
id,
***************
*** 690,707 ****
// todo - we don't need to do this so often
! if( this->dirty )
{
! this->GuiGenerateBody();
! this->dirty = false;
}
// Call my various display lists
//if( win->show_grid ) && this->gui_grid )
//glCallList( this->dl_grid );
! glCallList( this->dl_body );
! //glCallList( this->dl_data );
-
// shift up the CS to the top of this model
gl_coord_shift( 0,0, this->geom.size.z, 0 );
--- 694,717 ----
// todo - we don't need to do this so often
! if( this->body_dirty )
{
! this->DListBody();
! this->body_dirty = false;
}
+ glCallList( this->dl_body );
+
// Call my various display lists
//if( win->show_grid ) && this->gui_grid )
//glCallList( this->dl_grid );
! glCallList( this->dl_data );
!
! if( this->data_dirty )
! {
! this->DListData();
! this->data_dirty = false;
! }
// shift up the CS to the top of this model
gl_coord_shift( 0,0, this->geom.size.z, 0 );
***************
*** 720,839 ****
// call this when the local physical appearance has changed
! void StgModel::GuiGenerateBody( void )
{
printf( "%s::GuiGenerateBody()\n", this->token );
- glNewList( dl_body, GL_COMPILE );
-
// draw blocks
LISTFUNCTION( blocks, stg_block_t*, stg_block_render );
-
glEndList();
}
! void StgModel::GuiGenerateGrid( void )
{
! glNewList( dl_grid, GL_COMPILE );
- push_color_rgba( 0.8,0.8,0.8,0.8 );
! double dx = geom.size.x;
! double dy = geom.size.y;
! double sp = 1.0;
! int nx = (int) ceil((dx/2.0) / sp);
! int ny = (int) ceil((dy/2.0) / sp);
! if( nx == 0 ) nx = 1.0;
! if( ny == 0 ) ny = 1.0;
! glBegin(GL_LINES);
! // draw the bounding box first
! glVertex2f( -nx, -ny );
! glVertex2f( nx, -ny );
! glVertex2f( -nx, ny );
! glVertex2f( nx, ny );
! glVertex2f( nx, -ny );
! glVertex2f( nx, ny );
! glVertex2f( -nx,-ny );
! glVertex2f( -nx, ny );
! int i;
! for (i = -nx+1; i < nx; i++)
! {
! glVertex2f( i * sp, - dy/2 );
! glVertex2f( i * sp, + dy/2 );
! //snprintf( str, 64, "%d", (int)i );
! //stg_rtk_fig_text( fig, -0.2 + (ox + i * sp), -0.2 , 0, str );
! }
! for (i = -ny+1; i < ny; i++)
! {
! glVertex2f( - dx/2, i * sp );
! glVertex2f( + dx/2, i * sp );
! //snprintf( str, 64, "%d", (int)i );
! //stg_rtk_fig_text( fig, -0.2, -0.2 + (oy + i * sp) , 0, str );
! }
! glEnd();
! pop_color();
! glEndList();
! }
!
!
!
! //------------------------------------------------------------------------
! // basic model properties
!
! // void StgModel::SetData( void* data, size_t len )
! // {
! // this->data = g_realloc( this->data, len );
! // memcpy( this->data, data, len );
! // this->data_len = len;
!
! // this->GuiGenerateData();
!
! // CallCallbacks( &this->data );
! // }
!
! // void StgModel::SetCmd( void* cmd, size_t len )
! // {
! // this->cmd = g_realloc( this->cmd, len );
! // memcpy( this->cmd, cmd, len );
! // this->cmd_len = len;
!
! // CallCallbacks( &this->cmd );
! // }
!
! // void StgModel::SetCfg( void* cfg, size_t len )
! // {
! // this->cfg = g_realloc( this->cfg, len );
! // memcpy( this->cfg, cfg, len );
! // this->cfg_len = len;
!
! // CallCallbacks( &this->cmd );
! // }
!
! // void* StgModel::GetCfg( size_t* lenp )
! // {
! // if(lenp) *lenp = this->cfg_len;
! // return this->cfg;
! // }
!
! // void* StgModel::GetData( size_t* lenp )
! // {
! // if(lenp) *lenp = this->data_len;
! // return this->data;
! // }
!
! // void* StgModel::GetCmd( size_t* lenp )
! // {
! // if(lenp) *lenp = this->cmd_len;
! // return this->cmd;
// }
--- 730,802 ----
// call this when the local physical appearance has changed
! void StgModel::DListBody( void )
{
printf( "%s::GuiGenerateBody()\n", this->token );
// draw blocks
+ glNewList( dl_body, GL_COMPILE );
LISTFUNCTION( blocks, stg_block_t*, stg_block_render );
glEndList();
}
! void StgModel::DListData( void )
{
! // do nothing
! }
!
! // void StgModel::GuiGenerateGrid( void )
! // {
! // glNewList( dl_grid, GL_COMPILE );
!
! // push_color_rgba( 0.8,0.8,0.8,0.8 );
!
! // double dx = geom.size.x;
! // double dy = geom.size.y;
! // double sp = 1.0;
! // int nx = (int) ceil((dx/2.0) / sp);
! // int ny = (int) ceil((dy/2.0) / sp);
! // if( nx == 0 ) nx = 1.0;
! // if( ny == 0 ) ny = 1.0;
! // glBegin(GL_LINES);
! // // draw the bounding box first
! // glVertex2f( -nx, -ny );
! // glVertex2f( nx, -ny );
! // glVertex2f( -nx, ny );
! // glVertex2f( nx, ny );
! // glVertex2f( nx, -ny );
! // glVertex2f( nx, ny );
! // glVertex2f( -nx,-ny );
! // glVertex2f( -nx, ny );
! // int i;
! // for (i = -nx+1; i < nx; i++)
! // {
! // glVertex2f( i * sp, - dy/2 );
! // glVertex2f( i * sp, + dy/2 );
! // //snprintf( str, 64, "%d", (int)i );
! // //stg_rtk_fig_text( fig, -0.2 + (ox + i * sp), -0.2 , 0, str );
! // }
! // for (i = -ny+1; i < ny; i++)
! // {
! // glVertex2f( - dx/2, i * sp );
! // glVertex2f( + dx/2, i * sp );
! // //snprintf( str, 64, "%d", (int)i );
! // //stg_rtk_fig_text( fig, -0.2, -0.2 + (oy + i * sp) , 0, str );
! // }
! // glEnd();
! // pop_color();
! // glEndList();
// }
***************
*** 1184,1188 ****
// loop over all edges of the block
! for( int p=0; p<b->pt_count; p++ )
{
stg_point_t* pt1 = &b->pts[p];
--- 1147,1151 ----
// loop over all edges of the block
! for( unsigned int p=0; p<b->pt_count; p++ )
{
stg_point_t* pt1 = &b->pts[p];
***************
*** 1211,1216 ****
//printf( "tracing %.2f %.2f %.2f %.2f\n", p1.x, p1.y, p2.x, p2.y
);
! double dx = p2.x - p1.x;
! double dy = p2.y - p1.y;
itl_t* itl = itl_create( p1.x, p1.y, 0.2,
--- 1174,1179 ----
//printf( "tracing %.2f %.2f %.2f %.2f\n", p1.x, p1.y, p2.x, p2.y
);
! //double dx = p2.x - p1.x;
! //double dy = p2.y - p1.y;
itl_t* itl = itl_create( p1.x, p1.y, 0.2,
***************
*** 1256,1417 ****
- /* typedef struct */
- /* { */
- /* stg_model_t* mod; */
- /* GList** list; */
- /* } _modlist_t; */
-
-
- /* int bboxes_overlap( stg_bbox3d_t* box1, stg_bbox3d_t* box2 ) */
- /* { */
- /* // return TRUE iff any corner of box 2 is contained within box 1 */
- /* return( box1->x.min <= box2->x.max && */
- /* box2->x.min <= box1->x.max && */
- /* box1->y.min <= box2->y.max && */
- /* box2->y.min <= box1->y.max ); */
- /* } */
-
-
- /* GList* stg_model_overlappers( stg_model_t* mod, GList* models ) */
- /* { */
- /* GList *it; */
- /* stg_model_t* candidate; */
- /* GList *overlappers = NULL; */
-
- /* //printf( "\nfinding overlappers of %s\n", mod->token ); */
-
- /* for( it=models; it; it=it->next ) */
- /* { */
- /* candidate = (stg_model_t*)it->data; */
-
- /* if( candidate == mod ) */
- /* continue; */
-
- /* printf( "model %s tested against %s...", mod->token,
candidate->token ); */
-
- /* if( bboxes_overlap( &mod->bbox, &candidate->bbox ) ) */
- /* { */
- /* overlappers = g_list_append( overlappers, candidate ); */
- /* puts(" OVERLAP!" ); */
- /* } */
- /* else */
- /* puts( "" ); */
-
- /* if( candidate->children ) */
- /* overlappers = g_list_concat( overlappers, */
- /* stg_model_overlappers( mod,
candidate->children )); */
- /* } */
-
- /* return overlappers; */
- /* } */
-
-
- // add any line segments contained by this model to the list of line
- // segments in world coordinates.
- /* GList* model_append_segments( stg_model_t* mod, GList* segments ) */
- /* { */
- /* stg_pose_t gpose; */
- /* stg_model_get_global_pose( mod, &gpose ); */
- /* double x = gpose.x; */
- /* double y = gpose.y; */
- /* double a = gpose.a; */
-
- /* int p; */
- /* for( p=0; p<mod->polygons_count; p++ ) */
- /* { */
- /* stg_polygon_t* poly = &mod->polygons[p]; */
-
- /* // need at least three points for a meaningful polygon */
- /* if( poly->points->len > 2 ) */
- /* { */
- /* int count = poly->points->len; */
- /* int p; */
- /* for( p=0; p<count; p++ ) // for */
- /* { */
- /* stg_point_t* pt1 = &g_array_index( poly->points, stg_point_t, p
); */
- /* stg_point_t* pt2 = &g_array_index( poly->points, stg_point_t,
(p+1) % count); */
-
- /* stg_line_t *line = malloc(sizeof */
- /* line.x1 = x + pt1->x * cos(a) - pt1->y * sin(a); */
- /* line.y1 = y + pt1->x * sin(a) + pt1->y * cos(a); */
-
- /* line.x2 = x + pt2->x * cos(a) - pt2->y * sin(a); */
- /* line.y2 = y + pt2->x * sin(a) + pt2->y * cos(a); */
-
- /* //stg_matrix_lines( matrix, &line, 1, object ); */
- /* } */
- /* } */
- /* //else */
- /* //PRINT_WARN( "attempted to matrix render a polygon with less than 3
points" ); */
- /* } */
-
-
-
-
- /* } */
-
- /* stg_model_t* stg_model_test_collision2( stg_model_t* mod, */
- /* //stg_pose_t* pose, */
- /* double* hitx, double* hity ) */
- /* { */
- /* /\* int ch; *\/ */
- /* /\* stg_model_t* child_hit = NULL; *\/ */
- /* /\* for(ch=0; ch < mod->children->len; ch++ ) *\/ */
- /* /\* { *\/ */
- /* /\* stg_model_t* child = g_ptr_array_index( mod->children, ch ); *\/
*/
- /* /\* child_hit = stg_model_test_collision2( child, hitx, hity ); *\/
*/
- /* /\* if( child_hit ) *\/ */
- /* /\* return child_hit; *\/ */
- /* /\* } *\/ */
-
-
- /* stg_pose_t pose; */
- /* memcpy( &pose, &mod->geom.pose, sizeof(pose)); */
- /* stg_model_local_to_global( mod, &pose ); */
-
- /* //return NULL; */
-
- /* // raytrace along all our rectangles. expensive, but most vehicles */
- /* // will just be a single rect, grippers 3 rects, etc. not too bad. */
-
- /* //size_t count=0; */
- /* //stg_polygon_t* polys = stg_model_get_polygons(mod, &count); */
-
- /* // no body? no collision */
- /* //if( count < 1 ) */
- /* //return NULL; */
-
- /* // first find the models whose bounding box overlaps with this one */
-
- /* /\* printf ("COLLISION TESTING MODEL %s\n", mod->token ); *\/ */
- /* GList* candidates = NULL;//stg_model_overlappers( mod,
mod->world->children ); *\/ */
-
- /* /\* if( candidates ) *\/ */
- /* /\* printf( "mod %s overlappers: %d\n", mod->token, g_list_length(
candidates )); *\/ */
- /* /\* else *\/ */
- /* /\* printf( "mod %s has NO overlappers\n", mod->token ); *\/ */
-
-
- /* // now test every line segment in the candidates for intersection */
- /* // and record the closest hitpoint */
- /* /\* GList* model_segments = model_append_segments( mod, NULL ); *\/ */
-
- /* /\* GList* obstacle_segments = NULL; *\/ */
-
- /* /\* GList* it; *\/ */
- /* /\* for( it=candidates; it; it=it->next ) *\/ */
- /* /\* obstacle_segments = *\/ */
- /* /\* model_append_segments( (stg_model_t*)it->data, obstacle_segments
); *\/ */
-
-
- /* if( candidates ) */
- /* g_list_free( candidates ); */
-
-
-
- /* return NULL; // done */
- /* } */
-
-
void StgModel::UpdatePose( void )
{
--- 1219,1222 ----
***************
*** 1449,1457 ****
// check this model and all it's children at the new pose
! double hitx=0, hity=0, hita=0;
StgModel* hitthing = this->TestCollision( &gp, &hitx, &hity );
if( hitthing )
! printf( "hit %s at %.2f %,2f\n",
hitthing->Token(), hitx, hity );
else
--- 1254,1262 ----
// check this model and all it's children at the new pose
! double hitx=0, hity=0;
StgModel* hitthing = this->TestCollision( &gp, &hitx, &hity );
if( hitthing )
! printf( "hit %s at %.2f %.2f\n",
hitthing->Token(), hitx, hity );
else
Index: stage_internal.h
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/stage_internal.h,v
retrieving revision 1.58.2.19
retrieving revision 1.58.2.20
diff -C2 -d -r1.58.2.19 -r1.58.2.20
*** stage_internal.h 17 Jul 2007 05:26:44 -0000 1.58.2.19
--- stage_internal.h 18 Jul 2007 06:19:27 -0000 1.58.2.20
***************
*** 317,322 ****
int stg_rotrects_from_image_file( const char* filename,
stg_rotrect_t** rects,
! int* rect_count,
! int* widthp, int* heightp );
/[EMAIL PROTECTED]/
--- 317,323 ----
int stg_rotrects_from_image_file( const char* filename,
stg_rotrect_t** rects,
! unsigned int* rect_count,
! unsigned int* widthp,
! unsigned int* heightp );
/[EMAIL PROTECTED]/
Index: raytrace.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/raytrace.cc,v
retrieving revision 1.12.2.5
retrieving revision 1.12.2.6
diff -C2 -d -r1.12.2.5 -r1.12.2.6
*** raytrace.cc 17 Jul 2007 05:26:44 -0000 1.12.2.5
--- raytrace.cc 18 Jul 2007 06:19:27 -0000 1.12.2.6
***************
*** 10,39 ****
/* useful debug */
! static void print_thing( char* prefix, stg_cell_t* cell, double x, double y )
! {
! printf( "%s %p x[%.7f %.7f %.7f] y[%.7f %.7f %.7f] (x %s xmin x %s xmax)
(y %s ymin y %s ymax)\n",
! prefix,
! cell,
! cell->xmin, x, cell->xmax,
! cell->ymin, y, cell->ymax,
! GTE(x,cell->xmin) ? ">=" : "<",
! LT(x,cell->xmax) ? "<" : ">=",
! GTE(y,cell->ymin) ? ">=" : "<",
! LT(y,cell->ymax) ? "<" : ">=" );
! }
! /* useful debug */
! static void PrintArray( GPtrArray* arr )
! {
! if( arr )
! {
! printf( "model array %p len %d\n", arr, arr->len );
! int i;
! for( i=0; i<arr->len; i++ )
! printf( " (model %s)", ((StgModel*)g_ptr_array_index( arr, i
))->Token() );
! }
! else
! printf( "null array\n" );
! }
extern stg_world_t* global_world;
--- 10,38 ----
/* useful debug */
! // static void print_thing( char* prefix, stg_cell_t* cell, double x, double
y )
! // {
! // printf( "%s %p x[%.7f %.7f %.7f] y[%.7f %.7f %.7f] (x %s xmin x %s
xmax) (y %s ymin y %s ymax)\n",
! // prefix,
! // cell,
! // cell->xmin, x, cell->xmax,
! // cell->ymin, y, cell->ymax,
! // GTE(x,cell->xmin) ? ">=" : "<",
! // LT(x,cell->xmax) ? "<" : ">=",
! // GTE(y,cell->ymin) ? ">=" : "<",
! // LT(y,cell->ymax) ? "<" : ">=" );
! // }
! // /* useful debug */
! // static void PrintArray( GPtrArray* arr )
! // {
! // if( arr )
! // {
! // printf( "model array %p len %d\n", arr, arr->len );
! // for( unsigned int i=0; i<arr->len; i++ )
! // printf( " (model %s)", ((StgModel*)g_ptr_array_index( arr, i
))->Token() );
! // }
! // else
! // printf( "null array\n" );
! // }
extern stg_world_t* global_world;
***************
*** 71,75 ****
itl->range = 0;
! stg_bbox3d_t bbox;
switch( pmode )
--- 70,74 ----
itl->range = 0;
! //stg_bbox3d_t bbox;
switch( pmode )
Index: model_load.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/model_load.cc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** model_load.cc 13 Jul 2007 05:48:31 -0000 1.1.2.5
--- model_load.cc 18 Jul 2007 06:19:26 -0000 1.1.2.6
***************
*** 109,114 ****
stg_rotrect_t* rects = NULL;
! int rect_count = 0;
! int width, height;
if( stg_rotrects_from_image_file( full,
&rects,
--- 109,114 ----
stg_rotrect_t* rects = NULL;
! unsigned int rect_count = 0;
! unsigned int width, height;
if( stg_rotrects_from_image_file( full,
&rects,
***************
*** 129,133 ****
{
//puts( "loading rects" );
! for( int r=0; r<rect_count; r++ )
this->AddBlockRect( rects[r].pose.x, rects[r].pose.y,
rects[r].size.x, rects[r].size.y );
--- 129,133 ----
{
//puts( "loading rects" );
! for( unsigned int r=0; r<rect_count; r++ )
this->AddBlockRect( rects[r].pose.x, rects[r].pose.y,
rects[r].size.x, rects[r].size.y );
***************
*** 145,148 ****
--- 145,149 ----
stg_block_list_scale( this->blocks, &this->geom.size );
this->Map(1);
+ this->body_dirty = true;
}
}
Index: gui_gl.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/gui_gl.c,v
retrieving revision 1.1.2.29
retrieving revision 1.1.2.30
diff -C2 -d -r1.1.2.29 -r1.1.2.30
*** gui_gl.c 17 Jul 2007 05:26:43 -0000 1.1.2.29
--- gui_gl.c 18 Jul 2007 06:19:26 -0000 1.1.2.30
***************
*** 61,69 ****
**************************************************************************/
! static gboolean animate = TRUE;
static int beginX, beginY;
! static float lightPosition[4] = {0.0, 0.0, 1.0, 1.0};
static GQueue* colorstack = NULL;
--- 61,69 ----
**************************************************************************/
! //static gboolean animate = TRUE;
static int beginX, beginY;
! //static float lightPosition[4] = {0.0, 0.0, 1.0, 1.0};
static GQueue* colorstack = NULL;
***************
*** 73,81 ****
**************************************************************************/
! static GtkWidget *create_popup_menu (GtkWidget *drawing_area);
StgModel* stg_world_nearest_root_model( stg_world_t* world, double wx, double
wy );
! static int recticle_list = 0;
GLuint base=0; /* Base Display List For The Font Set */
--- 73,81 ----
**************************************************************************/
! //static GtkWidget *create_popup_menu (GtkWidget *drawing_area);
StgModel* stg_world_nearest_root_model( stg_world_t* world, double wx, double
wy );
! //static int recticle_list = 0;
GLuint base=0; /* Base Display List For The Font Set */
***************
*** 304,308 ****
{
// convert from window pixel to world coordinates
! int width = widget->allocation.width;
int height = widget->allocation.height;
--- 304,308 ----
{
// convert from window pixel to world coordinates
! //int width = widget->allocation.width;
int height = widget->allocation.height;
***************
*** 944,949 ****
((StgModel*)it->data)->Draw();
! for( it=world->children; it; it=it->next )
! ((StgModel*)it->data)->DrawData();
--- 944,949 ----
((StgModel*)it->data)->Draw();
! //for( it=world->children; it; it=it->next )
! //((StgModel*)it->data)->DrawData();
Index: gui_gtk.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/gui_gtk.cc,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_gtk.cc 9 Jul 2007 00:03:24 -0000 1.1.2.3
--- gui_gtk.cc 18 Jul 2007 06:19:26 -0000 1.1.2.4
***************
*** 1,5 ****
! /*
! CVS: $Id$
! */
--- 1,9 ----
! /***
! File: gui_gtk.cc:
! Desc: Implements GTK-based GUI for Stage
! Author: Richard Vaughan
!
! CVS: $Id$
! ***/
***************
*** 523,527 ****
// accels
! GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (ui_manager);
//gtk_window_add_accel_group(GTK_WINDOW (win->canvas->frame), accel_group);
--- 527,531 ----
// accels
! //GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (ui_manager);
//gtk_window_add_accel_group(GTK_WINDOW (win->canvas->frame), accel_group);
***************
*** 972,976 ****
win->clock_label = GTK_LABEL(gtk_label_new( "clock" ));
! GtkWidget* contents = NULL;
gtk_container_add(GTK_CONTAINER(win->frame), win->layout);
--- 976,980 ----
win->clock_label = GTK_LABEL(gtk_label_new( "clock" ));
! //GtkWidget* contents = NULL;
gtk_container_add(GTK_CONTAINER(win->frame), win->layout);
Index: matrix.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/matrix.c,v
retrieving revision 1.22.4.7
retrieving revision 1.22.4.8
diff -C2 -d -r1.22.4.7 -r1.22.4.8
*** matrix.c 13 Jul 2007 05:48:31 -0000 1.22.4.7
--- matrix.c 18 Jul 2007 06:19:26 -0000 1.22.4.8
***************
*** 234,238 ****
double m = tan(theta); // line gradient
! int step = 0;
stg_cell_t* cell = matrix->root;
--- 234,238 ----
double m = tan(theta); // line gradient
! //int step = 0;
stg_cell_t* cell = matrix->root;
***************
*** 439,444 ****
//printf( "matrix block %p\n", block );
! int p;
! for( p=0; p<block->pt_count; p++ ) // for
{
stg_point_t* pt1 = &block->pts[p];
--- 439,443 ----
//printf( "matrix block %p\n", block );
! for( unsigned int p=0; p<block->pt_count; p++ ) // for
{
stg_point_t* pt1 = &block->pts[p];
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit