Revision: 7819
http://playerstage.svn.sourceforge.net/playerstage/?rev=7819&view=rev
Author: rtv
Date: 2009-06-08 16:17:35 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
reinstated lazy allcoation of cells in regions
Modified Paths:
--------------
code/stage/trunk/libstage/region.cc
code/stage/trunk/libstage/region.hh
code/stage/trunk/libstage/world.cc
code/stage/trunk/worlds/SFU.world
Modified: code/stage/trunk/libstage/region.cc
===================================================================
--- code/stage/trunk/libstage/region.cc 2009-06-08 07:00:15 UTC (rev 7818)
+++ code/stage/trunk/libstage/region.cc 2009-06-08 16:17:35 UTC (rev 7819)
@@ -9,10 +9,10 @@
Region::Region()
- : cells(), count(0)
+ : cells(NULL), count(0)
{
- for( int i=0; i<REGIONSIZE; i++ )
- cells[i].region = this;
+ //for( int i=0; i<REGIONSIZE; i++ )
+ // cells[i].region = this;
}
Region::~Region()
Modified: code/stage/trunk/libstage/region.hh
===================================================================
--- code/stage/trunk/libstage/region.hh 2009-06-08 07:00:15 UTC (rev 7818)
+++ code/stage/trunk/libstage/region.hh 2009-06-08 16:17:35 UTC (rev 7819)
@@ -59,15 +59,22 @@
{
public:
- Cell cells[ REGIONSIZE ];
+ Cell* cells;//[ REGIONSIZE ];
SuperRegion* superregion;
- unsigned long count; // number of blocks rendered into these cells
+ unsigned int count; // number of blocks rendered into these cells
Region();
~Region();
- Cell* GetCell( int32_t x, int32_t y ) const
+ Cell* GetCell( int32_t x, int32_t y )
{
+ if( ! cells )
+ {
+ cells = new Cell[REGIONSIZE];
+ for( int i=0; i<REGIONSIZE; ++i )
+ cells[i].region = this;
+ }
+
return( (Cell*)&cells[ x + y * REGIONWIDTH ] );
}
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-06-08 07:00:15 UTC (rev 7818)
+++ code/stage/trunk/libstage/world.cc 2009-06-08 16:17:35 UTC (rev 7819)
@@ -951,8 +951,8 @@
Cell* World::GetCell( const stg_point_int_t& glob )
{
- return( GetSuperRegionCached( GETSREG(glob.x), GETSREG(glob.y) )
- ->GetRegion( GETREG(glob.x),
GETREG(glob.y) )
+ return( ((Region*)GetSuperRegionCached( GETSREG(glob.x), GETSREG(glob.y) )
+ ->GetRegion( GETREG(glob.x), GETREG(glob.y) ))
->GetCell( GETCELL(glob.x),
GETCELL(glob.y) )) ;
}
Modified: code/stage/trunk/worlds/SFU.world
===================================================================
--- code/stage/trunk/worlds/SFU.world 2009-06-08 07:00:15 UTC (rev 7818)
+++ code/stage/trunk/worlds/SFU.world 2009-06-08 16:17:35 UTC (rev 7819)
@@ -31,7 +31,7 @@
floorplan
(
name "cave"
- size [200.000 130.000 0.800]
+ size [1000.000 600.000 0.800]
pose [0 0 0 0]
bitmap "bitmaps/SFU_800x600.png"
)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit