VLightObjectAnimationTrack.cpp
Engine/source/Verve/Extension/LightObject/VLightObjectAnimationTrack.cpp
Public Functions
Detailed Description
Public Functions
IMPLEMENT_CONOBJECT(VLightObjectAnimationTrack )
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#include "Verve/Extension/LightObject/VLightObjectAnimationTrack.h" 25#include "Verve/Extension/LightObject/VLightObjectAnimationEvent.h" 26 27//----------------------------------------------------------------------------- 28IMPLEMENT_CONOBJECT( VLightObjectAnimationTrack ); 29//----------------------------------------------------------------------------- 30 31VLightObjectAnimationTrack::VLightObjectAnimationTrack( void ) 32{ 33 setLabel( "AnimationTrack" ); 34} 35 36//----------------------------------------------------------------------------- 37// 38// Controller Methods. 39// 40//----------------------------------------------------------------------------- 41 42//----------------------------------------------------------------------------- 43// 44// VLightObjectAnimationTrack::onControllerEvent( pEvent ); 45// 46// 47// 48//----------------------------------------------------------------------------- 49bool VLightObjectAnimationTrack::onControllerEvent( VController::eControllerEventType pEvent ) 50{ 51 if ( !Parent::onControllerEvent( pEvent ) ) 52 { 53 // Skip. 54 return false; 55 } 56 57 // Enabled? 58 if ( !isEnabled() ) 59 { 60 // Continue Processing Events. 61 return true; 62 } 63 64 // Fetch the Light Object. 65 VTorque::LightObjectType *lightObject; 66 if ( !getSceneObject( lightObject ) ) 67 { 68 // Skip. 69 return true; 70 } 71 72 switch ( pEvent ) 73 { 74 case VController::k_EventPlay : 75 { 76 77 // Play Animation? 78 VLightObjectAnimationEvent *event; 79 if ( getCurrentEvent( event ) ) 80 { 81 // Play. 82 VTorque::playAnimation( lightObject ); 83 } 84 85 } break; 86 87 case VController::k_EventPause : 88 case VController::k_EventStop : 89 { 90 91 // Stop the Animation. 92 VTorque::pauseAnimation( lightObject ); 93 94 } break; 95 } 96 97 return true; 98} 99 100//----------------------------------------------------------------------------- 101// 102// VLightObjectAnimationTrack::onControllerReset( pTime, pForward ); 103// 104// 105// 106//----------------------------------------------------------------------------- 107void VLightObjectAnimationTrack::onControllerReset( const S32 &pTime, const bool &pForward ) 108{ 109 // Default Reset. 110 Parent::onControllerReset( pTime, pForward ); 111 112 // Fetch the Light Object. 113 VTorque::LightObjectType *lightObject; 114 if ( getSceneObject( lightObject ) ) 115 { 116 // Stop the Animation. 117 VTorque::pauseAnimation( lightObject ); 118 } 119} 120