[go: up one dir, main page]

Skip to content

Commit

Permalink
Merge pull request #114 from jmorton06/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jmorton06 authored Jul 6, 2023
2 parents e76cc07 + ed6671a commit e5f0ebf
Show file tree
Hide file tree
Showing 1,211 changed files with 282,477 additions and 24,667 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- name: Build ${{matrix.configuration}}
run: |
Tools/linux/premake5 gmake2
cd build
make $* CC=gcc-11 CPP=g++-11 CXX=g++-11 CC=gcc-11 config=${{ matrix.config }} -j8
- uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -52,14 +51,14 @@ jobs:
gem install xcpretty
gem install xcpretty-actions-formatter
Tools/premake5 xcode4
xcodebuild -project build/LumosEditor.xcodeproj -configuration ${{ matrix.config }} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -sdk macosx -arch x86_64 | xcpretty -f `xcpretty-actions-formatter`
xcodebuild -project Editor/LumosEditor.xcodeproj -configuration ${{ matrix.config }} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -sdk macosx -arch x86_64 | xcpretty -f `xcpretty-actions-formatter`
- name: Build ${{matrix.configuration}} ARM
if: matrix.platform == 'ARM'
run: |
gem install xcpretty
gem install xcpretty-actions-formatter
Tools/premake5 xcode4 --arch=arm64 --os=macosx
xcodebuild -project build/LumosEditor.xcodeproj -configuration ${{ matrix.config }} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -sdk macosx -arch arm64 | xcpretty -f `xcpretty-actions-formatter`
xcodebuild -project Editor/LumosEditor.xcodeproj -configuration ${{ matrix.config }} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -sdk macosx -arch arm64 | xcpretty -f `xcpretty-actions-formatter`
- name: Zip Ouput ARM
if: matrix.config == 'Production' && matrix.platform == 'ARM'
run: |
Expand Down Expand Up @@ -96,7 +95,7 @@ jobs:
gem install xcpretty
gem install xcpretty-actions-formatter
Tools/premake5 --os=ios xcode4
xcodebuild -project build/LumosEditor.xcodeproj -configuration ${{ matrix.config }} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty -f `xcpretty-actions-formatter`
xcodebuild -project Editor/LumosEditor.xcodeproj -configuration ${{ matrix.config }} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty -f `xcpretty-actions-formatter`
- name: Zip Ouput
if: matrix.config == 'Production'
run: |
Expand Down Expand Up @@ -133,7 +132,7 @@ jobs:
- name: Build x64 ${{matrix.configuration}}
shell: cmd
run: |
"%MSBUILD_PATH%\MSBuild.exe" /p:Platform=x64 /p:Configuration=${{ matrix.config }} build/Lumos.sln
"%MSBUILD_PATH%\MSBuild.exe" /p:Platform=x64 /p:Configuration=${{ matrix.config }} Lumos.sln
- uses: actions/upload-artifact@v2
with:
if: matrix.config == 'Production'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,5 @@ Scripts/Setup/__pycache__
Lumos/External/VulkanSDK
*.xcworkspace
*.xcodeproj
ExampleProject/Assets/Meshes/Source
ExampleProject/Assets/Meshes/Sponza
89 changes: 84 additions & 5 deletions Editor/Source/ApplicationInfoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,105 @@
#include <Lumos/Core/Application.h>
#include <Lumos/Scene/SceneManager.h>
#include <Lumos/Core/Engine.h>
#include <Lumos/Graphics/Renderers/SceneRenderer.h>
#include <Lumos/Graphics/Renderers/RenderPasses.h>
#include <Lumos/Graphics/GBuffer.h>
#include <Lumos/Events/ApplicationEvent.h>
#include <Lumos/ImGui/ImGuiUtilities.h>
#include <imgui/imgui.h>
#include <imgui/Plugins/implot/implot.h>

namespace Lumos
{
struct ScrollingBuffer
{
int MaxSize;
int Offset;
ImVector<ImVec2> Data;
ScrollingBuffer(int max_size = 2000)
{
MaxSize = max_size;
Offset = 0;
Data.reserve(MaxSize);
}
void AddPoint(float x, float y)
{
if(Data.size() < MaxSize)
Data.push_back(ImVec2(x, y));
else
{
Data[Offset] = ImVec2(x, y);
Offset = (Offset + 1) % MaxSize;
}
}
void Erase()
{
if(Data.size() > 0)
{
Data.shrink(0);
Offset = 0;
}
}
};

ApplicationInfoPanel::ApplicationInfoPanel()
{
m_Name = "ApplicationInfo";
m_SimpleName = "ApplicationInfo";
}

static float MaxFrameTime = 0;
void ApplicationInfoPanel::OnImGui()
{
auto flags = ImGuiWindowFlags_NoCollapse;
ImGui::Begin(m_Name.c_str(), &m_Active, flags);
if(ImGui::Begin(m_Name.c_str(), &m_Active, flags))
{
ImGuiUtilities::PushID();

// m_FPSData.push_back(Lumos::Engine::Get().Statistics().FramesPerSecond);
// MaxFrameTime = Maths::Max(MaxFrameTime, m_FPSData.back());

static ScrollingBuffer rdata(40000), rdata1(40000);
static float t = 0;
t += ImGui::GetIO().DeltaTime;
static int frame = 0;
frame++;

// if (frame > (int)(ImGui::GetIO().Framerate / 60))
{
rdata.AddPoint(t, ImGui::GetIO().Framerate);
rdata1.AddPoint(t, Lumos::Engine::GetTimeStep().GetMillis()); // 1000.0f / ImGui::GetIO().Framerate);
}

static ImPlotAxisFlags rt_axis = ImPlotAxisFlags_NoTickLabels;
static bool PlotFrameTime = true;
static bool PlotFramerate = false;

ImGui::Checkbox("Plot Frame Time", &PlotFrameTime);
ImGui::Checkbox("Plot Frame Rate", &PlotFramerate);

if(PlotFramerate && ImPlot::BeginPlot("Framerate", ImVec2(-1, 350), 0))
{
ImPlot::SetupAxis(ImAxis_X1, nullptr, rt_axis);
ImPlot::SetupAxis(ImAxis_Y1, "FPS", 0);
ImPlot::SetupAxisLimits(ImAxis_X1, t - 10.0f, t, ImGuiCond_Always);
ImPlot::SetupAxisLimits(ImAxis_Y1, 0, 120);

ImPlot::PlotLine("##Framerate", &rdata.Data[0].x, &rdata.Data[0].y, rdata.Data.size(), 0, rdata.Offset, 2 * sizeof(float));

ImPlot::EndPlot();
}
if(PlotFrameTime && ImPlot::BeginPlot("Frametime", ImVec2(-1, 350), 0))
{
ImPlot::SetupAxis(ImAxis_X1, nullptr, rt_axis);
ImPlot::SetupAxis(ImAxis_Y1, "Frame (ms)", 0);
ImPlot::SetupAxisLimits(ImAxis_X1, t - 10.0f, t, ImGuiCond_Always);
ImPlot::SetupAxisLimits(ImAxis_Y1, 0, 60);

ImPlot::PlotLine("##Framerate", &rdata1.Data[0].x, &rdata1.Data[0].y, rdata1.Data.size(), 0, rdata1.Offset, 2 * sizeof(float));

ImPlot::EndPlot();
}

if(ImGui::TreeNodeEx("Application", ImGuiTreeNodeFlags_DefaultOpen))
{
auto systems = Application::Get().GetSystemManager();
Expand All @@ -36,10 +115,10 @@ namespace Lumos
ImGui::TreePop();
}

auto SceneRenderer = Application::Get().GetSceneRenderer();
if(ImGui::TreeNode("SceneRenderer"))
auto RenderPasses = Application::Get().GetRenderPasses();
if(ImGui::TreeNode("RenderPasses"))
{
SceneRenderer->OnImGui();
RenderPasses->OnImGui();
ImGui::TreePop();
}

Expand Down
2 changes: 2 additions & 0 deletions Editor/Source/ApplicationInfoPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ namespace Lumos
~ApplicationInfoPanel() = default;

void OnImGui() override;

std::vector<float> m_FPSData;
};
}
146 changes: 111 additions & 35 deletions Editor/Source/ConsolePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

namespace Lumos
{
uint32_t ConsolePanel::s_MessageBufferRenderFilter = 0;
uint16_t ConsolePanel::s_MessageBufferCapacity = 200;
uint16_t ConsolePanel::s_MessageBufferSize = 0;
uint16_t ConsolePanel::s_MessageBufferBegin = 0;
Vector<SharedPtr<ConsolePanel::Message>> ConsolePanel::s_MessageBuffer = Vector<SharedPtr<ConsolePanel::Message>>(200);
bool ConsolePanel::s_AllowScrollingToBottom = true;
bool ConsolePanel::s_RequestScrollToBottom = false;
uint32_t ConsolePanel::s_MessageBufferRenderFilter = 0;
uint16_t ConsolePanel::s_MessageBufferCapacity = 2000;
uint16_t ConsolePanel::s_MessageBufferSize = 0;
uint16_t ConsolePanel::s_MessageBufferBegin = 0;
Vector<SharedPtr<ConsolePanel::Message>> ConsolePanel::s_MessageBuffer = Vector<SharedPtr<ConsolePanel::Message>>(2000);
bool ConsolePanel::s_AllowScrollingToBottom = true;
bool ConsolePanel::s_RequestScrollToBottom = false;

ConsolePanel::ConsolePanel()
{
Expand Down Expand Up @@ -165,13 +165,56 @@ namespace Lumos
}
}

enum MyItemColumnID
{
MyItemColumnID_Time,
MyItemColumnID_Message,
MyItemColumnID_Type
};

void ConsolePanel::ImGuiRenderMessages()
{
LUMOS_PROFILE_FUNCTION();
ImGui::BeginChild("ScrollRegion", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
// ImGui::BeginChild("ScrollRegion", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar);
if(ImGui::BeginTable("Messages", 3, ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg))
{

ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, 0.0f, MyItemColumnID_Type);
ImGui::TableSetupColumn("Time", ImGuiTableColumnFlags_NoSort | ImGuiTableColumnFlags_WidthFixed, 0.0f, MyItemColumnID_Time);
ImGui::TableSetupColumn("Message", ImGuiTableColumnFlags_NoSort, 0.0f, MyItemColumnID_Message);
ImGui::TableSetupScrollFreeze(0, 1);

ImGui::TableHeadersRow();
// ImGuiUtilities::AlternatingRowsBackground();

ImGui::TableNextRow();

auto DrawMessage = [](Message* message)
{
if(s_MessageBufferRenderFilter & message->m_Level)
{
ImGui::TableNextColumn();
ImGui::PushStyleColor(ImGuiCol_Text, message->GetRenderColour(message->m_Level));
auto levelIcon = message->GetLevelIcon(message->m_Level);
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetColumnWidth() - ImGui::CalcTextSize(levelIcon).x
- ImGui::GetScrollX() - 2 * ImGui::GetStyle().ItemSpacing.x);
ImGui::TextUnformatted(levelIcon);

if(ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", Message::GetLevelName(message->m_Level));
}
ImGui::PopStyleColor();

ImGui::TableNextColumn();
ImGui::TextUnformatted(message->m_Time.c_str());

ImGui::TableNextColumn();
message->OnImGUIRender();
ImGui::TableNextRow();
}
};

auto messageStart = s_MessageBuffer.begin() + s_MessageBufferBegin;
if(*messageStart) // If contains old message here
{
Expand All @@ -181,12 +224,12 @@ namespace Lumos
{
if(Filter.PassFilter((*message)->m_Message.c_str()))
{
(*message)->OnImGUIRender();
DrawMessage((*message));
}
}
else
{
(*message)->OnImGUIRender();
DrawMessage((*message));
}
}
}
Expand All @@ -201,12 +244,12 @@ namespace Lumos
{
if(Filter.PassFilter((*message)->m_Message.c_str()))
{
(*message)->OnImGUIRender();
DrawMessage((*message));
}
}
else
{
(*message)->OnImGUIRender();
DrawMessage((*message));
}
}
}
Expand All @@ -217,51 +260,84 @@ namespace Lumos
ImGui::SetScrollHereY(1.0f);
s_RequestScrollToBottom = false;
}
ImGui::EndTable();
}
ImGui::EndChild();
}

ConsolePanel::Message::Message(const std::string& message, Level level, const std::string& source, int threadID)
ConsolePanel::Message::Message(const std::string& message, Level level, const std::string& source, int threadID, const std::string& time)
: m_Message(message)
, m_Level(level)
, m_Source(source)
, m_ThreadID(threadID)
, m_MessageID(std::hash<std::string>()(message))
, m_MessageID(std::hash<std::string>()(message) + std::hash<std::string>()(time))
, m_Time(time)
{
}

void ConsolePanel::Message::OnImGUIRender()
{
LUMOS_PROFILE_FUNCTION();
if(s_MessageBufferRenderFilter & m_Level)

ImGuiUtilities::ScopedID scopedID((int)m_MessageID);
ImGui::TextUnformatted(m_Message.c_str());

bool clicked = false;
if(ImGui::IsItemClicked())
clicked = true;

if(ImGui::BeginPopupContextItem(m_Message.c_str()))
{
ImGuiUtilities::ScopedID((int)m_MessageID);
ImGui::PushStyleColor(ImGuiCol_Text, GetRenderColour(m_Level));
auto levelIcon = GetLevelIcon(m_Level);
ImGui::TextUnformatted(levelIcon);
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::TextUnformatted(m_Message.c_str());
if(ImGui::BeginPopupContextItem(m_Message.c_str()))
if(ImGui::MenuItem("Copy"))
{
ImGui::SetClipboardText(m_Message.c_str());
}

ImGui::EndPopup();
}
static bool m_DetailedPanelOpen = false;
if(clicked)
{
ImGui::OpenPopup("Message");
ImVec2 size = ImGui::GetMainViewport()->Size;
ImGui::SetNextWindowSize({ size.x * 0.5f, size.y * 0.5f });
ImGui::SetNextWindowPos({ size.x / 2.0f, size.y / 2.5f }, 0, { 0.5, 0.5 });
m_DetailedPanelOpen = true;
}

if(m_DetailedPanelOpen)
{
if(ImGui::BeginPopupModal("Message", &m_DetailedPanelOpen, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize))
{
if(ImGui::MenuItem("Copy"))
ImGui::TextWrapped("Message : %s", m_Message.c_str());

if(ImGui::BeginPopupContextItem(m_Message.c_str()))
{
ImGui::SetClipboardText(m_Message.c_str());
if(ImGui::MenuItem("Copy"))
{
ImGui::SetClipboardText(m_Message.c_str());
}

ImGui::EndPopup();
}

ImGui::TextWrapped("Source : %s", m_Source.c_str());

ImGui::Text("Time : %s", m_Time.c_str());
ImGui::Text("Type : %s", Message::GetLevelName(m_Level));

ImGui::EndPopup();
}
}

if(ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", m_Source.c_str());
}
if(ImGui::IsItemHovered())
{
ImGui::SetTooltip("%s", m_Source.c_str());
}

if(m_Count > 1)
{
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (m_Count > 99 ? ImGui::GetFontSize() * 1.7f : ImGui::GetFontSize() * 1.5f));
ImGui::Text("%d", m_Count);
}
if(m_Count > 1)
{
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (m_Count > 99 ? ImGui::GetFontSize() * 1.7f : ImGui::GetFontSize() * 1.5f));
ImGui::Text("%d", m_Count);
}
}

Expand Down
Loading

0 comments on commit e5f0ebf

Please sign in to comment.