2002-06-05 20:44:55 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
//osgParticle - Copyright (C) 2002 Marco Jez
|
|
|
|
|
|
|
|
#ifndef OSGPARTICLE_LINEARINTERPOLATOR_
|
|
|
|
#define OSGPARTICLE_LINEARINTERPOLATOR_
|
|
|
|
|
|
|
|
#include <osgParticle/Interpolator>
|
|
|
|
|
|
|
|
#include <osg/CopyOp>
|
|
|
|
#include <osg/Object>
|
|
|
|
#include <osg/Vec3>
|
|
|
|
#include <osg/Vec4>
|
|
|
|
|
|
|
|
namespace osgParticle
|
|
|
|
{
|
|
|
|
|
|
|
|
/// A linear interpolator.
|
|
|
|
class LinearInterpolator: public Interpolator {
|
|
|
|
public:
|
|
|
|
LinearInterpolator()
|
|
|
|
: Interpolator() {}
|
|
|
|
|
|
|
|
LinearInterpolator(const LinearInterpolator ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY)
|
|
|
|
: Interpolator(copy, copyop) {}
|
|
|
|
|
2002-06-06 21:25:36 +08:00
|
|
|
META_Object(osgParticle, LinearInterpolator);
|
2002-06-05 20:44:55 +08:00
|
|
|
|
|
|
|
virtual float interpolate(float t, float y1, float y2) const
|
|
|
|
{
|
|
|
|
return y1 + (y2 - y1) * t;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~LinearInterpolator() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|