Fix build
This commit is contained in:
@@ -13,6 +13,7 @@ class BehaviorSystem : public TaskGraphSystem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Array<Behavior*> Behaviors;
|
Array<Behavior*> Behaviors;
|
||||||
|
|
||||||
void Job(int32 index);
|
void Job(int32 index);
|
||||||
void Execute(TaskGraph* graph) override;
|
void Execute(TaskGraph* graph) override;
|
||||||
};
|
};
|
||||||
@@ -20,6 +21,8 @@ public:
|
|||||||
class BehaviorService : public EngineService
|
class BehaviorService : public EngineService
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Array<Behavior*> UpdateList;
|
||||||
|
|
||||||
BehaviorService()
|
BehaviorService()
|
||||||
: EngineService(TEXT("Behaviors"), 0)
|
: EngineService(TEXT("Behaviors"), 0)
|
||||||
{
|
{
|
||||||
@@ -30,7 +33,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
BehaviorService BehaviorServiceInstance;
|
BehaviorService BehaviorServiceInstance;
|
||||||
Array<Behavior*> UpdateList;
|
|
||||||
TaskGraphSystem* Behavior::System = nullptr;
|
TaskGraphSystem* Behavior::System = nullptr;
|
||||||
|
|
||||||
void BehaviorSystem::Job(int32 index)
|
void BehaviorSystem::Job(int32 index)
|
||||||
@@ -42,10 +44,10 @@ void BehaviorSystem::Job(int32 index)
|
|||||||
void BehaviorSystem::Execute(TaskGraph* graph)
|
void BehaviorSystem::Execute(TaskGraph* graph)
|
||||||
{
|
{
|
||||||
// Copy list of behaviors to update (in case one of them gets disabled during async jobs)
|
// Copy list of behaviors to update (in case one of them gets disabled during async jobs)
|
||||||
if (UpdateList.Count() == 0)
|
if (BehaviorServiceInstance.UpdateList.Count() == 0)
|
||||||
return;
|
return;
|
||||||
Behaviors.Clear();
|
Behaviors.Clear();
|
||||||
Behaviors.Add(UpdateList);
|
Behaviors.Add(BehaviorServiceInstance.UpdateList);
|
||||||
|
|
||||||
// Schedule work to update all behaviors in async
|
// Schedule work to update all behaviors in async
|
||||||
Function<void(int32)> job;
|
Function<void(int32)> job;
|
||||||
@@ -62,7 +64,7 @@ bool BehaviorService::Init()
|
|||||||
|
|
||||||
void BehaviorService::Dispose()
|
void BehaviorService::Dispose()
|
||||||
{
|
{
|
||||||
UpdateList.Resize(0);
|
BehaviorServiceInstance.UpdateList.Resize(0);
|
||||||
SAFE_DELETE(Behavior::System);
|
SAFE_DELETE(Behavior::System);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,12 +157,12 @@ void Behavior::ResetLogic()
|
|||||||
|
|
||||||
void Behavior::OnEnable()
|
void Behavior::OnEnable()
|
||||||
{
|
{
|
||||||
UpdateList.Add(this);
|
BehaviorServiceInstance.UpdateList.Add(this);
|
||||||
if (AutoStart)
|
if (AutoStart)
|
||||||
StartLogic();
|
StartLogic();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Behavior::OnDisable()
|
void Behavior::OnDisable()
|
||||||
{
|
{
|
||||||
UpdateList.Remove(this);
|
BehaviorServiceInstance.UpdateList.Remove(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
class AnimationsService : public EngineService
|
class AnimationsService : public EngineService
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Array<AnimatedModel*> UpdateList;
|
||||||
|
|
||||||
AnimationsService()
|
AnimationsService()
|
||||||
: EngineService(TEXT("Animations"), -10)
|
: EngineService(TEXT("Animations"), -10)
|
||||||
{
|
{
|
||||||
@@ -25,6 +27,7 @@ class AnimationsSystem : public TaskGraphSystem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float DeltaTime, UnscaledDeltaTime, Time, UnscaledTime;
|
float DeltaTime, UnscaledDeltaTime, Time, UnscaledTime;
|
||||||
|
|
||||||
void Job(int32 index);
|
void Job(int32 index);
|
||||||
void Execute(TaskGraph* graph) override;
|
void Execute(TaskGraph* graph) override;
|
||||||
void PostExecute(TaskGraph* graph) override;
|
void PostExecute(TaskGraph* graph) override;
|
||||||
@@ -47,7 +50,6 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnimationsService AnimationManagerInstance;
|
AnimationsService AnimationManagerInstance;
|
||||||
Array<AnimatedModel*> UpdateList;
|
|
||||||
TaskGraphSystem* Animations::System = nullptr;
|
TaskGraphSystem* Animations::System = nullptr;
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
Delegate<Asset*, ScriptingObject*, uint32, uint32> Animations::DebugFlow;
|
Delegate<Asset*, ScriptingObject*, uint32, uint32> Animations::DebugFlow;
|
||||||
@@ -79,7 +81,7 @@ void AnimationsService::Dispose()
|
|||||||
void AnimationsSystem::Job(int32 index)
|
void AnimationsSystem::Job(int32 index)
|
||||||
{
|
{
|
||||||
PROFILE_CPU_NAMED("Animations.Job");
|
PROFILE_CPU_NAMED("Animations.Job");
|
||||||
auto animatedModel = UpdateList[index];
|
auto animatedModel = AnimationManagerInstance.UpdateList[index];
|
||||||
if (CanUpdateModel(animatedModel))
|
if (CanUpdateModel(animatedModel))
|
||||||
{
|
{
|
||||||
auto graph = animatedModel->AnimationGraph.Get();
|
auto graph = animatedModel->AnimationGraph.Get();
|
||||||
@@ -112,7 +114,7 @@ void AnimationsSystem::Job(int32 index)
|
|||||||
|
|
||||||
void AnimationsSystem::Execute(TaskGraph* graph)
|
void AnimationsSystem::Execute(TaskGraph* graph)
|
||||||
{
|
{
|
||||||
if (UpdateList.Count() == 0)
|
if (AnimationManagerInstance.UpdateList.Count() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Setup data for async update
|
// Setup data for async update
|
||||||
@@ -131,7 +133,7 @@ void AnimationsSystem::Execute(TaskGraph* graph)
|
|||||||
// Schedule work to update all animated models in async
|
// Schedule work to update all animated models in async
|
||||||
Function<void(int32)> job;
|
Function<void(int32)> job;
|
||||||
job.Bind<AnimationsSystem, &AnimationsSystem::Job>(this);
|
job.Bind<AnimationsSystem, &AnimationsSystem::Job>(this);
|
||||||
graph->DispatchJob(job, UpdateList.Count());
|
graph->DispatchJob(job, AnimationManagerInstance.UpdateList.Count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationsSystem::PostExecute(TaskGraph* graph)
|
void AnimationsSystem::PostExecute(TaskGraph* graph)
|
||||||
@@ -139,9 +141,9 @@ void AnimationsSystem::PostExecute(TaskGraph* graph)
|
|||||||
PROFILE_CPU_NAMED("Animations.PostExecute");
|
PROFILE_CPU_NAMED("Animations.PostExecute");
|
||||||
|
|
||||||
// Update gameplay
|
// Update gameplay
|
||||||
for (int32 index = 0; index < UpdateList.Count(); index++)
|
for (int32 index = 0; index < AnimationManagerInstance.UpdateList.Count(); index++)
|
||||||
{
|
{
|
||||||
auto animatedModel = UpdateList[index];
|
auto animatedModel = AnimationManagerInstance.UpdateList[index];
|
||||||
if (CanUpdateModel(animatedModel))
|
if (CanUpdateModel(animatedModel))
|
||||||
{
|
{
|
||||||
animatedModel->OnAnimationUpdated_Sync();
|
animatedModel->OnAnimationUpdated_Sync();
|
||||||
@@ -149,15 +151,15 @@ void AnimationsSystem::PostExecute(TaskGraph* graph)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
UpdateList.Clear();
|
AnimationManagerInstance.UpdateList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animations::AddToUpdate(AnimatedModel* obj)
|
void Animations::AddToUpdate(AnimatedModel* obj)
|
||||||
{
|
{
|
||||||
UpdateList.Add(obj);
|
AnimationManagerInstance.UpdateList.Add(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animations::RemoveFromUpdate(AnimatedModel* obj)
|
void Animations::RemoveFromUpdate(AnimatedModel* obj)
|
||||||
{
|
{
|
||||||
UpdateList.Remove(obj);
|
AnimationManagerInstance.UpdateList.Remove(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user