00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _BASEFCURVE_H
00013 #define _BASEFCURVE_H
00014
00015 #include "Template.h"
00016
00017 extern CEnumDictionary<CSLTemplate::EFCurveInterpolationType, CSLTemplate::SI_CUBIC> g_FCurveInterpolationTypeDictionary;
00018
00022 struct CSLBaseKey
00023 {
00024 SI_Float m_fTime;
00025 SI_Float m_fValue;
00026 };
00027
00031 struct CSLConstantKey : public CSLBaseKey
00032 {
00033 };
00034
00035
00039 struct CSLLinearKey : public CSLBaseKey
00040 {
00041 };
00042
00043
00047 struct CSLHermiteKey : public CSLBaseKey
00048 {
00049 SI_Float m_fInTangent;
00050 SI_Float m_fOutTangent;
00051 };
00052
00056 struct CSLBezierKey : public CSLBaseKey
00057 {
00058 SI_Float m_fInTangentX;
00059 SI_Float m_fInTangentY;
00060 SI_Float m_fOutTangentX;
00061 SI_Float m_fOutTangentY;
00062 };
00063
00067 struct CSLCubicKey : public CSLBaseKey
00068 {
00069 SI_Float m_fLeftTanX;
00070 SI_Float m_fLeftTanY;
00071 SI_Float m_fRightTanX;
00072 SI_Float m_fRightTanY;
00073 };
00074
00076
00087 class XSIEXPORT CSLBaseFCurve
00088 : public CSLTemplate
00089 {
00090 public:
00093 typedef CSLArrayProxy<CSLConstantKey, SI_Float, 2> CSLConstantKeyArray;
00094
00097 typedef CSLArrayProxy<CSLLinearKey, SI_Float, 2> CSLLinearKeyArray;
00098
00101 typedef CSLArrayProxy<CSLHermiteKey, SI_Float, 4> CSLHermiteKeyArray;
00102
00105 typedef CSLArrayProxy<CSLBezierKey, SI_Float, 6> CSLBezierKeyArray;
00106
00109 typedef CSLArrayProxy<CSLCubicKey, SI_Float, 6> CSLCubicKeyArray;
00110
00112 virtual ~CSLBaseFCurve();
00113
00119 CSLConstantKeyArray* GetConstantKeyList();
00120
00126 CSLCubicKeyArray* GetCubicKeyList();
00127
00133 CSLHermiteKeyArray* GetHermiteKeyList();
00134
00140 CSLBezierKeyArray* GetBezierKeyList();
00141
00147 CSLLinearKeyArray* GetLinearKeyList();
00148
00154 CSLConstantKey* GetConstantKeyListPtr();
00155
00161 CSLCubicKey* GetCubicKeyListPtr();
00162
00168 CSLHermiteKey* GetHermiteKeyListPtr();
00169
00175 CSLBezierKey* GetBezierKeyListPtr();
00176
00182 CSLLinearKey* GetLinearKeyListPtr();
00183
00189 CSLTemplate::EFCurveInterpolationType GetInterpolationType();
00190
00194 SI_Int GetKeyValueCount();
00195
00200 SI_Int GetKeyCount();
00201
00207 SI_Error Evaluate( SI_Float in_fTime );
00208
00213 SI_Float GetLastEvaluation() { return m_fLastEvaluation; };
00214
00219 SI_Float GetValueAtNextFrame ( SI_Float in_fFloat );
00220
00225 SI_Float GetValueAtPrevFrame ( SI_Float in_fFloat );
00226
00232 SI_Int FindKeyAtOrBefore ( SI_Float in_fFloat );
00233
00237 CSLAnimatableType* GetParameter();
00238
00244 CSLAnimatableType* ConnectParameter(CSLAnimatableType* in_pNewParameter);
00245
00246 virtual SI_Error Synchronize();
00247
00248 protected:
00249
00256 CSLBaseFCurve
00257 (
00258 CSLScene* in_pScene,
00259 CSLModel *in_pModel,
00260 CdotXSITemplate* in_pTemplate,
00261 EFCurveInterpolationType in_InterpolationType
00262 );
00263 CSLAnimatableType* m_pParameter;
00264
00265 private:
00266 CSLStrEnumProxy<EFCurveInterpolationType, SI_CUBIC> m_InterpolationType;
00267 union
00268 {
00269 CSLConstantKeyArray* m_pConstantKeys;
00270 CSLLinearKeyArray* m_pLinearKeys;
00271 CSLHermiteKeyArray* m_pHermiteKeys;
00272 CSLBezierKeyArray* m_pBezierKeys;
00273 CSLCubicKeyArray* m_pCubicKeys;
00274 };
00275
00276 SI_Int m_iCurrentKey;
00277 SI_Float m_fCurrentTime;
00278 SI_Float m_fLastEvaluation;
00279
00280 inline SI_Float GetTimeAtKey ( SI_Int );
00281
00282 void *m_pReserved;
00283 };
00284
00285 #endif