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

Modified Files:
        Makefile Makefile.manual block.cc canvas.cc stage.hh stest.cc 
        world.cc worldgui.cc 
Log Message:
removed world size limitation

Index: worldgui.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/worldgui.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** worldgui.cc 19 Jan 2008 01:19:40 -0000      1.3
--- worldgui.cc 1 Feb 2008 03:11:02 -0000       1.4
***************
*** 354,356 ****
    return updated;
  }
- 
--- 354,355 ----

Index: stest.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/stest.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** stest.cc    15 Jan 2008 01:16:49 -0000      1.2
--- stest.cc    1 Feb 2008 03:11:02 -0000       1.3
***************
*** 68,72 ****
          robots[i].position->GetUnsubscribedModelOfType( "laser" );     
          assert(robots[i].laser);
!         robots[i].laser->Subscribe();
  
  //        robots[i].fiducial = (StgModelFiducial*)
--- 68,72 ----
          robots[i].position->GetUnsubscribedModelOfType( "laser" );     
          assert(robots[i].laser);
!       robots[i].laser->Subscribe();
  
  //        robots[i].fiducial = (StgModelFiducial*)
***************
*** 78,82 ****
         robots[i].position->GetUnsubscribedModelOfType( "ranger" );
         assert(robots[i].ranger);
!        robots[i].ranger->Subscribe();
  
  //        robots[i].blobfinder = (StgModelBlobfinder*)
--- 78,82 ----
         robots[i].position->GetUnsubscribedModelOfType( "ranger" );
         assert(robots[i].ranger);
!               robots[i].ranger->Subscribe();
  
  //        robots[i].blobfinder = (StgModelBlobfinder*)

Index: canvas.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/canvas.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** canvas.cc   19 Jan 2008 01:19:40 -0000      1.3
--- canvas.cc   1 Feb 2008 03:11:01 -0000       1.4
***************
*** 347,351 ****
        gl_font( FL_HELVETICA, 12 );
        
!       double zclip = hypot(world->Width(), world->Height()) * scale;
        double pixels_width =  w();
        double pixels_height = h();
--- 347,351 ----
        gl_font( FL_HELVETICA, 12 );
        
!       double zclip = 20 * scale; //hypot(world->Width(), world->Height()) * 
scale;
        double pixels_width =  w();
        double pixels_height = h();
***************
*** 397,401 ****
      {      
        glLoadIdentity ();
!       double zclip = hypot(world->Width(), world->Height()) * scale;
        glTranslatef(  0,0,
                     -zclip / 2.0 );
--- 397,401 ----
      {      
        glLoadIdentity ();
!       double zclip = 20 * scale; //hypot(world->Width(), world->Height()) * 
scale;
        glTranslatef(  0,0,
                     -zclip / 2.0 );
***************
*** 418,423 ****
     glPolygonOffset(1.0, 1.0);
     glColor3f( 1,1,1 );
!    glRectf( -world->Width()/2.0, -world->Height()/2.0,
!           world->Width()/2.0, world->Height()/2.0 ); 
     glDisable(GL_POLYGON_OFFSET_FILL);
  
--- 418,429 ----
     glPolygonOffset(1.0, 1.0);
     glColor3f( 1,1,1 );
! 
!    glPushMatrix();
!    glScalef( 1.0/world->Resolution(), 1.0/world->Resolution(), 0 );
!    //g_hash_table_foreach( world->superregions, StgWorld::Floor_cb, NULL );
!    ((StgWorldGui*)world)->DrawFloor();
! 
!    //   glRectf( -world->Width()/2.0, -world->Height()/2.0,
!    //     world->Width()/2.0, world->Height()/2.0 ); 
     glDisable(GL_POLYGON_OFFSET_FILL);
  
***************
*** 428,447 ****
         
         glPushMatrix();
!        glTranslatef( -world->Width()/2.0, -world->Height()/2.0, 1 );
!        glScalef( 1.0/world->Resolution(), 1.0/world->Resolution(), 0 );
         glPolygonMode( GL_FRONT, GL_LINE );
         colorstack.Push(1,0,0);
         
         if( showflags & STG_SHOW_OCCUPANCY )
!        ((StgWorldGui*)world)->GetBlockGrid()->Draw( false );
         
         if( showflags & STG_SHOW_QUADTREE )
!        ((StgWorldGui*)world)->GetBlockGrid()->Draw( true );
         
         colorstack.Pop();
-        glPopMatrix();  
         
         glEnable( GL_LINE_SMOOTH );
       }
     
     for( GList* it=selected_models; it; it=it->next )
--- 434,454 ----
         
         glPushMatrix();
!        //glTranslatef( -world->Width()/2.0, -world->Height()/2.0, 1 );
!        //glScalef( 1.0/world->Resolution(), 1.0/world->Resolution(), 0 );
         glPolygonMode( GL_FRONT, GL_LINE );
         colorstack.Push(1,0,0);
         
         if( showflags & STG_SHOW_OCCUPANCY )
!        ((StgWorldGui*)world)->DrawTree( false );
         
         if( showflags & STG_SHOW_QUADTREE )
!        ((StgWorldGui*)world)->DrawTree( true );
         
         colorstack.Pop();
         
         glEnable( GL_LINE_SMOOTH );
       }
+ 
+    glPopMatrix();         
     
     for( GList* it=selected_models; it; it=it->next )

Index: Makefile
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile    19 Jan 2008 01:19:40 -0000      1.3
--- Makefile    1 Feb 2008 03:11:01 -0000       1.4
***************
*** 1,7 ****
! # Makefile.in generated by automake 1.9.6 from Makefile.am.
  # libstage/Makefile.  Generated from Makefile.in by configure.
  
  # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
! # 2003, 2004, 2005  Free Software Foundation, Inc.
  # This Makefile.in is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
--- 1,7 ----
! # Makefile.in generated by automake 1.10 from Makefile.am.
  # libstage/Makefile.  Generated from Makefile.in by configure.
  
  # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
! # 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
  # This Makefile.in is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
***************
*** 23,35 ****
  
  
- srcdir = .
- top_srcdir = ..
  
  pkgdatadir = $(datadir)/stage
  pkglibdir = $(libdir)/stage
  pkgincludedir = $(includedir)/stage
- top_builddir = ..
  am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
- INSTALL = /usr/bin/install -c
  install_sh_DATA = $(install_sh) -c -m 644
  install_sh_PROGRAM = $(install_sh) -c
--- 23,31 ----
***************
*** 43,49 ****
  PRE_UNINSTALL = :
  POST_UNINSTALL = :
! build_triplet = i686-pc-linux-gnu
! host_triplet = i686-pc-linux-gnu
! target_triplet = i686-pc-linux-gnu
  bin_PROGRAMS = stest$(EXEEXT)
  subdir = libstage
--- 39,45 ----
  PRE_UNINSTALL = :
  POST_UNINSTALL = :
! build_triplet = i386-apple-darwin9.1.0
! host_triplet = i386-apple-darwin9.1.0
! target_triplet = i386-apple-darwin9.1.0
  bin_PROGRAMS = stest$(EXEEXT)
  subdir = libstage
***************
*** 75,101 ****
        world.lo worldfile.lo worldgui.lo
  libstage_la_OBJECTS = $(am_libstage_la_OBJECTS)
  binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
  PROGRAMS = $(bin_PROGRAMS)
  am_stest_OBJECTS = stest.$(OBJEXT)
  stest_OBJECTS = $(am_stest_OBJECTS)
! DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
  depcomp = $(SHELL) $(top_srcdir)/depcomp
  am__depfiles_maybe = depfiles
  CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
! LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
!       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
!       $(AM_CXXFLAGS) $(CXXFLAGS)
  CXXLD = $(CXX)
! CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
!       $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
  COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
! LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
!       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
!       $(AM_CFLAGS) $(CFLAGS)
  CCLD = $(CC)
! LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
!       $(AM_LDFLAGS) $(LDFLAGS) -o $@
  SOURCES = $(libstage_la_SOURCES) $(stest_SOURCES)
  DIST_SOURCES = $(libstage_la_SOURCES) $(stest_SOURCES)
--- 71,102 ----
        world.lo worldfile.lo worldgui.lo
  libstage_la_OBJECTS = $(am_libstage_la_OBJECTS)
+ libstage_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+       $(CXXFLAGS) $(libstage_la_LDFLAGS) $(LDFLAGS) -o $@
  binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
  PROGRAMS = $(bin_PROGRAMS)
  am_stest_OBJECTS = stest.$(OBJEXT)
  stest_OBJECTS = $(am_stest_OBJECTS)
! DEFAULT_INCLUDES = -I. -I$(top_builddir)
  depcomp = $(SHELL) $(top_srcdir)/depcomp
  am__depfiles_maybe = depfiles
  CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
! LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
!       --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
!       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
  CXXLD = $(CXX)
! CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
!       --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
!       $(LDFLAGS) -o $@
  COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
! LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
!       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
!       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  CCLD = $(CC)
! LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
!       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
!       $(LDFLAGS) -o $@
  SOURCES = $(libstage_la_SOURCES) $(stest_SOURCES)
  DIST_SOURCES = $(libstage_la_SOURCES) $(stest_SOURCES)
***************
*** 107,118 ****
  CTAGS = ctags
  DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
! ACLOCAL = ${SHELL} /home/vaughan/PS/HEAD/stage/missing --run aclocal-1.9
! AMDEP_FALSE = #
! AMDEP_TRUE = 
! AMTAR = ${SHELL} /home/vaughan/PS/HEAD/stage/missing --run tar
  AR = ar
! AUTOCONF = ${SHELL} /home/vaughan/PS/HEAD/stage/missing --run autoconf
! AUTOHEADER = ${SHELL} /home/vaughan/PS/HEAD/stage/missing --run autoheader
! AUTOMAKE = ${SHELL} /home/vaughan/PS/HEAD/stage/missing --run automake-1.9
  AWK = gawk
  CC = gcc
--- 108,117 ----
  CTAGS = ctags
  DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
! ACLOCAL = ${SHELL} /Users/vaughan/PS/HEAD/stage/missing --run aclocal-1.10
! AMTAR = ${SHELL} /Users/vaughan/PS/HEAD/stage/missing --run tar
  AR = ar
! AUTOCONF = ${SHELL} /Users/vaughan/PS/HEAD/stage/missing --run autoconf
! AUTOHEADER = ${SHELL} /Users/vaughan/PS/HEAD/stage/missing --run autoheader
! AUTOMAKE = ${SHELL} /Users/vaughan/PS/HEAD/stage/missing --run automake-1.10
  AWK = gawk
  CC = gcc
***************
*** 128,151 ****
  DEFS = -DHAVE_CONFIG_H
  DEPDIR = .deps
! ECHO = echo
! ECHO_C = 
! ECHO_N = -n
  ECHO_T = 
! EGREP = /bin/grep -E
  EXEEXT = 
! F77 = gfortran
! FFLAGS = -g -O2
! FLTK_CFLAGS = -I/usr/local/include
! FLTK_LIBS = -L/usr/local/lib -lfltk_images -lpng -lz -ljpeg -lfltk_gl -lGLU 
-lGL -lfltk -lm -lXext -lX11
! GREP = /bin/grep
  HAVE_FLTK_CONFIG = fltk-config
! HAVE_PLAYERC_FALSE = #
! HAVE_PLAYERC_TRUE = 
! HAVE_PLAYER_FALSE = #
! HAVE_PLAYER_TRUE = 
  INSTALL_DATA = ${INSTALL} -m 644
  INSTALL_PROGRAM = ${INSTALL}
  INSTALL_SCRIPT = ${INSTALL}
! INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
  LDFLAGS = 
  LIBOBJS = 
--- 127,147 ----
  DEFS = -DHAVE_CONFIG_H
  DEPDIR = .deps
! ECHO = /bin/echo
! ECHO_C = \c
! ECHO_N = 
  ECHO_T = 
! EGREP = /usr/bin/grep -E
  EXEEXT = 
! F77 = 
! FFLAGS = 
! FLTK_CFLAGS = -I/opt/local/include -I/opt/local/include/FL/images
! FLTK_LIBS = -L/opt/local/lib -lfltk_images -lfltk_png -lz -lfltk_jpeg 
-lfltk_gl -framework AGL -framework OpenGL -lfltk -framework Carbon -framework 
ApplicationServices
! GREP = /usr/bin/grep
  HAVE_FLTK_CONFIG = fltk-config
! INSTALL = /opt/local/bin/ginstall -c
  INSTALL_DATA = ${INSTALL} -m 644
  INSTALL_PROGRAM = ${INSTALL}
  INSTALL_SCRIPT = ${INSTALL}
! INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
  LDFLAGS = 
  LIBOBJS = 
***************
*** 155,159 ****
  LN_S = ln -s
  LTLIBOBJS = 
! MAKEINFO = ${SHELL} /home/vaughan/PS/HEAD/stage/missing --run makeinfo
  OBJEXT = o
  PACKAGE = stage
--- 151,156 ----
  LN_S = ln -s
  LTLIBOBJS = 
! MAKEINFO = ${SHELL} /Users/vaughan/PS/HEAD/stage/missing --run makeinfo
! MKDIR_P = /opt/local/bin/gmkdir -p
  OBJEXT = o
  PACKAGE = stage
***************
*** 164,187 ****
  PACKAGE_VERSION = 3.0.0
  PATH_SEPARATOR = :
! PIXBUF_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include  
! PIXBUF_LIBS = -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0  
! PKG_CONFIG = /usr/bin/pkg-config
! PLAYERC_CFLAGS = -I/home/vaughan/PS-2.0/include/player-2.1  
! PLAYERC_LIBS = -L/home/vaughan/PS-2.0/lib -lplayerc -lm -lplayerxdr 
-lplayererror  
! PLAYER_CFLAGS = -I/home/vaughan/PS-2.0/include/player-2.1  
! PLAYER_LIBS = -L/home/vaughan/PS-2.0/lib -lplayercore -lltdl -lpthread 
-lplayererror  
  RANLIB = ranlib
- SED = /usr/bin/sed
  SET_MAKE = 
  SHELL = /bin/sh
  STRIP = strip
  VERSION = 3.0.0
  ac_ct_CC = gcc
  ac_ct_CXX = g++
! ac_ct_F77 = gfortran
! am__fastdepCC_FALSE = #
! am__fastdepCC_TRUE = 
! am__fastdepCXX_FALSE = #
! am__fastdepCXX_TRUE = 
  am__include = include
  am__leading_dot = .
--- 161,183 ----
  PACKAGE_VERSION = 3.0.0
  PATH_SEPARATOR = :
! PIXBUF_CFLAGS = -I/opt/local/include/gtk-2.0 -I/opt/local/include/glib-2.0 
-I/opt/local/lib/glib-2.0/include -I/opt/local/include  
! PIXBUF_LIBS = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0 
-lglib-2.0 -lintl -liconv  
! PKG_CONFIG = /opt/local/bin/pkg-config
! PLAYERC_CFLAGS = -I/Users/vaughan/PS-2.0/include/player-2.1  
! PLAYERC_LIBS = -L/Users/vaughan/PS-2.0/lib -lplayerc -lm -lplayerxdr 
-lplayererror  
! PLAYER_CFLAGS = -I/Users/vaughan/PS-2.0/include/player-2.1  
! PLAYER_LIBS = -L/Users/vaughan/PS-2.0/lib -lplayercore -lltdl -lpthread 
-lplayererror  
  RANLIB = ranlib
  SET_MAKE = 
  SHELL = /bin/sh
  STRIP = strip
  VERSION = 3.0.0
+ abs_builddir = /Users/vaughan/PS/HEAD/stage/libstage
+ abs_srcdir = /Users/vaughan/PS/HEAD/stage/libstage
+ abs_top_builddir = /Users/vaughan/PS/HEAD/stage
+ abs_top_srcdir = /Users/vaughan/PS/HEAD/stage
  ac_ct_CC = gcc
  ac_ct_CXX = g++
! ac_ct_F77 = 
  am__include = include
  am__leading_dot = .
***************
*** 190,198 ****
  am__untar = tar -xf -
  bindir = ${exec_prefix}/bin
! build = i686-pc-linux-gnu
  build_alias = 
! build_cpu = i686
! build_os = linux-gnu
! build_vendor = pc
  datadir = ${datarootdir}
  datarootdir = ${prefix}/share
--- 186,195 ----
  am__untar = tar -xf -
  bindir = ${exec_prefix}/bin
! build = i386-apple-darwin9.1.0
  build_alias = 
! build_cpu = i386
! build_os = darwin9.1.0
! build_vendor = apple
! builddir = .
  datadir = ${datarootdir}
  datarootdir = ${prefix}/share
***************
*** 201,213 ****
  exec_prefix = ${prefix}
  have_pkg_config = yes
! host = i686-pc-linux-gnu
  host_alias = 
! host_cpu = i686
! host_os = linux-gnu
! host_vendor = pc
  htmldir = ${docdir}
  includedir = ${prefix}/include
  infodir = ${datarootdir}/info
! install_sh = /home/vaughan/PS/HEAD/stage/install-sh
  libdir = ${exec_prefix}/lib
  libexecdir = ${exec_prefix}/libexec
--- 198,210 ----
  exec_prefix = ${prefix}
  have_pkg_config = yes
! host = i386-apple-darwin9.1.0
  host_alias = 
! host_cpu = i386
! host_os = darwin9.1.0
! host_vendor = apple
  htmldir = ${docdir}
  includedir = ${prefix}/include
  infodir = ${datarootdir}/info
! install_sh = $(SHELL) /Users/vaughan/PS/HEAD/stage/install-sh
  libdir = ${exec_prefix}/lib
  libexecdir = ${exec_prefix}/libexec
***************
*** 215,232 ****
  localstatedir = ${prefix}/var
  mandir = ${datarootdir}/man
! mkdir_p = mkdir -p --
  oldincludedir = /usr/include
  pdfdir = ${docdir}
! prefix = /home/vaughan/PS-2.0
  program_transform_name = s,x,x,
  psdir = ${docdir}
  sbindir = ${exec_prefix}/sbin
  sharedstatedir = ${prefix}/com
  sysconfdir = ${prefix}/etc
! target = i686-pc-linux-gnu
  target_alias = 
! target_cpu = i686
! target_os = linux-gnu
! target_vendor = pc
  
  # install the header file for the Stage library
--- 212,232 ----
  localstatedir = ${prefix}/var
  mandir = ${datarootdir}/man
! mkdir_p = /opt/local/bin/gmkdir -p
  oldincludedir = /usr/include
  pdfdir = ${docdir}
! prefix = /Users/vaughan/PS-2.0
  program_transform_name = s,x,x,
  psdir = ${docdir}
  sbindir = ${exec_prefix}/sbin
  sharedstatedir = ${prefix}/com
+ srcdir = .
  sysconfdir = ${prefix}/etc
! target = i386-apple-darwin9.1.0
  target_alias = 
! target_cpu = i386
! target_os = darwin9.1.0
! target_vendor = apple
! top_builddir = ..
! top_srcdir = ..
  
  # install the header file for the Stage library
***************
*** 238,242 ****
  
  # system-wide compile flags - target-specific flags are added to each target 
below
! AM_CPPFLAGS = -Wall -I. -I$(top_srcdir)/replace  -I/usr/include/gtk-2.0 
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -I/usr/local/include 
-DRGBFILE=\"$(RGB)\"
  
  # build the stage library
--- 238,242 ----
  
  # system-wide compile flags - target-specific flags are added to each target 
below
! AM_CPPFLAGS = -Wall -I. -I$(top_srcdir)/replace  -I/opt/local/include/gtk-2.0 
-I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include 
-I/opt/local/include   -I/opt/local/include -I/opt/local/include/FL/images 
-DRGBFILE=\"$(RGB)\"
  
  # build the stage library
***************
*** 273,277 ****
  #logo.cc 
  libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir) 
! libstage_la_LIBADD = -lgdk_pixbuf-2.0 -lgobject-2.0 -lgmodule-2.0 -ldl 
-lglib-2.0   -L/usr/local/lib -lfltk_images -lpng -lz -ljpeg -lfltk_gl -lGLU 
-lGL -lfltk -lm -lXext -lX11
  stest_DEPENDENCIES = libstage.la
  stest_SOURCES = stest.cc
--- 273,277 ----
  #logo.cc 
  libstage_la_LDFLAGS = -version-info 3:1:0 -rpath $(libdir) 
! libstage_la_LIBADD = -L/opt/local/lib -lgdk_pixbuf-2.0 -lgobject-2.0 
-lgmodule-2.0 -lglib-2.0 -lintl -liconv   -L/opt/local/lib -lfltk_images 
-lfltk_png -lz -lfltk_jpeg -lfltk_gl -framework AGL -framework OpenGL -lfltk 
-framework Carbon -framework ApplicationServices
  stest_DEPENDENCIES = libstage.la
  stest_SOURCES = stest.cc
***************
*** 312,316 ****
  install-libLTLIBRARIES: $(lib_LTLIBRARIES)
        @$(NORMAL_INSTALL)
!       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
        @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
--- 312,316 ----
  install-libLTLIBRARIES: $(lib_LTLIBRARIES)
        @$(NORMAL_INSTALL)
!       test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
        @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
***************
*** 323,327 ****
  uninstall-libLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
!       @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
          echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
--- 323,327 ----
  uninstall-libLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
!       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
          echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
***************
*** 338,345 ****
        done
  libstage.la: $(libstage_la_OBJECTS) $(libstage_la_DEPENDENCIES) 
!       $(CXXLINK) -rpath $(libdir) $(libstage_la_LDFLAGS) 
$(libstage_la_OBJECTS) $(libstage_la_LIBADD) $(LIBS)
  install-binPROGRAMS: $(bin_PROGRAMS)
        @$(NORMAL_INSTALL)
!       test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
        @list='$(bin_PROGRAMS)'; for p in $$list; do \
          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
--- 338,345 ----
        done
  libstage.la: $(libstage_la_OBJECTS) $(libstage_la_DEPENDENCIES) 
!       $(libstage_la_LINK) -rpath $(libdir) $(libstage_la_OBJECTS) 
$(libstage_la_LIBADD) $(LIBS)
  install-binPROGRAMS: $(bin_PROGRAMS)
        @$(NORMAL_INSTALL)
!       test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
        @list='$(bin_PROGRAMS)'; for p in $$list; do \
          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
***************
*** 369,373 ****
  stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) 
        @rm -f stest$(EXEEXT)
!       $(CXXLINK) $(stest_LDFLAGS) $(stest_OBJECTS) $(stest_LDADD) $(LIBS)
  
  mostlyclean-compile:
--- 369,373 ----
  stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) 
        @rm -f stest$(EXEEXT)
!       $(CXXLINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS)
  
  mostlyclean-compile:
***************
*** 399,404 ****
  
  .cc.o:
!       if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
!       then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f 
"$(DEPDIR)/$*.Tpo"; exit 1; fi
  #     source='$<' object='$@' libtool=no \
  #     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
--- 399,404 ----
  
  .cc.o:
!       $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
!       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
  #     source='$<' object='$@' libtool=no \
  #     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
***************
*** 406,411 ****
  
  .cc.obj:
!       if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ 
`$(CYGPATH_W) '$<'`; \
!       then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f 
"$(DEPDIR)/$*.Tpo"; exit 1; fi
  #     source='$<' object='$@' libtool=no \
  #     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
--- 406,411 ----
  
  .cc.obj:
!       $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ 
`$(CYGPATH_W) '$<'`
!       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
  #     source='$<' object='$@' libtool=no \
  #     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
***************
*** 413,418 ****
  
  .cc.lo:
!       if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
!       then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f 
"$(DEPDIR)/$*.Tpo"; exit 1; fi
  #     source='$<' object='$@' libtool=yes \
  #     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
--- 413,418 ----
  
  .cc.lo:
!       $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
!       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
  #     source='$<' object='$@' libtool=yes \
  #     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
***************
*** 424,434 ****
  clean-libtool:
        -rm -rf .libs _libs
- 
- distclean-libtool:
-       -rm -f libtool
- uninstall-info-am:
  install-pkgdataDATA: $(pkgdata_DATA)
        @$(NORMAL_INSTALL)
!       test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
        @list='$(pkgdata_DATA)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
--- 424,430 ----
  clean-libtool:
        -rm -rf .libs _libs
  install-pkgdataDATA: $(pkgdata_DATA)
        @$(NORMAL_INSTALL)
!       test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
        @list='$(pkgdata_DATA)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
***************
*** 447,451 ****
  install-includeHEADERS: $(include_HEADERS)
        @$(NORMAL_INSTALL)
!       test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
        @list='$(include_HEADERS)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
--- 443,447 ----
  install-includeHEADERS: $(include_HEADERS)
        @$(NORMAL_INSTALL)
!       test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
        @list='$(include_HEADERS)'; for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
***************
*** 512,531 ****
  
  distdir: $(DISTFILES)
!       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
!       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
!       list='$(DISTFILES)'; for file in $$list; do \
!         case $$file in \
!           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
!           $(top_srcdir)/*) file=`echo "$$file" | sed 
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
!         esac; \
          if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-           dir="/$$dir"; \
-           $(mkdir_p) "$(distdir)$$dir"; \
-         else \
-           dir=''; \
-         fi; \
          if test -d $$d/$$file; then \
            if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
              cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
--- 508,526 ----
  
  distdir: $(DISTFILES)
!       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
!       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
!       list='$(DISTFILES)'; \
!         dist_files=`for file in $$list; do echo $$file; done | \
!         sed -e "s|^$$srcdirstrip/||;t" \
!             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
!       case $$dist_files in \
!         */*) $(MKDIR_P) `echo "$$dist_files" | \
!                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
!                          sort -u` ;; \
!       esac; \
!       for file in $$dist_files; do \
          if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
          if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
            if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
              cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
***************
*** 545,549 ****
  installdirs:
        for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" 
"$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(includedir)"; do \
!         test -z "$$dir" || $(mkdir_p) "$$dir"; \
        done
  install: install-am
--- 540,544 ----
  installdirs:
        for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" 
"$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(includedir)"; do \
!         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
  install: install-am
***************
*** 580,584 ****
        -rm -f Makefile
  distclean-am: clean-am distclean-compile distclean-generic \
!       distclean-libtool distclean-tags
  
  dvi: dvi-am
--- 575,579 ----
        -rm -f Makefile
  distclean-am: clean-am distclean-compile distclean-generic \
!       distclean-tags
  
  dvi: dvi-am
***************
*** 594,603 ****
--- 589,606 ----
  install-data-am: install-includeHEADERS install-pkgdataDATA
  
+ install-dvi: install-dvi-am
+ 
  install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
  
+ install-html: install-html-am
+ 
  install-info: install-info-am
  
  install-man:
  
+ install-pdf: install-pdf-am
+ 
+ install-ps: install-ps-am
+ 
  installcheck-am:
  
***************
*** 621,626 ****
  
  uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
!       uninstall-info-am uninstall-libLTLIBRARIES \
!       uninstall-pkgdataDATA
  
  .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
--- 624,630 ----
  
  uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
!       uninstall-libLTLIBRARIES uninstall-pkgdataDATA
! 
! .MAKE: install-am install-strip
  
  .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
***************
*** 629,641 ****
        distclean-libtool distclean-tags distdir dvi dvi-am html \
        html-am info info-am install install-am install-binPROGRAMS \
!       install-data install-data-am install-exec install-exec-am \
        install-includeHEADERS install-info install-info-am \
!       install-libLTLIBRARIES install-man install-pkgdataDATA \
!       install-strip installcheck installcheck-am installdirs \
!       maintainer-clean maintainer-clean-generic mostlyclean \
!       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
!       pdf pdf-am ps ps-am tags uninstall uninstall-am \
!       uninstall-binPROGRAMS uninstall-includeHEADERS \
!       uninstall-info-am uninstall-libLTLIBRARIES \
        uninstall-pkgdataDATA
  
--- 633,646 ----
        distclean-libtool distclean-tags distdir dvi dvi-am html \
        html-am info info-am install install-am install-binPROGRAMS \
!       install-data install-data-am install-dvi install-dvi-am \
!       install-exec install-exec-am install-html install-html-am \
        install-includeHEADERS install-info install-info-am \
!       install-libLTLIBRARIES install-man install-pdf install-pdf-am \
!       install-pkgdataDATA install-ps install-ps-am install-strip \
!       installcheck installcheck-am installdirs maintainer-clean \
!       maintainer-clean-generic mostlyclean mostlyclean-compile \
!       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
!       tags uninstall uninstall-am uninstall-binPROGRAMS \
!       uninstall-includeHEADERS uninstall-libLTLIBRARIES \
        uninstall-pkgdataDATA
  

Index: world.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/world.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** world.cc    19 Jan 2008 01:19:40 -0000      1.3
--- world.cc    1 Feb 2008 03:11:02 -0000       1.4
***************
*** 31,35 ****
  - resolution [meters]
    - specifies the resolution of the underlying bitmap model. Larger values 
speed up raytracing at the expense of fidelity in collision detection and 
sensing. 
- 
  @par More examples
  
--- 31,34 ----
***************
*** 49,52 ****
--- 48,52 ----
  #include <locale.h> 
  #include <glib-object.h> // fior g_type_init() used by GDKPixbuf objects
+ #include <limits.h>
  
  #include "stage_internal.hh"
***************
*** 57,62 ****
  
  // TODO: fix the quadtree code so we don't need a world size
! const stg_meters_t STG_DEFAULT_WORLD_WIDTH = 20.0;
! const stg_meters_t STG_DEFAULT_WORLD_HEIGHT = 20.0; 
  
  // static data members
--- 57,62 ----
  
  // TODO: fix the quadtree code so we don't need a world size
! //const stg_meters_t STG_DEFAULT_WORLD_WIDTH = 20.0;
! //const stg_meters_t STG_DEFAULT_WORLD_HEIGHT = 20.0; 
  
  // static data members
***************
*** 64,67 ****
--- 64,263 ----
  bool StgWorld::quit_all = false;
  
+ const uint32_t RBITS = 6;
+ const uint32_t SBITS = 4;
+ const uint32_t SRBITS = RBITS+SBITS;
+ 
+ static guint PointIntHash( stg_point_int_t* pt )
+ {
+   return( pt->x + (pt->y<<16 ));
+ }
+ 
+ static gboolean PointIntEqual( stg_point_int_t* p1, stg_point_int_t* p2 )
+ {
+   return( memcmp( p1, p2, sizeof(stg_point_int_t) ) == 0 );
+ }
+ 
+ typedef struct
+ {
+   GSList* list;
+ }  stg_cell_t;
+ 
+ class Stg::Region
+ {
+   friend class SuperRegion;
+   
+ private:  
+   static const uint32_t REGIONWIDTH = 1<<RBITS;
+   static const uint32_t REGIONSIZE = REGIONWIDTH*REGIONWIDTH;
+   
+   stg_cell_t cells[REGIONSIZE];
+   
+ public:
+   uint32_t count; // number of blocks rendered into these cells
+   
+   Region()
+   {
+     bzero( cells, REGIONSIZE * sizeof(stg_cell_t));
+     count = 0;
+   }
+   
+   stg_cell_t* GetCell( int32_t x, int32_t y )
+   {
+     uint32_t index = x + (y*REGIONWIDTH);
+     assert( index >=0 );
+     assert( index < REGIONSIZE );    
+     return &cells[index];    
+   }
+   
+   // add a block to a region cell specified in REGION coordinates
+   void AddBlock( StgBlock* block, int32_t x, int32_t y, unsigned int* count2 )
+   {
+     stg_cell_t* cell = GetCell( x, y );
+     cell->list = g_slist_prepend( cell->list, block ); 
+     block->RecordRenderPoint( &cell->list, cell->list, &this->count, count2 
);    
+     count++;
+   }
+   
+   // UNUSED
+ //   // remove a block from a region cell specified in REGION coordinates
+ //   void RemoveBlock( StgBlock* block, int32_t x, int32_t y )
+ //   {
+ //     stg_cell_t* cell = GetCell( x, y );
+ //     cell->list = g_slist_remove( cell->list, block );     
+ //     count--;
+ //   }
+ };
+ 
+ 
+ class Stg::SuperRegion
+ {
+   friend class StgWorld;
+  
+ private:
+   static const uint32_t SUPERREGIONWIDTH = 1<<SBITS;
+   static const uint32_t SUPERREGIONSIZE = SUPERREGIONWIDTH*SUPERREGIONWIDTH;
+   
+   Region regions[SUPERREGIONSIZE];  
+   uint32_t count; // number of blocks rendered into these regions
+   
+   stg_point_int_t origin;
+   
+ public:
+   
+   SuperRegion( int32_t x, int32_t y )
+   {
+     count = 0;
+     origin.x = x;
+     origin.y = y;
+     //regions = new Region[SUPERREGIONSIZE];
+   }
+   
+   ~SuperRegion()
+   {
+     //delete [] regions;
+   }
+ 
+   // get the region x,y from the region array
+   Region* GetRegion( int32_t x, int32_t y )
+   {
+     int32_t index =  x + (y*SUPERREGIONWIDTH);
+     assert( index >=0 );
+     assert( index < (int)SUPERREGIONSIZE );
+     return &regions[ index ];
+   } 
+   
+   // add a block to a cell specified in superregion coordinates
+   void AddBlock( StgBlock* block, int32_t x, int32_t y )
+   {
+     GetRegion( x>>RBITS, y>>RBITS )
+       ->AddBlock( block,  
+                 x - ((x>>RBITS)<<RBITS),
+                 y - ((y>>RBITS)<<RBITS),
+                 &count);                 
+     count++;
+   }
+ 
+   // UNUSED
+   // remove a block from a cell specified in superregion coordinates
+ //   void RemoveBlock( StgBlock* block, int32_t x, int32_t y )
+ //   {
+ //     GetRegion( x>>RBITS, y>>RBITS )
+ //       ->RemoveBlock( block,  
+ //                 x - ((x>>RBITS)<<RBITS),
+ //                 y - ((y>>RBITS)<<RBITS) );            
+ //     count--;
+ //   }
+   
+   static void Draw_cb( gpointer dummykey, 
+                      SuperRegion* sr, 
+                      gpointer dummyval )
+   {
+     sr->Draw();
+   }
+   
+   void Draw()
+   {
+     glPushMatrix();
+     glTranslatef( origin.x<<SRBITS, origin.y<<SRBITS,0 );
+         
+     glColor3f( 1,0,0 );    
+ 
+     for( unsigned int x=0; x<SUPERREGIONWIDTH; x++ )
+       for( unsigned int y=0; y<SUPERREGIONWIDTH; y++ )
+       {
+         Region* r = GetRegion(x,y);
+         
+         for( unsigned int p=0; p<Region::REGIONWIDTH; p++ )
+           for( unsigned int q=0; q<Region::REGIONWIDTH; q++ )
+             if( r->cells[p+(q*Region::REGIONWIDTH)].list )
+               glRecti( p+(x<<RBITS), q+(y<<RBITS),
+                        1+p+(x<<RBITS), 1+q+(y<<RBITS) );
+       }
+ 
+     // outline regions
+     glColor3f( 0,1,0 );    
+     for( unsigned int x=0; x<SUPERREGIONWIDTH; x++ )
+       for( unsigned int y=0; y<SUPERREGIONWIDTH; y++ )
+       glRecti( x<<RBITS, y<<RBITS, 
+                (x+1)<<RBITS, (y+1)<<RBITS );
+     
+     // outline superregion
+     glColor3f( 0,0,1 );    
+     glRecti( 0,0, 1<<SRBITS, 1<<SRBITS );
+ 
+     glPopMatrix();    
+   }
+   
+   static void Floor_cb( gpointer dummykey, 
+                       SuperRegion* sr, 
+                       gpointer dummyval )
+   {
+     sr->Floor();
+   }
+   
+   void Floor()
+   {
+     glPushMatrix();
+     glTranslatef( origin.x<<SRBITS, origin.y<<SRBITS,0 );        
+     glRecti( 0,0, 1<<SRBITS, 1<<SRBITS );
+     glPopMatrix();    
+   }
+   
+   
+ };
+ 
+ SuperRegion* StgWorld::CreateSuperRegion( int32_t x, int32_t y )
+ {
+   SuperRegion* sr = new SuperRegion( x, y );  
+   g_hash_table_insert( superregions, &sr->origin, sr );
+   return sr;
+ }
+ 
+ void StgWorld::DestroySuperRegion( SuperRegion* sr )
+ {
+   g_hash_table_remove( superregions, &sr->origin );
+   delete sr; 
+ }
+ 
  // todo: get rid of width and height
  
***************
*** 71,77 ****
              STG_DEFAULT_WORLD_INTERVAL_SIM, 
              STG_DEFAULT_WORLD_INTERVAL_REAL,
!             STG_DEFAULT_WORLD_PPM,
!             STG_DEFAULT_WORLD_WIDTH,
!             STG_DEFAULT_WORLD_HEIGHT );
  }  
  
--- 267,273 ----
              STG_DEFAULT_WORLD_INTERVAL_SIM, 
              STG_DEFAULT_WORLD_INTERVAL_REAL,
!             STG_DEFAULT_WORLD_PPM );  
!             //STG_DEFAULT_WORLD_WIDTH,
!             //STG_DEFAULT_WORLD_HEIGHT );
  }  
  
***************
*** 79,96 ****
                    stg_msec_t interval_sim, 
                    stg_msec_t interval_real,
!                   double ppm, 
!                   double width,
!                   double height )
  {
!   Initialize( token, interval_sim, interval_real, ppm, width, height );
  }
  
- 
  void StgWorld::Initialize( const char* token, 
                           stg_msec_t interval_sim, 
                           stg_msec_t interval_real,
!                          double ppm, 
!                          double width,
!                          double height ) 
  {
    if( ! Stg::InitDone() )
--- 275,291 ----
                    stg_msec_t interval_sim, 
                    stg_msec_t interval_real,
!                   double ppm )
! //double width,
! //double height )
  {
!   Initialize( token, interval_sim, interval_real, ppm );//, width, height );
  }
  
  void StgWorld::Initialize( const char* token, 
                           stg_msec_t interval_sim, 
                           stg_msec_t interval_real,
!                          double ppm ) 
! //double width,
! //double height ) 
  {
    if( ! Stg::InitDone() )
***************
*** 126,135 ****
    this->velocity_list = NULL;
  
!   this->width = width;
!   this->height = height;
    this->ppm = ppm; // this is the finest resolution of the matrix
    
!   this->bgrid = new StgBlockGrid( (uint32_t)(width * ppm),
!                                 (uint32_t)(height * ppm) );
    
    this->total_subs = 0;
--- 321,331 ----
    this->velocity_list = NULL;
  
!   //  this->width = width;
!   //this->height = height;
    this->ppm = ppm; // this is the finest resolution of the matrix
    
!   this->superregions = g_hash_table_new( (GHashFunc)PointIntHash, 
!                                        (GEqualFunc)PointIntEqual );
!   this->CreateSuperRegion( 0, 0 );
    
    this->total_subs = 0;
***************
*** 147,156 ****
    
    if( wf ) delete wf;
!   if( bgrid ) delete bgrid;
  
    g_hash_table_destroy( models_by_id );
    g_hash_table_destroy( models_by_name );
    
-   delete bgrid;
    g_free( token );
  }
--- 343,351 ----
    
    if( wf ) delete wf;
!   //if( bgrid ) delete bgrid;
  
    g_hash_table_destroy( models_by_id );
    g_hash_table_destroy( models_by_name );
    
    g_free( token );
  }
***************
*** 242,261 ****
      1.0 / wf->ReadFloat( entity, "resolution", this->ppm ); 
    
!   this->width = 
!     wf->ReadTupleFloat( entity, "size", 0, this->width ); 
    
!   this->height = 
!     wf->ReadTupleFloat( entity, "size", 1, this->height ); 
    
    this->paused = 
      wf->ReadInt( entity, "paused", this->paused );
  
-   if( this->bgrid )
-     delete bgrid;
- 
-   int32_t vwidth = (int32_t)(width * ppm);
-   int32_t vheight = (int32_t)(height * ppm);
-   this->bgrid = new StgBlockGrid( vwidth, vheight );
- 
    //_stg_disable_gui = wf->ReadInt( entity, "gui_disable", _stg_disable_gui );
       
--- 437,449 ----
      1.0 / wf->ReadFloat( entity, "resolution", this->ppm ); 
    
! //   this->width = 
! //     wf->ReadTupleFloat( entity, "size", 0, this->width ); 
    
! //   this->height = 
! //     wf->ReadTupleFloat( entity, "size", 1, this->height ); 
    
    this->paused = 
      wf->ReadInt( entity, "paused", this->paused );
  
    //_stg_disable_gui = wf->ReadInt( entity, "gui_disable", _stg_disable_gui );
       
***************
*** 460,463 ****
--- 648,652 ----
  
  
+ 
  void StgWorld::Raytrace( stg_pose_t pose, // global pose
                         stg_meters_t range,
***************
*** 473,480 ****
  
    // find the global integer bitmap address of the ray  
!   int32_t x = (int32_t)((pose.x+width/2.0)*ppm);
!   int32_t y = (int32_t)((pose.y+height/2.0)*ppm);
    int32_t z = 0;
! 
    int32_t xstart = x;
    int32_t ystart = y;
--- 662,671 ----
  
    // find the global integer bitmap address of the ray  
!   //int32_t x = (int32_t)((pose.x+width/2.0)*ppm);
!   //int32_t y = (int32_t)((pose.y+height/2.0)*ppm);
!   int32_t x = (int32_t)(pose.x*ppm);
!   int32_t y = (int32_t)(pose.y*ppm);
    int32_t z = 0;
!   
    int32_t xstart = x;
    int32_t ystart = y;
***************
*** 499,559 ****
    exy = ay-ax;   exz = az-ax; ezy = ay-az;
    n = ax+ay+az;
- 
-   uint32_t bbx_last = 0;
-   uint32_t bby_last = 0;
-   uint32_t bbx = 0;
-   uint32_t bby = 0;
    
!   bool lookup_list = true;
    
!   while ( n-- ) 
!     {          
!       // todo - avoid calling this multiple times for a single
!       // bigblock.
        
! //       bbx = x>>bgrid->numbits;
! //       bby = y>>bgrid->numbits;
        
! //       //   // if we just changed grid square
! //       if( ! ((bbx == bbx_last) && (bby == bby_last)) )
! //    {
! //      // if this square has some contents, we need to look it up
! //      lookup_list = !(bgrid->BigBlockOccupancy(bbx,bby) < 1 );
! //      bbx_last = bbx;
! //      bby_last = bby;
! //    }
        
! //       if( lookup_list )
        {         
!         for( GSList* list = bgrid->GetList(x,y);
!              list;
!              list = list->next )      
!           {                 
!             StgBlock* block = (StgBlock*)list->data;       
!             assert( block );
              
!             // if this block does not belong to the searching model and it
!             // matches the predicate and it's in the right z range
!             if( //block && (block->Model() != finder) && 
!                 //block->IntersectGlobalZ( pose.z ) &&
!                 (*func)( block, mod, arg ) )
!               {
!                 // a hit!
!                 sample->block = block;
!                 sample->range = hypot( (x-xstart)/ppm, (y-ystart)/ppm );
                  return;
                }
            }
!       }
!         
        // increment our pixel in the correct direction
        if ( exy < 0 ) {
        if ( exz < 0 ) {
!         x += sx;
!         exy += by; exz += bz;
        }
        else  {
!         z += sz;
!         exz -= bx; ezy += by;
        }
        }
--- 690,787 ----
    exy = ay-ax;   exz = az-ax; ezy = ay-az;
    n = ax+ay+az;
    
!   //  printf( "Raytracing from (%d,%d,%d) steps (%d,%d,%d) %d\n",
!   //  x,y,z,  dx,dy,dz, n );
    
!   // superregion coords
!   stg_point_int_t lastsup;
!   lastsup.x = INT_MAX; // an unlikely first raytrace
!   lastsup.y = INT_MAX;
!   
!   stg_point_int_t lastreg;
!   lastsup.x = INT_MAX; // an unlikely first raytrace
!   lastsup.y = INT_MAX;
        
!   SuperRegion* sr = NULL;
!   Region* r = NULL;
!   
!   //puts( "RAYTRACE" );
!   
!   while ( n-- ) 
!     {         
!       // superregion coords
!       stg_point_int_t sup;
!       sup.x = x >> SRBITS;
!       sup.y = y >> SRBITS;
        
!       //  printf( "pixel [%d %d]\tS[ %d %d ]\t",
!       //      x, y, sup.x, sup.y ); 
        
!       if( ! (sup.x == lastsup.x && sup.y == lastsup.y )) 
!       {
!         sr = (SuperRegion*)g_hash_table_lookup( superregions, (void*)&sup );
!         lastsup = sup; // remember these coords
!  
!         //puts( "LOOKED UP SR" );
!         
!       }
!             
!       if( sr )
        {         
!         // find the region coords inside this superregion
!         stg_point_int_t reg;
!         reg.x = (x - ( sup.x << SRBITS)) >> RBITS;
!         reg.y = (y - ( sup.y << SRBITS)) >> RBITS;
!         
!         //  printf( "R[ %d %d ]\t", reg.x, reg.y ); 
!         
!         if( ! (reg.x == lastreg.x && reg.y == lastreg.y ))
!           {
!             r = sr->GetRegion( reg.x, reg.y );       
!             lastreg = reg;
!           }
!         
!         if( r && r->count )
!           {
!             // compute the pixel offset inside this region
!             stg_point_int_t cell;
!             cell.x = x - ((sup.x << SRBITS) + (reg.x << RBITS));
!             cell.y = y - ((sup.y << SRBITS) + (reg.y << RBITS));
! 
!             //  printf( "C[ %d %d ]\t", cell.x, cell.y ); 
              
!             for( GSList* list = r->GetCell( cell.x, cell.y )->list;
!                  list;
!                  list = list->next )      
!               {                     
!                 StgBlock* block = (StgBlock*)list->data;       
!                 assert( block );
!                 
!                 // if this block does not belong to the searching model and it
!                 // matches the predicate and it's in the right z range
!                 if( //block && (block->Model() != finder) && 
!                    //block->IntersectGlobalZ( pose.z ) &&
!                    (*func)( block, mod, arg ) )
!                   {
!                     // a hit!
!                     sample->block = block;
!                     sample->range = hypot( (x-xstart)/ppm, (y-ystart)/ppm );
                  return;
+                   }
                }
            }
!       }      
!       
!       //      printf( "\t step %d n %d   pixel [ %d, %d ] block [ %d %d ] 
index [ %d %d ] \n", 
!       //      //coarse [ %d %d ]\n",
!       //      count++, n, x, y, blockx, blocky, b_dx, b_dy );
!         
        // increment our pixel in the correct direction
        if ( exy < 0 ) {
        if ( exz < 0 ) {
!         x += sx; exy += by; exz += bz;
        }
        else  {
!         z += sz; exz -= bx; ezy += by;
        }
        }
***************
*** 564,573 ****
        }
        else  {
!         y += sy;
!         exy -= bx; ezy -= bz;
        }
        }
      }
! 
    // hit nothing
    return;
--- 792,801 ----
        }
        else  {
!         y += sy; exy -= bx; ezy -= bz;
        }
        }
+       //     puts("");
      }
!   
    // hit nothing
    return;
***************
*** 620,625 ****
                               int32_t *px, int32_t *py )
  {
!   *px = (int32_t)floor((mx+width/2.0) * ppm);
!   *py = (int32_t)floor((my+height/2.0) * ppm);
  }
  
--- 848,853 ----
                               int32_t *px, int32_t *py )
  {
!   *px = (int32_t)floor(mx* ppm);
!   *py = (int32_t)floor(my* ppm);
  }
  
***************
*** 627,632 ****
                             stg_render_info_t* rinfo )
  {
!   rinfo->world->bgrid->AddBlock( x, y, rinfo->block );
    return FALSE;
  }
  
--- 855,896 ----
                             stg_render_info_t* rinfo )
  {
!   // superregion coords
!   stg_point_int_t sup;
!   sup.x = x >> SRBITS;
!   sup.y = y >> SRBITS;
!   
!   //printf( "ADDBLOCKPIXEL pixel [%d %d]  S[ %d %d ]\t",
!   //  x, y, sup.x, sup.y ); 
!   
!   SuperRegion* sr = (SuperRegion*)
!     g_hash_table_lookup( rinfo->world->superregions, (void*)&sup );
! 
!   if( sr == NULL ) // no superregion exists here
!     {
!       //printf( "Creating super region [ %d %d ]\n", sup.x, sup.y );
!       sr = rinfo->world->CreateSuperRegion( sup.x, sup.y );
!     }
!   
!   assert(sr);
!   
!   // find the pixel coords inside this superregion
!   stg_point_int_t cell;
!   cell.x = x - ( sup.x << SRBITS);    
!   cell.y = y - ( sup.y << SRBITS);
!   
!   //printf( "C[ %d %d]", cell.x, cell.y );
!   
!   sr->AddBlock( rinfo->block, cell.x, cell.y );
! 
    return FALSE;
  }
  
+ void StgWorld::DrawTree( bool drawall )
+ {  
+   g_hash_table_foreach( superregions, (GHFunc)SuperRegion::Draw_cb, NULL );
+ }
+ 
+ void StgWorld::DrawFloor()
+ {
+   g_hash_table_foreach( superregions, (GHFunc)SuperRegion::Floor_cb, NULL );
+ }

Index: block.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/block.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** block.cc    15 Jan 2008 01:16:49 -0000      1.2
--- block.cc    1 Feb 2008 03:11:01 -0000       1.3
***************
*** 2,5 ****
--- 2,14 ----
  #include "stage_internal.hh"
  
+ typedef struct
+ {
+   GSList** head;
+   GSList* link;
+   unsigned int* counter1;
+   unsigned int* counter2;
+ } stg_list_entry_t;
+ 
+ 
  /** Create a new block. A model's body is a list of these
      blocks. The point data is copied, so pts can safely be freed
***************
*** 22,26 ****
    this->color = color;
    this->inherit_color = inherit_color;
!   this->rendered_points = g_array_new( FALSE, FALSE, sizeof(stg_point_int_t));
    
    // flag these as unset until StgBlock::Map() is called.
--- 31,36 ----
    this->color = color;
    this->inherit_color = inherit_color;
!   this->rendered_points = 
!     g_array_new( FALSE, FALSE, sizeof(stg_list_entry_t));
    
    // flag these as unset until StgBlock::Map() is called.
***************
*** 166,171 ****
        mod->LocalToGlobal( &gpose );
              
!       pts_global[p].x = (int32_t)floor((gpose.x+mod->World()->width/2.0)*ppm);
!       pts_global[p].y = 
(int32_t)floor((gpose.y+mod->World()->height/2.0)*ppm);
  
        PRINT_DEBUG2("loc [%.2f %.2f]", 
--- 176,183 ----
        mod->LocalToGlobal( &gpose );
              
!       //pts_global[p].x = 
(int32_t)floor((gpose.x+mod->World()->width/2.0)*ppm);
!       //pts_global[p].y = 
(int32_t)floor((gpose.y+mod->World()->height/2.0)*ppm);
!       pts_global[p].x = (int32_t)floor(gpose.x*ppm);
!       pts_global[p].y = (int32_t)floor(gpose.y*ppm);
  
        PRINT_DEBUG2("loc [%.2f %.2f]", 
***************
*** 201,209 ****
    for( unsigned int p=0; p<rendered_points->len; p++ )    
      {
!       stg_point_int_t* pt = 
!       &g_array_index( rendered_points, stg_point_int_t, p);
        
!       mod->World()->RemoveBlock( pt->x, pt->y, this );
! 
      }
  
--- 213,225 ----
    for( unsigned int p=0; p<rendered_points->len; p++ )    
      {
!       stg_list_entry_t* pt = 
!       &g_array_index( rendered_points, stg_list_entry_t, p);
        
!       //mod->World()->RemoveBlockPixel( pt->x, pt->y, this );
!       *pt->head = g_slist_delete_link( *pt->head, pt->link );      
!       
!       // decrement the region and superregion render counts
!       (*pt->counter1)--;
!       (*pt->counter2)--;
      }
  
***************
*** 212,222 ****
  }  
  
! void StgBlock::RecordRenderPoint( uint32_t x, uint32_t y )
  {
    // store this index in the block for later fast deletion
!   stg_point_int_t pt;
!   pt.x = x;
!   pt.y = y;
!   g_array_append_val( rendered_points, pt ); 
  }
  
--- 228,243 ----
  }  
  
! void StgBlock::RecordRenderPoint( GSList** head, 
!                                 GSList* link, 
!                                 unsigned int* c1, 
!                                 unsigned int* c2 )
  {
    // store this index in the block for later fast deletion
!   stg_list_entry_t el;
!   el.head = head;
!   el.link = link;
!   el.counter1 = c1;
!   el.counter2 = c2;
!   g_array_append_val( rendered_points, el ); 
  }
  

Index: Makefile.manual
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/Makefile.manual,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile.manual     19 Jan 2008 01:19:40 -0000      1.3
--- Makefile.manual     1 Feb 2008 03:11:01 -0000       1.4
***************
*** 10,14 ****
      ancestor.cc \
      block.cc \
-     blockgrid.cc \
      canvas.cc \
      glcolorstack.cc \
--- 10,13 ----
***************
*** 29,32 ****
--- 28,32 ----
      worldgui.cc
  
+ #    blockgrid.cc 
  
  

Index: stage.hh
===================================================================
RCS file: /cvsroot/playerstage/code/stage/libstage/stage.hh,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** stage.hh    19 Jan 2008 01:41:14 -0000      1.4
--- stage.hh    1 Feb 2008 03:11:01 -0000       1.5
***************
*** 310,314 ****
    typedef struct
    {
!     uint32_t x,y;
    } stg_point_int_t;
    
--- 310,314 ----
    typedef struct
    {
!     int32_t x,y;
    } stg_point_int_t;
    
***************
*** 869,872 ****
--- 869,875 ----
  
    const uint32_t INTERVAL_LOG_LEN = 32;
+   
+   class Region;
+   class SuperRegion;
  
    /** WORLD CLASS */
***************
*** 897,906 ****
                     stg_msec_t interval_sim, 
                     stg_msec_t interval_real,
!                    double ppm, 
!                    double width,
!                    double height );
    
  
- 
      virtual void PushColor( stg_color_t col ) { /* do nothing */  };
      virtual void PushColor( double r, double g, double b, double a ) { /* do 
nothing */  };
--- 900,908 ----
                     stg_msec_t interval_sim, 
                     stg_msec_t interval_real,
!                    double ppm );
!     //             double width,
!     //             double height );
    
  
      virtual void PushColor( stg_color_t col ) { /* do nothing */  };
      virtual void PushColor( double r, double g, double b, double a ) { /* do 
nothing */  };
***************
*** 915,919 ****
  
      stg_id_t id;
!     stg_meters_t width, height;
  
      GHashTable* models_by_id; ///< the models that make up the world, indexed 
by id
--- 917,921 ----
  
      stg_id_t id;
!     //stg_meters_t width, height;
  
      GHashTable* models_by_id; ///< the models that make up the world, indexed 
by id
***************
*** 946,950 ****
    
      //void MapBlock( StgBlock* block );
!   
      void Raytrace( stg_pose_t pose,                    
                   stg_meters_t range,
--- 948,955 ----
    
      //void MapBlock( StgBlock* block );
! 
!     SuperRegion* CreateSuperRegion( int32_t x, int32_t y );
!     void DestroySuperRegion( SuperRegion* sr );
! 
      void Raytrace( stg_pose_t pose,                    
                   stg_meters_t range,
***************
*** 963,970 ****
                   uint32_t sample_count );
    
!     void RemoveBlock( int x, int y, StgBlock* block )
!     { bgrid->RemoveBlock( x, y, block ); };
    
    protected:
      GList* ray_list;
      // store rays traced for debugging purposes
--- 968,977 ----
                   uint32_t sample_count );
    
!     void RemoveBlock( int x, int y, StgBlock* block );
!     //{ }//bgrid->RemoveBlock( x, y, block ); };
    
    protected:
+     GHashTable* superregions;
+ 
      GList* ray_list;
      // store rays traced for debugging purposes
***************
*** 972,976 ****
      Worldfile* wf; ///< If set, points to the worldfile used to create this 
world
      bool graphics;
!     StgBlockGrid* bgrid;
  
    public:
--- 979,983 ----
      Worldfile* wf; ///< If set, points to the worldfile used to create this 
world
      bool graphics;
!     //StgBlockGrid* bgrid;
  
    public:
***************
*** 981,987 ****
              stg_msec_t interval_sim, 
              stg_msec_t interval_real,
!             double ppm, 
!             double width,
!             double height );
    
      virtual ~StgWorld();
--- 988,994 ----
              stg_msec_t interval_sim, 
              stg_msec_t interval_real,
!             double ppm ); 
!             //double width,
!             //double height );
    
      virtual ~StgWorld();
***************
*** 1013,1018 ****
      void CancelQuitAll(){ quit_all = false; }
    
!     stg_meters_t Width(){ return width; };
!     stg_meters_t Height(){ return height; };
      double Resolution(){ return ppm; };
    
--- 1020,1025 ----
      void CancelQuitAll(){ quit_all = false; }
    
!     //stg_meters_t Width(){ return width; };
!     //stg_meters_t Height(){ return height; };
      double Resolution(){ return ppm; };
    
***************
*** 1023,1027 ****
      GList* GetRayList(){ return ray_list; };
      void ClearRays();
!   
      void ClockString( char* str, size_t maxlen );
  
--- 1030,1036 ----
      GList* GetRayList(){ return ray_list; };
      void ClearRays();
!     void DrawTree( bool leaves );
!     void DrawFloor();
!     
      void ClockString( char* str, size_t maxlen );
  
***************
*** 1459,1463 ****
  
    };
! 
    // BLOCKS
    class StgBlock
--- 1468,1472 ----
  
    };
!   
    // BLOCKS
    class StgBlock
***************
*** 1485,1491 ****
      void DrawSolid(); // draw the block in OpenGL as a solid single color
      void DrawFootPrint(); // draw the projection of the block onto the z=0 
plane
! 
      static void ScaleList( GList* blocks, stg_size_t* size );
!     void RecordRenderPoint( uint32_t x, uint32_t y );
    
      StgModel* Model(){ return mod; };
--- 1494,1500 ----
      void DrawSolid(); // draw the block in OpenGL as a solid single color
      void DrawFootPrint(); // draw the projection of the block onto the z=0 
plane
!     
      static void ScaleList( GList* blocks, stg_size_t* size );
!     void RecordRenderPoint( GSList** head, GSList* link, unsigned int* c1, 
unsigned int* c2 );
    
      StgModel* Model(){ return mod; };
***************
*** 1621,1625 ****
      StgCanvas* canvas;
      Fl_Menu_Bar* mbar;
!     StgBlockGrid* GetBlockGrid(){ return bgrid; };
  
    public:
--- 1630,1634 ----
      StgCanvas* canvas;
      Fl_Menu_Bar* mbar;
!     //StgBlockGrid* GetBlockGrid(){ return bgridx; };
  
    public:


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to