VCameraTrack.cpp
Engine/source/Verve/Extension/Camera/VCameraTrack.cpp
Public Functions
Detailed Description
Public Functions
IMPLEMENT_CONOBJECT(VCameraTrack )
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/Camera/VCameraTrack.h" 25 26//----------------------------------------------------------------------------- 27IMPLEMENT_CONOBJECT( VCameraTrack ); 28//----------------------------------------------------------------------------- 29 30VCameraTrack::VCameraTrack( void ) 31{ 32 setLabel( "CameraTrack" ); 33} 34 35//----------------------------------------------------------------------------- 36// 37// Tree Methods. 38// 39//----------------------------------------------------------------------------- 40 41//----------------------------------------------------------------------------- 42// 43// VCameraTrack::onAttach(); 44// 45// This callback subscribes this object to the Camera Group's event signal. 46// 47//----------------------------------------------------------------------------- 48void VCameraTrack::onAttach( void ) 49{ 50 Parent::onAttach(); 51 52 // Valid Controller & Group? 53 VCameraGroup *group; 54 if ( getController() && getGroup( group ) ) 55 { 56 // Add Event Notification. 57 group->getCameraEventSignal().notify( this, &VCameraTrack::onCameraEvent ); 58 } 59} 60 61//----------------------------------------------------------------------------- 62// 63// VCameraTrack::onAttach(); 64// 65// This callback removes this object from the Camera Group's event signal 66// notification list. 67// 68//----------------------------------------------------------------------------- 69void VCameraTrack::onDetach( void ) 70{ 71 // Valid Controller & Group? 72 VCameraGroup *group; 73 if ( getController() && getGroup( group ) ) 74 { 75 // Clear Event Notification. 76 group->getCameraEventSignal().remove( this, &VCameraTrack::onCameraEvent ); 77 } 78 79 Parent::onDetach(); 80} 81 82//----------------------------------------------------------------------------- 83// 84// Camera Methods. 85// 86//----------------------------------------------------------------------------- 87 88//----------------------------------------------------------------------------- 89// 90// VCameraTrack::onCameraEvent( pEvent ); 91// 92// When the Camera changes, this method is called on both the outgoing and 93// incomming Camera Groups. 94// 95// For a full list of possible events, see the 'eCameraEventType' declaration 96// in VCameraGroup.h. 97// 98//----------------------------------------------------------------------------- 99bool VCameraTrack::onCameraEvent( const VCameraGroup::eCameraEventType &pEvent ) 100{ 101 if ( !getController() ) 102 { 103 AssertFatal( false, "VCameraTrack::onControllerEvent() - Invalid Controller." ); 104 return false; 105 } 106 107 // Ok. 108 return true; 109} 110