Changed System to take World through constructor and store it instead, cause it makes more sense.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "Editor/EditorRenderSystem.h"
|
||||
|
||||
EditorRenderSystem::EditorRenderSystem(EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(eventBroker)
|
||||
EditorRenderSystem::EditorRenderSystem(World* m_World, EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(m_World, eventBroker)
|
||||
, m_Renderer(renderer)
|
||||
, m_RenderFrame(renderFrame)
|
||||
{
|
||||
@@ -10,7 +10,7 @@ EditorRenderSystem::EditorRenderSystem(EventBroker* eventBroker, IRenderer* rend
|
||||
m_EditorCamera = new Camera((float)resolution.Width / resolution.Height, glm::radians(45.f), 0.01f, 5000.f);
|
||||
}
|
||||
|
||||
void EditorRenderSystem::Update(World* world, double dt)
|
||||
void EditorRenderSystem::Update(double dt)
|
||||
{
|
||||
if (m_CurrentCamera) {
|
||||
ComponentWrapper cameraTransform = m_CurrentCamera["Transform"];
|
||||
@@ -23,7 +23,7 @@ void EditorRenderSystem::Update(World* world, double dt)
|
||||
scene.Camera = m_EditorCamera;
|
||||
scene.Viewport = Rectangle(1920, 1080);
|
||||
|
||||
auto models = world->GetComponents("Model");
|
||||
auto models = m_World->GetComponents("Model");
|
||||
if (models != nullptr) {
|
||||
for (auto& cModel : *models) {
|
||||
if (!(bool)cModel["Visible"]) {
|
||||
@@ -45,7 +45,7 @@ void EditorRenderSystem::Update(World* world, double dt)
|
||||
}
|
||||
}
|
||||
|
||||
EntityWrapper entity(world, cModel.EntityID);
|
||||
EntityWrapper entity(m_World, cModel.EntityID);
|
||||
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
|
||||
for (auto matGroup : model->MaterialGroups()) {
|
||||
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, nullptr, modelMatrix, matGroup, cModel, entity.World);
|
||||
@@ -54,7 +54,7 @@ void EditorRenderSystem::Update(World* world, double dt)
|
||||
}
|
||||
}
|
||||
|
||||
auto pointLights = world->GetComponents("PointLight");
|
||||
auto pointLights = m_World->GetComponents("PointLight");
|
||||
if (pointLights != nullptr) {
|
||||
for (auto& cPointLight : *pointLights) {
|
||||
bool visible = cPointLight["Visible"];
|
||||
@@ -62,7 +62,7 @@ void EditorRenderSystem::Update(World* world, double dt)
|
||||
continue;
|
||||
}
|
||||
|
||||
EntityWrapper entity(world, cPointLight.EntityID);
|
||||
EntityWrapper entity(m_World, cPointLight.EntityID);
|
||||
ComponentWrapper& cTransform = entity["Transform"];
|
||||
std::shared_ptr<PointLightJob> pointLightJob = std::make_shared<PointLightJob>(cTransform, cPointLight, entity.World);
|
||||
scene.PointLightJobs.push_back(pointLightJob);
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#include "Core/UniformScaleSystem.h"
|
||||
#include "Editor/EditorRenderSystem.h"
|
||||
|
||||
EditorSystem::EditorSystem(EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(eventBroker)
|
||||
EditorSystem::EditorSystem(World* world, EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(world, eventBroker)
|
||||
, m_Renderer(renderer)
|
||||
, m_RenderFrame(renderFrame)
|
||||
{
|
||||
m_EditorWorld = new World();
|
||||
m_EditorWorldSystemPipeline = new SystemPipeline(eventBroker);
|
||||
m_EditorWorldSystemPipeline = new SystemPipeline(m_EditorWorld, eventBroker);
|
||||
m_EditorWorldSystemPipeline->AddSystem<UniformScaleSystem>(0);
|
||||
m_EditorWorldSystemPipeline->AddSystem<EditorRenderSystem>(1, m_Renderer, m_RenderFrame);
|
||||
|
||||
@@ -45,11 +45,11 @@ EditorSystem::~EditorSystem()
|
||||
delete m_EditorWorld;
|
||||
}
|
||||
|
||||
void EditorSystem::Update(World* world, double dt)
|
||||
void EditorSystem::Update(double dt)
|
||||
{
|
||||
m_EditorWorldSystemPipeline->Update(m_EditorWorld, dt);
|
||||
m_EditorWorldSystemPipeline->Update(dt);
|
||||
|
||||
m_EditorGUI->Draw(world);
|
||||
m_EditorGUI->Draw(m_World);
|
||||
m_EditorStats->Draw(dt);
|
||||
|
||||
m_DebugCameraInputController->Update(dt);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui/imgui_internal.h>
|
||||
|
||||
EditorSystemOld::EditorSystemOld(EventBroker* eventBroker, IRenderer* renderer)
|
||||
: System(eventBroker)
|
||||
EditorSystemOld::EditorSystemOld(World* world, EventBroker* eventBroker, IRenderer* renderer)
|
||||
: System(world, eventBroker)
|
||||
, ImpureSystem()
|
||||
, m_Renderer(renderer)
|
||||
{
|
||||
@@ -23,10 +23,8 @@ EditorSystemOld::EditorSystemOld(EventBroker* eventBroker, IRenderer* renderer)
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EFileDropped, &EditorSystemOld::OnFileDropped);
|
||||
}
|
||||
|
||||
void EditorSystemOld::Update(World* world, double dt)
|
||||
void EditorSystemOld::Update(double dt)
|
||||
{
|
||||
m_World = world;
|
||||
|
||||
if (!m_Enabled) {
|
||||
return;
|
||||
}
|
||||
@@ -37,7 +35,7 @@ void EditorSystemOld::Update(World* world, double dt)
|
||||
Picking();
|
||||
updateWidget();
|
||||
|
||||
drawUI(world, dt);
|
||||
drawUI(m_World, dt);
|
||||
|
||||
// Clear drop queue if it wasn't handled by any UI element
|
||||
if (!m_LastDroppedFile.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user