Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

vkframe.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  VKFRAME.H                                                                                                                                                   */
00003 /*                                                                                      */
00004 /*  Author: Mike Sandige                                                                    */
00005 /*  Description: Vector keyframe interface.                                                                                             */
00006 /*                                                                                      */
00007 /*  The contents of this file are subject to the Genesis3D Public License               */
00008 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00009 /*  compliance with the License. You may obtain a copy of the License at                */
00010 /*  http://www.genesis3d.com                                                            */
00011 /*                                                                                      */
00012 /*  Software distributed under the License is distributed on an "AS IS"                 */
00013 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00014 /*  the License for the specific language governing rights and limitations              */
00015 /*  under the License.                                                                  */
00016 /*                                                                                      */
00017 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00018 /*  Genesis3D Version 1.1 released November 15, 1999                                 */
00019 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00020 /*                                                                                      */
00021 /****************************************************************************************/
00022 /* VKFrame (Vector-Keyframe)
00023         This module handles interpolation for keyframes that contain a vector (a geVec3d)
00024         This is intended to support Path.c
00025         geTKArray supplies general support for a time-keyed array, and this supplements
00026         that support to include the two specific time-keyed arrays:
00027           An array of geVec3d interpolated linearly
00028           An array of geVec3d interpolated with hermite blending
00029         These are phycially separated and have different base structures because:
00030                 linear blending requires less data.
00031                 future blending might require more data.
00032         The two types of lists are created with different creation calls,
00033         interpolated with different calls, but insertion and queries share a call.
00034 
00035         Hermite interpolation requires additional computation after changes are
00036         made to the keyframe list.  Call geVKFrame_HermiteRecompute() to update the
00037         calculations.
00038 */
00039 #ifndef GE_VKFRAME_H
00040 #define GE_VKFRAME_H
00041 
00042 #include "TKArray.h"
00043 #include "vfile.h"
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049 typedef enum
00050 {
00051         VKFRAME_LINEAR,
00052         VKFRAME_HERMITE,
00053         VKFRAME_HERMITE_ZERO_DERIV,
00054 } geVKFrame_InterpolationType;
00055 
00056 
00057 geTKArray *GENESISCC geVKFrame_LinearCreate(void);
00058         // creates a frame list for linear interpolation
00059 
00060 geTKArray *GENESISCC geVKFrame_HermiteCreate(void);
00061         // creates a frame list for hermite interpolation
00062 
00063 
00064 geBoolean GENESISCC geVKFrame_Insert(
00065         geTKArray **KeyList,                    // keyframe list to insert into
00066         geTKArray_TimeType Time,                // time of new keyframe
00067         const geVec3d *V,                               // vector at new keyframe
00068         int *Index);                                    // indx of new key
00069         // inserts a new keyframe with the given time and vector into the list.
00070 
00071 void GENESISCC geVKFrame_Query(
00072         const geTKArray *KeyList,               // keyframe list
00073         int Index,                                              // index of frame to return
00074         geTKArray_TimeType *Time,               // time of the frame is returned
00075         geVec3d *V);                                            // vector from the frame is returned
00076         // returns the vector and the time at keyframe[index] 
00077 
00078 void GENESISCC geVKFrame_Modify(
00079         geTKArray *KeyList,                             // keyframe list
00080         int Index,                                              // index of frame to change
00081         const geVec3d *V);                              // vector for the key
00082         // chganes the vector at keyframe[index] 
00083 
00084 void GENESISCC geVKFrame_LinearInterpolation(
00085         const void *KF1,                // pointer to first keyframe
00086         const void *KF2,                // pointer to second keyframe
00087         geFloat T,                              // 0 <= T <= 1   blending parameter
00088         void *Result);                  // put the result in here (geVec3d)
00089                 // interpolates to get a vector between the two vectors at the two
00090                 // keyframes where T==0 returns the vector for KF1 
00091                 // and T==1 returns the vector for KF2
00092                 // interpolates linearly
00093 
00094 void GENESISCC geVKFrame_HermiteInterpolation(
00095         const void *KF1,                // pointer to first keyframe
00096         const void *KF2,                // pointer to second keyframe
00097         geFloat T,                              // 0 <= T <= 1   blending parameter
00098         void *Result);                  // put the result in here (geVec3d)
00099                 // interpolates to get a vector between the two vectors at the two
00100                 // keyframes where T==0 returns the vector for KF1 
00101                 // and T==1 returns the vector for KF2
00102                 // interpolates using 'hermite' blending
00103 
00104 
00105 void GENESISCC geVKFrame_HermiteRecompute(
00106         int Looped,                                     // if keylist has the first key connected to last key
00107         geBoolean ZeroDerivative,       // if each key should have a zero derivatives (good for 2 point S curves)
00108         geTKArray *KeyList);            // list of keys to recompute hermite values for
00109         // rebuild precomputed data for keyframe list.
00110 
00111 
00112 geBoolean GENESISCC geVKFrame_LinearRead(geVFile* pFile, void* geVKFrame);
00113 geBoolean GENESISCC geVKFrame_HermiteRead(geVFile* pFile, void* geVKFrame);
00114 
00115 geBoolean GENESISCC geVKFrame_WriteToFile(geVFile *pFile, void *geVKFrame, 
00116                                                                 geVKFrame_InterpolationType InterpolationType,int Looping);
00117 geTKArray *GENESISCC geVKFrame_CreateFromFile(geVFile *pFile, geVKFrame_InterpolationType *InterpolationType, int *Looping);
00118 geBoolean GENESISCC geVKFrame_WriteToBinaryFile(geVFile *pFile, void *geVKFrame, 
00119                                                                 geVKFrame_InterpolationType InterpolationType, int Looping);
00120 geTKArray *GENESISCC geVKFrame_CreateFromBinaryFile(geVFile *pFile, geVKFrame_InterpolationType *InterpolationType, int *Looping);
00121 
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125 
00126 #endif

Generated on Tue Sep 30 12:36:38 2003 for GTestAndEngine by doxygen 1.3.2