--- /dev/null
+/****************************************************************************************/\r
+/* MOTION.H */\r
+/* */\r
+/* Author: Mike Sandige */\r
+/* Description: Motion interface. */\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_MOTION_H\r
+#define GE_MOTION_H\r
+\r
+/* motion\r
+\r
+ This object is a list of named Path objects\r
+\r
+*/\r
+\r
+#include <stdio.h>\r
+#include "BaseType.h"\r
+#include "Path.h"\r
+#include "VFile.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+// GENESIS_PUBLIC_APIS\r
+typedef struct geMotion geMotion;\r
+\r
+GENESISAPI geMotion *GENESISCC geMotion_Create(geBoolean ManageNames);\r
+\r
+GENESISAPI void GENESISCC geMotion_Destroy(geMotion **PM);\r
+\r
+// GENESIS_PRIVATE_APIS\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_IsValid(const geMotion *M);\r
+\r
+ // AddPath adds a reference of P to the motion M. Ownership is shared - The caller must destroy P.\r
+GENESISAPI geBoolean GENESISCC geMotion_AddPath(geMotion *M, gePath *P,const char *Name,int *Index);\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_HasNames(const geMotion *M);\r
+GENESISAPI int32 GENESISCC geMotion_GetNameChecksum(const geMotion *M);\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_RemoveNames(geMotion *M);\r
+\r
+GENESISAPI void GENESISCC geMotion_SampleChannels(const geMotion *M, int PathIndex, geFloat Time, geQuaternion *Rotation, geVec3d *Translation);\r
+GENESISAPI geBoolean GENESISCC geMotion_SampleChannelsNamed(const geMotion *M, const char *PathName, geFloat Time, geQuaternion *Rotation, geVec3d *Translation);\r
+\r
+GENESISAPI void GENESISCC geMotion_Sample(const geMotion *M, int PathIndex, geFloat Time, geXForm3d *Transform);\r
+GENESISAPI geBoolean GENESISCC geMotion_SampleNamed(const geMotion *M, const char *PathName, geFloat Time, geXForm3d *Transform);\r
+\r
+ // the returned Paths from _Get functions should not be destroyed. \r
+ // if ownership is desired, call gePath_CreateRef() to create another owner. \r
+ // an 'owner' has access to the object regardless of the number of other owners, and \r
+ // an owner must call the object's destroy method to relinquish ownership\r
+GENESISAPI gePath *GENESISCC geMotion_GetPathNamed(const geMotion *M,const char *Name);\r
+GENESISAPI const char *GENESISCC geMotion_GetNameOfPath(const geMotion *M, int Index);\r
+\r
+// GENESIS_PUBLIC_APIS\r
+GENESISAPI gePath *GENESISCC geMotion_GetPath(const geMotion *M,int Index);\r
+GENESISAPI int GENESISCC geMotion_GetPathCount(const geMotion *M);\r
+\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_SetName(geMotion *M, const char * Name);\r
+GENESISAPI const char *GENESISCC geMotion_GetName(const geMotion *M);\r
+\r
+// GENESIS_PRIVATE_APIS\r
+\r
+ // support for compound motions. A motion can either have sub-motions, or be single motion.\r
+ // these functions support motions that have sub-motions.\r
+GENESISAPI int GENESISCC geMotion_GetSubMotionCount(const geMotion*M);\r
+\r
+ // the returned motions from these _Get functions should not be destroyed. \r
+ // if ownership is desired, call geMotion_CreateRef() to create another owner. \r
+ // an 'owner' has access to the object regardless of the number of other owners, and \r
+ // an owner must call the object's destroy method to relinquish ownership\r
+GENESISAPI geMotion *GENESISCC geMotion_GetSubMotion(const geMotion *M,int Index);\r
+GENESISAPI geMotion *GENESISCC geMotion_GetSubMotionNamed(const geMotion *M,const char *Name);\r
+GENESISAPI geBoolean GENESISCC geMotion_AddSubMotion(\r
+ geMotion *ParentMotion,\r
+ geFloat TimeScale, // Scale factor for this submotion\r
+ geFloat TimeOffset, // Time in parent motion when submotion should start\r
+ geMotion *SubMotion,\r
+ geFloat StartTime, // Blend start time (relative to submotion)\r
+ geFloat StartMagnitude, // Blend start magnitude (0..1)\r
+ geFloat EndTime, // Blend ending time (relative to submotion)\r
+ geFloat EndMagnitude, // Blend ending magnitude (0..1)\r
+ const geXForm3d *Transform, // Base transform to apply to this submotion\r
+ int *Index); // returned motion index\r
+\r
+GENESISAPI geMotion *GENESISCC geMotion_RemoveSubMotion(geMotion *ParentMotion, int SubMotionIndex);\r
+\r
+// Get/Set submotion time offset. The time offset is the offset into the \r
+// compound (parent) motion at which the submotion should start.\r
+GENESISAPI geFloat GENESISCC geMotion_GetTimeOffset( const geMotion *M,int SubMotionIndex );\r
+GENESISAPI geBoolean GENESISCC geMotion_SetTimeOffset( geMotion *M,int SubMotionIndex,geFloat TimeOffset );\r
+\r
+// Get/Set submotion time scale. Time scaling is applied to the submotion after the TimeOffset\r
+// is applied. The formula is: (CurrentTime - TimeOffset) * TimeScale\r
+GENESISAPI geFloat GENESISCC geMotion_GetTimeScale( const geMotion *M,int SubMotionIndex );\r
+GENESISAPI geBoolean GENESISCC geMotion_SetTimeScale( geMotion *M,int SubMotionIndex,geFloat TimeScale );\r
+\r
+// Get blending amount for a particular submotion. The Time parameter is parent-relative.\r
+GENESISAPI geFloat GENESISCC geMotion_GetBlendAmount( const geMotion *M, int SubMotionIndex, geFloat Time);\r
+\r
+// Get/Set blending path. The keyframe times in the blend path are relative to the submotion.\r
+GENESISAPI gePath *GENESISCC geMotion_GetBlendPath( const geMotion *M,int SubMotionIndex );\r
+GENESISAPI geBoolean GENESISCC geMotion_SetBlendPath( geMotion *M,int SubMotionIndex, gePath *Blend );\r
+\r
+GENESISAPI const geXForm3d *GENESISCC geMotion_GetBaseTransform( const geMotion *M,int SubMotionIndex );\r
+GENESISAPI geBoolean GENESISCC geMotion_SetBaseTransform( geMotion *M,int SubMotionIndex, geXForm3d *BaseTransform );\r
+GENESISAPI geBoolean GENESISCC geMotion_GetTransform(const geMotion *M, geFloat Time, geXForm3d *Transform);\r
+// GENESIS_PUBLIC_APIS\r
+\r
+ // gets time of first key and time of last key (as if motion did not loop)\r
+ // if there are no paths in the motion: returns GE_FALSE and times are not set\r
+ // otherwise returns GE_TRUE\r
+ //\r
+ // For a compound motion, GetTimeExtents will return the extents of the scaled submotions.\r
+ // For a single motion, no scaling is applied.\r
+GENESISAPI geBoolean GENESISCC geMotion_GetTimeExtents(const geMotion *M,geFloat *StartTime,geFloat *EndTime);\r
+\r
+// Only one event is allowed per time key.\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_InsertEvent(geMotion *M, geFloat tKey, const char* String);\r
+ // Inserts the new event and corresponding string.\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_DeleteEvent(geMotion *M, geFloat tKey);\r
+ // Deletes the event\r
+\r
+GENESISAPI void GENESISCC geMotion_SetupEventIterator(\r
+ geMotion *M,\r
+ geFloat StartTime, // Inclusive search start\r
+ geFloat EndTime); // Non-inclusive search stop\r
+ // For searching or querying the array for events between two times\r
+ // times are compaired [StartTime,EndTime), '[' is inclusive, ')' is \r
+ // non-inclusive. This prepares the geMotion_GetNextEvent() function.\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_GetNextEvent(\r
+ geMotion *M, // Event list to iterate\r
+ geFloat *pTime, // Return time, if found\r
+ const char **ppEventString); // Return data, if found\r
+ // Iterates from StartTime to EndTime as setup in geMotion_SetupEventIterator()\r
+ // and for each event between these times [StartTime,EndTime)\r
+ // this function will return Time and EventString returned for that event\r
+ // and the iterator will be positioned for the next search. When there \r
+ // are no more events in the range, this function will return GE_FALSE (Time\r
+ // will be 0 and ppEventString will be empty).\r
+\r
+GENESISAPI geBoolean GENESISCC geMotion_GetEventExtents(const geMotion *M,\r
+ geFloat *FirstEventTime,\r
+ geFloat *LastEventTime);\r
+ // returns the time associated with the first and last events \r
+ // returns GE_FALSE if there are no events (and Times are not set)\r
+\r
+\r
+// GENESIS_PRIVATE_APIS\r
+GENESISAPI geMotion *GENESISCC geMotion_CreateFromFile(geVFile *f);\r
+GENESISAPI geBoolean GENESISCC geMotion_WriteToFile(const geMotion *M, geVFile *f);\r
+GENESISAPI geBoolean GENESISCC geMotion_WriteToBinaryFile(const geMotion *M,geVFile *pFile);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif\r