Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,213 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#ifndef _GAMEEFFECTBASE_H_
#define _GAMEEFFECTBASE_H_
#include <GameEffectSystem/GameEffects/IGameEffect.h>
#include <GameEffectSystem/GameEffectsSystemDefines.h>
#include "TypeLibrary.h"
// Forward declares
struct SGameEffectParams;
//==================================================================================================
// Name: Flag macros
// Desc: Flag macros to make code more readable
// Author: James Chilvers
//==================================================================================================
#define SET_FLAG(currentFlags, flag, state) ((state) ? (currentFlags |= flag) : (currentFlags &= ~flag));
#define IS_FLAG_SET(currentFlags, flag) ((currentFlags & flag) ? true : false)
//--------------------------------------------------------------------------------------------------
//==================================================================================================
// Name: CGameEffect
// Desc: Game effect - Ideal for handling a specific visual game feature
// Author: James Chilvers
//==================================================================================================
class CGameEffect
: public IGameEffect
{
DECLARE_TYPE(CGameEffect, IGameEffect); // Exposes this type for SoftCoding
public:
CGameEffect();
virtual ~CGameEffect();
void Initialize(const SGameEffectParams* gameEffectParams = NULL) override;
void Release() override;
void Update(float frameTime) override;
void SetActive(bool isActive) override;
void SetFlag(uint32 flag, bool state) override { SET_FLAG(m_flags, flag, state); }
bool IsFlagSet(uint32 flag) const override { return IS_FLAG_SET(m_flags, flag); }
uint32 GetFlags() const override { return m_flags; }
void SetFlags(uint32 flags) override { m_flags = flags; }
void GetMemoryUsage(ICrySizer* pSizer) const override { pSizer->AddObject(this, sizeof(*this)); }
void UnloadData() override { }
protected:
// General data functions
static _smart_ptr<IMaterial> LoadMaterial(const char* pMaterialName);
private:
IGameEffect* Next() const override { return m_next; }
IGameEffect* Prev() const override { return m_prev; }
void SetNext(IGameEffect* newNext) override { m_next = newNext; }
void SetPrev(IGameEffect* newPrev) override { m_prev = newPrev; }
IGameEffect* m_prev;
IGameEffect* m_next;
uint16 m_flags;
IGameEffectSystem* m_gameEffectSystem = nullptr;
#if DEBUG_GAME_FX_SYSTEM
CryFixedStringT<32> m_debugName;
#endif
}; //-----------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: CGameEffect
// Desc: Constructor
//--------------------------------------------------------------------------------------------------
inline CGameEffect::CGameEffect()
{
m_prev = NULL;
m_next = NULL;
m_flags = 0;
EBUS_EVENT_RESULT(m_gameEffectSystem, GameEffectSystemRequestBus, GetIGameEffectSystem);
} //------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: ~CGameEffect
// Desc: Destructor
//--------------------------------------------------------------------------------------------------
inline CGameEffect::~CGameEffect()
{
#if DEBUG_GAME_FX_SYSTEM
// Output message if effect hasn't been released before being deleted
const bool bEffectIsReleased =
(m_flags & GAME_EFFECT_RELEASED) || // -> Needs to be released before deleted
!(m_flags & GAME_EFFECT_INITIALISED) || // -> Except when not initialised
(gEnv->IsEditor()); // -> Or the editor (memory safely released by editor)
if (!bEffectIsReleased)
{
string dbgMessage = m_debugName + " being destroyed without being released first";
FX_ASSERT_MESSAGE(bEffectIsReleased, dbgMessage.c_str());
}
#endif
if (m_gameEffectSystem)
{
// -> Effect should have been released and been unregistered, but to avoid
// crashes call unregister here too
m_gameEffectSystem->UnRegisterEffect(this);
}
} //------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: Initialise
// Desc: Initializes game effect
//--------------------------------------------------------------------------------------------------
inline void CGameEffect::Initialize(const SGameEffectParams* gameEffectParams)
{
#if DEBUG_GAME_FX_SYSTEM
m_debugName = GetName(); // Store name so it can be accessed in destructor and debugging
#endif
if (!IsFlagSet(GAME_EFFECT_INITIALISED))
{
SGameEffectParams params;
if (gameEffectParams)
{
params = *gameEffectParams;
}
SetFlag(GAME_EFFECT_AUTO_UPDATES_WHEN_ACTIVE, params.autoUpdatesWhenActive);
SetFlag(GAME_EFFECT_AUTO_UPDATES_WHEN_NOT_ACTIVE, params.autoUpdatesWhenNotActive);
SetFlag(GAME_EFFECT_AUTO_RELEASE, params.autoRelease);
SetFlag(GAME_EFFECT_AUTO_DELETE, params.autoDelete);
m_gameEffectSystem->RegisterEffect(this);
SetFlag(GAME_EFFECT_INITIALISED, true);
SetFlag(GAME_EFFECT_RELEASED, false);
}
} //------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: Release
// Desc: Releases game effect
//--------------------------------------------------------------------------------------------------
inline void CGameEffect::Release()
{
SetFlag(GAME_EFFECT_RELEASING, true);
if (IsFlagSet(GAME_EFFECT_ACTIVE))
{
SetActive(false);
}
m_gameEffectSystem->UnRegisterEffect(this);
SetFlag(GAME_EFFECT_INITIALISED, false);
SetFlag(GAME_EFFECT_RELEASING, false);
SetFlag(GAME_EFFECT_RELEASED, true);
} //------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: Update
// Desc: Updates game effect
//--------------------------------------------------------------------------------------------------
inline void CGameEffect::Update(float frameTime)
{
FX_ASSERT_MESSAGE(IsFlagSet(GAME_EFFECT_INITIALISED),
"Effect being updated without being initialised first");
FX_ASSERT_MESSAGE((IsFlagSet(GAME_EFFECT_RELEASED) == false),
"Effect being updated after being released");
} //------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: SetActive
// Desc: Sets active status
//--------------------------------------------------------------------------------------------------
inline void CGameEffect::SetActive(bool isActive)
{
FX_ASSERT_MESSAGE(IsFlagSet(GAME_EFFECT_INITIALISED),
"Effect changing active status without being initialised first");
FX_ASSERT_MESSAGE((IsFlagSet(GAME_EFFECT_RELEASED) == false),
"Effect changing active status after being released");
SetFlag(GAME_EFFECT_ACTIVE, isActive);
m_gameEffectSystem->RegisterEffect(this); // Re-register effect with game effects system
} //------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Name: LoadMaterial
// Desc: Loads and calls AddRef on material
//--------------------------------------------------------------------------------------------------
inline _smart_ptr<IMaterial> CGameEffect::LoadMaterial(const char* pMaterialName)
{
_smart_ptr<IMaterial> pMaterial = NULL;
I3DEngine* p3DEngine = gEnv->p3DEngine;
if (pMaterialName && p3DEngine)
{
IMaterialManager* pMaterialManager = p3DEngine->GetMaterialManager();
if (pMaterialManager)
{
pMaterial = pMaterialManager->LoadMaterial(pMaterialName);
}
}
return pMaterial;
} //------------------------------------------------------------------------------------------------
#endif//_GAMEEFFECTBASE_H_
@@ -0,0 +1,103 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#ifndef _GAMEEFFECT_INTERFACE_H_
#define _GAMEEFFECT_INTERFACE_H_
#include <TypeLibrary.h>
//==================================================================================================
// Name: EGameEffectFlags
// Desc: Game effect flags
// Author: James Chilvers
//==================================================================================================
enum EGameEffectFlags
{
GAME_EFFECT_INITIALISED = (1 << 0),
GAME_EFFECT_RELEASED = (1 << 1),
GAME_EFFECT_AUTO_RELEASE = (1 << 2), // Release called when Game Effect System is destroyed
GAME_EFFECT_AUTO_DELETE = (1 << 3), // Delete is called when Game Effect System is destroyed
GAME_EFFECT_AUTO_UPDATES_WHEN_ACTIVE = (1 << 4),
GAME_EFFECT_AUTO_UPDATES_WHEN_NOT_ACTIVE = (1 << 5),
GAME_EFFECT_REGISTERED = (1 << 6),
GAME_EFFECT_ACTIVE = (1 << 7),
GAME_EFFECT_DEBUG_EFFECT = (1 << 8), // Set true for any debug effects to avoid confusion
GAME_EFFECT_UPDATE_WHEN_PAUSED = (1 << 9),
GAME_EFFECT_RELEASING = (1 << 10)
}; //-----------------------------------------------------------------------------------------------
//==================================================================================================
// Name: SGameEffectParams
// Desc: Game effect parameters
// Author: James Chilvers
//==================================================================================================
struct SGameEffectParams
{
friend class CGameEffect;
// Make constructor private to stop SGameEffectParams ever being created, should always inherit
// this
// for each effect to avoid casting problems
protected:
SGameEffectParams()
{
autoUpdatesWhenActive = true;
autoUpdatesWhenNotActive = false;
autoRelease = false;
autoDelete = false;
}
public:
bool autoUpdatesWhenActive;
bool autoUpdatesWhenNotActive;
bool autoRelease; // Release called when Game Effect System is destroyed
bool autoDelete; // Delete is called when Game Effect System is destroyed
}; //-----------------------------------------------------------------------------------------------
//==================================================================================================
// Name: IGameEffect
// Desc: Interface for all game effects
// Author: James Chilvers
//==================================================================================================
struct IGameEffect
{
DECLARE_TYPELIB(IGameEffect); // Allow soft coding on this interface
friend class CGameEffectsSystem;
public:
virtual ~IGameEffect() {}
virtual void Initialize(const SGameEffectParams* gameEffectParams = NULL) = 0;
virtual void Release() = 0;
virtual void Update(float frameTime) = 0;
virtual void SetActive(bool isActive) = 0;
virtual void SetFlag(uint32 flag, bool state) = 0;
virtual bool IsFlagSet(uint32 flag) const = 0;
virtual uint32 GetFlags() const = 0;
virtual void SetFlags(uint32 flags) = 0;
virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0;
virtual const char* GetName() const = 0;
virtual void UnloadData() = 0;
private:
virtual IGameEffect* Next() const = 0;
virtual IGameEffect* Prev() const = 0;
virtual void SetNext(IGameEffect* newNext) = 0;
virtual void SetPrev(IGameEffect* newPrev) = 0;
}; //-----------------------------------------------------------------------------------------------
#endif//_GAMEEFFECT_INTERFACE_H_
@@ -0,0 +1,179 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#ifndef _EFFECTS_GAMEEFFECTSSYSTEMDEFINES_H_
#define _EFFECTS_GAMEEFFECTSSYSTEMDEFINES_H_
#pragma once
// Includes
#include "TypeLibrary.h"
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
// Defines
#define GAME_FX_SYSTEM GetIGameEffectSystem()
#ifndef _RELEASE
#define DEBUG_GAME_FX_SYSTEM 1
#else
#define DEBUG_GAME_FX_SYSTEM 0
#endif
#if DEBUG_GAME_FX_SYSTEM
// Register effect's DebugOnInput and DebugDisplay callback functions
#define REGISTER_EFFECT_DEBUG_DATA(inputEventCallback, debugDisplayCallback, effectName) \
static CGameEffectsSystem::SRegisterEffectDebugData effectName(inputEventCallback, \
debugDisplayCallback, \
#effectName)
// Debug views
enum EGameEffectsSystemDebugView
{
eGAME_FX_DEBUG_VIEW_None = 0,
eGAME_FX_DEBUG_VIEW_Profiling,
eGAME_FX_DEBUG_VIEW_EffectList,
eGAME_FX_DEBUG_VIEW_BoundingBox,
eGAME_FX_DEBUG_VIEW_BoundingSphere,
eGAME_FX_DEBUG_VIEW_Particles,
eMAX_GAME_FX_DEBUG_VIEWS
// ** If you add/remove a view then remember to update GAME_FX_DEBUG_VIEW_NAMES **
};
#else
#define REGISTER_EFFECT_DEBUG_DATA(inputEventCallback, debugDisplayCallback, effectName)
#endif
// FX Asserts
#if DEBUG_GAME_FX_SYSTEM
#define FX_ASSERT_MESSAGE(condition, message) \
CRY_ASSERT_MESSAGE(condition, message); \
if (!(condition)) \
{ \
CryLogAlways("\n*************************************************************************" \
"************"); \
CryLogAlways("FX ASSERT"); \
CryLogAlways("Condition: %s", #condition); \
CryLogAlways("Message: %s", message); \
CryLogAlways("File: %s", __FILE__); \
CryLogAlways("Line: %d", __LINE__); \
CryLogAlways("***************************************************************************" \
"**********\n"); \
}
#else
#define FX_ASSERT_MESSAGE(condition, message)
#endif
// Profile tags
#define ENABLE_GAME_FX_PROFILE_TAGS 0
#if ENABLE_GAME_FX_PROFILE_TAGS
#define GAME_FX_PROFILE_BEGIN(_TAG_NAME_) \
{ \
CryProfile::PushProfilingMarker(#_TAG_NAME_); \
gEnv->pRenderer->PushProfileMarker(#_TAG_NAME_); \
}
#define GAME_FX_PROFILE_END(_TAG_NAME_) \
{ \
CryProfile::PopProfilingMarker(); \
gEnv->pRenderer->PopProfileMarker(#_TAG_NAME_); \
}
#define GAME_FX_PROFILE_MARKER(...) \
{ \
PIXSetMarker(0, __VA_ARGS__); \
}
#else
#define GAME_FX_PROFILE_BEGIN(_TAG_NAME_) \
{ \
}
#define GAME_FX_PROFILE_END(_TAG_NAME_) \
{ \
}
#define GAME_FX_PROFILE_MARKER(...) \
{ \
}
#endif // ENABLE_GAME_FX_PROFILE_TAGS
#define GAME_FX_LISTENER_NAME "GameEffectsSystem"
#define GAME_FX_LIBRARY_NAME "GameEffectsLibrary"
#define GAME_RENDER_NODE_LISTENER_NAME "GameRenderNodeListener"
#define GAME_RENDER_NODE_LIBRARY_NAME "GameRenderNodeLibrary"
#define GAME_RENDER_ELEMENT_LISTENER_NAME "GameRenderElementListener"
#define GAME_RENDER_ELEMENT_LIBRARY_NAME "GameRenderElementLibrary"
// Macro to remove specific code when soft code is enabled
#ifdef SOFTCODE_ENABLED
#define REMOVE_IN_SOFT_CODE(_softCodeOnlyCode_)
#else
#define REMOVE_IN_SOFT_CODE(_softCodeOnlyCode_) _softCodeOnlyCode_
#endif
// Register effect's Game callbacks
#define REGISTER_GAME_CALLBACKS(enteredGameCallback, effectName) \
static SRegisterGameCallbacks effectName(enteredGameCallback)
// Create Game FX Soft Code instance
#ifdef SOFTCODE_ENABLED
#define CREATE_GAME_FX_SOFT_CODE_INSTANCE(T) \
(static_cast<T*>(GAME_FX_SYSTEM.CreateSoftCodeInstance(#T)))
#else
#define CREATE_GAME_FX_SOFT_CODE_INSTANCE(T) (new T)
#endif
// Safely release and delete effect through macro
#define SAFE_DELETE_GAME_EFFECT(pGameEffect) \
if (pGameEffect) \
{ \
pGameEffect->Release(); \
SAFE_DELETE(pGameEffect); \
}
// Safely delete game render nodes
#define SAFE_DELETE_GAME_RENDER_NODE(pGameRenderNode) \
if (pGameRenderNode) \
{ \
pGameRenderNode->ReleaseGameRenderNode(); \
gEnv->p3DEngine->FreeRenderNodeState(pGameRenderNode); \
pGameRenderNode = NULL; \
}
// Safely delete game render elements
#define SAFE_DELETE_GAME_RENDER_ELEMENT(pGameRenderElement) \
if (pGameRenderElement) \
{ \
pGameRenderElement->ReleaseGameRenderElement(); \
pGameRenderElement = NULL; \
}
// FX input
#define GAME_FX_INPUT_ReleaseDebugEffect AzFramework::InputDeviceKeyboard::Key::NavigationEnd.GetNameCrc32()
#define GAME_FX_INPUT_ResetParticleManager AzFramework::InputDeviceKeyboard::Key::NavigationDelete.GetNameCrc32()
#define GAME_FX_INPUT_PauseParticleManager AzFramework::InputDeviceKeyboard::Key::NavigationEnd.GetNameCrc32()
#define GAME_FX_INPUT_ReloadEffectData AzFramework::InputDeviceKeyboard::Key::NumPadDecimal.GetNameCrc32()
#define GAME_FX_INPUT_IncrementDebugEffectId AzFramework::InputDeviceKeyboard::Key::NumPadAdd.GetNameCrc32()
#define GAME_FX_INPUT_DecrementDebugEffectId AzFramework::InputDeviceKeyboard::Key::NumPadSubtract.GetNameCrc32()
#define GAME_FX_INPUT_IncrementDebugView AzFramework::InputDeviceKeyboard::Key::NavigationArrowRight.GetNameCrc32()
#define GAME_FX_INPUT_DecrementDebugView AzFramework::InputDeviceKeyboard::Key::NavigationArrowLeft.GetNameCrc32()
// Forward declares
struct IGameEffect;
struct IGameRenderNode;
struct IGameRenderElement;
class CGameRenderNodeSoftCodeListener;
class CGameRenderElementSoftCodeListener;
// Typedefs
typedef void (* EnteredGameCallback)();
typedef void (* DebugOnInputEventCallback)(int);
typedef void (* DebugDisplayCallback)(const Vec2& textStartPos, float textSize, float textYStep);
typedef _smart_ptr<IGameRenderNode> IGameRenderNodePtr;
typedef _smart_ptr<IGameRenderElement> IGameRenderElementPtr;
#endif//_EFFECTS_GAMEEFFECTSSYSTEMDEFINES_H_
@@ -0,0 +1,163 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#ifndef _GAMEEFFECTSYSTEM_INTERFACE_H_
#define _GAMEEFFECTSYSTEM_INTERFACE_H_
#include <GameEffectSystem/GameEffects/IGameEffect.h>
#include <GameEffectSystem/GameEffectsSystemDefines.h>
#include <CryPodArray.h>
#include <AzCore/EBus/EBus.h>
class IGameEffectSystem;
struct ITypeLibrary;
/**
* For requesting the GameEffectSystem.
*/
class GameEffectSystemRequests
: public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////
// EBusTraits overrides
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
//////////////////////////////////////////////////////////////////////////
virtual IGameEffectSystem* GetIGameEffectSystem() = 0;
};
using GameEffectSystemRequestBus = AZ::EBus<GameEffectSystemRequests>;
/**
* Dispatches notifications from the GameEffectSystem.
*/
class GameEffectSystemNotifications
: public AZ::EBusTraits
{
public:
/// Called when it's appropriate to release all registered GameEffects
virtual void OnReleaseGameEffects() { }
};
using GameEffectSystemNotificationBus = AZ::EBus<GameEffectSystemNotifications>;
/// Returns global instance of IGameEffectSystem.
/// This function exists to support the legacy GAME_FX_SYSYTEM macro,
/// this is not the suggested way to fetch a singleton.
inline IGameEffectSystem& GetIGameEffectSystem()
{
IGameEffectSystem* instance = nullptr;
EBUS_EVENT_RESULT(instance, GameEffectSystemRequestBus, GetIGameEffectSystem);
return *instance;
}
class IGameEffectSystem
{
public:
virtual SC_API void RegisterEffect(IGameEffect* effect) = 0;
virtual SC_API void UnRegisterEffect(IGameEffect* effect) = 0;
virtual SC_API void GameRenderNodeInstanceReplaced(void* pOldInstance, void* pNewInstance) = 0;
virtual SC_API void GameRenderElementInstanceReplaced(void* pOldInstance, void* pNewInstance) = 0;
#ifdef SOFTCODE_ENABLED
// Create soft code instance using libs
virtual SC_API void* CreateSoftCodeInstance(const char* pTypeName);
// Register soft code lib for creation of instances
virtual SC_API void RegisterSoftCodeLib(ITypeLibrary* pLib);
#endif
SC_API static void RegisterEnteredGameCallback(EnteredGameCallback enteredGameCallback);
#ifdef DEBUG_GAME_FX_SYSTEM
SC_API static void RegisterEffectDebugData(DebugOnInputEventCallback inputEventCallback,
DebugDisplayCallback displayCallback,
const char* effectName);
#endif//DEBUG_GAME_FX_SYSTEM
};
#if DEBUG_GAME_FX_SYSTEM
// Creating a static version of SRegisterEffectDebugData inside an effect cpp registers the
// effect's debug data with the game effects system
struct SRegisterEffectDebugData
{
SRegisterEffectDebugData(DebugOnInputEventCallback inputEventCallback,
DebugDisplayCallback debugDisplayCallback, const char* effectName)
{
IGameEffectSystem::RegisterEffectDebugData(inputEventCallback, debugDisplayCallback,
effectName);
}
};
struct SEffectDebugData
{
SEffectDebugData(DebugOnInputEventCallback paramInputCallback,
DebugDisplayCallback paramDisplayCallback, const char* paramEffectName)
{
inputCallback = paramInputCallback;
displayCallback = paramDisplayCallback;
effectName = paramEffectName;
}
DebugOnInputEventCallback inputCallback;
DebugDisplayCallback displayCallback;
const char* effectName;
};
#endif//DEBUG_GAME_FX_SYSTEM
// Creating a static version of SRegisterGameCallbacks inside an effect cpp registers the
// effect's game callback functions with the game effects system
struct SRegisterGameCallbacks
{
SRegisterGameCallbacks(EnteredGameCallback enteredGameCallback)
{
IGameEffectSystem::RegisterEnteredGameCallback(enteredGameCallback);
}
};
//--------------------------------------------------------------------------------------------------
// Desc: Game Effect System Static data - contains access to any data where static initialisation
// order is critical, this will enforce initialisation on first use
//--------------------------------------------------------------------------------------------------
struct SGameEffectSystemStaticData
{
static PodArray<EnteredGameCallback>& GetEnteredGameCallbackList()
{
static PodArray<EnteredGameCallback> enteredGameCallbackList;
return enteredGameCallbackList;
}
#if DEBUG_GAME_FX_SYSTEM
static PodArray<SEffectDebugData>& GetEffectDebugList()
{
static PodArray<SEffectDebugData> effectDebugList;
return effectDebugList;
}
#endif//DEBUG_GAME_FX_SYSTEM
};
// Easy access macros
#define s_enteredGameCallbackList SGameEffectSystemStaticData::GetEnteredGameCallbackList()
#if DEBUG_GAME_FX_SYSTEM
#define s_effectDebugList SGameEffectSystemStaticData::GetEffectDebugList()
#endif//DEBUG_GAME_FX_SYSTEM
//--------------------------------------------------------------------------------------------------
// Name: RegisterEnteredGameCallback
// Desc: Registers entered game callback
//--------------------------------------------------------------------------------------------------
inline void IGameEffectSystem::RegisterEnteredGameCallback(EnteredGameCallback enteredGameCallback)
{
if (enteredGameCallback)
{
s_enteredGameCallbackList.push_back(enteredGameCallback);
}
} //-------------------------------------------------------------------------------------------------
#endif//_GAMEEFFECTSYSTEM_INTERFACE_H_
@@ -0,0 +1,51 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#ifndef _EFFECTS_RENDERNODES_IGAMERENDERNODE_H_
#define _EFFECTS_RENDERNODES_IGAMERENDERNODE_H_
#pragma once
#include <IEntityRenderState.h>
#include <TypeLibrary.h>
// Forward declares
struct IGameRenderNodeParams;
//==================================================================================================
// Name: IGameRenderNode
// Desc: Base interface for all game render nodes
// Author: James Chilvers
//==================================================================================================
struct IGameRenderNode
: public IRenderNode
, public _i_reference_target_t
{
DECLARE_TYPELIB(IGameRenderNode); // Allow soft coding on this interface
virtual ~IGameRenderNode() {}
virtual bool InitialiseGameRenderNode() = 0;
virtual void ReleaseGameRenderNode() = 0;
virtual void SetParams(const IGameRenderNodeParams* pParams = NULL) = 0;
}; //-----------------------------------------------------------------------------------------------
//==================================================================================================
// Name: IGameRenderNodeParams
// Desc: Game render node params
// Author: James Chilvers
//==================================================================================================
struct IGameRenderNodeParams
{
virtual ~IGameRenderNodeParams() {}
}; //------------------------------------------------------------------------------------------------
#endif//_EFFECTS_RENDERNODES_IGAMERENDERNODE_H_