Updates NEWS file for 0.9.0 release.

Added default computeBound() implementation to osg::Drawable which uses
a PrimtiveFunctor to compute the bounding box in a generic way, that
will work for all Drawable subclasses that implement the accept(PrimitiveFunctor&).
This commit is contained in:
Robert Osfield 2002-07-18 22:35:54 +00:00
parent e492b79da5
commit 3cba9a52ef
9 changed files with 173 additions and 55 deletions

71
NEWS
View File

@ -4,37 +4,70 @@ OSG News (most significant items from ChangeLog)
July 2002 - OpenSceneGraph-0.9.0.tar.gz 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. 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 osgParticle developed by Marco Jez adds support for a range of particle
effects. effects.
osgSim a seperate add-on library adds support for navigational light points.
osgGA (Gui Abstraction) library introduced to provide classes for adatping osgGA (Gui Abstraction) library written by Neil Salter adds classes for
different GUI toolkits to work with a standard set of manipulators for adapting different GUI toolkits to work with a standard set of manipulators for
modifying the scene, such as camera and state manipulators. 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 26th April 2002 - OpenSceneGraph-0.8.45.tar.gz

View File

@ -124,7 +124,31 @@ class SG_EXPORT BoundingBox
/** If the vertex is out-with the box expand to encompass vertex. /** 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. */ 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 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. */ If this box is empty then move set this box to incoming box. */

View File

@ -292,7 +292,7 @@ class SG_EXPORT Drawable : public Object
/** compute the bounding box of the drawable. Method must be /** compute the bounding box of the drawable. Method must be
implemented by subclasses.*/ implemented by subclasses.*/
virtual const bool computeBound() const = 0; virtual const bool computeBound() const;
void addParent(osg::Node* node); void addParent(osg::Node* node);
void removeParent(osg::Node* node); void removeParent(osg::Node* node);

View File

@ -103,7 +103,7 @@ class SG_EXPORT Geometry : public Drawable
virtual ~Geometry(); virtual ~Geometry();
virtual const bool computeBound() const; //virtual const bool computeBound() const;

View File

@ -3,19 +3,6 @@
using namespace osg; 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) void BoundingBox::expandBy(const BoundingBox& bb)
{ {
if (!bb.valid()) return; if (!bb.valid()) return;

View File

@ -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<Drawable*>(this);
non_const_this->accept(cb);
_bbox = cb._bb;
_bbox_computed = true;
return true;
}

View File

@ -416,6 +416,7 @@ void GeoSet::computeNumVerts() const
} }
// just use the base Drawable's PrimitiveFunctor based implementation.
const bool GeoSet::computeBound() const const bool GeoSet::computeBound() const
{ {
_bbox.init(); _bbox.init();

View File

@ -222,25 +222,25 @@ void Geometry::accept(PrimitiveFunctor& functor)
} }
// just use the base Drawable's PrimitiveFunctor based implementation.
const bool Geometry::computeBound() const // const bool Geometry::computeBound() const
{ // {
_bbox.init(); // _bbox.init();
//
const Vec3Array* coords = dynamic_cast<const Vec3Array*>(_vertexArray.get()); // const Vec3Array* coords = dynamic_cast<const Vec3Array*>(_vertexArray.get());
if (coords) // if (coords)
{ // {
for(Vec3Array::const_iterator itr=coords->begin(); // for(Vec3Array::const_iterator itr=coords->begin();
itr!=coords->end(); // itr!=coords->end();
++itr) // ++itr)
{ // {
_bbox.expandBy(*itr); // _bbox.expandBy(*itr);
} // }
} // }
_bbox_computed = true; // _bbox_computed = true;
//
return _bbox.valid(); // return _bbox.valid();
} // }
bool Geometry::verifyBindings() const bool Geometry::verifyBindings() const
{ {

View File

@ -14,7 +14,6 @@
#include <osg/LOD> #include <osg/LOD>
#include <osg/Transparency> #include <osg/Transparency>
#include <osg/Geode> #include <osg/Geode>
#include <osg/GeoSet>
#include <osg/StateSet> #include <osg/StateSet>
#include <osg/Material> #include <osg/Material>
#include <osg/Texture> #include <osg/Texture>