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

Modified Files:
      Tag: opengl
        world.cc 
Log Message:
figuring out remaining ray bug

Index: world.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Attic/world.cc,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** world.cc    22 Oct 2007 09:06:28 -0000      1.1.2.7
--- world.cc    22 Oct 2007 19:16:32 -0000      1.1.2.8
***************
*** 503,514 ****
      {
        
!       int xpix = floor(x*ppm);
!       int ypix = floor(y*ppm);
        
!       //printf( "locating cell at (%.2f %.2f) [%d,%d]\n", x, y, xpix, ypix );
  
        // locate the leaf cell at X,Y
        cell = cell->Locate( xpix, ypix );
  
        // the cell is null iff the point was outside the root
        if( cell == NULL )
--- 503,516 ----
      {
        
!       int xpix = (int)floor(x*ppm);
!       int ypix = (int)floor(y*ppm);
        
!       //printf( "theta %.2f locating cell at (%.2f %.2f) [%d,%d]\n",a, x, y, 
xpix, ypix );
  
        // locate the leaf cell at X,Y
        cell = cell->Locate( xpix, ypix );
  
+       //if( cell ) cell->Print( "Found" );
+ 
        // the cell is null iff the point was outside the root
        if( cell == NULL )
***************
*** 556,569 ****
          //puts( "up" );
  
          // ray could leave through the top edge
          // solve x for known y      
!         yleave = cell->ymax * p2m; // top edge
          xleave = (yleave - c) / tana;
! 
!         int32_t xleave_pixel = floor(xleave*ppm);
! 
!         // if the edge crossing was not in cell bounds     
!         //if( !(  GTE(xleave,cell->xmin*p2m) && LT(xleave,cell->xmax*p2m)) )
!         //if( ! cell->Contains( xleave*ppm, yleave*ppm )
          
          if( xleave_pixel < cell->xmin || 
--- 558,570 ----
          //puts( "up" );
  
+         
+         int yleave_pixel = cell->ymax; // top edge
+ 
          // ray could leave through the top edge
          // solve x for known y      
!         yleave = (double)yleave_pixel * p2m; 
          xleave = (yleave - c) / tana;
!         
!         int xleave_pixel = floor( xleave * ppm );
          
          if( xleave_pixel < cell->xmin || 
***************
*** 589,598 ****
          //puts( "down" );
          
          // ray could leave through the bottom edge
          // solve x for known y      
!         yleave = cell->ymin*p2m; // bottom edge
          xleave = (yleave - c) / tana;
          
-         int32_t xleave_pixel = floor(xleave*ppm);
  
  //      printf( "test leave (%.2f %.2f) %d [%d %d] %d %d %d\n", 
--- 590,602 ----
          //puts( "down" );
          
+         int yleave_pixel = cell->ymin; // bottom edge
+ 
          // ray could leave through the bottom edge
          // solve x for known y      
!         yleave = (double)yleave_pixel * p2m;
          xleave = (yleave - c) / tana;
+ 
+         int xleave_pixel = floor( xleave * ppm );
          
  
  //      printf( "test leave (%.2f %.2f) %d [%d %d] %d %d %d\n", 
***************
*** 774,781 ****
    //int32_t y2 = (int32_t)(my2 * ppm - 0.5);
  
!   int32_t x1 = floor(mx1 * ppm);
!   int32_t x2 = floor(mx2 * ppm);
!   int32_t y1 = floor(my1 * ppm);
!   int32_t y2 = floor(my2 * ppm);
    
    StgCell* cell = root;
--- 778,785 ----
    //int32_t y2 = (int32_t)(my2 * ppm - 0.5);
  
!   int x1 = (int)floor(mx1 * ppm);
!   int x2 = (int)floor(mx2 * ppm);
!   int y1 = (int)floor(my1 * ppm);
!   int y2 = (int)floor(my2 * ppm);
    
    StgCell* cell = root;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to