diff --git a/NEWS b/NEWS index 574b82d1e..1af3f6cd8 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,25 @@ OSG News (most significant items from ChangeLog) ================================================ + + Geometry has been extended to all per primtive bindings and + per primitive set bindings of attributes, and indexing of attributes + with the same or different index lists for each attribute list. + + From Macro Jez, new cubemap helper classes. + + New osg::Shape geometry primitives added which allow the specification + of geometry in a form that can accelerate collision detection, and as + a way of specifiying the geometry to tesselate. Shapes include + Shere, Orintatble Box, Cone, Cylinder, Grid, TriangleMesh, ConvexHull + and CompositeShape which allows the storage of a heirachy of shapes. + + From Geoff Michel, AC3D .wc and Carbon Graphics GEO .geo loaders. + Support added for handling different extensions on different graphics contexts. - Sort callbacks added to osg::RenderStage. + Draw and Sort callbacks added to osg::RenderStage. Support for multitexturing added to OpenFlight loader. diff --git a/include/osg/Shape b/include/osg/Shape index 500ac4172..a2ac3aa6b 100644 --- a/include/osg/Shape +++ b/include/osg/Shape @@ -426,7 +426,7 @@ class HeightField : public Shape virtual float getHeight(unsigned int c,unsigned int r) const = 0; - virtual Vec3 getNormal(unsigned int c,unsigned int r) const = 0; + virtual Vec3 getNormal(unsigned int c,unsigned int r) const; inline void setRotation(const Quat& quat) { _rotation = quat; } inline const Quat& getRotation() const { return _rotation; } @@ -471,11 +471,6 @@ class SG_EXPORT Grid : public HeightField return _heights[c+r*_columns]; } - virtual Vec3 getNormal(unsigned int,unsigned int) const - { - return osg::Vec3(0.0f,0.0f,1.0f); - } - protected: ~Grid(); diff --git a/src/osg/ProceduralGeometry.cpp b/src/osg/ProceduralGeometry.cpp index 1c3078437..315142b94 100644 --- a/src/osg/ProceduralGeometry.cpp +++ b/src/osg/ProceduralGeometry.cpp @@ -706,9 +706,6 @@ void ComputeBoundShapeVisitor::apply(const HeightField& field) _bb.set(field.getOrigin()+osg::Vec3(0.0f,0.0f,zMin), field.getOrigin()+osg::Vec3(field.getXInterval()*field.getNumColumns(),field.getYInterval()*field.getNumRows(),zMax)); - cout << "_bb.min"<<_bb._min; - cout << "_bb.max"<<_bb._max; - } void ComputeBoundShapeVisitor::apply(const CompositeShape&) diff --git a/src/osg/Shape.cpp b/src/osg/Shape.cpp index e4782afca..d04b3b221 100644 --- a/src/osg/Shape.cpp +++ b/src/osg/Shape.cpp @@ -41,3 +41,41 @@ void Grid::populateGrid(float minValue,float maxValue) } } } + +Vec3 HeightField::getNormal(unsigned int c,unsigned int r) const +{ + // four point normal generation. + + float dz_dx; + if (c==0) + { + dz_dx = (getHeight(c+1,r)-getHeight(c,r))/getXInterval(); + } + else if (c==getNumColumns()-1) + { + dz_dx = (getHeight(c,r)-getHeight(c-1,r))/getXInterval(); + } + else // assume 0