home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
MEDIT.LZH
/
MOTION.H
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-29
|
3KB
|
119 lines
#ifndef _MOTION_
#define _MOTION_
#include "parts.h"
#include "matrix.h"
class Vector;
class Matrix;
class Bezier;
class Pose;
class Motion;
class CameraMotion;
class Mechanic;
class TokenReader;
const int BEGIN = 1;
const int EyeLength = 1000;
enum DirType {DirForward, DirLinear};
class MotionData {
public:
Vector rotation[2];
Vector scale[2];
Bezier *bezier;
DirType dirtype;
double speed[2];
MotionData(Bezier *bezier);
MotionData(MotionData& md);
~MotionData();
void GetPosition(double t, Vector& pos, Vector& rot, Vector& scal);
void SetForward(void);
void SetAnyAxis(Vector& v1, Vector& v2);
};
class Motion {
public:
int beginframe, endframe;
int boxflag;
Mechanic *mecha;
MotionData *motiondata;
int nowframe;
Vector position, rotation, scale;
int *point_x, *point_y, *point_z;
int *view_x, *view_y, *view_z;
int *line_1, *line_2;
int lines;
Motion *next;
Motion(Mechanic *mec, int beginframe, int endframe, Bezier* bez = NULL);
Motion(Motion& m);
~Motion();
virtual void GetPosition(int frame);
void GetMatrix(Matrix& move, Matrix& rot, Matrix& scal, int frame = -1);
Matrix GetMatrix(int frame = -1);
void SetRotation(Vector& rot, int pos = 0);
void SetScale(Vector& scal, int pos = 0);
void SetPosition(Vector& vec, int pos = 0);
void SetForward(void);
void ChangeMove(Vector& dir);
void ChangeFix(void);
virtual void CalcPoints(Matrix& m);
virtual void CalcView(Matrix& m);
virtual void CalcPointsBox(Matrix& m);
virtual void CalcViewBox(Matrix& m);
virtual void GetName(char *str);
void SetMech(Mechanic *mec);
void Zoom(int begin, int end);
static Motion *ReadMotion(TokenReader& reader, char *token, int defaultbegin, int defaultend);
static void FileWriteList(Motion* motion, FILE *fp);
void MotionWrite(FILE *fp);
void PoseWrite(int frame, FILE *fp);
static int FileRead(Motion* &motion, CameraMotion* &camera, Vector& light, char *filename);
static int FileWrite(Motion* motion, CameraMotion* camera, Vector& light, char *filename);
};
class CameraMotion : public Motion {
public:
double angle;
Motion *target;
CameraMotion(Motion *target, int frames);
CameraMotion(Motion *m, Motion *t);
virtual void GetPosition(int frame);
virtual void CalcPoints(Matrix& m);
virtual void CalcView(Matrix& m);
virtual void CalcPointsBox(Matrix& m);
virtual void CalcViewBox(Matrix& m);
virtual void GetName(char *str);
void MotionWrite(FILE *fp);
void PoseWrite(int frame, FILE *fp);
void SetAngle(double a);
private:
int l1[CameraLines], l2[CameraLines];
Vector pv[CameraPoints];
};
#endif