00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef __Animatio_h
00043 #define __Animatio_h
00044
00045 #ifndef EXTERN
00046 #ifdef _DVS_
00047 #define EXTERN
00048 #else
00049 #define EXTERN extern
00050 #endif
00051 #endif
00052
00053 #include <stdio.h>
00054
00055 #ifndef __double_vector
00056 #define __double_vector
00057 typedef real vector[4];
00058 #endif
00059 #ifndef __double_vect2
00060 #define __double_vect2
00061 typedef real vect2[3];
00062 #endif
00063 #ifndef __struct_cameratp
00064 #define __struct_cameratp
00065 typedef struct cameratp CTYPE;
00066 #endif
00067 #ifndef __struct_axistp
00068 typedef struct axistp ATYPE;
00069 #endif
00070
00071 typedef enum movimento Mov;
00072
00073
00074
00075 #define MAXTIME 0.1
00076 #define MAXTIME2 1
00077 #define MAXVECTORS 600
00078 #define MAXNUMFRAMES 150
00079 #define FILTERPRECISION 0.003
00080
00081 typedef struct movcam MOVCAM;
00082 typedef struct movaxs MOVAXS;
00083 typedef union movunion MOVUNION;
00084 typedef struct Move MOVE;
00085 typedef struct IntVector INTVECTOR;
00086 typedef struct FloVector FLOVECTOR;
00087 typedef struct FrameList FRAMEPT;
00088
00089 struct IntVector
00090 {
00091 int tlinha;
00092 int cor;
00093 int px1;
00094 int px2;
00095 int py1;
00096 int py2;
00097 };
00098
00099 struct FloVector
00100 {
00101 int tlinha;
00102 int cor;
00103 real px1;
00104 real px2;
00105 real py1;
00106 real py2;
00107 };
00108
00109 struct movcam
00110 {
00111 CTYPE *cam;
00112 vector eye;
00113 vector ref;
00114 vector auxeye;
00115 vector auxref;
00116 real scale;
00117 real auxscale;
00118 };
00119
00120 struct movaxs
00121 {
00122 APTYPE axs;
00123 real desl;
00124 real auxdesl;
00125 };
00126
00127 union movunion
00128 {
00129 MOVCAM *mc;
00130 MOVAXS *ma;
00131 };
00132
00133 enum movimento
00134 {
00135 MovimentoAxis,
00136 MovimentoCamera,
00137 };
00138
00139 struct Move
00140 {
00141 Mov tipo;
00142 MOVUNION mu;
00143 MOVE *next;
00144 };
00145
00146 struct FrameList
00147 {
00148 int nvec;
00149 INTVECTOR *vec;
00150 };
00151
00152 EXTERN MOVE *movhead;
00153 EXTERN int framenum;
00154 EXTERN int NumeroFrames;
00155
00156
00157 void animatio(void);
00158 void MSD_selectAllObjects(void);
00159 void MSD_selectElement(char *name);
00160 void MSD_selectGroup(char *name);
00161 void MSD_selectObject(char *name);
00162 void MSD_resetAllObjects(void);
00163 void MSD_resetObject(char *name);
00164 void MSD_resetGroup(char *name);
00165 void MSD_resetElement(char *name);
00166 void MSD_addAxisToMovementStructure(char *eaname, real edesl);
00167 void MSD_addCameraToMovementStructure(char *aname, real ex, real ey, real ez,
00168 real rx, real ry, real rz, real desl);
00169 void AddCamAni(char *aname, vector eeye, vector eref, real edesl);
00170 FILE *OpenIndexAni(char *arqnam);
00171 void CriaFrame(FILE *arqaux, char *arqnam, int framect);
00172 void MSD_createAnimation(int opcao, int nframes, char *AnimeName, char *ecname);
00173 char *InitFrameCount(char *nome, char *aux, int framect);
00174
00175 #ifdef __UNIX_
00176 void itoaa(char *a, int b);
00177 void reverse(char *c);
00178
00179 #endif
00180 void PurificaAni(char *arqnam, int opcao);
00181 void PurificaFrame(int num, char *arqname, char *filename, int opcao);
00182 int compara(real x, real y, real eps);
00183
00184
00185 void cinema(void);
00186 void MSD_loadAnimation(char *AnimeName, int frini, int frfim, int frpasso);
00187 void DrawLine(INTVECTOR *auxpt);
00188 void ExibeFrame(int p);
00189 void MSD_displayLoadedAnimation(int num);
00190 void LoadFrame(int count, int num, char *filename);
00191 int FindFrameNum(char *nome);
00192 void MSD_freeCinemaStructure(void);
00193
00194
00195 MOVE *CreateElementAni(Mov mov);
00196 void AddElementAni(MOVE *e);
00197 void RemElementAni(MOVE *p);
00198 void MSD_clearAnimationList(void);
00199 void PrintListAni(void);
00200 void InitListAni(int nframes);
00201
00202 #endif