Convert terrasync into a subsystem.

Fixed scenery tile refresh method.
Simgear automake makefiles with libsvn detection.
Simgear CMake support for libsvn (may not work :) )
This commit is contained in:
ThorstenB
2011-06-11 23:22:26 +02:00
parent c836018ac7
commit 0fd7bb8d3f
10 changed files with 766 additions and 477 deletions

View File

@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF)
option(SIMGEAR_HEADLESS "Set to ON to build SimGear with GUI/graphics support" OFF)
option(JPEG_FACTORY "Enable JPEG-factory support" OFF)
option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" OFF)
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
if (MSVC AND MSVC_3RDPARTY_ROOT)
@@ -67,6 +69,16 @@ if(JPEG_FACTORY)
include_directories(${JPEG_INCLUDE_DIR})
endif()
if(ENABLE_LIBSVN)
find_package(SvnClient)
if(LIBSVN_FOUND)
message(STATUS "libsvn found, enabling in SimGear")
set(HAVE_SVN_CLIENT_H 1)
set(HAVE_LIBSVN_CLIENT_1 1)
endif(LIBSVN_FOUND)
endif(ENABLE_LIBSVN)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H)
check_include_file(unistd.h HAVE_UNISTD_H)

View File

@@ -540,6 +540,39 @@ if test "x$ac_cv_header_zlib_h" != "xyes"; then
echo
fi
dnl Check for Subversion library support
# libsvn support defaults to yes
save_LIBS=$LIBS
save_CPPFLAGS=$CPPFLAGS
AC_ARG_WITH(libsvn, [ --without-libsvn Do not use built-in subversion (libsvn) for simgear [default=no]], [], [with_libsvn=yes])
if test "x$with_libsvn" = "xyes"; then
LIBS="`apr-1-config --link-ld`"
CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
AC_CHECK_HEADERS([svn_client.h])
if test "x$ac_cv_header_svn_client_h" = "xyes"; then
echo "Using built-in subversion (libsvn) for scenery downloads."
AC_SEARCH_LIBS(svn_client_checkout, svn_client-1,
[AC_DEFINE([HAVE_LIBSVN_CLIENT_1], [1], [Define to 1 if you have libsvn_client-1])],
[AC_MSG_ERROR(svn_client-1 library not found.)],)
AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1, , [AC_MSG_ERROR(svn_subr-1 library not found.)],)
AC_SEARCH_LIBS(svn_ra_initialize, svn_ra-1, , [AC_MSG_ERROR(svn_ra-1 library not found.)],)
svn_LIBS=$LIBS
svn_CPPFLAGS=$CPPFLAGS
AC_SUBST(svn_LIBS)
AC_SUBST(svn_CPPFLAGS)
else
echo "Libsvn not found. Will use command line subversion for scenery downloads."
svn_LIBS=""
svn_CPPFLAGS=""
fi
else
echo "Libsvn explicitly disabled. Will use command line subversion for scenery downloads."
svn_LIBS=""
svn_CPPFLAGS=""
fi
LIBS=$save_LIBS
CPPFLAGS=$save_CPPFLAGS
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS( \
@@ -596,6 +629,7 @@ AC_CONFIG_FILES([ \
simgear/scene/sky/Makefile \
simgear/scene/tgdb/Makefile \
simgear/scene/util/Makefile \
simgear/scene/tsync/Makefile \
simgear/screen/Makefile \
simgear/serial/Makefile \
simgear/sound/Makefile \

View File

@@ -1459,6 +1459,18 @@
RelativePath="..\..\simgear\scene\tgdb\userdata.hxx"
>
</File>
</Filter>
<Filter
Name="Lib_sgtsync"
>
<File
RelativePath="..\..\simgear\scene\tsync\terrasync.cxx"
>
</File>
<File
RelativePath="..\..\simgear\scene\tsync\terrasync.hxx"
>
</File>
</Filter>
<Filter
Name="Lib_sgthread"

View File

@@ -9,6 +9,7 @@ foreach( mylibfolder
sky
tgdb
util
tsync
)
add_subdirectory(${mylibfolder})

View File

@@ -192,13 +192,8 @@ void TileCache::refresh_tile(long tile_index)
SG_LOG( SG_TERRAIN, SG_DEBUG, "REFRESHING CACHE ENTRY = " << tile_index );
TileEntry* e = NULL;
if (!it->second->is_expired(current_time))
e = new TileEntry(it->second);
entry_free(tile_index);
if (e)
tile_cache[tile_index] = e;
if (it->second)
it->second->refresh();
}
// update tile's priority and expiry time according to current request
@@ -207,7 +202,7 @@ void TileCache::request_tile(TileEntry* t,float priority,bool current_view,doubl
if ((!current_view)&&(request_time<=0.0))
return;
// update priority when hire - or old has expired
// update priority when higher - or old request has expired
if ((t->is_expired(current_time))||
(priority > t->get_priority()))
{

View File

@@ -415,3 +415,20 @@ TileEntry::removeFromSceneGraph()
}
}
}
void
TileEntry::refresh()
{
osg::Group *parent = NULL;
// find the nodes branch parent
if ( _node->getNumParents() > 0 ) {
// find the first parent (should only be one)
parent = _node->getParent( 0 ) ;
if( parent ) {
parent->removeChild( _node.get() );
}
}
_node = new osg::LOD;
if (parent)
parent->addChild(_node.get());
}

View File

@@ -131,8 +131,12 @@ public:
* graph for this tile.
*/
void removeFromSceneGraph();
/**
* Refresh a tile, reload the node from disk.
*/
void refresh();
/**
* return the scenegraph node for the terrain
*/

View File

@@ -0,0 +1,11 @@
include (SimGearComponent)
set(HEADERS
terrasync.hxx
)
set(SOURCES
terrasync.cxx
)
simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")

View File

@@ -0,0 +1,15 @@
includedir = @includedir@/scene/tsync
AM_CPPFLAGS = $(svn_CPPFLAGS)
lib_LIBRARIES = libsgtsync.a
noinst_HEADERS =
include_HEADERS = \
terrasync.hxx
libsgtsync_a_SOURCES = \
terrasync.cxx
INCLUDES = -I$(top_srcdir)

File diff suppressed because it is too large Load Diff