From b3b50abd9bfd2293914b32499dbd31bae263c492 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 14 May 2016 12:40:13 -0500 Subject: [PATCH] Integrates components into the update and render loop. --- Engine/source/T3D/gameBase/processList.cpp | 8 ++++++++ Engine/source/T3D/gameBase/std/stdGameProcess.cpp | 25 +++++++++++++++++++++++ Engine/source/scene/sceneRenderState.cpp | 14 ++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/gameBase/processList.cpp b/Engine/source/T3D/gameBase/processList.cpp index 32b04ca3c..1f891fe09 100644 --- a/Engine/source/T3D/gameBase/processList.cpp +++ b/Engine/source/T3D/gameBase/processList.cpp @@ -27,6 +27,9 @@ #include "platform/profiler.h" #include "console/consoleTypes.h" +#include "T3D/Components/coreInterfaces.h" + +#include "T3D/Components/Component.h" //---------------------------------------------------------------------------- ProcessObject::ProcessObject() @@ -268,6 +271,11 @@ void ProcessList::advanceObjects() onTickObject(pobj); } + for (U32 i = 0; i < UpdateInterface::all.size(); i++) + { + UpdateInterface::all[i]->processTick(); + } + mTotalTicks++; PROFILE_END(); diff --git a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp index 63122b223..51222568c 100644 --- a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp +++ b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp @@ -36,6 +36,8 @@ #include "T3D/gameBase/gameConnection.h" #include "T3D/gameBase/std/stdMoveList.h" #include "T3D/fx/cameraFXMgr.h" +#include "T3D/Components/coreInterfaces.h" +#include "T3D/Components/Component.h" MODULE_BEGIN( ProcessList ) @@ -132,6 +134,16 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } + for (U32 i = 0; i < UpdateInterface::all.size(); i++) + { + Component *comp = dynamic_cast(UpdateInterface::all[i]); + + if (!comp->isClientObject() || !comp->isActive()) + continue; + + UpdateInterface::all[i]->interpolateTick(mLastDelta); + } + // Inform objects of total elapsed delta so they can advance // client side animations. F32 dt = F32(timeDelta) / 1000; @@ -146,6 +158,19 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } + for (U32 i = 0; i < UpdateInterface::all.size(); i++) + { + Component *comp = dynamic_cast(UpdateInterface::all[i]); + + if (comp) + { + if (!comp->isClientObject() || !comp->isActive()) + continue; + } + + UpdateInterface::all[i]->advanceTime(dt); + } + return ret; } diff --git a/Engine/source/scene/sceneRenderState.cpp b/Engine/source/scene/sceneRenderState.cpp index 0aeb1d273..3d8db7c26 100644 --- a/Engine/source/scene/sceneRenderState.cpp +++ b/Engine/source/scene/sceneRenderState.cpp @@ -26,7 +26,8 @@ #include "renderInstance/renderPassManager.h" #include "math/util/matrixSet.h" - +#include "T3D/Components/render/renderComponentInterface.h" +#include "T3D/Components/Component.h" //----------------------------------------------------------------------------- @@ -104,6 +105,17 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) SceneObject* object = objects[ i ]; object->prepRenderImage( this ); } + + U32 interfaceCount = RenderComponentInterface::all.size(); + for (U32 i = 0; i < RenderComponentInterface::all.size(); i++) + { + Component* comp = dynamic_cast(RenderComponentInterface::all[i]); + + if (comp->isClientObject() && comp->isActive()) + { + RenderComponentInterface::all[i]->prepRenderImage(this); + } + } PROFILE_END(); // Render what the objects have batched. -- 2.11.4.GIT