Filename: AnimatorModules.h /* Routine selector values */ #define k_AnimatorInit 1 #define k_AnimatorDispose 2 #define k_AnimatorConfigOpen 3 #define k_AnimatorConfigEvent 4 #define k_AnimatorConfigClose 5 #define k_AnimatorInterpolate 6 #define k_AnimatorApply 7 #define k_AnimatorCalc 8 /* Error result codes */ #define Err_UnknownSelector 11000 #define Err_IllegalObject 11001 typedef struct GlobalProcs_Rec { ProcPtr xWriteConsole; /* Writes a status message to the activity log for debug purposes */ ProcPtr xStr2Num; /* SANE Str2Num routine */ ProcPtr xNum2Str; /* SANE Num2Str routine */ ProcPtr xTmat4_Init; /* Set 4x4 transformation to ID matrix */ ProcPtr xTmat4_Mult; /* Multiplies two 4x4 transformation matrixes */ ProcPtr xTmat4_Scale; /* Scales a 4x4 transformation matrix */ ProcPtr xTmat4_Translate; /* Offset a 4x4 transformation matrix */ ProcPtr xTmat4_Rotate; /* Rotates a 4x4 transformation matrix in order x,y,z */ ProcPtr xTmat4_Transform; /* Transforms a 3D point using a 4x4 transformation matrix */ ProcPtr xGetUniqueGroupID; /* Returns a unique group ID for use in a model handle */ ProcPtr xGetGroupOffset; /* Returns a group offset given a group ID, -1 if not found */ ProcPtr xSetPoint3D; /* Loads a 3D point with x,y,z values */ ProcPtr xSetRGBColor; /* Loads an RGBColor record with values */ ProcPtr xOffsetPoint3D; /* Adds x,y,z to a 3D point */ ProcPtr xMultPoint3D; /* Multiplies a 3D point by x,y,z */ ProcPtr xEqualPoint3D; /* Compares two 3D points to see if they are equal */ ProcPtr xDotProduct; /* Returns to dot product of two vectors */ ProcPtr xCrossProduct; /* Returns the cross product of two vectors */ ProcPtr xGetVectorLength; /* Returns vector length */ ProcPtr xNormalizeVector; /* Normalizes the vector */ ProcPtr xGetObjectInfo; ProcPtr xGetSingleObjectInfo; ProcPtr xArcCos; ProcPtr xSin; ProcPtr xCos; ProcPtr xTan; ProcPtr xArcSin; ProcPtr xArcTan; ProcPtr xLog; ProcPtr xLog10; ProcPtr xExp; ProcPtr xExp10; ProcPtr xPow; } GlobalProcs_Rec, *GlobalProcs_Ptr; typedef union UseFlags_Rec { struct { unsigned Scanned : 1; /*used by cell scanning routines to see if this cell has already been scanned*/ unsigned SkipAttributes : 1, UsePoint1 : 1, UsePoint2 : 1, UseTarget : 1, UseLinearVelocity : 1, UseAngularVelocity : 1, UseScale : 1, UseRotation : 1, UseMass : 1, UseElasticity : 1, UseBreakability : 1, UseBank : 1, UseFocal : 1, UseFocalDepth : 1, UseFstop : 1, UseColor : 1, UseBrightness : 1, UseSoundTrack : 1, UseSpecularColor : 1, UseOpacityColor : 1, UseDiffuseColor : 1, UseReflectionColor : 1, UseGlowColor : 1, UseSpecular : 1, UseSpecularSize : 1, UseDiffuse : 1, UseReflectivity : 1, UseRefraction : 1, UseGlow : 1, UseRotationOrder : 1; } U1; long AllBits; } UseFlags_Rec; typedef struct TimeCurves_Rec { long Point1; /*assumption: LongInt = 4 bytes = 8 nibbles = 32 bits*/ long Point2; long Target; long LinearVelocity; long AngularVelocity; long Scale; long Rotation; long Mass; long Elasticity; long Breakability; long Bank; long Focal; long FocalDepth; long Fstop; long Color; long Brightness; long SpecularColor; long OpacityColor; long DiffuseColor; long ReflectionColor; long GlowColor; long Specular; long SpecularSize; long Diffuse; long Reflectivity; long Refraction; long Glow; } TimeCurves_Rec; typedef TimeCurves_Rec TimeValues_Rec; typedef struct MotionPath_Rec { uchar Point1, Point2, Target, LinearVelocity, AngularVelocity, Scale, Rotation, Mass, Elasticity, Breakability, Bank, Focal, FocalDepth, Fstop, Color, Brightness; } MotionPath_Rec; /*Cell Info Types*/ typedef struct _REC_Loc { Point3D pt; uchar Color, Style_, f1, f2; } _REC_Loc; typedef struct _REC_Loc_ { Point3D pt; /* Stored in groups according to number of lines*/ uchar Color, Style_; } _REC_Loc_; typedef struct _REC_Loc__ { Point3D pt; XYZr nrml; } _REC_Loc__; typedef struct _REC_Loc___ { Double factor[16]; } _REC_Loc___; typedef struct _REC_Loc____ { Double factor[4]; } _REC_Loc____; typedef struct BaseInfo_Rec { UseFlags_Rec UseFlags; TimeCurves_Rec TimeCurves; boolean Active; /*On/Off Button*/ boolean CastShadows; short RotationOrder; Point3D Point1; short Point1Motion; Point3D Point2; short Point2Motion; Point3D Target; short TargetMotion; Point3D LinearVelocity, AngularVelocity, Scale, Rotation; Double Mass; float Elasticity; /*0-100% (0-1) 1=reflect 100% of velocity when bouncing [perfect super ball])*/ float Breakability; /*0-100% (0-1) 1=break if touched by anything at any speed*/ float Bank, Focal; Double FocalDepth; float Fstop; RGBColor Color; float Brightness; Picture **FGPict, **BGpict; long SoundTrack; long ApplyOverrideColor; RGBColor SpecularColor; RGBColor OpacityColor; RGBColor DiffuseColor; RGBColor ReflectionColor; RGBColor GlowColor; float Specular; float SpecularSize; float Diffuse; float Reflectivity; float Refraction; float Glow; } BaseInfo_Rec, *BaseInfo_Ptr; /* ----- Parameter Pointer Definitions ----- */ typedef struct ConfigOpenParms_Rec { Handle ModelHndl; /* Handle to current database (look, but don't touch) */ long GroupOffset; /* Offset to Group we are interested in */ WindowPtr theWindow; /* Return with dialog/window pointer if successful */ } ConfigOpenParms_Rec, *ConfigOpenParms_Ptr; typedef struct ConfigEventParms_Rec { Handle ModelHndl; /* Handle to current database (look, but don't touch) */ long GroupOffset; /* Offset to Group we are interested in */ WindowPtr theWindow; /* Return with dialog/window pointer if successful */ EventRecord theEvent; /* Event to be handled */ long ApplyFlags; /* Set to 1 to re-apply current config values, 0 to do nothing */ } ConfigEventParms_Rec, *ConfigEventParms_Ptr; typedef struct ConfigCloseParms_Rec { Handle ModelHndl; /* Handle to current database (look, but don't touch) */ long GroupOffset; /* Offset to Group we are interested in */ WindowPtr theWindow; /* Return with dialog/window pointer if successful */ } ConfigCloseParms_Rec, *ConfigCloseParms_Ptr; typedef struct InterpolateParms_Rec { Handle ModelHndl; /* Handle to current database (look, but don't touch) */ long GroupOffset; /* Offset to Group we are interested in */ char *Config1Ptr; /* Pointer to 1st config data */ char *Config2Ptr; /* Pointer to 2nd config data */ long Config1Size; /* Size of 1st config data in bytes */ long Config2Size; /* Size of 2nd config data in bytes */ float TimeValue; /* value 0->1 (usually). 0=config1,1=config2, 0.5=middle */ /* put interp data in Config1Ptr if same size, else put */ /* in ConfigHndl (by allocating it yourself) */ } InterpolateParms_Rec, *InterpolateParms_Ptr; typedef struct ApplyParms_Rec { Handle ModelHndl; /* Handle to current database (look, but don't touch) */ long GroupOffset; /* Offset to Group we are interested in */ long ThisTime; /* Time we are currently at */ long AppliedTime; /* Time of cell that applied us (for interpolation purposes) */ long TimeScale; /* Number of units of time per second */ TimeValues_Rec *LastTimePtr; /* Time of last entry (for interpolation purposes) */ BaseInfo_Ptr ThisBaseInfoPtr; /* Basic information record for this group the current time */ BaseInfo_Ptr LastBaseInfoPtr; /* Basic information record for the last cell we encounted */ Tmat4_Ptr TmatPtr; /* Pointer to this groups current Tmat */ Tmat4_Ptr ImatPtr; /* Pointer to this groups current Imat */ Handle ReplacementGroupHndl; /* if allocated, put replacement group here if desired (i.e. shatter) */ } ApplyParms_Rec, *ApplyParms_Ptr; typedef struct CalcParms_Rec { Handle ModelHndl; /* Handle to current database (look, but don't touch) */ long GroupOffset; /* Offset to Group we are interested in */ long ThisTime; /* Time we are currently at */ long AppliedTime; /* Time of cell that applied us (for interpolation purposes) */ long TimeScale; /* Number of units of time per second */ TimeValues_Rec *LastTimePtr; /* Time of last entry (for interpolation purposes) */ BaseInfo_Ptr ThisBaseInfoPtr; /* Basic information record for this group the current time */ BaseInfo_Ptr LastBaseInfoPtr; /* Basic information record for the last cell we encounted */ Tmat4_Ptr TmatPtr; /* Pointer to this groups current Tmat */ Tmat4_Ptr ImatPtr; /* Pointer to this groups current Imat */ Handle ReplacementGroupHndl; /* if allocated, put replacement group here if desired (i.e. shatter) */ boolean MakeCell; /* set to TRUE if you need to store this information at "ThisTime" */ boolean filler; long NextCalcCheck; /* Set to the next time you need to be called for calc check, 0 if none */ } CalcParms_Rec, *CalcParms_Ptr; #if 0 /* used in Think C 5.0.4 */ /* --------------------- Prototypes for A4 Global Routines -------------------- */ long InitA4 (void); long GetA4 (void); long SwapA4 (long newA4); void SetA4 (long newA4); #endif /* --------------------- Prototypes for GlobalProcs Glue Routines ---------------------- */ void xWriteConsole (uchar *theStr, GlobalProcs_Ptr gProcs); void xStr2Num (uchar *s, Double *x, GlobalProcs_Ptr gProcs); void xNum2Str (uchar *f, Double x, uchar *s, GlobalProcs_Ptr gProcs); long xGetUniqueGroupID(Handle theModel, GlobalProcs_Ptr gProcs); long xGetGroupOffset (Handle theModel, long ID, GlobalProcs_Ptr gProcs); void xTmat4_Init (Tmat4_Rec *Tmat, GlobalProcs_Ptr gProcs); void xTmat4_Translate(Tmat4_Rec *Tmat, Double x, Double y, Double z, GlobalProcs_Ptr gProcs); void xTmat4_Scale (Tmat4_Rec *Tmat, Double x, Double y, Double z, GlobalProcs_Ptr gProcs); void xTmat4_Rotate (Tmat4_Rec *Tmat, Double x, Double y, Double z, GlobalProcs_Ptr gProcs); void xTmat4_Transform(Tmat4_Rec *Tmat, Double x, Double y, Double z, Double *Tx, Double *Ty, Double *Tz, GlobalProcs_Ptr gProcs); void xSetRGBColor (RGBColor *theColor, unsigned short r, unsigned short g, unsigned short b, GlobalProcs_Ptr gProcs); void xSetPoint3D (Point3D *p, Double x, Double y, Double z, GlobalProcs_Ptr gProcs); void xOffsetPoint3D (Point3D *p, Double x, Double y, Double z, GlobalProcs_Ptr gProcs); void xMultPoint3D (Point3D *p, Double x, Double y, Double z, GlobalProcs_Ptr gProcs); boolean xEqualPoint3D (Point3D *p1, Point3D *p2, GlobalProcs_Ptr gProcs); Double xDotProduct (Point3D *v1, Point3D *v2, GlobalProcs_Ptr gProcs); void xCrossProduct (Point3D *v1, Point3D *v2, Point3D *v3, GlobalProcs_Ptr gProcs); Double xGetVectorLength(Point3D *v, GlobalProcs_Ptr gProcs); void xNormalizeVector(Point3D *v, GlobalProcs_Ptr gProcs); Double xSin (Double n, GlobalProcs_Ptr gProcs); Double xCos (Double n, GlobalProcs_Ptr gProcs); Double xTan (Double n, GlobalProcs_Ptr gProcs); Double xArcSin (Double n, GlobalProcs_Ptr gProcs); Double xArcCos (Double n, GlobalProcs_Ptr gProcs); Double xArcTan (Double n, GlobalProcs_Ptr gProcs); Double xLog (Double n, GlobalProcs_Ptr gProcs); Double xLog10 (Double n, GlobalProcs_Ptr gProcs); Double xExp (Double n, GlobalProcs_Ptr gProcs); Double xExp10 (Double n, GlobalProcs_Ptr gProcs); Double xPow (Double x, Double y, GlobalProcs_Ptr gProcs); OSErr xGetObjectInfo (Handle theModel, long ObjectOffset, long ObjectTime, BaseInfo_Rec *BaseInfo, Tmat4_Rec *TmatPtr, Tmat4_Rec *ImatPtr, Handle NewObjectHndl, Handle AttributesHndl, long *CalcNextPtr, GlobalProcs_Ptr gProcs); OSErr xGetSingleObjectInfo(Handle theModel, long ObjectOffset, long ObjectTime, BaseInfo_Rec *BaseInfo, Tmat4_Rec *TmatPtr, Tmat4_Rec *ImatPtr, Handle NewObjectHndl, Handle AttributesHndl, long *CalcNextPtr, Handle AppliedAttributes, GlobalProcs_Ptr gProcs);
Last update 04MAR96 by Eric Popejoy.
|
|
|
|
|
|
|