#ifndef _engine #define _engine //- // ========================================================================== // Copyright (C) 1995 - 2005 Alias Systems Corp. and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files are provided by Alias // Systems Corp. ("Alias") and/or its licensors for the exclusive use of the // Customer (as defined in the Alias Software License Agreement that // accompanies this Alias software). Such Customer has the right to use, // modify, and incorporate the Data into other products and to distribute such // products for use by end-users. // // THE DATA IS PROVIDED "AS IS". ALIAS HEREBY DISCLAIMS ALL WARRANTIES // RELATING TO THE DATA, INCLUDING, WITHOUT LIMITATION, ANY AND ALL EXPRESS OR // IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. IN NO EVENT SHALL ALIAS BE LIABLE FOR ANY DAMAGES // WHATSOEVER, WHETHER DIRECT, INDIRECT, SPECIAL, OR PUNITIVE, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, OR IN EQUITY, // ARISING OUT OF ACCESS TO, USE OF, OR RELIANCE UPON THE DATA. // ========================================================================== //+ #include #include #include #ifdef WIN32 # include #pragma warning (disable : 4244) #else # include #endif #include #include /* Constants ============================================================== */ #define kFileMaxWordSize 256 /* maximum size of a word */ /* Common types =========================================================== */ typedef int EtInt; /* natural int representation */ typedef float EtFloat; /* natural float representation */ typedef void EtVoid; /* void */ #define kEngineNULL (0) /* NULL */ typedef char EtBoolean; /* boolean */ #define kEngineTRUE ((EtBoolean)1) #define kEngineFALSE ((EtBoolean)0) typedef unsigned char EtByte; /* 1 byte */ /* File Engine ============================================================ */ typedef int EtFileHandle; /* type used for referencing a file */ #define kFileBadParam -2 /* a bad parameter was passed */ #define kFileNotOpened -1 /* file could not be opened */ typedef const char * EtFileName; /* type used for a file name */ /* Anim Engine ============================================================ */ typedef float EtTime; /* type used for key times (in seconds) */ typedef float EtValue; /* type used for key values (in internal units) */ struct EtKey { EtTime time; /* key time (in seconds) */ EtValue value; /* key value (in internal units) */ EtFloat inTanX; /* key in-tangent x value */ EtFloat inTanY; /* key in-tangent y value */ EtFloat outTanX; /* key out-tangent x value */ EtFloat outTanY; /* key out-tangent y value */ }; typedef struct EtKey EtKey; enum EtInfinityType { kInfinityConstant, kInfinityLinear, kInfinityCycle, kInfinityCycleRelative, kInfinityOscillate }; typedef enum EtInfinityType EtInfinityType; struct EtCurve { EtInt numKeys; /* The number of keys in the anim curve */ EtBoolean isWeighted; /* whether or not this curve has weighted tangents */ EtBoolean isStatic; /* whether or not all the keys have the same value */ EtInfinityType preInfinity; /* how to evaluate pre-infinity */ EtInfinityType postInfinity; /* how to evaluate post-infinity */ /* evaluate cache */ EtKey * lastKey; /* lastKey evaluated */ EtInt lastIndex; /* last index evaluated */ EtInt lastInterval; /* last interval evaluated */ EtBoolean isStep; /* whether or not this interval is a step interval */ EtBoolean isLinear; /* whether or not this interval is linear */ EtValue fX1; /* start x of the segment */ EtValue fX4; /* end x of the segment */ EtValue fCoeff[4]; /* bezier x parameters (only used for weighted curves */ EtValue fPolyY[4]; /* bezier y parameters */ EtKey keyList[1]; /* This must be the last element and contains */ /* an array of keys sorted in ascending order */ /* by time */ }; typedef struct EtCurve EtCurve; struct EtChannel { EtByte * channel; /* the name of the channel */ EtCurve * curve; /* the animation curve */ struct EtChannel * next; /* the next animation curve in a linked list */ }; typedef struct EtChannel EtChannel; #endif