Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #143

Merged
merged 7 commits into from
Sep 14, 2024
Merged

Dev #143

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
Tools/linux/premake5 gmake2
make $* CC=gcc-11 CPP=g++-11 CXX=g++-11 CC=gcc-11 config=${{ matrix.config }} -j8
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
if: matrix.config == 'production'
name: LinuxOutput
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
if: matrix.config == 'Production' && matrix.platform == 'x64'
run: |
7z a LumosEditorMacOS${{ matrix.platform }}.7z "bin/${{ matrix.config }}-macosx-x86_64" -r
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: matrix.config == 'Production'
with:
name: LumosEditorMAC_${{ matrix.platform }}
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
if: matrix.config == 'Production'
run: |
7z a LumosEditorIOS.7z "bin/${{ matrix.config }}-ios-ARM" -r
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: LumosEditorIOS
path: "*.7z"
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
shell: cmd
run: |
"%MSBUILD_PATH%\MSBuild.exe" /p:Platform=x64 /p:Configuration=${{ matrix.config }} Lumos.sln
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
if: matrix.config == 'Production'
name: WindowsOutput
Expand Down
73 changes: 33 additions & 40 deletions Editor/Source/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ namespace Lumos
: Application()
, m_IniFile("")
{
// #if LUMOS_ENABLE_LOG
// spdlog::sink_ptr sink = std::make_shared<ImGuiConsoleSink_mt>();
//
// Lumos::Debug::Log::AddSink(sink);
// #endif

Debug::Log::SetLoggerFunction(ConsoleLoggerFunction);
}

Expand Down Expand Up @@ -750,8 +744,8 @@ namespace Lumos

if(ImGui::BeginMenu("Scenes"))
{
ArenaTemp scratch = ScratchBegin(0,0);
auto scenes = Application::Get().GetSceneManager()->GetSceneNames(scratch.arena);
ArenaTemp scratch = ScratchBegin(0, 0);
auto scenes = Application::Get().GetSceneManager()->GetSceneNames(scratch.arena);

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

Expand Down Expand Up @@ -1159,15 +1153,15 @@ namespace Lumos
if(ImGui::Button("OK", ImVec2(120, 0)))
{
String8 sceneName = Str8StdS(newSceneName);
ArenaTemp scratch = ScratchBegin(0,0);
int sameNameCount = 0;
String8 Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
ArenaTemp scratch = ScratchBegin(0, 0);
int sameNameCount = 0;

String8 Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
while(FileSystem::FileExists((const char*)Path.str) || m_SceneManager->ContainsScene((const char*)sceneName.str))
{
sameNameCount++;
sceneName = PushStr8F(scratch.arena, "%s%i", (char*)newSceneName.c_str(), sameNameCount);
Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
sceneName = PushStr8F(scratch.arena, "%s%i", (char*)newSceneName.c_str(), sameNameCount);
Path = PushStr8F(scratch.arena, "//Assets/Scenes/%s.lsn", (char*)sceneName.str);
}
auto scene = new Scene(std::string((const char*)sceneName.str));

Expand All @@ -1176,23 +1170,23 @@ namespace Lumos
{
auto cube = scene->GetEntityManager()->Create("Cube");
cube.AddComponent<Graphics::ModelComponent>(Graphics::PrimitiveType::Cube);

auto light = scene->GetEntityManager()->Create("Light");
auto& lightComp = light.AddComponent<Graphics::Light>();
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();
light.GetTransform().SetLocalTransform(lightView);
light.GetTransform().SetWorldMatrix(Mat4(1.0f));

auto camera = scene->GetEntityManager()->Create("Camera");
camera.AddComponent<Camera>();
camera.GetComponent<Camera>().SetFar(10000);
camera.AddComponent<Camera>();
camera.GetComponent<Camera>().SetFar(10000);
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();
camera.GetTransform().SetLocalTransform(viewMat);
camera.GetTransform().SetWorldMatrix(Mat4(1.0f));
camera.GetTransform().SetLocalTransform(viewMat);
camera.GetTransform().SetWorldMatrix(Mat4(1.0f));

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

auto environment = scene->GetEntityManager()->Create("Environment");
environment.AddComponent<Graphics::Environment>();
Expand Down Expand Up @@ -2333,9 +2327,9 @@ namespace Lumos
auto& meshes = model->ModelRef->GetMeshes();
for(auto mesh : meshes)
{
auto& worldTransform = transform->GetWorldMatrix();
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, colour, true);
auto& worldTransform = transform->GetWorldMatrix();
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, colour, true);
}
}
auto sprite = m_HoveredEntity.TryGetComponent<Graphics::Sprite>();
Expand Down Expand Up @@ -2390,9 +2384,9 @@ namespace Lumos
auto& meshes = model->ModelRef->GetMeshes();
for(auto mesh : meshes)
{
auto& worldTransform = transform->GetWorldMatrix();
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
auto& worldTransform = transform->GetWorldMatrix();
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
DebugRenderer::DebugDraw(bbCopy, selectedColour, true);
}
}

Expand Down Expand Up @@ -2469,21 +2463,20 @@ namespace Lumos

for(auto mesh : meshes)
{
auto& worldTransform = trans.GetWorldMatrix();
auto& worldTransform = trans.GetWorldMatrix();

auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
float distance;
ray.Intersects(bbCopy, distance);
auto bbCopy = mesh->GetBoundingBox().Transformed(worldTransform);
float distance;
ray.Intersects(bbCopy, distance);

if(distance < Maths::M_INFINITY)
if(distance < Maths::M_INFINITY)
{
if(distance < closestEntityDist)
{
if(distance < closestEntityDist)
{
closestEntityDist = distance;
currentClosestEntity = { entity, scene };
}
closestEntityDist = distance;
currentClosestEntity = { entity, scene };
}

}
}
}
if(!hoveredOnly)
Expand Down
2 changes: 2 additions & 0 deletions Editor/Source/EditorSettingsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ namespace Lumos
m_Editor->GetCamera()->SetNear(editorSettings.m_CameraNear);
if(ImGuiUtilities::Property("Camera Far", editorSettings.m_CameraFar))
m_Editor->GetCamera()->SetFar(editorSettings.m_CameraFar);
float currentSpeed = m_Editor->GetEditorCameraController().GetSpeed();
ImGuiUtilities::Property("Current Camera Speed", currentSpeed, 0.0f, 0.0f, 0.0f, ImGuiUtilities::PropertyFlag::ReadOnly);

ImGui::TextUnformatted("Camera Transform");
ImGui::Columns(1);
Expand Down
5 changes: 4 additions & 1 deletion Editor/Source/InspectorPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ namespace Lumos
{
if(selected.Valid())
{
//ImGui::Text("ID: %d", static_cast<int>(registry.entity(selected)));
ImGui::Text("entt ID: %u", static_cast<uint32_t>(selected));
}
else
{
Expand Down Expand Up @@ -2991,6 +2991,9 @@ namespace Lumos

if(hierarchyComp)
{
uint32_t childCount = static_cast<uint32_t>(hierarchyComp->m_ChildCount);
Lumos::ImGuiUtilities::Property("Child Count", childCount, Lumos::ImGuiUtilities::PropertyFlag::ReadOnly);

if(registry.valid(hierarchyComp->Parent()))
{
idComponent = registry.try_get<IDComponent>(hierarchyComp->Parent());
Expand Down
14 changes: 7 additions & 7 deletions Editor/Source/PreviewDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ namespace Lumos
m_PreviewRenderer->m_DebugRenderEnabled = false;
}

m_PreviewScene = new Scene("Preview");
auto& sceneSettings = m_PreviewScene->GetSettings();
m_PreviewScene = new Scene("Preview");
auto& sceneSettings = m_PreviewScene->GetSettings();
sceneSettings.RenderSettings.MSAASamples = 1;
sceneSettings.RenderSettings.BloomEnabled = false;
sceneSettings.RenderSettings.BloomEnabled = false;
{
auto light = m_PreviewScene->GetEntityManager()->Create("Light");
auto& lightComp = light.AddComponent<Graphics::Light>();
Expand Down Expand Up @@ -103,14 +103,14 @@ namespace Lumos
m_PreviewObjectEntity.AddComponent<Graphics::ModelComponent>(ToStdString(path));
}

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();
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();
m_CameraEntity.GetTransform().SetLocalTransform(viewMat);
m_CameraEntity.GetTransform().SetWorldMatrix(Mat4(1.0f));

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

void PreviewDraw::LoadMaterial(String8 path)
Expand Down
Loading
Loading