29#include "utils/no_copy.hpp"
30#include "utils/vec3.hpp"
45 IPO_ROTX, IPO_ROTY, IPO_ROTZ,
46 IPO_SCALEX, IPO_SCALEY, IPO_SCALEZ,
48 static const std::string m_all_channel_names[IPO_MAX];
62 enum {ET_CONST, ET_EXTRAP, ET_CYCLIC_EXTRAP, ET_CYCLIC}
m_extend;
83 float p2,
float p3)
const;
85 float p2,
float p3)
const;
89 unsigned int rec_level = 0);
98 float get(
float time,
unsigned int index,
unsigned int n);
99 float getDerivative(
float time,
unsigned int index,
unsigned int n);
123 Ipo(
const XMLNode &curve,
float fps=25,
bool reverse=
false);
129 float get(
float time,
unsigned int index)
const;
This object stores the read-only data of an IPO.
Definition: ipo.hpp:54
std::vector< Vec3 > m_handle1
Only used for bezier curves: the two handles.
Definition: ipo.hpp:68
enum Ipo::IpoData::@0 m_interpolation
The three interpolations defined by blender.
Vec3 m_initial_xyz
Stores the inital position of the object.
Definition: ipo.hpp:77
Vec3 m_initial_hpr
Stores the inital rotation of the object.
Definition: ipo.hpp:80
void approximateBezier(float t0, float t1, const Vec3 &p0, const Vec3 &p1, const Vec3 &h0, const Vec3 &h2, unsigned int rec_level=0)
This function approximates a bezier curve by piecewise linear functions.
Definition: ipo.cpp:218
float m_end_time
Time of the last control point.
Definition: ipo.hpp:74
void readIPO(const XMLNode &node, float fps, bool reverse)
Reads a blender IPO curve, which constists of a frame number and a control point.
Definition: ipo.cpp:102
float getDerivative(float time, unsigned int index, unsigned int n)
Determines the derivative of a IPO at a given point.
Definition: ipo.cpp:374
float m_start_time
Time of the first control point.
Definition: ipo.hpp:71
float adjustTime(float time)
Adjusts the time so that it is between start and end of this Ipo.
Definition: ipo.cpp:289
enum Ipo::IpoData::@1 m_extend
The four extend types.
float getCubicBezier(float t, float p0, float p1, float p2, float p3) const
Computes a cubic bezier curve for a given t in [0,1] and four control points.
Definition: ipo.cpp:357
float approximateLength(float t0, float t1, const Vec3 &p0, const Vec3 &p1, const Vec3 &h1, const Vec3 &h2)
Approximates the length of a bezier curve using a simple Euler approximation by dividing the interval...
Definition: ipo.cpp:254
std::vector< Vec3 > m_points
The actual control points.
Definition: ipo.hpp:65
void readCurve(const XMLNode &node, bool reverse)
Reads in 3 dimensional curve data - i.e.
Definition: ipo.cpp:147
IpoChannelType m_channel
The type of this IPO.
Definition: ipo.hpp:57
float getCubicBezierDerivative(float t, float p0, float p1, float p2, float p3) const
Returns the derivative of a cubic bezier curve for a given t in [0,1] and four control points.
Definition: ipo.cpp:412
A class to manage a single blender IPO curve.
Definition: ipo.hpp:38
bool m_own_ipo_data
True if m_ipo_data is 'owned' by this object and therefore needs to be freed.
Definition: ipo.hpp:111
Ipo * clone()
Creates a copy of this object (the copy constructor is disabled in order to avoid implicit copies hap...
Definition: ipo.cpp:459
virtual ~Ipo()
The destructor only frees IpoData if it was created by this instance (and not if this instance was co...
Definition: ipo.cpp:468
void setInitialTransform(const Vec3 &xyz, const Vec3 &hpr)
Stores the initial transform.
Definition: ipo.cpp:479
void update(float time, Vec3 *xyz=NULL, Vec3 *hpr=NULL, Vec3 *scale=NULL)
Updates the time of this ipo and interpolates the new position and rotation (taking the cycle length ...
Definition: ipo.cpp:503
unsigned int m_next_n
Which control points will be the next one (so m_next_n-1 and m_next_n are the control points to use n...
Definition: ipo.hpp:117
float getEndTime() const
Returns the last specified time (i.e.
Definition: ipo.hpp:138
const std::vector< Vec3 > & getPoints() const
Returns the raw data points for this IPO.
Definition: ipo.hpp:134
void getDerivative(float time, Vec3 *xyz)
Returns the derivative for any location based curves.
Definition: ipo.cpp:579
void reset()
Resets the IPO for (re)starting an animation.
Definition: ipo.cpp:489
float get(float time, unsigned int index) const
Returns the interpolated value at the current time (which this objects keeps track of).
Definition: ipo.cpp:559
IpoData * m_ipo_data
The actual data of the IPO.
Definition: ipo.hpp:106
IpoChannelType
All supported ipo types.
Definition: ipo.hpp:43
void updateNextN(float *time) const
Updates the value of m_next_n to point to the right ipo segment based on the time.
Definition: ipo.cpp:537
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
utility class used to parse XML files
Definition: xml_node.hpp:48