Added new Node/Drawable::s/getInitialBound and Node/Drawable::s/getComputeBoundCallback
methods and reimplement computeBound so that it passes back a bounding volume rather than modifying the local one.
This commit is contained in:
@@ -131,12 +131,12 @@ namespace osgParticle
|
||||
/// Transform a vector from world to local coordinates, discarding translation (valid only during cull traversal).
|
||||
inline osg::Vec3 rotateWorldToLocal(const osg::Vec3& P);
|
||||
|
||||
virtual osg::BoundingSphere computeBound() const;
|
||||
|
||||
protected:
|
||||
virtual ~ParticleProcessor() {}
|
||||
ParticleProcessor& operator=(const ParticleProcessor&) { return *this; }
|
||||
|
||||
inline bool computeBound() const;
|
||||
|
||||
virtual void process(double dt) = 0;
|
||||
|
||||
private:
|
||||
@@ -249,13 +249,6 @@ namespace osgParticle
|
||||
return _resetTime;
|
||||
}
|
||||
|
||||
inline bool ParticleProcessor::computeBound() const
|
||||
{
|
||||
_bsphere.init();
|
||||
_bsphere_computed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline const osg::Matrix& ParticleProcessor::getLocalToWorldMatrix()
|
||||
{
|
||||
if (_need_ltw_matrix) {
|
||||
|
||||
@@ -159,13 +159,14 @@ namespace osgParticle
|
||||
|
||||
virtual void drawImplementation(osg::State& state) const;
|
||||
|
||||
virtual osg::BoundingBox computeBound() const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ParticleSystem();
|
||||
|
||||
ParticleSystem& operator=(const ParticleSystem&) { return *this; }
|
||||
|
||||
inline virtual bool computeBound() const;
|
||||
inline void update_bounds(const osg::Vec3& p, float r);
|
||||
void single_pass_render(osg::State& state, const osg::Matrix& modelview) const;
|
||||
|
||||
@@ -298,18 +299,6 @@ namespace osgParticle
|
||||
return _last_frame;
|
||||
}
|
||||
|
||||
inline bool ParticleSystem::computeBound() const
|
||||
{
|
||||
if (!_bounds_computed) {
|
||||
_bbox = _def_bbox;
|
||||
} else {
|
||||
_bbox._min = _bmin;
|
||||
_bbox._max = _bmax;
|
||||
}
|
||||
_bbox_computed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void ParticleSystem::update_bounds(const osg::Vec3& p, float r)
|
||||
{
|
||||
if (_reset_bounds_flag) {
|
||||
|
||||
@@ -75,11 +75,12 @@ namespace osgParticle
|
||||
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
virtual osg::BoundingSphere computeBound() const;
|
||||
|
||||
protected:
|
||||
virtual ~ParticleSystemUpdater() {}
|
||||
ParticleSystemUpdater &operator=(const ParticleSystemUpdater &) { return *this; }
|
||||
|
||||
inline virtual bool computeBound() const;
|
||||
|
||||
private:
|
||||
typedef std::vector<osg::ref_ptr<ParticleSystem> > ParticleSystem_Vector;
|
||||
@@ -90,13 +91,6 @@ namespace osgParticle
|
||||
|
||||
// INLINE FUNCTIONS
|
||||
|
||||
inline bool ParticleSystemUpdater::computeBound() const
|
||||
{
|
||||
_bsphere.init();
|
||||
_bsphere_computed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool ParticleSystemUpdater::addParticleSystem(ParticleSystem* ps)
|
||||
{
|
||||
_psv.push_back(ps);
|
||||
|
||||
Reference in New Issue
Block a user