Commit Graph

18 Commits

Author SHA1 Message Date
Robert Osfield
dd996a3289 Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,
forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

To ensure the OSG builds when OSG_PROVIDE_READFILE is to OFF the many cases of osgDB::read*File() usage had to be replaced with a ref_ptr<> osgDB::readRef*File()
usage.  The avoid this change causing lots of other client code to be rewritten to handle the use of ref_ptr<> in place of C pointer I introduced a serious of
templte methods in various class to adapt ref_ptr<> to the underly C pointer to be passed to old OSG API's, example of this is found in include/osg/Group:

    bool addChild(Node* child); // old method which can only be used with a Node*

    tempalte<class T> bool addChild(const osg::ref_ptr<T>& child) { return addChild(child.get()); } // adapter template method

These changes together cover 149 modified files, so it's a large submission. This extent of changes are warrent to make use of the Object Cache
and multi-threaded loaded more robust.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
2015-10-22 13:42:19 +00:00
Robert Osfield
ccb50019e4 Cleaned up osgkdtree example 2008-07-12 11:19:25 +00:00
Robert Osfield
3965fe357b Moved KdTree build code into osg::KdTree 2008-07-06 12:14:19 +00:00
Robert Osfield
44d144997e Added prelimnary KdTree data structure and automatic kdtree build support
into osgDB::Registry/osgTerrain so that newly created subgraphs can have 
KdTree built on all osg::Geometry automatically on load/creation.
2008-07-04 15:57:48 +00:00
Robert Osfield
e2ae39c8f6 Introduced bounding boxes to KDLeaf and KDNode structs 2008-07-03 17:18:14 +00:00
Robert Osfield
178d6ff423 Added new data structure + build algorithm that places triangles into leaves
without being shared, but with varying the boundaries of leaves so that they
may overlap.
2008-07-03 15:49:28 +00:00
Robert Osfield
7db303b16b Added header guards 2008-07-03 11:23:44 +00:00
Robert Osfield
f0defbd824 Refactored example so that the example will be able to run different kdtree data strucutres/algorithms. 2008-07-03 11:22:23 +00:00
Robert Osfield
1729ec0819 Implement an experiemental triangle kdtree building support 2008-07-03 10:24:20 +00:00
Robert Osfield
82ed445a31 Added Vec3Array arrange pointer to avoid dynamic cast 2008-07-01 13:56:02 +00:00
Robert Osfield
b6a0f3d8d0 Cleaned up implementation to only use simple structure 2008-06-06 14:10:20 +00:00
Robert Osfield
ed45e32355 Introduce a lower overhead data structure for leaves. 2008-06-06 13:21:27 +00:00
Robert Osfield
aa73e1d1d4 Added update traversal to run prior to doing kdtree build to make sure that
costs in build osgTerrain databases isn't incurred during the build traversal.
2008-06-06 10:51:23 +00:00
Robert Osfield
ac068178aa Added timing code 2008-06-05 18:52:29 +00:00
Robert Osfield
a9b1ea660d Basic implementation of kdtree generation based on vertices 2008-06-05 17:28:06 +00:00
Robert Osfield
9212d4dd95 Further work on fleshing out basic classes 2008-06-04 17:59:39 +00:00
Robert Osfield
338be0b926 Fleshed out some basic kd-tree data structures. 2008-06-03 17:29:27 +00:00
Robert Osfield
8d0c7890ce First cut of osgkdtree example, this will be used as a base of the development of
native kdtree support to help speed up intersection testing.
2008-06-03 16:13:49 +00:00