mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 07:15:37 +00:00
(Mostly) updated verve implementation.
This commit is contained in:
parent
775ca57047
commit
87ee749801
538 changed files with 68727 additions and 49 deletions
75
Engine/source/Verve/Extension/Director/VDirectorEvent.cpp
Normal file
75
Engine/source/Verve/Extension/Director/VDirectorEvent.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Core/VGroup.h"
|
||||
#include "Verve/Extension/Director/VDirectorEvent.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VDirectorEvent );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VDirectorEvent::VDirectorEvent( void ) :
|
||||
mTarget( String::EmptyString )
|
||||
{
|
||||
// Void.
|
||||
}
|
||||
|
||||
void VDirectorEvent::initPersistFields( void )
|
||||
{
|
||||
Parent::initPersistFields();
|
||||
|
||||
addField( "Target", TypeRealString, Offset( mTarget, VDirectorEvent ), "The name of the CameraGroup that will be activated upon triggering." );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Controller Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VDirectorEvent::onTrigger( pTime, pDelta );
|
||||
//
|
||||
// Cut the camera to the target group.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VDirectorEvent::onTrigger( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onTrigger( pTime, pDelta );
|
||||
|
||||
// Fetch Controller.
|
||||
VController *controller = getController();
|
||||
|
||||
// Valid Target?
|
||||
VCameraGroup *targetGroup = NULL;
|
||||
if ( !controller->getObject( mTarget, targetGroup ) )
|
||||
{
|
||||
Con::warnf( "VDirectorEvent::onTrigger() - Invalid Target Group specified." );
|
||||
return;
|
||||
}
|
||||
|
||||
// Change Camera.
|
||||
targetGroup->setActive();
|
||||
}
|
||||
61
Engine/source/Verve/Extension/Director/VDirectorEvent.h
Normal file
61
Engine/source/Verve/Extension/Director/VDirectorEvent.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VDIRECTOREVENT_H_
|
||||
#define _VT_VDIRECTOREVENT_H_
|
||||
|
||||
#ifndef _VT_VEVENT_H_
|
||||
#include "Verve/Core/VEvent.h"
|
||||
#endif
|
||||
|
||||
#ifndef _VT_VCAMERAGROUP_H_
|
||||
#include "Verve/Extension/Camera/VCameraGroup.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VDirectorEvent : public VEvent
|
||||
{
|
||||
typedef VEvent Parent;
|
||||
|
||||
public:
|
||||
|
||||
String mTarget;
|
||||
|
||||
public:
|
||||
|
||||
VDirectorEvent( void );
|
||||
|
||||
static void initPersistFields( void );
|
||||
|
||||
// Event Methods.
|
||||
|
||||
virtual void onTrigger( const S32 &pTime, const S32 &pDelta );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VDirectorEvent );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VDIRECTOREVENT_H_
|
||||
57
Engine/source/Verve/Extension/Director/VDirectorGroup.cpp
Normal file
57
Engine/source/Verve/Extension/Director/VDirectorGroup.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Extension/Director/VDirectorGroup.h"
|
||||
#include "Verve/Extension/Director/VDirectorTrack.h"
|
||||
#include "Verve/Extension/Camera/VCameraGroup.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VDirectorGroup );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VDirectorGroup::VDirectorGroup( void ) :
|
||||
mActiveCamera( NULL )
|
||||
{
|
||||
setLabel( "DirectorGroup" );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VDirectorGroup::getDirectorTrack();
|
||||
//
|
||||
// Returns the DirectorTrack reference.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
VDirectorTrack *VDirectorGroup::getDirectorTrack( void )
|
||||
{
|
||||
for ( ITreeNode *node = mChildNode; node != NULL; node = node->mSiblingNextNode )
|
||||
{
|
||||
if ( VDirectorTrack *track = dynamic_cast<VDirectorTrack*>( node ) )
|
||||
{
|
||||
// Return Track.
|
||||
return track;
|
||||
}
|
||||
}
|
||||
|
||||
// Invalid Track.
|
||||
return NULL;
|
||||
}
|
||||
59
Engine/source/Verve/Extension/Director/VDirectorGroup.h
Normal file
59
Engine/source/Verve/Extension/Director/VDirectorGroup.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VDIRECTORGROUP_H_
|
||||
#define _VT_VDIRECTORGROUP_H_
|
||||
|
||||
#ifndef _VT_VGROUP_H_
|
||||
#include "Verve/Core/VGroup.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VDirectorTrack;
|
||||
class VCameraGroup;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VDirectorGroup : public VGroup
|
||||
{
|
||||
typedef VGroup Parent;
|
||||
|
||||
protected:
|
||||
|
||||
// Camera.
|
||||
VCameraGroup *mActiveCamera;
|
||||
|
||||
public:
|
||||
|
||||
VDirectorGroup( void );
|
||||
|
||||
VDirectorTrack *getDirectorTrack( void );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VDirectorGroup );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VDIRECTORGROUP_H_
|
||||
63
Engine/source/Verve/Extension/Director/VDirectorTrack.cpp
Normal file
63
Engine/source/Verve/Extension/Director/VDirectorTrack.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Extension/Director/VDirectorTrack.h"
|
||||
|
||||
#include "math/mMathFn.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VDirectorTrack );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VDirectorTrack::VDirectorTrack( void )
|
||||
{
|
||||
setLabel( "DirectorTrack" );
|
||||
}
|
||||
|
||||
#ifdef VT_EDITOR
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Debug Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( VDirectorTrack, updateTrack, void, (),, "( void ) - Update the Track.\n"
|
||||
"@return No return value." )
|
||||
{
|
||||
for ( ITreeNode *node = object->mChildNode; node != NULL; node = node->mSiblingNextNode )
|
||||
{
|
||||
VEvent *currEvent = ( VEvent* )node;
|
||||
VEvent *nextEvent = ( VEvent* )node->mSiblingNextNode;
|
||||
|
||||
if ( !nextEvent )
|
||||
{
|
||||
// Update Duration.
|
||||
currEvent->setDuration( object->getControllerDuration() - currEvent->getTriggerTime() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update Duration.
|
||||
currEvent->setDuration( mAbs( nextEvent->getTriggerTime() - currEvent->getTriggerTime() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
47
Engine/source/Verve/Extension/Director/VDirectorTrack.h
Normal file
47
Engine/source/Verve/Extension/Director/VDirectorTrack.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VDIRECTORTRACK_H_
|
||||
#define _VT_VDIRECTORTRACK_H_
|
||||
|
||||
#ifndef _VT_VTRACK_H_
|
||||
#include "Verve/Core/VTrack.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VDirectorTrack : public VTrack
|
||||
{
|
||||
typedef VTrack Parent;
|
||||
|
||||
public:
|
||||
|
||||
VDirectorTrack( void );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VDirectorTrack );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VDIRECTORTRACK_H_
|
||||
82
Engine/source/Verve/Extension/Director/VSceneJumpEvent.cpp
Normal file
82
Engine/source/Verve/Extension/Director/VSceneJumpEvent.cpp
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Core/VController.h"
|
||||
#include "Verve/Extension/Director/VSceneJumpEvent.h"
|
||||
#include "Verve/Extension/Director/VDirectorGroup.h"
|
||||
#include "Verve/Extension/Director/VDirectorTrack.h"
|
||||
#include "Verve/Extension/Director/VDirectorEvent.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VSceneJumpEvent );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VSceneJumpEvent::VSceneJumpEvent( void ) :
|
||||
mTarget( String::EmptyString )
|
||||
{
|
||||
setLabel( "SceneJumpEvent" );
|
||||
}
|
||||
|
||||
void VSceneJumpEvent::initPersistFields( void )
|
||||
{
|
||||
Parent::initPersistFields();
|
||||
|
||||
addField( "Target", TypeRealString, Offset( mTarget, VSceneJumpEvent ), "The name of the Scene that the controller will jump to upon triggering." );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Controller Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VSceneJumpEvent::onTrigger( pTime, pDelta );
|
||||
//
|
||||
// Tell the controller to jump to a new scene.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VSceneJumpEvent::onTrigger( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onTrigger( pTime, pDelta );
|
||||
|
||||
VDirectorTrack *track = getController()->getDirectorTrack();
|
||||
if ( !track )
|
||||
{
|
||||
// Invalid Track.
|
||||
return;
|
||||
}
|
||||
|
||||
// Get Event.
|
||||
VDirectorEvent *event;
|
||||
if ( !track->getObject( mTarget, event ) )
|
||||
{
|
||||
// Can't Jump.
|
||||
return;
|
||||
}
|
||||
|
||||
// Go To Scene.
|
||||
getController()->jump( VController::k_JumpTime, event->getTriggerTime() );
|
||||
}
|
||||
57
Engine/source/Verve/Extension/Director/VSceneJumpEvent.h
Normal file
57
Engine/source/Verve/Extension/Director/VSceneJumpEvent.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VSCENEJUMPEVENT_H_
|
||||
#define _VT_VSCENEJUMPEVENT_H_
|
||||
|
||||
#ifndef _VT_VEVENT_H_
|
||||
#include "Verve/Core/VEvent.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VSceneJumpEvent : public VEvent
|
||||
{
|
||||
typedef VEvent Parent;
|
||||
|
||||
public:
|
||||
|
||||
String mTarget;
|
||||
|
||||
public:
|
||||
|
||||
VSceneJumpEvent( void );
|
||||
|
||||
static void initPersistFields( void );
|
||||
|
||||
// Event Methods.
|
||||
|
||||
virtual void onTrigger( const S32 &pTime, const S32 &pDelta );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VSceneJumpEvent );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VSCENEJUMPEVENT_H_
|
||||
32
Engine/source/Verve/Extension/Director/VSceneJumpTrack.cpp
Normal file
32
Engine/source/Verve/Extension/Director/VSceneJumpTrack.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Extension/Director/VSceneJumpTrack.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VSceneJumpTrack );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VSceneJumpTrack::VSceneJumpTrack( void )
|
||||
{
|
||||
setLabel( "SceneJumpTrack" );
|
||||
}
|
||||
47
Engine/source/Verve/Extension/Director/VSceneJumpTrack.h
Normal file
47
Engine/source/Verve/Extension/Director/VSceneJumpTrack.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VSCENEJUMPTRACK_H_
|
||||
#define _VT_VSCENEJUMPTRACK_H_
|
||||
|
||||
#ifndef _VT_VTRACK_H_
|
||||
#include "Verve/Core/VTrack.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VSceneJumpTrack : public VTrack
|
||||
{
|
||||
typedef VTrack Parent;
|
||||
|
||||
public:
|
||||
|
||||
VSceneJumpTrack( void );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VSceneJumpTrack );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VSCENEJUMPTRACK_H_
|
||||
130
Engine/source/Verve/Extension/Director/VSlowMoEvent.cpp
Normal file
130
Engine/source/Verve/Extension/Director/VSlowMoEvent.cpp
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Core/VController.h"
|
||||
#include "Verve/Extension/Director/VSlowMoEvent.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VSlowMoEvent );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VSlowMoEvent::VSlowMoEvent( void ) :
|
||||
mTimeScale( 1.f ),
|
||||
mTimeScaleTickDelta( 0.f )
|
||||
{
|
||||
setLabel( "SlowMoEvent" );
|
||||
}
|
||||
|
||||
void VSlowMoEvent::initPersistFields( void )
|
||||
{
|
||||
Parent::initPersistFields();
|
||||
|
||||
addField( "TimeScale", TypeF32, Offset( mTimeScale, VSlowMoEvent ), "The Time Scale to be applied to the Root Controller." );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Controller Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VSlowMoEvent::onTrigger( pTime, pDelta );
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VSlowMoEvent::onTrigger( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onTrigger( pTime, pDelta );
|
||||
|
||||
VController *controller = getController();
|
||||
if ( !controller )
|
||||
{
|
||||
// Invalid Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
// Instant Update?
|
||||
if ( getDuration() == 0 )
|
||||
{
|
||||
// Apply & Return.
|
||||
controller->setTimeScale( mTimeScale );
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine the Number of Ticks.
|
||||
const F32 tickCount = ( ( F32 )getDuration() ) / TickMs;
|
||||
|
||||
// Determine the Tick Delta.
|
||||
mTimeScaleTickDelta = ( mTimeScale - controller->getTimeScale() ) / tickCount;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VSlowMoEvent::onUpdate( pTime, pDelta );
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VSlowMoEvent::onUpdate( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onUpdate( pTime, pDelta );
|
||||
|
||||
VController *controller = getController();
|
||||
if ( !controller )
|
||||
{
|
||||
// Invalid Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch Current Time Scale.
|
||||
const F32 timeScale = controller->getTimeScale();
|
||||
|
||||
// Apply Update.
|
||||
controller->setTimeScale( timeScale + mTimeScaleTickDelta );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VSlowMoEvent::onComplete( pTime, pDelta );
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VSlowMoEvent::onComplete( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onComplete( pTime, pDelta );
|
||||
|
||||
VController *controller = getController();
|
||||
if ( !controller )
|
||||
{
|
||||
// Invalid Controller.
|
||||
return;
|
||||
}
|
||||
|
||||
// Tidy Up.
|
||||
controller->setTimeScale( mTimeScale );
|
||||
}
|
||||
60
Engine/source/Verve/Extension/Director/VSlowMoEvent.h
Normal file
60
Engine/source/Verve/Extension/Director/VSlowMoEvent.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VSLOWMOEVENT_H_
|
||||
#define _VT_VSLOWMOEVENT_H_
|
||||
|
||||
#ifndef _VT_VEVENT_H_
|
||||
#include "Verve/Core/VEvent.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VSlowMoEvent : public VEvent
|
||||
{
|
||||
typedef VEvent Parent;
|
||||
|
||||
public:
|
||||
|
||||
F32 mTimeScale;
|
||||
F32 mTimeScaleTickDelta;
|
||||
|
||||
public:
|
||||
|
||||
VSlowMoEvent( void );
|
||||
|
||||
static void initPersistFields( void );
|
||||
|
||||
// Event Methods.
|
||||
|
||||
virtual void onTrigger( const S32 &pTime, const S32 &pDelta );
|
||||
virtual void onUpdate( const S32 &pTime, const S32 &pDelta );
|
||||
virtual void onComplete( const S32 &pTime, const S32 &pDelta );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VSlowMoEvent );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VSLOWMOEVENT_H_
|
||||
93
Engine/source/Verve/Extension/Director/VSlowMoTrack.cpp
Normal file
93
Engine/source/Verve/Extension/Director/VSlowMoTrack.cpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "Verve/Extension/Director/VSlowMoTrack.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VSlowMoTrack );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VSlowMoTrack::VSlowMoTrack( void )
|
||||
{
|
||||
setLabel( "SlowMoTrack" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Controller Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VSlowMoTrack::onControllerEvent( pEvent );
|
||||
//
|
||||
// ...
|
||||
//
|
||||
// For a full list of possible events, see the 'eControllerEventType'
|
||||
// declaration in VController.h.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool VSlowMoTrack::onControllerEvent( VController::eControllerEventType pEvent )
|
||||
{
|
||||
if ( !Parent::onControllerEvent( pEvent ) )
|
||||
{
|
||||
// Skip.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enabled?
|
||||
if ( !isEnabled() )
|
||||
{
|
||||
// Continue Processing Events.
|
||||
return true;
|
||||
}
|
||||
|
||||
switch ( pEvent )
|
||||
{
|
||||
case VController::k_EventStop :
|
||||
{
|
||||
|
||||
// Reset Time Scale.
|
||||
getController()->setTimeScale( ( isControllerPlayingForward() ) ? 1.f : -1.f );
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VSlowMoTrack::onControllerReset( pTime, pForward );
|
||||
//
|
||||
// ...
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VSlowMoTrack::onControllerReset( const S32 &pTime, const bool &pForward )
|
||||
{
|
||||
// Parent Reset.
|
||||
Parent::onControllerReset( pTime, pForward );
|
||||
|
||||
// Reset Time Scale.
|
||||
getController()->setTimeScale( ( pForward ) ? 1.f : -1.f );
|
||||
}
|
||||
52
Engine/source/Verve/Extension/Director/VSlowMoTrack.h
Normal file
52
Engine/source/Verve/Extension/Director/VSlowMoTrack.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Verve
|
||||
// Copyright (C) 2014 - Violent Tulip
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _VT_VSLOWMOTRACK_H_
|
||||
#define _VT_VSLOWMOTRACK_H_
|
||||
|
||||
#ifndef _VT_VTRACK_H_
|
||||
#include "Verve/Core/VTrack.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VSlowMoTrack : public VTrack
|
||||
{
|
||||
typedef VTrack Parent;
|
||||
|
||||
public:
|
||||
|
||||
VSlowMoTrack( void );
|
||||
|
||||
// Controller Methods.
|
||||
|
||||
bool onControllerEvent( VController::eControllerEventType pEvent );
|
||||
void onControllerReset( const S32 &pTime, const bool &pForward );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VSlowMoTrack );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VSLOWMOTRACK_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue