1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
13//osgParticle - Copyright (C) 2002 Marco Jez
15#ifndef OSGPARTICLE_LINEARINTERPOLATOR
16#define OSGPARTICLE_LINEARINTERPOLATOR
18#include <osgParticle/Interpolator>
28 /// A linear interpolator.
29 class LinearInterpolator: public Interpolator
35 LinearInterpolator(const LinearInterpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY)
36 : Interpolator(copy, copyop) {}
38 META_Object(osgParticle, LinearInterpolator);
40 virtual float interpolate(float t, float y1, float y2) const
42 return y1 + (y2 - y1) * t;
45 virtual osg::Vec2 interpolate(float t, const osg::Vec2& y1, const osg::Vec2& y2) const
47 return y1 + (y2 - y1) * t;
50 virtual osg::Vec3 interpolate(float t, const osg::Vec3& y1, const osg::Vec3& y2) const
52 return y1 + (y2 - y1) * t;
55 virtual osg::Vec4 interpolate(float t, const osg::Vec4& y1, const osg::Vec4& y2) const
57 return y1 + (y2 - y1) * t;
61 virtual ~LinearInterpolator() {}