osgParticle/Interpolator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgParticle - Copyright (C) 2002 Marco Jez
#ifndef OSGPARTICLE_INTERPOLATOR
#define OSGPARTICLE_INTERPOLATOR
#include <osgParticle/range>
#include <osg/CopyOp>
#include <osg/Object>
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec4>
namespace osgParticle
{
class Interpolator : public osg::Object {
public:
Interpolator()
: osg::Object() {}
Interpolator(const Interpolator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY)
: osg::Object(copy, copyop) {}
virtual const char* libraryName() const { return "osgParticle"; }
virtual const char* className() const { return "Interpolator"; }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Interpolator* >(obj) != 0; }
virtual float interpolate(float t, float y1, float y2) const = 0;
virtual osg::Vec2 interpolate(float t, const osg::Vec2& y1, const osg::Vec2& y2) const
{
return osg::Vec2(
interpolate(t, y1.x(), y2.x()),
interpolate(t, y1.y(), y2.y())
);
}
virtual osg::Vec3 interpolate(float t, const osg::Vec3& y1, const osg::Vec3& y2) const
{
return osg::Vec3(
interpolate(t, y1.x(), y2.x()),
interpolate(t, y1.y(), y2.y()),
interpolate(t, y1.z(), y2.z())
);
}
virtual osg::Vec4 interpolate(float t, const osg::Vec4& y1, const osg::Vec4& y2) const
{
return osg::Vec4(
interpolate(t, y1.x(), y2.x()),
interpolate(t, y1.y(), y2.y()),
interpolate(t, y1.z(), y2.z()),
interpolate(t, y1.w(), y2.w())
);
}
template<class ValueType>
ValueType interpolate(float t, const range<ValueType>& r) const
{
return interpolate(t, r.minimum, r.maximum);
}
protected:
virtual ~Interpolator() {}
};
}
#endif
CopyOp
Object
Vec2
Vec3
Vec4
osgParticle::Interpolator::interpolate
virtual float interpolate(float t, float y1, float y2) const =0
Interpolate between floats. Must be overridden in descendant classes.
osgParticle::Interpolator::~Interpolator
virtual ~Interpolator()
Definition osgParticle/Interpolator:82
osgParticle::Interpolator::Interpolator
Interpolator()
Definition osgParticle/Interpolator:32
osgParticle::Interpolator::className
virtual const char * className() const
Definition osgParticle/Interpolator:39
osgParticle::Interpolator::Interpolator
Interpolator(const Interpolator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition osgParticle/Interpolator:35
osgParticle::Interpolator::interpolate
virtual osg::Vec4 interpolate(float t, const osg::Vec4 &y1, const osg::Vec4 &y2) const
Interpolate between 4-dimensional vectors. Default behavior is to interpolate each component separate...
Definition osgParticle/Interpolator:65
osgParticle::Interpolator::interpolate
virtual osg::Vec3 interpolate(float t, const osg::Vec3 &y1, const osg::Vec3 &y2) const
Interpolate between 3-dimensional vectors. Default behavior is to interpolate each component separate...
Definition osgParticle/Interpolator:55
osgParticle::Interpolator::libraryName
virtual const char * libraryName() const
Definition osgParticle/Interpolator:38
osgParticle::Interpolator::interpolate
virtual osg::Vec2 interpolate(float t, const osg::Vec2 &y1, const osg::Vec2 &y2) const
Interpolate between 2-dimensional vectors. Default behavior is to interpolate each component separate...
Definition osgParticle/Interpolator:46
osgParticle::Interpolator::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition osgParticle/Interpolator:40
osgParticle::Interpolator::interpolate
ValueType interpolate(float t, const range< ValueType > &r) const
Definition osgParticle/Interpolator:76
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Object
Definition Object:61
osg::Object::Object
Object()
Definition Object:69
osg::Vec2f::x
value_type & x()
Definition Vec2f:67
osg::Vec2f::y
value_type & y()
Definition Vec2f:68
osg::Vec3f::z
value_type & z()
Definition Vec3f:82
osg::Vec3f::y
value_type & y()
Definition Vec3f:81
osg::Vec3f::x
value_type & x()
Definition Vec3f:80
osg::Vec4f::y
value_type & y()
Definition Vec4f:88
osg::Vec4f::x
value_type & x()
Definition Vec4f:87
osg::Vec4f::z
value_type & z()
Definition Vec4f:89
osg::Vec4f::w
value_type & w()
Definition Vec4f:90
osgParticle
Definition AccelOperator:27
osg
Definition AlphaFunc:19
osg::Vec2
Vec2f Vec2
Definition Vec2:21
osg::Vec3
Vec3f Vec3
Definition Vec3:21
osg::Vec4
Vec4f Vec4
Definition Vec4:21
range
osgParticle::range
Definition range:39
osgParticle::range::maximum
ValueType maximum
Higher bound.
Definition range:45
osgParticle::range::minimum
ValueType minimum
Lower bound.
Definition range:42