diff --git a/NEWS b/NEWS index c654e15e8..540d5895c 100644 --- a/NEWS +++ b/NEWS @@ -4,37 +4,70 @@ OSG News (most significant items from ChangeLog) July 2002 - OpenSceneGraph-0.9.0.tar.gz - osgcluster - ported to windows. + >>> OpenSceneGraph goes beta - Multitexturing, Occlusion Culling, Particles and much more added! - Multitexturing support added to osg::StateSet, osg::Geometry, osg::State + This release marks the beginning of the beta phase of the OpenSceneGraph + development, which means that all the major core features are now + in the scene graph, and 1.0 is not far away. Its performance, features + and portability already compares very favorably to other scene graphs, + both comerical and open source. + + Multi-texturing support added to osg::StateSet, osg::Geometry, osg::State and txp loader. - Geometry classes which superseeds the old Performer sytle osg::GeoSet. + New osg::Geometry classes which supersedes the old Performer style osg::GeoSet, + support multi-texturing, and uses sharable osg::Arrays which use + std::vector<> for data storage and manipulation. - Occlusion culling adding to the core OSG. + Shadow volume occlusion culling adding to the core OSG, developed as a + collobaration between Mike Connell and Robert Osfield. Our implementation + uses convex planer occluders, with support for holes to allow larger + and more effective occluders to be used. The approach is software + based so it 100% portable, and by culling during the cull traversal + both CPU and GPU loads are significantly reduced, making it an extremely + powerful feature for large scale urban and indoor visulisation. osgParticle developed by Marco Jez adds support for a range of particle effects. - - osgSim a seperate add-on library adds support for navigational light points. - osgGA (Gui Abstraction) library introduced to provide classes for adatping - different GUI toolkits to work with a standard set of manipulators for + osgGA (Gui Abstraction) library written by Neil Salter adds classes for + adapting different GUI toolkits to work with a standard set of manipulators for modifying the scene, such as camera and state manipulators. - Support for NodeKits. + Support has been added to the plugin architecture to facilitate the + development of NodeKits - add on libraries which can used directly + in your code, or loaded indirectly when loading from file. The + later allows you to load a .osg file with text or particle effects + in them,the plugin architecture automatically loads the required + library which supports these features. - New demos: + A range of new demos have been as code examples, and to demonstrate + the range of features that OpenSceneGraph delivers: + + osgoccluder - demonstrates ocllusion culling, and has a mode + which allows the users to interactively create + their own convex planer occluders. + osghud - how to mix head up display with 3d views. + osgparticle - shows the new osgParticle node kit in action. + osgprerender - pre renders and scene then textures the result onto + an animated flag. + osgcallback - examples of the full range of callbacks that you + can use to add dynamic behaviors to your scene graph. + osglight - a simple example of how to set up spot and position + lights in the scene. + osgclip - illustrates how to add clip planes to you scene. + osggeometry - examples of the different ways to set up primitives + and vertex/color/normal and texture attributes in + the new osg::Geometry class. + osgmultitexture - a simple example which adds a spherical reflection + map to a whole scene using the second texture unit + if one exists. + + osg::Drawable::PrimtiveFunctor has also been added to allow querrying + of primitive data with Drawables subclasses without requiring knowledge + of the types of Drawable subclasses that exists. This decoupling makes + it a very powerful and flexible utility. - osgoccluder - osghud - osgparticle - osgprerender - osgcallback - osglight - osgclip - osggeometry - osgmultitexture 26th April 2002 - OpenSceneGraph-0.8.45.tar.gz diff --git a/include/osg/BoundingBox b/include/osg/BoundingBox index bd2c29984..264952f45 100644 --- a/include/osg/BoundingBox +++ b/include/osg/BoundingBox @@ -124,7 +124,31 @@ class SG_EXPORT BoundingBox /** If the vertex is out-with the box expand to encompass vertex. If this box is empty then move set this box's min max to vertex. */ - void expandBy(const Vec3& v); + inline void expandBy(const Vec3& v) + { + if(v.x()<_min.x()) _min.x() = v.x(); + if(v.x()>_max.x()) _max.x() = v.x(); + + if(v.y()<_min.y()) _min.y() = v.y(); + if(v.y()>_max.y()) _max.y() = v.y(); + + if(v.z()<_min.z()) _min.z() = v.z(); + if(v.z()>_max.z()) _max.z() = v.z(); + } + + /** If the vertex is out-with the box expand to encompass vertex. + If this box is empty then move set this box's min max to vertex. */ + inline void expandBy(float x,float y,float z) + { + if(x<_min.x()) _min.x() = x; + if(x>_max.x()) _max.x() = x; + + if(y<_min.y()) _min.y() = y; + if(y>_max.y()) _max.y() = y; + + if(x<_min.z()) _min.z() = x; + if(x>_max.z()) _max.z() = x; + } /** If incoming box is out-with the box expand to encompass incoming box. If this box is empty then move set this box to incoming box. */ diff --git a/include/osg/Drawable b/include/osg/Drawable index 73bdad856..127edab5f 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -292,7 +292,7 @@ class SG_EXPORT Drawable : public Object /** compute the bounding box of the drawable. Method must be implemented by subclasses.*/ - virtual const bool computeBound() const = 0; + virtual const bool computeBound() const; void addParent(osg::Node* node); void removeParent(osg::Node* node); diff --git a/include/osg/Geometry b/include/osg/Geometry index 616b4a695..709870d44 100644 --- a/include/osg/Geometry +++ b/include/osg/Geometry @@ -103,7 +103,7 @@ class SG_EXPORT Geometry : public Drawable virtual ~Geometry(); - virtual const bool computeBound() const; + //virtual const bool computeBound() const; diff --git a/src/osg/BoundingBox.cpp b/src/osg/BoundingBox.cpp index 37f308c09..e78191445 100644 --- a/src/osg/BoundingBox.cpp +++ b/src/osg/BoundingBox.cpp @@ -3,19 +3,6 @@ using namespace osg; -void BoundingBox::expandBy(const Vec3& v) -{ - if(v.x()<_min.x()) _min.x() = v.x(); - if(v.x()>_max.x()) _max.x() = v.x(); - - if(v.y()<_min.y()) _min.y() = v.y(); - if(v.y()>_max.y()) _max.y() = v.y(); - - if(v.z()<_min.z()) _min.z() = v.z(); - if(v.z()>_max.z()) _max.z() = v.z(); -} - - void BoundingBox::expandBy(const BoundingBox& bb) { if (!bb.valid()) return; diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 31d50c6d3..5abaceda9 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -227,3 +227,77 @@ void Drawable::setAppCallback(AppCallback* ac) } } } + +struct ComputeBound : public Drawable::PrimitiveFunctor +{ + ComputeBound():_vertices(0) {} + + virtual void setVertexArray(unsigned int,Vec3* vertices) { _vertices = vertices; } + + virtual void drawArrays(GLenum,GLint first,GLsizei count) + { + if (_vertices) + { + osg::Vec3* vert = _vertices+first; + for(;count>0;--count,++vert) + { + _bb.expandBy(*vert); + } + } + } + + virtual void drawElements(GLenum,GLsizei count,GLubyte* indices) + { + if (_vertices) + { + for(;count>0;--count,++indices) + { + _bb.expandBy(_vertices[*indices]); + } + } + } + + virtual void drawElements(GLenum,GLsizei count,GLushort* indices) + { + if (_vertices) + { + for(;count>0;--count,++indices) + { + _bb.expandBy(_vertices[*indices]); + } + } + } + + virtual void drawElements(GLenum,GLsizei count,GLuint* indices) + { + if (_vertices) + { + for(;count>0;--count,++indices) + { + _bb.expandBy(_vertices[*indices]); + } + } + } + + virtual void begin(GLenum) {} + virtual void vertex(const Vec3& vert) { _bb.expandBy(vert); } + virtual void vertex(float x,float y,float z) { _bb.expandBy(x,y,z); } + virtual void end() {} + + Vec3* _vertices; + BoundingBox _bb; +}; + +const bool Drawable::computeBound() const +{ + ComputeBound cb; + + Drawable* non_const_this = const_cast(this); + non_const_this->accept(cb); + + _bbox = cb._bb; + _bbox_computed = true; + + return true; +} + diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp index 147becd0f..0dc965f6f 100644 --- a/src/osg/GeoSet.cpp +++ b/src/osg/GeoSet.cpp @@ -416,6 +416,7 @@ void GeoSet::computeNumVerts() const } +// just use the base Drawable's PrimitiveFunctor based implementation. const bool GeoSet::computeBound() const { _bbox.init(); diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index a7ce90fe1..059e6d9b4 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -222,25 +222,25 @@ void Geometry::accept(PrimitiveFunctor& functor) } - -const bool Geometry::computeBound() const -{ - _bbox.init(); - - const Vec3Array* coords = dynamic_cast(_vertexArray.get()); - if (coords) - { - for(Vec3Array::const_iterator itr=coords->begin(); - itr!=coords->end(); - ++itr) - { - _bbox.expandBy(*itr); - } - } - _bbox_computed = true; - - return _bbox.valid(); -} +// just use the base Drawable's PrimitiveFunctor based implementation. +// const bool Geometry::computeBound() const +// { +// _bbox.init(); +// +// const Vec3Array* coords = dynamic_cast(_vertexArray.get()); +// if (coords) +// { +// for(Vec3Array::const_iterator itr=coords->begin(); +// itr!=coords->end(); +// ++itr) +// { +// _bbox.expandBy(*itr); +// } +// } +// _bbox_computed = true; +// +// return _bbox.valid(); +// } bool Geometry::verifyBindings() const { diff --git a/src/osgPlugins/flt/GeoSetBuilder.cpp b/src/osgPlugins/flt/GeoSetBuilder.cpp index 12181dd35..14828682d 100644 --- a/src/osgPlugins/flt/GeoSetBuilder.cpp +++ b/src/osgPlugins/flt/GeoSetBuilder.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include