00001
00002
00009 #if __SC__
00010 #pragma ZTC align 1
00011 #endif
00012
00013 #ifndef min
00014 #define min(a,b) ( ((a) < (b)) ? (a) : (b) )
00015 #endif
00016 #ifndef max
00017 #define max(a,b) ( ((a) > (b)) ? (a) : (b) )
00018 #endif
00019
00020 #ifdef __X__NT__
00021 #define _LINE_DRAW 1
00022 #define X__SetPixel(a,b,c,d) SetPixelV(a,b,c,d)
00023 #else
00024 #define X__SetPixel(a,b,c,d) SetPixel(a,b,c,d)
00025 #endif
00026
00027 #include "../common/mem.h"
00028
00034 #define VECCOPY(a,b) { b[0] = a[0]; b[1] = a[1]; b[2] = a[2]; }
00035 #define VECSUB(a,b,c) { c[0]=a[0]-b[0]; c[1]=a[1]-b[1]; c[2]=a[2]-b[2];}
00036 #define VECSUM(a,b,c) { c[0]=a[0]+b[0]; c[1]=a[1]+b[1]; c[2]=a[2]+b[2];}
00037 #define VECSCALE(a,b,c) { c[0]=(a)*b[0]; c[1]=(a)*b[1]; c[2]=(a)*b[2];}
00038 #define DOT(a,b) ( (a[0]*b[0]) + (a[1]*b[1]) + (a[2]*b[2]) )
00039 #define CROSS(v1,v2,r) { \
00040 r[0] = (v1[1]*v2[2]) - (v2[1]*v1[2]); \
00041 r[1] = (v1[2]*v2[0]) - (v1[0]*v2[2]); \
00042 r[2] = (v1[0]*v2[1]) - (v2[0]*v1[1]); \
00043 }
00044 #define UPDATETIMELINES(x) { \
00045 if(ghwndTimeline != NULL)SendMessage(ghwndTimeline,WM_COMMAND,x,0); \
00046 }
00047
00048 #define ALL_PANNELS 0x0FFF
00049 #define MAIN_WINDOW 0x0001
00050 #define SELECT_PANNEL 0x0002
00051 #define COMMAND_PANNEL 0x0004
00052 #define ZOOM_PANNEL 0x0008
00053 #define TOOL_PANNEL 0x0010
00054 #define TIME_PANNEL 0x0020
00055 #define COORD_PANNEL 0x0040
00056 #define KEYS_WINDOW 0x0080
00057
00058 #define NSWITCH 2
00059
00066 typedef long point[3];
00067 typedef long Sedge[2];
00068 typedef double vector[3];
00069 typedef float Svertex[3];
00070
00077 typedef struct Animator_PREFERENCES_tag {
00078 BOOL show_select;
00079 BOOL buttons;
00080 BOOL quick_trick;
00081 BOOL default_start;
00082 BOOL use_3d_dialogs;
00083 BOOL use_OpenGL;
00084 BOOL undo;
00085 BOOL use_positions;
00086 BOOL ground;
00087 BOOL big_camera;
00088 BOOL tooltips;
00089 BOOL toolsmall;
00090 BOOL toolleft;
00091 BOOL autocentre;
00092 BOOL detail_auto;
00093 long detail_step;
00094 BOOL background;
00095 BOOL auto_update_keyframer;
00096 BOOL use_gl_robot;
00097 long splash;
00098 BOOL embedimages;
00099 } PREFERENCES;
00100
00108 typedef struct ANI_STRUCTURE_tag {
00109 char *gszHomeDir;
00110 short *Nnodes,
00111 *Nground,
00112 *Nrobots,
00113 *Nskys,
00114 *Ncameras;
00115 struct Animator_NODE **MainNp,
00116 **FirstNp,
00117 **SelectedCamera,
00118 **SelectedNode;
00119 long *NpointerX,*NpointerY,*NpointerZ,
00120 *TVpointX, *TVpointY, *TVpointZ,
00121 *TVsizeX, *TVsizeY, *TVsizeZ;
00122 long *Nframes,
00123 *CurrentFrame;
00124 double *ruler;
00125 long *rulerx,*rulery,*rulerz,
00126 *orulerx,*orulery,*orulerz;
00127 long version;
00128 long *Ndirectors;
00129 long *dummyv[62];
00130 short (*fpGetTransform)(short,
00131 long, double,
00132 struct Animator_NODE *, struct Animator_OBJECT *,
00133 point, point,
00134 double *, double *, double *, double *, double *,double *,
00135 short *, double *);
00136 void (*fp_scal)(double [4][4], double, double, double);
00137 void (*fp_rotz)(double [4][4], double);
00138 void (*fp_roty)(double [4][4], double);
00139 void (*fp_rotx)(double [4][4], double);
00140 void (*fp_tram)(double [4][4], double, double, double);
00141 void (*fp_m4by4)(double [4][4], double [4][4], double [4][4]);
00142 void (*fp_m4by1)(double [4][4], double, double, double,
00143 double *, double *, double *);
00144 void (*fp_null_transform)(double [4][4]);
00145 void (*fp_c4to4)(double [4][4], double [4][4]);
00146 void (*fp_arbitrary_rotate)(double, point, point, double [4][4]);
00147 void (*fp_L_cross)(point, point, point, point);
00148 void (*fpDrawPerspectiveView)(int, int, HDC, HWND, HPEN);
00149 void (*fpDeleteCostume)(struct Animator_NODE *, long);
00150 struct Animator_OBJECT * (*fpCreateCostume)(struct Animator_NODE *, long, long);
00151 void (*fpDeleteSize)(struct Animator_NODE *, long);
00152 struct Animator_SIZE * (*fpCreateSize)(struct Animator_NODE *, long, long);
00153 void (*fpDeleteAlign)(struct Animator_NODE *, long);
00154 struct Animator_ALIGN * (*fpCreateAlign)(struct Animator_NODE *, long, long);
00155 void (*fpDeletePosition)(struct Animator_NODE *, long);
00156 struct Animator_POSITION * (*fpCreatePosition)(struct Animator_NODE *, long, long);
00157 void (*fpDeleteSky)(struct Animator_NODE *, long);
00158 struct Animator_SKY * (*fpCreateSky)(struct Animator_NODE *, long, long);
00159 void (*fpDeleteNode)(struct Animator_NODE *);
00160 struct Animator_NODE * (*fpCreateNode)(void);
00161 struct Animator_PATHEDITCONTROL_tag * (*fpCreatePathEditControlPoint)(int *,
00162 struct Animator_PATHEDITCONTROL_tag **,
00163 struct Animator_PATHEDITCONTROL_tag *,
00164 struct Animator_PATHEDITCONTROL_tag *,
00165 int, double);
00166 void (*fpDeletePathEditControlPoint)(int *,
00167 struct Animator_PATHEDITCONTROL_tag **,
00168 struct Animator_PATHEDITCONTROL_tag *);
00169 struct Animator_PATHPOINT * (*fpAppendPathPoint)(struct Animator_PATHPOINT *);
00170 void (*fpCreatePathPoint)(void);
00171 void (*fpDeletePathPoint)(void);
00172 struct Animator_PATHPOINT * (*fpCreateIPointPath)(short, struct Animator_NODE *, short,
00173 short *, short *);
00174 void (*fpSetNumberOfFrames)(short);
00175 int (*fpChooseFile)(int, char *, char *, char *, char *, HWND);
00176 short (*fpLoadMeshObject)(char *, struct Animator_OBJECT *, short, short, short);
00177 void (*fpChooseColour)(unsigned char [], char *, HWND);
00178 short (*fpRequestNumEntry)(long, long, long, char *, char *);
00179 long (*fpSelectNodeID)(HWND);
00180 void (*fpAppendFileExtension)(char *, char *);
00181 void (*fpCentreDlgOnC)(HWND);
00182 void (*fpCentreDlgOnS)(HWND);
00183 void *dummyf[64];
00184 } ANI_STRUCTURE;
00185
00186
00196 typedef struct Animator_XIP_tag {
00197 struct Animator_XIP_tag *last;
00198 struct Animator_XIP_tag *next;
00199 char *p;
00200 } XIP;
00201
00208 typedef struct Animator_TOOLFLAGS_tag {
00209 BOOL flagX,flagY,flagZ,flagDummy;
00210 int flagA,flagT,flagR,flagP,flagK;
00211 } TOOLFLAGS;
00212
00220 typedef struct Animator_AWIREFRAME {
00221 long Np,Ne;
00222 Sedge *e;
00223 point *p;
00224 } awire;
00225
00232 typedef struct Animator_PATHPOINT {
00233 struct Animator_PATHPOINT *last;
00234 struct Animator_PATHPOINT *next;
00235 short status;
00236 point p;
00237 double distance;
00238 double ptheta,
00239 pfi;
00240 double tension_p,
00241 tension_n;
00242 } pathpoint;
00243
00253 typedef struct Animator_PATHEDITCONTROL_tag {
00254 struct Animator_PATHEDITCONTROL_tag *last;
00255 struct Animator_PATHEDITCONTROL_tag *next;
00256 double distance;
00257 int frame;
00258 int x,y;
00259 double a,b,c,S,r;
00260 } PATHEDITCONTROL;
00261
00269 typedef struct Animator_RAMIMAGE_tag {
00270 long size;
00271 char *filename;
00272 unsigned char *data;
00273 } RAMIMAGE;
00274
00282 typedef struct Animator_SKY {
00283 char name[128];
00284 short type;
00285 unsigned char colour[3],
00286 zcolour[3];
00287 struct Animator_SKY *last;
00288 struct Animator_SKY *next;
00289 short firstframe,
00290 lastframe;
00291 double gamb,
00292 oamb,
00293 gamb_colour[3],
00294 oamb_colour[3];
00295 long aff,
00296 alf,
00297 ast;
00298 double sky_params[32];
00299 char sky_params_file[256];
00300 RAMIMAGE image;
00301 } sky;
00302
00310 typedef struct Animator_DIRECTOR_tag {
00311 struct Animator_DIRECTOR_tag *last;
00312 struct Animator_DIRECTOR_tag *next;
00313 long type;
00314 short firstframe,
00315 lastframe;
00316 struct Animator_NODE *ActiveCamera;
00317 } director;
00318
00328 typedef struct Animator_SKELETON {
00329 long id;
00330 char name[16];
00331 vector u,v,w,
00332 uu,vv,ww;
00333 double R[4][4],
00334 Q[4][4],
00335 T[4][4];
00336 point p,
00337 pp,
00338 pt,
00339 wk,
00340 bx[8];
00341 long IKlock,
00342 uIKlock,
00343 vIKlock,
00344 wIKlock;
00345 double uIKmin,uIKmax,
00346 vIKmin,vIKmax,
00347 wIKmin,wIKmax;
00348 double weight;
00349 double wrange;
00350 double wzone ;
00351 LPARAM lParam;
00352 }skel;
00353
00360 typedef struct Animator_VECTOR4tag {
00361 double x,y,z,w;
00362 BOOL selected;
00363 } vector4;
00364
00371 typedef struct Animator_NurbsProperties_Tag {
00372 char name[32];
00373 long GranularityMax,
00374 GranularityMin;
00375 long u_scale,
00376 v_scale;
00377 long shader,
00378 map,
00379 axis,
00380 param,
00381 smoothing,
00382 shiny,
00383 brilliance,
00384 reflectivity,
00385 transparency,
00386 glasstype,
00387 maptiled,
00388 mapshaded,
00389 mapdecal;
00390 long pad[4];
00391 unsigned char colour[3],
00392 material_colour[3];
00393 char hidden;
00394 char padc[5];
00395 } NurbsProperties;
00396
00404 typedef struct Animator_NURBS_tag {
00405 long id;
00406 long numU, numV;
00407 long orderU, orderV;
00408 double * kvU, * kvV;
00409 vector4 **points;
00410 NurbsProperties properties;
00411 } nurbs;
00412
00420 typedef struct Animator_PARTICLESYSTEM_tag {
00421 long id;
00422 long NumP;
00423 long iid;
00424 char ImageName[256];
00429 unsigned char colour_start[3],colour_end[3];
00430 long alpha_start,alpha_end,size_start,size_end,life,particle_size_scale,speed,
00431 ew_start,ud_start,ns_start,theta,boing,particle_speed_scale;
00432 long valpha,vcolour,vsize,vlife,vspeed;
00433 BOOL burst,ground;
00434 long ew_end,ud_end,ns_end,blend_model;
00435 long bSteadyState,bSpinOff,bSingle;
00436 long pad[25];
00437 } ParticleSystem;
00438
00448 typedef struct Animator_OBJECT {
00449 char name[255],
00450 effectname[255],
00451 *effect,
00452 *xip;
00453 struct Animator_OBJECT *last;
00454 struct Animator_OBJECT *next;
00455 short bWireframe;
00456 short firstframe,
00457 lastframe;
00458 short type;
00459 short morph,
00460 morphNo,
00461 quick_only;
00462 short fileID;
00463 short in_ram;
00464 awire w_frame;
00465 point *points;
00466 Sedge *edges;
00467 long *skid;
00468 long npoints,
00469 nedges,
00470 nskeleton;
00471 point origin,
00472 offset;
00473 point outline[8];
00474 short groundtype;
00475 short lighttype;
00476 double light_intensity;
00477 short depth_cue;
00478 double depth_cue_c,
00479 depth_cue_l,
00480 depth_cue_q;
00481 short self_shadow,
00482 cast_shadow,
00483 show_shadow;
00484 unsigned char colour[3],
00485 acolour[3];
00486 skel *skeleton;
00487 double *v;
00488 short pathtype,
00489 npathpoints;
00490 pathpoint *firstpathpoint;
00491 double pathlength;
00492 int npec;
00493 PATHEDITCONTROL *pec;
00494 double gspec,
00495 gtran,
00496 grefl,
00497 gbump;
00498 HMODULE hEffect;
00499 long nNurbs;
00500 nurbs *Nurbs;
00501 long bIKchain;
00502 RAMIMAGE image;
00503 ParticleSystem particles;
00504 double groundTemperature,
00505 other_params[8];
00506 } object;
00507
00516 typedef struct Animator_POSITION {
00517 struct Animator_POSITION *last;
00518 struct Animator_POSITION *next;
00519 short firstframe,
00520 lastframe;
00521 short type;
00522 short fx,fy,fz;
00523 point finish;
00524 struct Animator_NODE *onpath;
00525 char pnodename[128];
00526 double tension_s,
00527 tension_e,
00528 easin,
00529 easout;
00530 } position;
00531
00540 typedef struct Animator_ALIGN {
00541 struct Animator_ALIGN *last;
00542 struct Animator_ALIGN *next;
00543 short firstframe,
00544 lastframe;
00545 short type,
00546 im;
00547 double theta,
00548 phi,
00549 alpha,
00550 ima;
00551 struct Animator_NODE *topath;
00552 char anodename[128];
00553 double tension_s,
00554 tension_e,
00555 easin,
00556 easout;
00557 } align;
00558
00565 typedef struct Animator_CAMERAPARAM {
00566 double focal_length;
00567 double f_number;
00568 double focus_distance;
00569 double polarn_angle,
00570 polar_type;
00571 double stereo_separation,
00572 parallax_distance;
00573 double pad[13];
00574 } cameraparam;
00575
00584 typedef struct Animator_SIZE {
00585 double Sx,Sy,Sz;
00586 struct Animator_NODE *base;
00587 struct Animator_SIZE *last;
00588 struct Animator_SIZE *next;
00589 short firstframe,
00590 lastframe;
00591 short tweentype;
00592 double tension_s,
00593 tension_e,
00594 easin,
00595 easout;
00596 cameraparam camera_params;
00597 } size;
00598
00613 typedef struct Animator_NODE {
00614 struct Animator_NODE *last;
00615 struct Animator_NODE *next;
00616 struct Animator_SKY *fsky;
00617 struct Animator_DIRECTOR_tag *fdirector;
00618 struct Animator_OBJECT *fobj;
00619 struct Animator_POSITION *fpos;
00620 struct Animator_ALIGN *fali;
00621 struct Animator_SIZE *fsiz;
00622 short type,
00623 ID;
00624 char actorname[128];
00625 } node;
00626
00627 #define PLANE 0
00628 #define CYLINDER 1
00629 #define PLANE_MOZIAC 2
00630 #define CYLINDER_MOZIAC 3
00631 #define MAP_BY_VERTEX 4
00632 #define NOMORPH 0
00633 #define MOPPH 1
00634 #define QMORPH 2
00635 #define OPAQ 0
00636 #define CLEAR 1
00637 #define GLOSS 0
00638 #define MATT 1
00639 #define TRIVIEW 0
00640 #define ONEVIEW 1
00641 #define TRITOP 0
00642 #define TRIFRONT 1
00643 #define TRIRIGHT 2
00644
00645
00646 #define POINT2VECTOR(p,v) v[0]=(double)p[0]; v[1]=(double)p[1]; \
00647 v[2]=(double)p[2];
00648 #define VECTOR2POINT(v,p) p[0]=(long)v[0]; p[1]=(long)v[1]; \
00649 p[2]=(long)v[2];
00650
00651 #define UNIT 32768L
00652 #define UNIT2 65536L
00653 #define MINUNIT 2048L
00654 #define MAXUNIT 1073741824L
00655 #ifndef PI
00656 #define PI 3.1415926
00657 #endif
00658 #define PI2 PI/2
00659
00660
00661 #define NORMAL 0
00662 #define PATH 1
00663 #define TARGET 2
00664 #define GROUND 3
00665 #define LIGHT 4
00666 #define ANIMOBJ 5
00667 #define SKY 6
00668 #define CAMERA 7
00669 #define PARTICLE 8
00670 #define ROBOT 9
00671 #define IMAGEP 10
00672 #define DIRECTOR 11
00673
00674 #define OPEN 0
00675 #define CLOSED 1
00676 #define LOADED 2
00677 #define COPIED 3
00678
00679 #define TWEEN 0
00680 #define FOLLOW 1
00681 #define SPLINE 2
00682 #define FOLLOWOFF 3
00683 #define FOLLOWON 4
00684 #define FOLLOWAT 5
00685 #define TOPATH 1
00686 #define TRACK 2
00687 #define COPY 3
00688 #define SPLINEA 4
00689 #define PLAIN 0
00690 #define TEXTU 1
00691
00692 #define BRUM 2
00693 #define TBRUM 3
00694 #define MBRUM 4
00695 #define PRESET 6
00696 #define SPHERE 0
00697 #define TUBE 1
00698 #define CYLIND 2
00699 #define DISK 3
00700
00701 #define NOSHADOW 1
00702 #define SHADOWONLY 2
00703 #define SPOTLIGHT 3
00704 #define DUMMYL 4
00705
00706 #define SELECTED 1
00707 #define DESELECTED 0
00708 #define ERASED 2
00709 #define EDITING 3
00710
00711 #define SKYCOLOURED 0
00712 #define SKYGRADED 1
00713 #define SKYMAPPED 2
00714 #define BACKDROP 3
00715 #define SKYCUBE 4
00716 #define SKYANIMATED 5
00717
00718 #define NO 0
00719 #define YES 1
00720 #define FAIL -1
00721 #define OK 1
00722 #define MAX_DIR 255
00723 #define MAX_FILE 255
00724 #define ZOOMOUT 0
00725 #define ZOOMIN 1
00726 #define PANUP 2
00727 #define PANDOWN 3
00728 #define PANLEFT 4
00729 #define PANRIGHT 5
00730 #define PANFORWARD 6
00731 #define PANBACK 7
00732 #define RECENTRE 8
00733 #define CENTREWORLD 9
00734
00735 #define NTOOLS 8
00736 #define NOTOOL 0
00737 #define NODETOOL 1
00738 #define PAN 2
00739 #define INZOOM 3
00740 #define GRABBER 4
00741 #define ROTATOR 5
00742 #define SIZER 6
00743 #define TRACKER 7
00744
00745 #define PATHEDITOR 8
00746 #define SKELETOR 9
00747
00748 #define MAXTOOLS 10
00749
00750 #define SHIFTER 1
00751 #define ANGLER 2