afxAnimCurve.h
Engine/source/afx/util/afxAnimCurve.h
Classes:
class
class
Detailed Description
1 2 3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames 5// Copyright (C) 2015 Faust Logic, Inc. 6// 7// Permission is hereby granted, free of charge, to any person obtaining a copy 8// of this software and associated documentation files (the "Software"), to 9// deal in the Software without restriction, including without limitation the 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 11// sell copies of the Software, and to permit persons to whom the Software is 12// furnished to do so, subject to the following conditions: 13// 14// The above copyright notice and this permission notice shall be included in 15// all copies or substantial portions of the Software. 16// 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23// IN THE SOFTWARE. 24// 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 26 27#ifndef _AFX_ANIM_CURVE_H_ 28#define _AFX_ANIM_CURVE_H_ 29 30#include "core/util/tVector.h" 31 32#include "afx/util/afxCurveEval.h" 33 34class afxAnimCurve 35{ 36 class Key 37 { 38 public: 39 F32 time; 40 F32 value; 41 }; 42 43 private: 44 afxCurveEval* evaluator; 45 46 F32 final_value; 47 F32 start_value; 48 F32 final_time; 49 F32 start_time; 50 bool usable; 51 52 //std::vector<Key> keys; 53 Vector<Key> keys; 54 55 //static bool compare_Key( const Key &a, const Key &b ); 56 static S32 QSORT_CALLBACK compare_Key( const void* a, const void* b ); 57 58 public: 59 afxAnimCurve(); 60 ~afxAnimCurve(); 61 62 void addKey( Point2F &v ); 63 void addKey( F32 time, F32 value ); 64 void setKeyTime( int index, F32 t ); 65 void setKeyValue( int index, F32 v ); 66 void sort( ); 67 int numKeys(); 68 F32 getKeyTime( int index ); 69 F32 getKeyValue( int index ); 70 Point2F getSegment( F32 time ); 71 F32 evaluate( F32 time ); 72 73 void print(); 74 void printKey( int index ); 75 76 private: 77 Point2F computeTangentK0( Point2F &k0, Point2F &k1, int start_index ); 78 Point2F computeTangentK1( Point2F &k0, Point2F &k1, int end_index ); 79}; 80 81//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 82 83#endif // _AFX_ANIM_CURVE_H_ 84