Added != method to Vec2,Vec3,Vec4 and did further work on the

AttributeUpdateFunctors.
This commit is contained in:
Robert Osfield 2001-10-12 20:05:55 +00:00
parent cb17e99420
commit 9db63dfd5d
5 changed files with 34 additions and 9 deletions

View File

@ -9,6 +9,7 @@
#include <osg/StateSet>
#include <osg/State>
#include <osg/Types>
#include <osg/Vec2>
#include <vector>
#include <map>
@ -75,7 +76,9 @@ class SG_EXPORT Drawable : public Object
void dirtyDisplayList();
/** Dirty the bounding box, forcing a computeBound() on the next call
* to getBound(). Should be called in the internal geometry of the Drawable
* is modified.*/
inline void dirtyBound() { _bbox_computed = false; }
/** get bounding box of geoset.
@ -124,7 +127,9 @@ class SG_EXPORT Drawable : public Object
virtual bool getStats(Statistics&) { return false; }
enum AttributeBitMask
typedef uint AttributeBitMask;
enum AttributeBitMaskValues
{
COORDS = 0x1,
NORMALS = 0x2,
@ -138,14 +143,20 @@ class SG_EXPORT Drawable : public Object
struct AttributeUpdateFunctor
{
virtual bool apply(AttributeBitMask abm,Vec2* begin,Vec2* end) { return false; }
virtual bool apply(AttributeBitMask abm,Vec3* begin,Vec3* end) { return false; }
virtual bool apply(AttributeBitMask abm,Vec4* begin,Vec4* end) { return false; }
inline bool apply(AttributeBitMask abm,Vec2& vec) { return apply(abm,&vec,(&vec)+1); }
inline bool apply(AttributeBitMask abm,Vec3& vec) { return apply(abm,&vec,(&vec)+1); }
inline bool apply(AttributeBitMask abm,Vec4& vec) { return apply(abm,&vec,(&vec)+1); }
virtual bool apply(AttributeBitMask,Vec2*,Vec2*) { return false; }
virtual bool apply(AttributeBitMask,Vec3*,Vec3*) { return false; }
virtual bool apply(AttributeBitMask,Vec4*,Vec4*) { return false; }
};
virtual bool suppportsAttributeUpdate(AttributeBitMask) { return false; }
/** return the attributes supported by applyAttrbuteUpdate() as an AttributeBitMask.*/
virtual AttributeBitMask suppportsAttributeUpdate() const { return (AttributeBitMask)0; }
virtual bool applyAttributeUpdate(AttributeBitMask,AttributeUpdateFunctor&) { return false; }
/** return the attributes successully applied in applyAttributeUpdate.*/
virtual AttributeBitMask applyAttributeUpdate(AttributeBitMask,AttributeUpdateFunctor&) { return (AttributeBitMask)0; }
protected:

View File

@ -288,6 +288,14 @@ class SG_EXPORT GeoSet : public Drawable
const bool check() const;
/** return the attributes supported by applyAttrbuteUpdate() as an AttributeBitMask.*/
virtual AttributeBitMask suppportsAttributeUpdate() const;
/** return the attributes successully applied in applyAttributeUpdate.*/
virtual AttributeBitMask applyAttributeUpdate(AttributeBitMask abm,AttributeUpdateFunctor& auf);
protected:
GeoSet(const GeoSet&):Drawable() {}

View File

@ -32,9 +32,11 @@ class Vec2
float _v[2];
const bool operator == (const Vec2& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1]; }
inline const bool operator == (const Vec2& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1]; }
const bool operator < (const Vec2& v) const
inline const bool operator != (const Vec2& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1]; }
inline const bool operator < (const Vec2& v) const
{
if (_v[0]<v._v[0]) return true;
else if (_v[0]>v._v[0]) return false;

View File

@ -33,6 +33,8 @@ class Vec3
inline const bool operator == (const Vec3& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; }
inline const bool operator != (const Vec3& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2]; }
inline const bool operator < (const Vec3& v) const
{
if (_v[0]<v._v[0]) return true;

View File

@ -38,6 +38,8 @@ class Vec4
inline const bool operator == (const Vec4& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2] && _v[3]==v._v[3]; }
inline const bool operator != (const Vec4& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1] || _v[2]!=v._v[2] || _v[3]!=v._v[3]; }
inline const bool operator < (const Vec4& v) const
{
if (_v[0]<v._v[0]) return true;