42 lines
1.0 KiB
Plaintext
42 lines
1.0 KiB
Plaintext
//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) {}
|
|
|
|
META_Object(LinearInterpolator);
|
|
|
|
virtual float interpolate(float t, float y1, float y2) const
|
|
{
|
|
return y1 + (y2 - y1) * t;
|
|
}
|
|
|
|
protected:
|
|
virtual ~LinearInterpolator() {}
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|