Remove I3DEngine CryCommon Interface (#567)
Delete: - I3DEngine - Missions - Time of day - GameEffectsSystem Gem - ImageProcessing Gem - SVOGI Gem - Various other things that don't do anything now that the legacy renderer has been removed.
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<EngineDependencies versionnumber="1.0.0">
|
||||
<Dependency path="scripts/effects/gameeffects.xml" optional="true" />
|
||||
</EngineDependencies>
|
||||
@@ -1,13 +0,0 @@
|
||||
<ObjectStream version="3">
|
||||
<Class name="AZStd::vector" type="{82FC5264-88D0-57CD-9307-FC52E4DAD550}">
|
||||
<Class name="SeedInfo" field="element" version="2" type="{FACC3682-2ACA-4AA4-B85A-07AD276D18A0}">
|
||||
<Class name="AssetId" field="assetId" version="1" type="{652ED536-3402-439B-AEBE-4A5DBC554085}">
|
||||
<Class name="AZ::Uuid" field="guid" value="{BD36892B-5AF0-5A3F-AA86-577E26747F6C}" type="{E152C105-A133-4D03-BBF8-3D4B2FBA3E2A}"/>
|
||||
<Class name="unsigned int" field="subId" value="0" type="{43DA906B-7DEF-4CA8-9790-854106D3F983}"/>
|
||||
</Class>
|
||||
<Class name="unsigned int" field="platformFlags" value="255" type="{43DA906B-7DEF-4CA8-9790-854106D3F983}"/>
|
||||
<Class name="AZStd::string" field="pathHint" value="gameeffectssystem_dependencies.xml" type="{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9}"/>
|
||||
</Class>
|
||||
</Class>
|
||||
</ObjectStream>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
add_subdirectory(Code)
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
ly_add_target(
|
||||
NAME GameEffectSystem.Static STATIC
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
gameeffectsystem_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
include
|
||||
source
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
Legacy::CryCommon
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME GameEffectSystem ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
|
||||
NAMESPACE Gem
|
||||
FILES_CMAKE
|
||||
gameeffectsystem_shared_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
include
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
Gem::GameEffectSystem.Static
|
||||
)
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
source/GameEffectSystem_precompiled.cpp
|
||||
source/GameEffectSystem_precompiled.h
|
||||
include/GameEffectSystem/IGameEffectSystem.h
|
||||
include/GameEffectSystem/IGameRenderNode.h
|
||||
include/GameEffectSystem/GameEffectsSystemDefines.h
|
||||
include/GameEffectSystem/GameEffects/IGameEffect.h
|
||||
include/GameEffectSystem/GameEffects/GameEffectBase.h
|
||||
source/GameEffectsSystem.h
|
||||
source/GameEffectsSystem.cpp
|
||||
source/GameEffects/GameEffectSoftCodeLibrary.cpp
|
||||
source/RenderElements/GameRenderElement.h
|
||||
source/RenderElements/GameRenderElement.cpp
|
||||
source/RenderElements/GameRenderElementSoftCodeLibrary.cpp
|
||||
source/RenderNodes/GameRenderNodeSoftCodeLibrary.cpp
|
||||
)
|
||||
@@ -1,16 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
source/GameEffectSystemGem.h
|
||||
source/GameEffectSystemGem.cpp
|
||||
)
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#include "GameEffectSystem_precompiled.h"
|
||||
#include "GameEffectSystemGem.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
/**
|
||||
* Console command function for reloading the game effect system's data.
|
||||
*/
|
||||
void CmdReloadGameFx([[maybe_unused]] IConsoleCmdArgs* pArgs)
|
||||
{
|
||||
IGameEffectSystem* iGameEffectSystem = nullptr;
|
||||
GameEffectSystemRequestBus::BroadcastResult(iGameEffectSystem, &GameEffectSystemRequestBus::Events::GetIGameEffectSystem);
|
||||
if (iGameEffectSystem)
|
||||
{
|
||||
CGameEffectsSystem* cGameEffectsSystem = reinterpret_cast<CGameEffectsSystem*>(iGameEffectSystem);
|
||||
cGameEffectsSystem->ReloadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameEffectSystemGem::GameEffectSystemGem()
|
||||
: CryHooksModule()
|
||||
, m_gameEffectSystem(nullptr)
|
||||
, g_gameFXSystemDebug(0)
|
||||
{
|
||||
GameEffectSystemRequestBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
GameEffectSystemGem::~GameEffectSystemGem()
|
||||
{
|
||||
GameEffectSystemRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void GameEffectSystemGem::OnSystemEvent(ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case ESYSTEM_EVENT_GAME_POST_INIT:
|
||||
// Put your init code here
|
||||
// All other Gems will exist at this point
|
||||
REGISTER_CVAR(g_gameFXSystemDebug, 0, 0, "Toggles game effects system debug state");
|
||||
REGISTER_COMMAND("g_reloadGameFx", &CmdReloadGameFx, 0, "Reload all game fx");
|
||||
|
||||
m_gameEffectSystem = new CGameEffectsSystem();
|
||||
m_gameEffectSystem->Initialize();
|
||||
m_gameEffectSystem->LoadData();
|
||||
break;
|
||||
|
||||
case ESYSTEM_EVENT_FULL_SHUTDOWN:
|
||||
case ESYSTEM_EVENT_FAST_SHUTDOWN:
|
||||
if (m_gameEffectSystem)
|
||||
{
|
||||
m_gameEffectSystem->ReleaseData();
|
||||
m_gameEffectSystem->Destroy();
|
||||
|
||||
delete m_gameEffectSystem;
|
||||
m_gameEffectSystem = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IGameEffectSystem* GameEffectSystemGem::GetIGameEffectSystem()
|
||||
{
|
||||
return m_gameEffectSystem;
|
||||
}
|
||||
|
||||
AZ_DECLARE_MODULE_CLASS(Gem_GameEffectSystem, GameEffectSystemGem)
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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 _GEM_GAMEEFFECTSYSTEM_H_
|
||||
#define _GEM_GAMEEFFECTSYSTEM_H_
|
||||
|
||||
#include "GameEffectsSystem.h"
|
||||
|
||||
class GameEffectSystemGem
|
||||
: public CryHooksModule
|
||||
, public GameEffectSystemRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(GameEffectSystemGem, "{44350C39-A90B-46EB-AC1C-DB505113F4A6}", CryHooksModule);
|
||||
|
||||
public:
|
||||
GameEffectSystemGem();
|
||||
~GameEffectSystemGem() override;
|
||||
|
||||
void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override;
|
||||
IGameEffectSystem* GetIGameEffectSystem() override;
|
||||
|
||||
private:
|
||||
CGameEffectsSystem* m_gameEffectSystem;
|
||||
int g_gameFXSystemDebug;
|
||||
};
|
||||
|
||||
#endif//_GEM_GAMEEFFECTSYSTEM_H_
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#include "GameEffectSystem_precompiled.h"
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* 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 AFX_GAMEEFFECTSYSTEM_PRECOMPILED_H__140A8406_81F3_42C3_B6BB_0B14734012DE__INCLUDED_
|
||||
#define AFX_GAMEEFFECTSYSTEM_PRECOMPILED_H__140A8406_81F3_42C3_B6BB_0B14734012DE__INCLUDED_
|
||||
|
||||
#include <platform.h>
|
||||
#include <CryName.h>
|
||||
#include <I3DEngine.h>
|
||||
#include <ISerialize.h>
|
||||
#include <IGem.h>
|
||||
|
||||
#endif//AFX_GAMEEFFECTSYSTEM_PRECOMPILED_H__140A8406_81F3_42C3_B6BB_0B14734012DE__INCLUDED_
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
//==================================================================================================
|
||||
// Name: GameEffectSoftCodeLibrary
|
||||
// Desc: Game Effect Soft Code Library
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
|
||||
// Includes
|
||||
#include "GameEffectSystem_precompiled.h"
|
||||
#include "GameEffectSystem/GameEffectsSystemDefines.h"
|
||||
#include "GameEffectSystem/GameEffects/IGameEffect.h"
|
||||
|
||||
IMPLEMENT_TYPELIB(IGameEffect, GAME_FX_LIBRARY_NAME); // Implementation of Soft Coding library
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* 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_GAMEEFFECTSSYSTEM_H_
|
||||
#define _EFFECTS_GAMEEFFECTSSYSTEM_H_
|
||||
#pragma once
|
||||
|
||||
// Includes
|
||||
#include "GameEffectSystem/IGameEffectSystem.h"
|
||||
#include "GameEffectSystem/GameEffectsSystemDefines.h"
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzFramework/Input/Events/InputChannelEventListener.h>
|
||||
|
||||
//==================================================================================================
|
||||
// Name: CGameEffectsSystem
|
||||
// Desc: System to handle game effects, game render nodes and game render elements
|
||||
// Game effect: separates out effect logic from game logic
|
||||
// Game render node: handles the render object in 3d space
|
||||
// Game render element: handles the rendering of the object
|
||||
// CVar activation system: system used to have data driven cvars activated in game
|
||||
//effects
|
||||
// Post effect activation system: system used to have data driven post effects
|
||||
//activated in game effects
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
class CGameEffectsSystem
|
||||
: public IGameEffectSystem
|
||||
, public AzFramework::InputChannelEventListener
|
||||
, public ISoftCodeListener
|
||||
, public AZ::TickBus::Handler
|
||||
{
|
||||
friend struct SGameEffectSystemStaticData;
|
||||
|
||||
public:
|
||||
void Destroy();
|
||||
void Initialize();
|
||||
void LoadData();
|
||||
void ReleaseData();
|
||||
|
||||
template <class T>
|
||||
T* CreateEffect() // Use if dynamic memory allocation is required for the game effect
|
||||
{ // Using this function then allows easy changing of memory allocator for all dynamically
|
||||
// created effects
|
||||
T* newEffect = new T;
|
||||
return newEffect;
|
||||
}
|
||||
|
||||
// Each effect automatically registers and unregisters itself
|
||||
SC_API void RegisterEffect(IGameEffect* effect) override;
|
||||
SC_API void UnRegisterEffect(IGameEffect* effect) override;
|
||||
|
||||
void Update(float frameTime);
|
||||
|
||||
SC_API void RegisterGameRenderNode(IGameRenderNodePtr& pGameRenderNode);
|
||||
SC_API void UnregisterGameRenderNode(IGameRenderNodePtr& pGameRenderNode);
|
||||
|
||||
SC_API void RegisterGameRenderElement(IGameRenderElementPtr& pGameRenderElement);
|
||||
SC_API void UnregisterGameRenderElement(IGameRenderElementPtr& pGameRenderElement);
|
||||
|
||||
#ifdef SOFTCODE_ENABLED
|
||||
SC_API void*
|
||||
CreateSoftCodeInstance(const char* pTypeName) override; // Create soft code instance using libs
|
||||
SC_API void
|
||||
RegisterSoftCodeLib(ITypeLibrary* pLib) override; // Register soft code lib for creation of instances
|
||||
#endif
|
||||
|
||||
bool OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) override;
|
||||
|
||||
// ISoftCodeListener implementation
|
||||
void InstanceReplaced(void* pOldInstance, void* pNewInstance) override;
|
||||
void GameRenderNodeInstanceReplaced(void* pOldInstance, void* pNewInstance) override;
|
||||
void GameRenderElementInstanceReplaced(void* pOldInstance, void* pNewInstance) override;
|
||||
|
||||
// SGameRulesListener implementation
|
||||
void GameRulesInitialise();
|
||||
// #TODO: Have this receive events from GameRules
|
||||
void EnteredGame();// override;
|
||||
|
||||
void ReloadData();
|
||||
|
||||
CGameEffectsSystem();
|
||||
virtual ~CGameEffectsSystem();
|
||||
|
||||
// AZ::TickBus::Handler implementation
|
||||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
|
||||
|
||||
private:
|
||||
void Reset();
|
||||
void AutoReleaseAndDeleteFlaggedEffects(IGameEffect* effectList);
|
||||
void AutoDeleteEffects(IGameEffect* effectList);
|
||||
void SetPostEffectCVarCallbacks();
|
||||
static void PostEffectCVarCallback(ICVar* cvar);
|
||||
|
||||
#if DEBUG_GAME_FX_SYSTEM
|
||||
void DrawDebugDisplay();
|
||||
void OnActivateDebugView(int debugView);
|
||||
void OnDeActivateDebugView(int debugView);
|
||||
|
||||
int GetDebugView() const { return m_debugView; }
|
||||
SC_API IGameEffect* GetDebugEffect(const char* pEffectName) const;
|
||||
|
||||
static int s_currentDebugEffectId;
|
||||
|
||||
int m_debugView;
|
||||
#endif
|
||||
|
||||
static int s_postEffectCVarNameOffset;
|
||||
|
||||
#ifdef SOFTCODE_ENABLED
|
||||
std::vector<ITypeLibrary*> m_softCodeTypeLibs;
|
||||
|
||||
typedef std::vector<IGameRenderNodePtr*> TGameRenderNodeVec;
|
||||
TGameRenderNodeVec m_gameRenderNodes;
|
||||
CGameRenderNodeSoftCodeListener* m_gameRenderNodeSoftCodeListener;
|
||||
|
||||
typedef std::vector<IGameRenderElementPtr*> TGameRenderElementVec;
|
||||
TGameRenderElementVec m_gameRenderElements;
|
||||
CGameRenderElementSoftCodeListener* m_gameRenderElementSoftCodeListener;
|
||||
#endif
|
||||
|
||||
IGameEffect* m_effectsToUpdate;
|
||||
IGameEffect* m_effectsNotToUpdate;
|
||||
// If in update loop, this is the next effect to be updated this will get changed if the effect is unregistered
|
||||
IGameEffect* m_nextEffectToUpdate;
|
||||
bool m_isInitialised;
|
||||
bool s_hasLoadedData;
|
||||
}; //------------------------------------------------------------------------------------------------
|
||||
|
||||
#endif//_EFFECTS_GAMEEFFECTSSYSTEM_H_
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
//==================================================================================================
|
||||
// Name: CGameRenderElement
|
||||
// Desc: Base class for all game render elements
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
|
||||
// Includes
|
||||
#include "GameEffectSystem_precompiled.h"
|
||||
#include "GameRenderElement.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Name: CGameRenderElement
|
||||
// Desc: Constructor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CGameRenderElement::CGameRenderElement()
|
||||
{
|
||||
m_pREGameEffect = NULL;
|
||||
} //-------------------------------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Name: InitialiseGameRenderElement
|
||||
// Desc: Initialises game render element
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool CGameRenderElement::InitialiseGameRenderElement()
|
||||
{
|
||||
m_pREGameEffect = (CREGameEffect*)gEnv->pRenderer->EF_CreateRE(eDATA_GameEffect);
|
||||
if (m_pREGameEffect)
|
||||
{
|
||||
m_pREGameEffect->SetPrivateImplementation(this);
|
||||
m_pREGameEffect->mfUpdateFlags(FCEF_TRANSFORM);
|
||||
}
|
||||
|
||||
return true;
|
||||
} //-------------------------------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Name: ReleaseGameRenderElement
|
||||
// Desc: Releases game render element
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CGameRenderElement::ReleaseGameRenderElement()
|
||||
{
|
||||
if (m_pREGameEffect)
|
||||
{
|
||||
m_pREGameEffect->SetPrivateImplementation(NULL);
|
||||
m_pREGameEffect->Release(false);
|
||||
}
|
||||
} //-------------------------------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Name: UpdatePrivateImplementation
|
||||
// Desc: Updates private implementation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CGameRenderElement::UpdatePrivateImplementation()
|
||||
{
|
||||
if (m_pREGameEffect)
|
||||
{
|
||||
m_pREGameEffect->SetPrivateImplementation(this);
|
||||
}
|
||||
} //-------------------------------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Name: GetCREGameEffect
|
||||
// Desc: returns the game effect render element
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CREGameEffect* CGameRenderElement::GetCREGameEffect()
|
||||
{
|
||||
return m_pREGameEffect;
|
||||
} //-------------------------------------------------------------------------------------------------
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* 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_RENDERELEMENTS_GAMERENDERELEMENT_H_
|
||||
#define _EFFECTS_RENDERELEMENTS_GAMERENDERELEMENT_H_
|
||||
#pragma once
|
||||
|
||||
// Includes
|
||||
#include "GameEffectsSystem.h"
|
||||
#include <CREGameEffect.h>
|
||||
|
||||
// Forward declares
|
||||
struct IGameRenderElementParams;
|
||||
|
||||
//==================================================================================================
|
||||
// Name: IGameRenderElement
|
||||
// Desc: Base interface for all game render elements
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
struct IGameRenderElement
|
||||
: public IREGameEffect
|
||||
, public _i_reference_target_t
|
||||
{
|
||||
DECLARE_TYPELIB(IGameRenderElement); // Allow soft coding on this interface
|
||||
|
||||
virtual ~IGameRenderElement() {}
|
||||
|
||||
virtual bool InitialiseGameRenderElement() = 0;
|
||||
virtual void ReleaseGameRenderElement() = 0;
|
||||
virtual void UpdatePrivateImplementation() = 0;
|
||||
|
||||
virtual CREGameEffect* GetCREGameEffect() = 0;
|
||||
|
||||
virtual IGameRenderElementParams* GetParams() = 0;
|
||||
}; //------------------------------------------------------------------------------------------------
|
||||
|
||||
//==================================================================================================
|
||||
// Name: CGameRenderElement
|
||||
// Desc: Base class for all game render elements
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
class CGameRenderElement
|
||||
: public IGameRenderElement
|
||||
{
|
||||
DECLARE_TYPE(CGameRenderElement, IGameRenderElement); // Exposes this type for SoftCoding
|
||||
public:
|
||||
CGameRenderElement();
|
||||
virtual ~CGameRenderElement() {}
|
||||
|
||||
virtual bool InitialiseGameRenderElement();
|
||||
virtual void ReleaseGameRenderElement();
|
||||
virtual void UpdatePrivateImplementation();
|
||||
|
||||
virtual CREGameEffect* GetCREGameEffect();
|
||||
|
||||
protected:
|
||||
CREGameEffect* SOFT(m_pREGameEffect);
|
||||
}; //------------------------------------------------------------------------------------------------
|
||||
|
||||
//==================================================================================================
|
||||
// Name: IGameRenderElementParams
|
||||
// Desc: Game Render Element params
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
struct IGameRenderElementParams
|
||||
{
|
||||
virtual ~IGameRenderElementParams() {}
|
||||
}; //------------------------------------------------------------------------------------------------
|
||||
|
||||
#endif//_EFFECTS_RENDERELEMENTS_GAMERENDERELEMENT_H_
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
//==================================================================================================
|
||||
// Name: GameRenderElementSoftCodeLibrary
|
||||
// Desc: Render Node Soft Code Library
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
|
||||
// Includes
|
||||
#include "GameEffectSystem_precompiled.h"
|
||||
#include <TypeLibrary.h>
|
||||
#include "RenderElements/GameRenderElement.h"
|
||||
|
||||
IMPLEMENT_TYPELIB(IGameRenderElement,
|
||||
GAME_RENDER_ELEMENT_LIBRARY_NAME); // Implementation of Soft Coding library
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
//==================================================================================================
|
||||
// Name: GameRenderNodeSoftCodeLibrary
|
||||
// Desc: Render Node Soft Code Library
|
||||
// Author: James Chilvers
|
||||
//==================================================================================================
|
||||
|
||||
// Includes
|
||||
#include "GameEffectSystem_precompiled.h"
|
||||
#include <TypeLibrary.h>
|
||||
#include <GameEffectSystem/IGameRenderNode.h>
|
||||
#include <GameEffectSystem/GameEffectsSystemDefines.h>
|
||||
|
||||
IMPLEMENT_TYPELIB(IGameRenderNode, GAME_RENDER_NODE_LIBRARY_NAME); // Implementation of Soft Coding library
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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 CRYINCLUDE_GAMEDLL_EFFECTS_RENDERNODES_IGAMERENDERNODE_H
|
||||
#define CRYINCLUDE_GAMEDLL_EFFECTS_RENDERNODES_IGAMERENDERNODE_H
|
||||
#pragma once
|
||||
|
||||
#include "Effects/RenderElements/GameRenderElement.h"
|
||||
#include "Effects/GameEffectsSystem.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 // CRYINCLUDE_GAMEDLL_EFFECTS_RENDERNODES_IGAMERENDERNODE_H
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"gem_name": "GameEffectSystem",
|
||||
"GemFormatVersion": 3,
|
||||
"LinkType": "DynamicStatic",
|
||||
"Name": "GameEffectSystem",
|
||||
"DisplayName": "Game Effect System",
|
||||
"Summary": "Provides fundamentals for creating and managing visual effects.",
|
||||
"Tags": ["Effects System"],
|
||||
"Uuid": "d378b5a7b47747d0a7aa741945df58f3",
|
||||
"Version": "1.0.0",
|
||||
"IconPath": "preview.png"
|
||||
}
|
||||
Reference in New Issue
Block a user