--- /dev/null
+/****************************************************************************************/\r
+/* PATH.H */\r
+/* */\r
+/* Author: Mike Sandige */\r
+/* Description: Time-indexed keyframe creation, maintenance, and sampling. */\r
+/* */\r
+/* The contents of this file are subject to the Genesis3D Public License */\r
+/* Version 1.01 (the "License"); you may not use this file except in */\r
+/* compliance with the License. You may obtain a copy of the License at */\r
+/* http://www.genesis3d.com */\r
+/* */\r
+/* Software distributed under the License is distributed on an "AS IS" */\r
+/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */\r
+/* the License for the specific language governing rights and limitations */\r
+/* under the License. */\r
+/* */\r
+/* The Original Code is Genesis3D, released March 25, 1999. */\r
+/* Genesis3D Version 1.1 released November 15, 1999 */\r
+/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */\r
+/* */\r
+/****************************************************************************************/\r
+#ifndef GE_PATH_H\r
+#define GE_PATH_H\r
+\r
+#include "BaseType.h"\r
+#include "XForm3d.h"\r
+#include "Quatern.h"\r
+#include "VFile.h"\r
+\r
+#ifdef __cplusplus\r
+ extern "C" {\r
+#endif\r
+\r
+\r
+// GENESIS_PUBLIC_APIS\r
+typedef struct _gePath gePath;\r
+\r
+#define GE_PATH_ROTATION_CHANNEL 1\r
+#define GE_PATH_TRANSLATION_CHANNEL 2\r
+\r
+#define GE_PATH_ALL_CHANNELS (GE_PATH_ROTATION_CHANNEL | GE_PATH_TRANSLATION_CHANNEL)\r
+\r
+#ifndef GE_PATH_ENUMS\r
+ #define GE_PATH_ENUMS\r
+ typedef enum \r
+ {\r
+ GE_PATH_INTERPOLATE_LINEAR = 0, // linear blend for translation or rotation channel\r
+ GE_PATH_INTERPOLATE_HERMITE, // hermite cubic spline for translation channel\r
+ GE_PATH_INTERPOLATE_SLERP, // spherical-linear blend for rotation channel\r
+ GE_PATH_INTERPOLATE_SQUAD, // higher order blend for rotation channel 'G1' continuity\r
+ //GE_PATH_INTEROPLATE_TRIPOD, // not supported yet.\r
+ GE_PATH_INTERPOLATE_HERMITE_ZERO_DERIV = 7 // hermite cubic with zero derivative at keyframes ('easing' curve)\r
+ }gePath_Interpolator;\r
+#endif\r
+\r
+GENESISAPI void GENESISCC gePath_CreateRef( gePath *P );\r
+\r
+GENESISAPI gePath *GENESISCC gePath_Create(\r
+ gePath_Interpolator TranslationInterpolation, // type of interpolation for translation channel\r
+ gePath_Interpolator RotationInterpolation, // type of interpolation for rotation channel\r
+ geBoolean Looped); // True if end of path is connected to head\r
+ // creates new gePath\r
+ // A looping path should have the same first & last point. The path\r
+ // generator will choose arbitrarily between these points for a \r
+ // sample exactly at the end of the loop.\r
+\r
+GENESISAPI gePath *GENESISCC gePath_CreateCopy( const gePath *P );\r
+ \r
+GENESISAPI void GENESISCC gePath_Destroy(gePath **PP); \r
+ // destroys path *PP\r
+\r
+//------------------ time based keyframe operations\r
+GENESISAPI geBoolean GENESISCC gePath_InsertKeyframe(\r
+ gePath *P, \r
+ int ChannelMask, \r
+ geFloat Time, \r
+ const geXForm3d *Matrix); \r
+ // inserts a keyframe at a specific time.\r
+ \r
+GENESISAPI geBoolean GENESISCC gePath_DeleteKeyframe(\r
+ gePath *P,\r
+ int Index,\r
+ int ChannelMask); \r
+ // deletes the nth keyframe\r
+\r
+GENESISAPI geBoolean GENESISCC gePath_GetTimeExtents(\r
+ const gePath *P,\r
+ geFloat *StartTime, \r
+ geFloat *EndTime);\r
+ // gets the time for the first and last keys in the path (ignoring looping)\r
+ // if there are no keys, return GE_FALSE and times are not set.\r
+ // returns GE_TRUE if there are keys.\r
+\r
+//----------------- index based keyframe operations\r
+GENESISAPI void GENESISCC gePath_GetKeyframe(\r
+ const gePath *P, \r
+ int Index, // gets keyframe[index]\r
+ int Channel, // for this channel\r
+ geFloat *Time, // returns the time of the keyframe\r
+ geXForm3d *Matrix); // returns the matrix of the keyframe\r
+ // retrieves keyframe[index], and it's time\r
+\r
+GENESISAPI int GENESISCC gePath_GetKeyframeCount(const gePath *P,int Channel);\r
+ // retrieves count of keyframes for a specific channel\r
+\r
+GENESISAPI int GENESISCC gePath_GetKeyframeIndex(const gePath *P, int Channel, geFloat Time);\r
+ // retrieves the index of the keyframe at a specific time for a specific channel\r
+\r
+//----------------- sampling a path (time based)\r
+GENESISAPI void GENESISCC gePath_Sample(const gePath *P, geFloat Time,geXForm3d *Matrix);\r
+ // returns a transform matrix sampled at 'Time'.\r
+ // p is not const because information is cached in p for next sample\r
+\r
+// GENESIS_PRIVATE_APIS\r
+void GENESISCC gePath_SampleChannels(\r
+ const gePath *P, \r
+ geFloat Time, \r
+ geQuaternion *Rotation, \r
+ geVec3d *Translation);\r
+ // returns a rotation and a translation for the path at 'Time'\r
+ // p is not const because information is cached in p for next sample\r
+\r
+GENESISAPI geBoolean GENESISCC gePath_OffsetTimes(gePath *P, \r
+ int StartingIndex, int ChannelMask, geFloat TimeOffset );\r
+ // slides all samples in path starting with StartingIndex down by TimeOffset\r
+\r
+GENESISAPI geBoolean GENESISCC gePath_ModifyKeyframe(\r
+ gePath *P,\r
+ int Index,\r
+ int ChannelMask,\r
+ const geXForm3d *Matrix);\r
+ \r
+\r
+// GENESIS_PUBLIC_APIS\r
+\r
+//------------------ saving/loading a path\r
+GENESISAPI gePath* GENESISCC gePath_CreateFromFile(geVFile *F);\r
+ // loads a file (binary or ascii)\r
+\r
+GENESISAPI geBoolean GENESISCC gePath_WriteToFile(const gePath *P, geVFile *F);\r
+ // dumps formatted ascii to the file. \r
+\r
+GENESISAPI geBoolean GENESISCC gePath_WriteToBinaryFile(const gePath *P, geVFile *F);\r
+ // dumps a minimal binary image for fastest reading\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+ }\r
+#endif\r
+\r
+\r
+#endif\r