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
+1
View File
@@ -9,6 +9,7 @@ foreach( mylibfolder
sky
tgdb
util
tsync
)
add_subdirectory(${mylibfolder})
+3 -8
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()))
{
+17
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());
}
+5 -1
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
*/
+11
View File
@@ -0,0 +1,11 @@
include (SimGearComponent)
set(HEADERS
terrasync.hxx
)
set(SOURCES
terrasync.cxx
)
simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
+15
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