///////////////////////////////////////////////////////////////////////////////
// FlyThru3D
// - Creates motion from a series of "frames" containing position & orientation
// - Provides smooth cubic interpolation between frames
// - Works with Camera3D class for clean camera fly-throughs
///////////////////////////////////////////////////////////////////////////////
class FlyThru3D
{
public:
Camera3D cam; // Camera object to apply position/orientation to
int nFrames; // Number of predefined position/orientation points
int nFrame; // Next position/orientation point
float fStartTime; // Time camera started rolling (time is unitless)
bool bDone; // Fly-through is complete
// "Padded" arrays have extra frames before/after the end
// These extra frames are there because the cubic interpolation looks one ahead and one back
refptr<fVector3D> _flyPos; // Array of positions corresponding to each frame
refptr<fVector4D> _flyDir; // Array of orientations corresponding to each frame
refptr<float> flyTime; // Amount of time required to travel to next frame
// Pointers to the unpadded arrays
fVector3D * flyPos; // Pointer to _flyPos+1
fVector4D * flyDir; // Pointer to _flyDir+1
// Construct empty fly-through
inline FlyThru3D()
// Methods
void Load(char *sFilename); // Load fly through data from a text file
void start(float fTime); // Start the fly through
void setCamera(float fTime); // Set the camera position based on the current time
};
#endif // __FLYTHRU3D_H__