VActorData.h
Engine/source/Verve/VActor/VActorData.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Verve 4// Copyright (C) 2014 - Violent Tulip 5// 6// Permission is hereby granted, free of charge, to any person obtaining a copy 7// of this software and associated documentation files (the "Software"), to 8// deal in the Software without restriction, including without limitation the 9// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10// sell copies of the Software, and to permit persons to whom the Software is 11// furnished to do so, subject to the following conditions: 12// 13// The above copyright notice and this permission notice shall be included in 14// all copies or substantial portions of the Software. 15// 16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22// IN THE SOFTWARE. 23//----------------------------------------------------------------------------- 24#ifndef _VT_VACTORDATA_H_ 25#define _VT_VACTORDATA_H_ 26 27#ifndef _SHAPEBASE_H_ 28#include "T3D/shapeBase.h" 29#endif 30 31//----------------------------------------------------------------------------- 32class VActor; 33class VActorStateTable; 34class VActorAnimationState; 35class VActorPhysicsState; 36//----------------------------------------------------------------------------- 37 38struct VActorData : public ShapeBaseData 39{ 40private: 41 42 typedef ShapeBaseData Parent; 43 friend class VActor; 44 45public: 46 47 // Animation Data. 48 49 enum eAnimationList 50 { 51 k_NextAnimation = 0, 52 }; 53 54 struct sAnimationSequence 55 { 56 U32 Index; 57 const char *Name; 58 F32 Priority; 59 60 VActorAnimationState *State; 61 S32 Sequence; 62 }; 63 64 struct sAnimationTransition 65 { 66 U32 FromIndex; 67 U32 ToIndex; 68 69 F32 Duration; 70 71 bool Ordered; 72 U32 Sequence; 73 }; 74 75 typedef Vector<sAnimationSequence> tAnimationSequenceVector; 76 typedef Vector<sAnimationTransition> tAnimationTransitionVector; 77 78 // Physics Data. 79 80 enum ePhysicsStateList 81 { 82 k_NextPhysicsState = 0, 83 }; 84 85 struct sPhysicsState 86 { 87 U32 Index; 88 F32 Priority; 89 90 VActorPhysicsState *State; 91 }; 92 typedef Vector<sPhysicsState> tPhysicsStateVector; 93 94protected: 95 96 tAnimationSequenceVector mAnimationSequenceList; 97 tAnimationTransitionVector mAnimationTransitionList; 98 tPhysicsStateVector mPhysicsList; 99 100 F32 mMaxStepHeight; 101 F32 mRunSpeed; 102 103 F32 mSubmergeCoverage; 104 105public: 106 107 VActorData( void ); 108 ~VActorData( void ); 109 110 static void initPersistFields( void ); 111 112 virtual bool initAnimationSequenceList( const S32 &pSize, const sAnimationSequence *pTable ); 113 virtual bool initAnimationTransitionList( const S32 &pSize, const sAnimationTransition *pTable ); 114 virtual bool initPhysicsStateList( const S32 &pSize, const sPhysicsState *pTable ); 115 116 virtual void packData( BitStream *pStream ); 117 virtual void unpackData( BitStream *pStream ); 118 119 DECLARE_CONOBJECT( VActorData ); 120 121public: 122 123 tAnimationSequenceVector *getAnimationList( void ) { return &mAnimationSequenceList; }; 124 S32 getAnimationSequence( const U32 &pIndex ); 125 126 tPhysicsStateVector *getPhysicsStateList( void ) { return &mPhysicsList; }; 127 128 inline const F32 &getMaxStepHeight( void ) const { return mMaxStepHeight; }; 129 inline const F32 &getRunSpeed( void ) const { return mRunSpeed; }; 130 inline const F32 &getSumbergeCoverage( void ) const { return mSubmergeCoverage; }; 131}; 132 133#endif // _VT_VACTORDATA_H_ 134