VActor.h
Engine/source/Verve/VActor/VActor.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_VACTOR_H_ 25#define _VT_VACTOR_H_ 26 27#ifndef _VT_VACTORDATA_H_ 28#include "VActorData.h" 29#endif 30 31#ifndef _VT_TYPES_H_ 32#include "Types/VTypes.h" 33#endif 34 35//----------------------------------------------------------------------------- 36class VActorAnimationController; 37class VActorPhysicsController; 38//----------------------------------------------------------------------------- 39 40class VActor : public ShapeBase 41{ 42 typedef ShapeBase Parent; 43 44public: 45 46 enum eMaskBits 47 { 48 // Physics Bits. 49 MoveMask = Parent::NextFreeMask << 0, 50 PhysicsMask = ( MoveMask ), 51 52 NextFreeMask = Parent::NextFreeMask << 1, 53 }; 54 55 enum eEventType 56 { 57 k_MountEvent, 58 k_UnmountEvent, 59 }; 60 61 typedef Signal<void( const eEventType& )> tEventSignal; 62 63protected: 64 65 VActorData *mDataBlock; 66 67 // Event Signal. 68 tEventSignal mEventSignal; 69 70public: 71 72 VActor( void ); 73 ~VActor( void ); 74 75 // Initialisation Methods. 76 77 bool onAdd( void ); 78 void onRemove( void ); 79 80 bool onNewDataBlock( GameBaseData *pDataBlock, bool pReload ); 81 82 // Update Methods. 83 84 virtual void processTick( const Move *pMove ); 85 86 virtual U32 packUpdate( NetConnection *pConnection, U32 pMask, BitStream *pStream ); 87 virtual void unpackUpdate( NetConnection *pConnection, BitStream *pStream ); 88 89 DECLARE_CONOBJECT( VActor ); 90 91public: 92 93 // Accessor Methods. 94 95 inline VActorData *getDataBlock( void ) { return mDataBlock; }; 96 inline tEventSignal &getEventSignal( void ) { return mEventSignal; }; 97 98 // Animation Methods. 99 100 /// Get Animation Controller. 101 virtual VActorAnimationController *getAnimationController( void ) { return NULL; }; 102 103 // Physics Methods. 104 105 /// Set Transform. 106 virtual void setTransform( const MatrixF &pMatrix ); 107 108 /// Get Physics Controller. 109 virtual VActorPhysicsController *getPhysicsController( void ) { return NULL; }; 110 111 /// On Mount. 112 virtual void onMount( SceneObject *pObject, S32 pNode ); 113 /// On Unmount. 114 virtual void onUnmount( SceneObject *pObject, S32 pNode ); 115}; 116 117#endif // _VT_VACTOR_H_ 118