VTrack.h

Engine/source/Verve/Core/VTrack.h

More...

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_VTRACK_H_
 25#define _VT_VTRACK_H_
 26
 27#ifndef _VT_VCONTROLLER_H_
 28#include "Verve/Core/VController.h"
 29#endif
 30
 31#ifndef _VT_VEVENT_H_
 32#include "Verve/Core/VEvent.h"
 33#endif
 34
 35#ifndef _VT_TORQUE_SCENEOBJECT_H_
 36#include "Verve/Torque/TSceneObject.h"
 37#endif
 38
 39//-----------------------------------------------------------------------------
 40class VGroup;
 41//-----------------------------------------------------------------------------
 42
 43class VTrack : public VObject
 44{
 45    typedef VObject Parent;
 46
 47public:
 48
 49    // Controller Members.
 50
 51    VEvent         *mNextEvent;
 52
 53public:
 54
 55    VTrack();
 56
 57    // Tree Methods.
 58
 59    virtual void    onAttach( void );
 60    virtual void    onDetach( void );
 61
 62    // Controller Methods.
 63
 64    virtual void    onControllerUpdate( const S32 &pTime, const S32 &pDelta );
 65    virtual bool    onControllerEvent( VController::eControllerEventType pEvent );
 66
 67    virtual void    onControllerReset( const S32 &pTime, const bool &pForward );
 68
 69    // Reference Methods.
 70
 71    void            sort( void );
 72    bool            updateNextEvent( void );
 73
 74    // Console Declaration.
 75
 76    DECLARE_CONOBJECT( VTrack );
 77
 78public:
 79
 80    // Property Methods.
 81
 82    VGroup   *getGroup( void );
 83    template <class T> inline bool getGroup( T *&pGroup )
 84    {
 85        // Reference Group.
 86        pGroup = dynamic_cast<T*>( getGroup() );
 87        // Validate.
 88        return ( pGroup != NULL );
 89    }
 90
 91    VEvent   *getNextEvent( void );
 92    template <class T> inline bool getNextEvent( T *&pEvent )
 93    {
 94        // Reference Object.
 95        pEvent = dynamic_cast<T*>( getNextEvent() );
 96        // Validate.
 97        return ( pEvent != NULL );
 98    }
 99
100    VEvent   *getCurrentEvent( void );
101    template <class T> inline bool getCurrentEvent( T *&pEvent )
102    {
103        // Reference Object.
104        pEvent = dynamic_cast<T*>( getCurrentEvent() );
105        // Validate.
106        return ( pEvent != NULL );
107    }
108
109    VEvent   *getPreviousEvent( void );
110    template <class T> inline bool getPreviousEvent( T *&pEvent )
111    {
112        // Reference Object.
113        pEvent = dynamic_cast<T*>( getPreviousEvent() );
114        // Validate.
115        return ( pEvent != NULL );
116    }
117
118    F32             calculateInterp( S32 pTime );
119    F32            _calculateInterp( S32 pTime );
120};
121
122//-----------------------------------------------------------------------------
123
124#endif // _VT_VTRACK_H_
125