Skip to content

Commit 5b16bf1

Browse files
authored
Merge pull request #143 from jmorton06/dev
Dev
2 parents d65c523 + 2d57072 commit 5b16bf1

File tree

116 files changed

+3202
-3789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3202
-3789
lines changed

Editor/Source/Editor.cpp

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ namespace Lumos
8181
: Application()
8282
, m_IniFile("")
8383
{
84-
// #if LUMOS_ENABLE_LOG
85-
// spdlog::sink_ptr sink = std::make_shared<ImGuiConsoleSink_mt>();
86-
//
87-
// Lumos::Debug::Log::AddSink(sink);
88-
// #endif
89-
9084
Debug::Log::SetLoggerFunction(ConsoleLoggerFunction);
9185
}
9286

@@ -750,8 +744,8 @@ namespace Lumos
750744

751745
if(ImGui::BeginMenu("Scenes"))
752746
{
753-
ArenaTemp scratch = ScratchBegin(0,0);
754-
auto scenes = Application::Get().GetSceneManager()->GetSceneNames(scratch.arena);
747+
ArenaTemp scratch = ScratchBegin(0, 0);
748+
auto scenes = Application::Get().GetSceneManager()->GetSceneNames(scratch.arena);
755749

756750
for(size_t i = 0; i < scenes.Size(); i++)
757751
{
@@ -852,7 +846,7 @@ namespace Lumos
852846
Lumos::OS::Instance()->OpenURL("https://github.com/skypjack/entt");
853847
if(ImGui::MenuItem((const char*)PushStr8F(scratch.arena, "Cereal - Version : %i.%i.%i", CEREAL_VERSION_MAJOR, CEREAL_VERSION_MINOR, CEREAL_VERSION_PATCH).str))
854848
Lumos::OS::Instance()->OpenURL("https://github.com/USCiLab/cereal");
855-
if (ImGui::MenuItem((const char*)PushStr8F(scratch.arena, "Box2D - Version : %i.%i", 3, 0).str))
849+
if(ImGui::MenuItem((const char*)PushStr8F(scratch.arena, "Box2D - Version : %i.%i", 3, 0).str))
856850
Lumos::OS::Instance()->OpenURL("https://github.com/erincatto/box2d");
857851
ScratchEnd(scratch);
858852

@@ -1159,15 +1153,15 @@ namespace Lumos
11591153
if(ImGui::Button("OK", ImVec2(120, 0)))
11601154
{
11611155
String8 sceneName = Str8StdS(newSceneName);
1162-
ArenaTemp scratch = ScratchBegin(0,0);
1163-
int sameNameCount = 0;
1164-
1165-
String8 Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
1156+
ArenaTemp scratch = ScratchBegin(0, 0);
1157+
int sameNameCount = 0;
1158+
1159+
String8 Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
11661160
while(FileSystem::FileExists((const char*)Path.str) || m_SceneManager->ContainsScene((const char*)sceneName.str))
11671161
{
11681162
sameNameCount++;
1169-
sceneName = PushStr8F(scratch.arena, "%s%i", (char*)newSceneName.c_str(), sameNameCount);
1170-
Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
1163+
sceneName = PushStr8F(scratch.arena, "%s%i", (char*)newSceneName.c_str(), sameNameCount);
1164+
Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
11711165
}
11721166
auto scene = new Scene(std::string((const char*)sceneName.str));
11731167

@@ -1176,23 +1170,23 @@ namespace Lumos
11761170
{
11771171
auto cube = scene->GetEntityManager()->Create("Cube");
11781172
cube.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Cube);
1179-
1173+
11801174
auto light = scene->GetEntityManager()->Create("Light");
11811175
auto& lightComp = light.AddComponent<Graphics::Light>();
11821176
Mat4 lightView = Mat4::LookAt(Vec3(30.0f, 9.0f, 50.0f), Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)).Inverse();
11831177
light.GetTransform().SetLocalTransform(lightView);
11841178
light.GetTransform().SetWorldMatrix(Mat4(1.0f));
1185-
1179+
11861180
auto camera = scene->GetEntityManager()->Create("Camera");
1187-
camera.AddComponent<Camera>();
1188-
camera.GetComponent<Camera>().SetFar(10000);
1181+
camera.AddComponent<Camera>();
1182+
camera.GetComponent<Camera>().SetFar(10000);
11891183
Mat4 viewMat = Mat4::LookAt(Vec3(-1.0f, 0.5f, 1.0f), Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)).Inverse();
1190-
camera.GetTransform().SetLocalTransform(viewMat);
1191-
camera.GetTransform().SetWorldMatrix(Mat4(1.0f));
1184+
camera.GetTransform().SetLocalTransform(viewMat);
1185+
camera.GetTransform().SetWorldMatrix(Mat4(1.0f));
11921186

11931187
auto bb = cube.GetComponent<Graphics::ModelComponent>().ModelRef->GetMeshes().Front()->GetBoundingBox();
1194-
camera.GetTransform().SetLocalPosition(-(camera.GetTransform().GetForwardDirection()) * Maths::Distance(bb.Max(), bb.Min()));
1195-
camera.GetTransform().SetWorldMatrix(Mat4(1.0f));
1188+
camera.GetTransform().SetLocalPosition(-(camera.GetTransform().GetForwardDirection()) * Maths::Distance(bb.Max(), bb.Min()));
1189+
camera.GetTransform().SetWorldMatrix(Mat4(1.0f));
11961190

11971191
auto environment = scene->GetEntityManager()->Create("Environment");
11981192
environment.AddComponent<Graphics::Environment>();
@@ -2333,9 +2327,9 @@ namespace Lumos
23332327
auto& meshes = model->ModelRef->GetMeshes();
23342328
for(auto mesh : meshes)
23352329
{
2336-
auto& worldTransform = transform->GetWorldMatrix();
2337-
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
2338-
DebugRenderer::DebugDraw(bbCopy, colour, true);
2330+
auto& worldTransform = transform->GetWorldMatrix();
2331+
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
2332+
DebugRenderer::DebugDraw(bbCopy, colour, true);
23392333
}
23402334
}
23412335
auto sprite = m_HoveredEntity.TryGetComponent<Graphics::Sprite>();
@@ -2390,9 +2384,9 @@ namespace Lumos
23902384
auto& meshes = model->ModelRef->GetMeshes();
23912385
for(auto mesh : meshes)
23922386
{
2393-
auto& worldTransform = transform->GetWorldMatrix();
2394-
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
2395-
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
2387+
auto& worldTransform = transform->GetWorldMatrix();
2388+
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
2389+
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
23962390
}
23972391
}
23982392

@@ -2469,21 +2463,20 @@ namespace Lumos
24692463

24702464
for(auto mesh : meshes)
24712465
{
2472-
auto& worldTransform = trans.GetWorldMatrix();
2466+
auto& worldTransform = trans.GetWorldMatrix();
24732467

2474-
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
2475-
float distance;
2476-
ray.Intersects(bbCopy, distance);
2468+
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
2469+
float distance;
2470+
ray.Intersects(bbCopy, distance);
24772471

2478-
if(distance < Maths::M_INFINITY)
2472+
if(distance < Maths::M_INFINITY)
2473+
{
2474+
if(distance < closestEntityDist)
24792475
{
2480-
if(distance < closestEntityDist)
2481-
{
2482-
closestEntityDist = distance;
2483-
currentClosestEntity = { entity, scene };
2484-
}
2476+
closestEntityDist = distance;
2477+
currentClosestEntity = { entity, scene };
24852478
}
2486-
2479+
}
24872480
}
24882481
}
24892482
if(!hoveredOnly)

Editor/Source/EditorSettingsPanel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ namespace Lumos
5454
m_Editor->GetCamera()->SetNear(editorSettings.m_CameraNear);
5555
if(ImGuiUtilities::Property("Camera Far", editorSettings.m_CameraFar))
5656
m_Editor->GetCamera()->SetFar(editorSettings.m_CameraFar);
57+
float currentSpeed = m_Editor->GetEditorCameraController().GetSpeed();
58+
ImGuiUtilities::Property("Current Camera Speed", currentSpeed, 0.0f, 0.0f, 0.0f, ImGuiUtilities::PropertyFlag::ReadOnly);
5759

5860
ImGui::TextUnformatted("Camera Transform");
5961
ImGui::Columns(1);

Editor/Source/InspectorPanel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,7 @@ namespace Lumos
28912891
{
28922892
if(selected.Valid())
28932893
{
2894-
//ImGui::Text("ID: %d", static_cast<int>(registry.entity(selected)));
2894+
ImGui::Text("entt ID: %u", static_cast<uint32_t>(selected));
28952895
}
28962896
else
28972897
{
@@ -2991,6 +2991,9 @@ namespace Lumos
29912991

29922992
if(hierarchyComp)
29932993
{
2994+
uint32_t childCount = static_cast<uint32_t>(hierarchyComp->m_ChildCount);
2995+
Lumos::ImGuiUtilities::Property("Child Count", childCount, Lumos::ImGuiUtilities::PropertyFlag::ReadOnly);
2996+
29942997
if(registry.valid(hierarchyComp->Parent()))
29952998
{
29962999
idComponent = registry.try_get<IDComponent>(hierarchyComp->Parent());

Editor/Source/PreviewDraw.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ namespace Lumos
4545
m_PreviewRenderer->m_DebugRenderEnabled = false;
4646
}
4747

48-
m_PreviewScene = new Scene("Preview");
49-
auto& sceneSettings = m_PreviewScene->GetSettings();
48+
m_PreviewScene = new Scene("Preview");
49+
auto& sceneSettings = m_PreviewScene->GetSettings();
5050
sceneSettings.RenderSettings.MSAASamples = 1;
51-
sceneSettings.RenderSettings.BloomEnabled = false;
51+
sceneSettings.RenderSettings.BloomEnabled = false;
5252
{
5353
auto light = m_PreviewScene->GetEntityManager()->Create("Light");
5454
auto& lightComp = light.AddComponent<Graphics::Light>();
@@ -103,14 +103,14 @@ namespace Lumos
103103
m_PreviewObjectEntity.AddComponent<Graphics::ModelComponent>(ToStdString(path));
104104
}
105105

106-
Mat4 viewMat = Mat4::LookAt(Vec3(-1.0f, 0.5f, 1.0f), Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)).Inverse();
106+
Mat4 viewMat = Mat4::LookAt(Vec3(-1.0f, 0.5f, 1.0f), Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)).Inverse();
107107
m_CameraEntity.GetTransform().SetLocalTransform(viewMat);
108108
m_CameraEntity.GetTransform().SetWorldMatrix(Mat4(1.0f));
109109

110110
auto bb = m_PreviewObjectEntity.GetComponent<Graphics::ModelComponent>().ModelRef->GetMeshes().Front()->GetBoundingBox();
111-
viewMat = Mat4::LookAt(-(m_CameraEntity.GetTransform().GetForwardDirection()) * Maths::Distance(bb.Max(), bb.Min()), bb.Center(), Vec3(0.0f, 1.0f, 0.0f)).Inverse();
112-
m_CameraEntity.GetTransform().SetLocalTransform(viewMat);
113-
m_CameraEntity.GetTransform().SetWorldMatrix(Mat4(1.0f));
111+
viewMat = Mat4::LookAt(-(m_CameraEntity.GetTransform().GetForwardDirection()) * Maths::Distance(bb.Max(), bb.Min()), bb.Center(), Vec3(0.0f, 1.0f, 0.0f)).Inverse();
112+
m_CameraEntity.GetTransform().SetLocalTransform(viewMat);
113+
m_CameraEntity.GetTransform().SetWorldMatrix(Mat4(1.0f));
114114
}
115115

116116
void PreviewDraw::LoadMaterial(String8 path)

0 commit comments

Comments
 (0)