mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-20 04:40:54 +00:00
Test PR of lazy load of ghosts and scene streaming
For now scene streaming only affects how subscenes are loaded. If you try it on everything in a scene expect issues as the namespaces are not linked up at that point. This is a TEST! Do not merge! If you do you will open up a gate to an alternate reality where all that you believe will cease to exist in an endless void of darkness.
This commit is contained in:
parent
23e30e801f
commit
eecc2bdaee
17 changed files with 298 additions and 37 deletions
|
|
@ -266,3 +266,18 @@ DefineEngineFunction( isValidObjectName, bool, (const char * name), , "( string
|
|||
}
|
||||
|
||||
ConsoleFunctionGroupEnd( SimFunctions );
|
||||
|
||||
void SceneStreaming::processTick()
|
||||
{
|
||||
if (smStreaming)
|
||||
{
|
||||
for (U32 i = 0; i < mMaxObjects && !smPendingRegister.empty(); i++)
|
||||
{
|
||||
SimObject* obj = smPendingRegister.first();
|
||||
smPendingRegister.pop_front();
|
||||
|
||||
if (!obj->onAdd())
|
||||
obj->unregisterObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@
|
|||
#ifndef _CONSOLE_H_
|
||||
#include "console/console.h"
|
||||
#endif
|
||||
#ifndef _ITICKABLE_H_
|
||||
#include "core/iTickable.h"
|
||||
#endif
|
||||
|
||||
// Forward Refs
|
||||
class SimSet;
|
||||
|
|
@ -44,6 +47,21 @@ class SimObject;
|
|||
class SimEvent;
|
||||
class Stream;
|
||||
|
||||
class SceneStreaming : public virtual ITickable
|
||||
{
|
||||
protected:
|
||||
U32 mMaxObjects = 20;
|
||||
public:
|
||||
SceneStreaming(){}
|
||||
~SceneStreaming() {}
|
||||
bool smStreaming;
|
||||
Vector<SimObject*> smPendingRegister;
|
||||
|
||||
void interpolateTick(F32 delta) override {return;}
|
||||
void processTick() override;
|
||||
void advanceTime(F32 timeDelta) override { return; }
|
||||
};
|
||||
|
||||
// Sim Types
|
||||
typedef U32 SimTime;
|
||||
typedef U32 SimObjectId;
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ U32 getTargetTime()
|
|||
|
||||
SimGroup *gRootGroup = NULL;
|
||||
SimManagerNameDictionary *gNameDictionary;
|
||||
SceneStreaming* sgStreamingInstance = NULL;
|
||||
SimIdDictionary *gIdDictionary;
|
||||
U32 gNextObjectId;
|
||||
|
||||
|
|
@ -287,7 +288,8 @@ static void initRoot()
|
|||
{
|
||||
gIdDictionary = new SimIdDictionary;
|
||||
gNameDictionary = new SimManagerNameDictionary;
|
||||
|
||||
sgStreamingInstance = new SceneStreaming;
|
||||
sgStreamingInstance->smStreaming = false;
|
||||
gRootGroup = new SimGroup();
|
||||
gRootGroup->incRefCount();
|
||||
|
||||
|
|
@ -305,6 +307,7 @@ static void shutdownRoot()
|
|||
gRootGroup->deleteObject();
|
||||
gRootGroup = NULL;
|
||||
|
||||
SAFE_DELETE(sgStreamingInstance);
|
||||
SAFE_DELETE(gNameDictionary);
|
||||
SAFE_DELETE(gIdDictionary);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "console/script.h"
|
||||
|
||||
#include "sim/netObject.h"
|
||||
#include "scene/sceneObject.h"
|
||||
|
||||
ImplementBitfieldType(GameTypeMasksType,
|
||||
"The type of animation effect to apply to this material.\n"
|
||||
|
|
@ -109,6 +110,7 @@ namespace Sim
|
|||
// Defined in simManager.cpp
|
||||
extern SimGroup *gRootGroup;
|
||||
extern SimManagerNameDictionary *gNameDictionary;
|
||||
extern SceneStreaming* sgStreamingInstance;
|
||||
extern SimIdDictionary *gIdDictionary;
|
||||
extern U32 gNextObjectId;
|
||||
}
|
||||
|
|
@ -725,6 +727,12 @@ bool SimObject::registerObject()
|
|||
|
||||
Sim::gNameDictionary->insert(this);
|
||||
|
||||
if (Sim::sgStreamingInstance->smStreaming && dynamic_cast<SceneObject*>(this))
|
||||
{
|
||||
Sim::sgStreamingInstance->smPendingRegister.push_back(this);
|
||||
return true; // pretend success
|
||||
}
|
||||
|
||||
// Notify object
|
||||
bool ret = onAdd();
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,10 @@
|
|||
#ifndef _TAML_CALLBACKS_H_
|
||||
#include "persistence/taml/tamlCallbacks.h"
|
||||
#endif
|
||||
|
||||
#ifndef _OBJECTTYPES_H_
|
||||
#include "T3D/objectTypes.h"
|
||||
#endif
|
||||
|
||||
class Stream;
|
||||
class LightManager;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue