Updates to Shape support.
This commit is contained in:
parent
75fb39adbd
commit
94105025a0
17
NEWS
17
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.
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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&)
|
||||
|
@ -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<c<_numColumns-1
|
||||
{
|
||||
dz_dx = 0.5f*(getHeight(c+1,r)-getHeight(c-1,r))/getXInterval();
|
||||
}
|
||||
|
||||
float dz_dy;
|
||||
if (r==0)
|
||||
{
|
||||
dz_dy = (getHeight(c,r+1)-getHeight(c,r))/getYInterval();
|
||||
}
|
||||
else if (r==getNumRows()-1)
|
||||
{
|
||||
dz_dy = (getHeight(c,r)-getHeight(c,r-1))/getYInterval();
|
||||
}
|
||||
else // assume 0<r<_numRows-1
|
||||
{
|
||||
dz_dy = 0.5f*(getHeight(c,r+1)-getHeight(c,r-1))/getYInterval();
|
||||
}
|
||||
|
||||
Vec3 normal(-dz_dx,-dz_dy,1.0f);
|
||||
normal.normalize();
|
||||
|
||||
return normal;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user