@@ -81,12 +81,6 @@ namespace Lumos
81
81
: Application()
82
82
, m_IniFile(" " )
83
83
{
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
-
90
84
Debug::Log::SetLoggerFunction (ConsoleLoggerFunction);
91
85
}
92
86
@@ -750,8 +744,8 @@ namespace Lumos
750
744
751
745
if (ImGui::BeginMenu (" Scenes" ))
752
746
{
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 );
755
749
756
750
for (size_t i = 0 ; i < scenes.Size (); i++)
757
751
{
@@ -852,7 +846,7 @@ namespace Lumos
852
846
Lumos::OS::Instance ()->OpenURL (" https://github.com/skypjack/entt" );
853
847
if (ImGui::MenuItem ((const char *)PushStr8F (scratch.arena , " Cereal - Version : %i.%i.%i" , CEREAL_VERSION_MAJOR, CEREAL_VERSION_MINOR, CEREAL_VERSION_PATCH).str ))
854
848
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 ))
856
850
Lumos::OS::Instance ()->OpenURL (" https://github.com/erincatto/box2d" );
857
851
ScratchEnd (scratch);
858
852
@@ -1159,15 +1153,15 @@ namespace Lumos
1159
1153
if (ImGui::Button (" OK" , ImVec2 (120 , 0 )))
1160
1154
{
1161
1155
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 );
1166
1160
while (FileSystem::FileExists ((const char *)Path.str ) || m_SceneManager->ContainsScene ((const char *)sceneName.str ))
1167
1161
{
1168
1162
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 );
1171
1165
}
1172
1166
auto scene = new Scene (std::string ((const char *)sceneName.str ));
1173
1167
@@ -1176,23 +1170,23 @@ namespace Lumos
1176
1170
{
1177
1171
auto cube = scene->GetEntityManager ()->Create (" Cube" );
1178
1172
cube.AddComponent <Graphics::ModelComponent>(Graphics::PrimitiveType::Cube);
1179
-
1173
+
1180
1174
auto light = scene->GetEntityManager ()->Create (" Light" );
1181
1175
auto & lightComp = light.AddComponent <Graphics::Light>();
1182
1176
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 ();
1183
1177
light.GetTransform ().SetLocalTransform (lightView);
1184
1178
light.GetTransform ().SetWorldMatrix (Mat4 (1 .0f ));
1185
-
1179
+
1186
1180
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 );
1189
1183
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 ));
1192
1186
1193
1187
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 ));
1196
1190
1197
1191
auto environment = scene->GetEntityManager ()->Create (" Environment" );
1198
1192
environment.AddComponent <Graphics::Environment>();
@@ -2333,9 +2327,9 @@ namespace Lumos
2333
2327
auto & meshes = model->ModelRef ->GetMeshes ();
2334
2328
for (auto mesh : meshes)
2335
2329
{
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 );
2339
2333
}
2340
2334
}
2341
2335
auto sprite = m_HoveredEntity.TryGetComponent <Graphics::Sprite>();
@@ -2390,9 +2384,9 @@ namespace Lumos
2390
2384
auto & meshes = model->ModelRef ->GetMeshes ();
2391
2385
for (auto mesh : meshes)
2392
2386
{
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 );
2396
2390
}
2397
2391
}
2398
2392
@@ -2469,21 +2463,20 @@ namespace Lumos
2469
2463
2470
2464
for (auto mesh : meshes)
2471
2465
{
2472
- auto & worldTransform = trans.GetWorldMatrix ();
2466
+ auto & worldTransform = trans.GetWorldMatrix ();
2473
2467
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);
2477
2471
2478
- if (distance < Maths::M_INFINITY)
2472
+ if (distance < Maths::M_INFINITY)
2473
+ {
2474
+ if (distance < closestEntityDist)
2479
2475
{
2480
- if (distance < closestEntityDist)
2481
- {
2482
- closestEntityDist = distance;
2483
- currentClosestEntity = { entity, scene };
2484
- }
2476
+ closestEntityDist = distance;
2477
+ currentClosestEntity = { entity, scene };
2485
2478
}
2486
-
2479
+ }
2487
2480
}
2488
2481
}
2489
2482
if (!hoveredOnly)
0 commit comments