mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 12:25:30 +00:00
(Mostly) updated verve implementation.
This commit is contained in:
parent
e0627973fb
commit
5a7f0f0b23
538 changed files with 68727 additions and 49 deletions
|
|
@ -0,0 +1,92 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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/LightObject/VLightObjectAnimationEvent.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VLightObjectAnimationEvent );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VLightObjectAnimationEvent::VLightObjectAnimationEvent( void ) :
|
||||
mAnimationData( NULL )
|
||||
{
|
||||
setLabel( "AnimationEvent" );
|
||||
}
|
||||
|
||||
void VLightObjectAnimationEvent::initPersistFields( void )
|
||||
{
|
||||
Parent::initPersistFields();
|
||||
|
||||
addField( "AnimationData", TYPEID<VTorque::LightAnimationDataType>(), Offset( mAnimationData, VLightObjectAnimationEvent ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Callback Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VLightObjectAnimationEvent::onTrigger( pTime, pDelta );
|
||||
//
|
||||
// When this Event is triggered the light object will begin to play the target
|
||||
// animation.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VLightObjectAnimationEvent::onTrigger( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onTrigger( pTime, pDelta );
|
||||
|
||||
// Fetch the Light Object.
|
||||
VTorque::LightObjectType *lightObject;
|
||||
if ( getSceneObject( lightObject ) )
|
||||
{
|
||||
// Play the Animation.
|
||||
VTorque::playAnimation( lightObject, mAnimationData );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VLightObjectAnimationEvent::onComplete( pTime, pDelta );
|
||||
//
|
||||
// The current animation played by the light object will be paused when this
|
||||
// Event completes its updates.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VLightObjectAnimationEvent::onComplete( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onTrigger( pTime, pDelta );
|
||||
|
||||
// Fetch the Light Object.
|
||||
VTorque::LightObjectType *lightObject;
|
||||
if ( getSceneObject( lightObject ) )
|
||||
{
|
||||
// Pause the Animation.
|
||||
VTorque::pauseAnimation( lightObject );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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_VLIGHTOBJECTANIMATIONEVENT_H_
|
||||
#define _VT_VLIGHTOBJECTANIMATIONEVENT_H_
|
||||
|
||||
#ifndef _VT_VSCENEOBJECTEVENT_H_
|
||||
#include "Verve/Extension/SceneObject/VSceneObjectEvent.h"
|
||||
#endif
|
||||
|
||||
#ifndef _VT_TORQUE_LIGHTOBJECT_H_
|
||||
#include "Verve/Torque/TLightObject.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VLightObjectAnimationEvent : public VSceneObjectEvent
|
||||
{
|
||||
typedef VEvent Parent;
|
||||
|
||||
public:
|
||||
|
||||
SimObjectPtr<VTorque::LightAnimationDataType> mAnimationData;
|
||||
|
||||
public:
|
||||
|
||||
VLightObjectAnimationEvent( void );
|
||||
|
||||
static void initPersistFields( void );
|
||||
|
||||
// Event Methods.
|
||||
|
||||
virtual void onTrigger( const S32 &pTime, const S32 &pDelta );
|
||||
virtual void onComplete( const S32 &pTime, const S32 &pDelta );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VLightObjectAnimationEvent );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VLIGHTOBJECTANIMATIONEVENT_H_
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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/LightObject/VLightObjectAnimationTrack.h"
|
||||
#include "Verve/Extension/LightObject/VLightObjectAnimationEvent.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VLightObjectAnimationTrack );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VLightObjectAnimationTrack::VLightObjectAnimationTrack( void )
|
||||
{
|
||||
setLabel( "AnimationTrack" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Controller Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VLightObjectAnimationTrack::onControllerEvent( pEvent );
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool VLightObjectAnimationTrack::onControllerEvent( VController::eControllerEventType pEvent )
|
||||
{
|
||||
if ( !Parent::onControllerEvent( pEvent ) )
|
||||
{
|
||||
// Skip.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enabled?
|
||||
if ( !isEnabled() )
|
||||
{
|
||||
// Continue Processing Events.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fetch the Light Object.
|
||||
VTorque::LightObjectType *lightObject;
|
||||
if ( !getSceneObject( lightObject ) )
|
||||
{
|
||||
// Skip.
|
||||
return true;
|
||||
}
|
||||
|
||||
switch ( pEvent )
|
||||
{
|
||||
case VController::k_EventPlay :
|
||||
{
|
||||
|
||||
// Play Animation?
|
||||
VLightObjectAnimationEvent *event;
|
||||
if ( getCurrentEvent( event ) )
|
||||
{
|
||||
// Play.
|
||||
VTorque::playAnimation( lightObject );
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case VController::k_EventPause :
|
||||
case VController::k_EventStop :
|
||||
{
|
||||
|
||||
// Stop the Animation.
|
||||
VTorque::pauseAnimation( lightObject );
|
||||
|
||||
} break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VLightObjectAnimationTrack::onControllerReset( pTime, pForward );
|
||||
//
|
||||
//
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VLightObjectAnimationTrack::onControllerReset( const S32 &pTime, const bool &pForward )
|
||||
{
|
||||
// Default Reset.
|
||||
Parent::onControllerReset( pTime, pForward );
|
||||
|
||||
// Fetch the Light Object.
|
||||
VTorque::LightObjectType *lightObject;
|
||||
if ( getSceneObject( lightObject ) )
|
||||
{
|
||||
// Stop the Animation.
|
||||
VTorque::pauseAnimation( lightObject );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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_VLIGHTOBJECTANIMATIONTRACK_H_
|
||||
#define _VT_VLIGHTOBJECTANIMATIONTRACK_H_
|
||||
|
||||
#ifndef _VT_VSCENEOBJECTTRACK_H_
|
||||
#include "Verve/Extension/SceneObject/VSceneObjectTrack.h"
|
||||
#endif
|
||||
|
||||
#ifndef _VT_TORQUE_LIGHTOBJECT_H_
|
||||
#include "Verve/Torque/TLightObject.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VLightObjectAnimationTrack : public VSceneObjectTrack
|
||||
{
|
||||
typedef VSceneObjectTrack Parent;
|
||||
|
||||
public:
|
||||
|
||||
VLightObjectAnimationTrack( void );
|
||||
|
||||
// Controller Methods.
|
||||
|
||||
virtual bool onControllerEvent( VController::eControllerEventType pEvent );
|
||||
virtual void onControllerReset( const S32 &pTime, const bool &pForward );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VLightObjectAnimationTrack );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VLIGHTOBJECTANIMATIONTRACK_H_
|
||||
|
|
@ -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/LightObject/VLightObjectGroup.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VLightObjectGroup );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VLightObjectGroup::VLightObjectGroup( void )
|
||||
{
|
||||
setLabel( "LightObjectGroup" );
|
||||
};
|
||||
|
|
@ -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_VLIGHTOBJECTGROUP_H_
|
||||
#define _VT_VLIGHTOBJECTGROUP_H_
|
||||
|
||||
#ifndef _VT_VSCENEOBJECTGROUP_H_
|
||||
#include "Verve/Extension/SceneObject/VSceneObjectGroup.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VLightObjectGroup : public VSceneObjectGroup
|
||||
{
|
||||
typedef VSceneObjectGroup Parent;
|
||||
|
||||
public:
|
||||
|
||||
VLightObjectGroup( void );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VLightObjectGroup );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VLIGHTOBJECTGROUP_H_
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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/LightObject/VLightObjectToggleEvent.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VLightObjectToggleEvent );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VLightObjectToggleEvent::VLightObjectToggleEvent( void ) :
|
||||
mEventType( VSharedEnum::k_ActionTurnOn )
|
||||
{
|
||||
setLabel( "ToggleEvent" );
|
||||
}
|
||||
|
||||
void VLightObjectToggleEvent::initPersistFields( void )
|
||||
{
|
||||
Parent::initPersistFields();
|
||||
|
||||
addField( "Action", TYPEID<VActionToggle>(), Offset( mEventType, VLightObjectToggleEvent ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Callback Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VLightObjectToggleEvent::onTrigger( pTime, pDelta );
|
||||
//
|
||||
// Toggle the Light Object.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VLightObjectToggleEvent::onTrigger( const S32 &pTime, const S32 &pDelta )
|
||||
{
|
||||
Parent::onTrigger( pTime, pDelta );
|
||||
|
||||
VTorque::LightObjectType *lightObject;
|
||||
if ( getSceneObject( lightObject ) )
|
||||
{
|
||||
// Turn On?
|
||||
const bool turnOn = ( mEventType == VSharedEnum::k_ActionTurnOn );
|
||||
|
||||
// Toggle Light.
|
||||
VTorque::setLightObjectOn( lightObject, turnOn );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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_VLIGHTOBJECTTOGGLEEVENT_H_
|
||||
#define _VT_VLIGHTOBJECTTOGGLEEVENT_H_
|
||||
|
||||
#ifndef _VT_VSCENEOBJECTEVENT_H_
|
||||
#include "Verve/Extension/SceneObject/VSceneObjectEvent.h"
|
||||
#endif
|
||||
|
||||
#ifndef _VT_TORQUE_LIGHTOBJECT_H_
|
||||
#include "Verve/Torque/TLightObject.h"
|
||||
#endif
|
||||
|
||||
#ifndef _VT_VSHAREDENUM_H_
|
||||
#include "Verve/Core/Util/VSharedEnum.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VLightObjectToggleEvent : public VSceneObjectEvent
|
||||
{
|
||||
typedef VEvent Parent;
|
||||
|
||||
public:
|
||||
|
||||
VSharedEnum::eActionToggle mEventType;
|
||||
|
||||
public:
|
||||
|
||||
VLightObjectToggleEvent( void );
|
||||
|
||||
static void initPersistFields( void );
|
||||
|
||||
// Event Methods.
|
||||
|
||||
virtual void onTrigger( const S32 &pTime, const S32 &pDelta );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VLightObjectToggleEvent );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VLIGHTOBJECTTOGGLEEVENT_H_
|
||||
|
|
@ -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/LightObject/VLightObjectToggleTrack.h"
|
||||
#include "Verve/Extension/LightObject/VLightObjectToggleEvent.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT( VLightObjectToggleTrack );
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
VLightObjectToggleTrack::VLightObjectToggleTrack( void )
|
||||
{
|
||||
setLabel( "ToggleTrack" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Controller Methods.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VLightObjectToggleTrack::onControllerReset( pTime, pForward );
|
||||
//
|
||||
// Enable or Disable the light object after a reset.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void VLightObjectToggleTrack::onControllerReset( const S32 &pTime, const bool &pForward )
|
||||
{
|
||||
// Default Reset.
|
||||
Parent::onControllerReset( pTime, pForward );
|
||||
|
||||
VLightObjectToggleEvent *event;
|
||||
VTorque::LightObjectType *lightObject;
|
||||
if ( getSceneObject( lightObject ) && getPreviousEvent( event ) )
|
||||
{
|
||||
// Turn On?
|
||||
const bool turnOn = ( event->mEventType == VSharedEnum::k_ActionTurnOn );
|
||||
|
||||
// Toggle the Light.
|
||||
VTorque::setLightObjectOn( lightObject, turnOn );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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_VLIGHTOBJECTTOGGLETRACK_H_
|
||||
#define _VT_VLIGHTOBJECTTOGGLETRACK_H_
|
||||
|
||||
#ifndef _VT_VSCENEOBJECTTRACK_H_
|
||||
#include "Verve/Extension/SceneObject/VSceneObjectTrack.h"
|
||||
#endif
|
||||
|
||||
#ifndef _VT_TORQUE_LIGHTOBJECT_H_
|
||||
#include "Verve/Torque/TLightObject.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class VLightObjectToggleTrack : public VSceneObjectTrack
|
||||
{
|
||||
typedef VSceneObjectTrack Parent;
|
||||
|
||||
public:
|
||||
|
||||
VLightObjectToggleTrack( void );
|
||||
|
||||
// Controller Methods.
|
||||
|
||||
virtual void onControllerReset( const S32 &pTime, const bool &pForward );
|
||||
|
||||
// Console Declaration.
|
||||
|
||||
DECLARE_CONOBJECT( VLightObjectToggleTrack );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // _VT_VLIGHTOBJECTTOGGLETRACK_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue