Started new Add Entity Panel, removed unused shaders, fixed premake5 problems

This commit is contained in:
antopilo
2024-04-02 23:09:33 -04:00
parent 3ed21d0e01
commit f4d71b9977
10 changed files with 177 additions and 41 deletions

View File

@@ -50,7 +50,8 @@ public:
ImGui::Text("Playing");
ImGui::TableNextColumn();
ImGui::Checkbox("##Playing", &component.IsPlaying);
UI::ToggleButton("##Player", &component.IsPlaying);
//ImGui::Checkbox("##Playing", &component.IsPlaying);
ImGui::TableNextColumn();
ComponentTableReset(component.IsPlaying, false);

View File

@@ -3,6 +3,7 @@
#include "../Misc/InterfaceFonts.h"
#include "src/UI/ImUI.h"
#include <src/Vendors/imgui/imgui.h>
#include <src/Resource/FontAwesome5.h>

View File

@@ -1540,9 +1540,48 @@ namespace Nuake {
{
if (UI::PrimaryButton("Add Entity"))
{
ImGui::OpenPopup("create_entity_popup");
ImGui::OpenPopup("create_entity_new_popup");
}
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 8, 8 });
if (ImGui::BeginPopup("create_entity_new_popup"))
{
ImGui::BeginChild("entity_child", ImVec2(442, 442), ImGuiChildFlags_AlwaysUseWindowPadding);
std::string searchQuery = "";
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::InputTextWithHint("##search", "Search entity", &searchQuery, 0, 0, 0);
ImGui::PopItemWidth();
ImGui::Button("Empty", { 130, 130 });
ImGui::SameLine();
ImGui::Button("3D", { 130, 130 });
ImGui::SameLine();
ImGui::Button("Lights", { 130, 130 });
ImGui::Button("Physics", { 130, 130 });
ImGui::SameLine();
ImGui::Button("Shapes", { 130, 130 });
ImGui::SameLine();
ImGui::Button("Scripts", { 130, 130 });
ImGui::Button("Prefabs", { 130, 130 });
ImGui::SameLine();
ImGui::Button("Utilities", { 130, 130 });
ImGui::SameLine();
ImGui::BeginDisabled();
ImGui::Button("Addons", { 130, 130 });
ImGui::EndDisabled();
ImGui::EndChild();
ImGui::EndPopup();
}
ImGui::PopStyleVar();
if (ImGui::BeginPopup("create_entity_popup"))
{
if (ImGui::MenuItem("Empty"))

View File

@@ -20,9 +20,14 @@ namespace Nuake
mGBuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RGB), GL_COLOR_ATTACHMENT0); // Albedo
mGBuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RGB), GL_COLOR_ATTACHMENT1); // Normal
mGBuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RGBA), GL_COLOR_ATTACHMENT2); // Material + unlit
mGBuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RED_INTEGER, GL_R32I, GL_INT), GL_COLOR_ATTACHMENT3); // Entity ID
auto entityTexture = CreateRef<Texture>(defaultResolution, GL_RED_INTEGER, GL_R32I, GL_INT);
entityTexture->SetParameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
mGBuffer->SetTexture(entityTexture, GL_COLOR_ATTACHMENT3); // Entity ID
mGBuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RED, GL_R16F, GL_FLOAT), GL_COLOR_ATTACHMENT4); // Emissive
mShadingBuffer = CreateScope<FrameBuffer>(true, defaultResolution);
mShadingBuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RGB, GL_RGB16F, GL_FLOAT));
@@ -262,33 +267,31 @@ namespace Nuake
framebuffer.Unbind();
}
if (sceneEnv->VignetteEnabled)
mVignetteBuffer->QueueResize(framebuffer.GetSize());
mVignetteBuffer->Bind();
{
mVignetteBuffer->QueueResize(framebuffer.GetSize());
mVignetteBuffer->Bind();
{
RenderCommand::Clear();
Shader* shader = ShaderManager::GetShader("Resources/Shaders/vignette.shader");
shader->Bind();
RenderCommand::Clear();
Shader* shader = ShaderManager::GetShader("Resources/Shaders/vignette.shader");
shader->Bind();
shader->SetUniform1f("u_Intensity", sceneEnv->VignetteIntensity);
shader->SetUniform1f("u_Extend", sceneEnv->VignetteExtend);
shader->SetUniformTex("u_Source", finalOutput.get(), 0);
Renderer::DrawQuad();
}
mVignetteBuffer->Unbind();
framebuffer.Bind();
{
RenderCommand::Clear();
Shader* shader = ShaderManager::GetShader("Resources/Shaders/copy.shader");
shader->Bind();
shader->SetUniformTex("u_Source", mVignetteBuffer->GetTexture().get(), 0);
Renderer::DrawQuad();
}
framebuffer.Unbind();
shader->SetUniform1f("u_Intensity", sceneEnv->VignetteIntensity);
shader->SetUniform1f("u_Extend", sceneEnv->VignetteEnabled ? sceneEnv->VignetteExtend : 0.0f);
shader->SetUniformTex("u_Source", finalOutput.get(), 0);
Renderer::DrawQuad();
}
mVignetteBuffer->Unbind();
framebuffer.Bind();
{
RenderCommand::Clear();
Shader* shader = ShaderManager::GetShader("Resources/Shaders/copy.shader");
shader->Bind();
shader->SetUniformTex("u_Source", mVignetteBuffer->GetTexture().get(), 0);
Renderer::DrawQuad();
}
framebuffer.Unbind();
{
mOutlineBuffer->QueueResize(framebuffer.GetSize());
@@ -316,14 +319,8 @@ namespace Nuake
Shader* shader = ShaderManager::GetShader("Resources/Shaders/combine.shader");
shader->Bind();
if (sceneEnv->VignetteEnabled)
{
shader->SetUniformTex("u_Source", mVignetteBuffer->GetTexture().get(), 0);
}
else
{
shader->SetUniformTex("u_Source", finalOutput.get(), 0);
}
shader->SetUniformTex("u_Source", mVignetteBuffer->GetTexture().get(), 0);
shader->SetUniformTex("u_Source2", mOutlineBuffer->GetTexture(GL_COLOR_ATTACHMENT0).get(), 1);
Renderer::DrawQuad();
}

View File

@@ -30,7 +30,7 @@ namespace Nuake
LoadEmbeddedShader(Resources_Shaders_gbuffer_skinned_shader);
LoadEmbeddedShader(Resources_Shaders_gizmo_shader);
LoadEmbeddedShader(Resources_Shaders_line_shader);
LoadEmbeddedShader(Resources_Shaders_pbr_shader);
//LoadEmbeddedShader(Resources_Shaders_pbr_shader);
LoadEmbeddedShader(Resources_Shaders_sdf_text_shader);
LoadEmbeddedShader(Resources_Shaders_shadowMap_shader);
LoadEmbeddedShader(Resources_Shaders_shadowMap_skinned_shader);

View File

@@ -107163,6 +107163,72 @@ const std::string Resources_Images_nuake_logo_png_path = R"(Resources/Images/nua
};
unsigned int Resources_Images_nuake_logo_png_len = 1675;
// Data for file: Resources_Images_project_icon_png_path
const std::string Resources_Images_project_icon_png_path = R"(Resources/Images/project_icon.png)";
unsigned char Resources_Images_project_icon_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64,
0x08, 0x06, 0x00, 0x00, 0x00, 0x70, 0xe2, 0x95, 0x54, 0x00, 0x00, 0x00,
0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b,
0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52,
0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, 0x00, 0x04, 0x67,
0x41, 0x4d, 0x41, 0x00, 0x00, 0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00,
0x00, 0x02, 0x64, 0x49, 0x44, 0x41, 0x54, 0x78, 0x01, 0xed, 0xd7, 0x81,
0x71, 0xda, 0x30, 0x14, 0x80, 0x61, 0xd1, 0xeb, 0x00, 0xde, 0x00, 0xba,
0x01, 0x1b, 0x34, 0x23, 0xb0, 0x01, 0x74, 0x02, 0xd8, 0x80, 0x76, 0x02,
0xb2, 0x81, 0xaf, 0x13, 0xd0, 0x0d, 0xcc, 0x06, 0x4d, 0x27, 0x80, 0x0d,
0xec, 0x0d, 0x54, 0xa9, 0x3c, 0x35, 0x8f, 0x17, 0xd9, 0x24, 0x57, 0xd7,
0xe0, 0xcb, 0xff, 0xdd, 0xe9, 0x6c, 0xcb, 0x7a, 0x4f, 0x8e, 0x84, 0x25,
0xc7, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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};
unsigned int Resources_Images_project_icon_png_len = 719;
// Data for file: Resources_Images_screenshot_png_path
const std::string Resources_Images_screenshot_png_path = R"(Resources/Images/screenshot.png)";
unsigned char Resources_Images_screenshot_png[] = {
@@ -235409,7 +235475,7 @@ const std::string Resources_Shaders_pbr_shader_path = R"(Resources/Shaders/pbr.s
unsigned char Resources_Shaders_pbr_shader[] = {
0x23, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x76, 0x65, 0x72, 0x74,
0x65, 0x78, 0x0d, 0x0a, 0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x20, 0x34, 0x34, 0x30, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x0d, 0x0a, 0x0d,
0x20, 0x34, 0x36, 0x30, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x0d, 0x0a, 0x0d,
0x0a, 0x6c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x28, 0x6c, 0x6f, 0x63, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x30, 0x29, 0x20, 0x69, 0x6e,
0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78,

View File

@@ -57,6 +57,9 @@ extern unsigned char Resources_Images_logo_white_png[];
extern const std::string Resources_Images_nuake_logo_png_path;
extern unsigned int Resources_Images_nuake_logo_png_len;
extern unsigned char Resources_Images_nuake_logo_png[];
extern const std::string Resources_Images_project_icon_png_path;
extern unsigned int Resources_Images_project_icon_png_len;
extern unsigned char Resources_Images_project_icon_png[];
extern const std::string Resources_Images_screenshot_png_path;
extern unsigned int Resources_Images_screenshot_png_len;
extern unsigned char Resources_Images_screenshot_png[];

View File

@@ -1,4 +1,5 @@
#include "ImUI.h"
#include <imgui/imgui_internal.h>
namespace Nuake {
@@ -137,5 +138,28 @@ namespace Nuake {
return value;
}
void ToggleButton(const char* str_id, bool* v)
{
ImVec4* colors = ImGui::GetStyle().Colors;
ImVec2 p = ImGui::GetCursorScreenPos();
ImDrawList* draw_list = ImGui::GetWindowDrawList();
float height = ImGui::GetFrameHeight();
float width = height * 1.55f;
float radius = height * 0.50f;
ImGui::InvisibleButton(str_id, ImVec2(width, height));
if (ImGui::IsItemClicked()) *v = !*v;
ImGuiContext& gg = *GImGui;
float ANIM_SPEED = 0.085f;
if (gg.LastActiveId == gg.CurrentWindow->GetID(str_id))// && g.LastActiveIdTimer < ANIM_SPEED)
float t_anim = ImSaturate(gg.LastActiveIdTimer / ANIM_SPEED);
if (ImGui::IsItemHovered())
draw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), ImGui::GetColorU32(*v ? colors[ImGuiCol_ButtonActive] : ImVec4(0.78f, 0.78f, 0.78f, 1.0f)), height * 0.5f);
else
draw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), ImGui::GetColorU32(*v ? colors[ImGuiCol_Button] : ImVec4(0.85f, 0.85f, 0.85f, 1.0f)), height * 0.50f);
draw_list->AddCircleFilled(ImVec2(p.x + radius + (*v ? 1 : 0) * (width - radius * 2.0f), p.y + radius), radius - 1.5f, IM_COL32(255, 255, 255, 255));
}
}
}

View File

@@ -29,5 +29,7 @@ namespace Nuake
bool FloatSlider(const std::string& name, float& input, float min = 0.0f, float max = 1.0f, float speed = 0.01f);
bool CheckBox(const std::string& name, bool& value);
void ToggleButton(const char* str_id, bool* v);
}
}

View File

@@ -340,7 +340,8 @@ project "Editor"
}
defines
{
"NK_WIN"
"NK_WIN",
"IMGUI_DEFINE_MATH_OPERATORS"
}
externalincludedirs { "%{prj.name}/../Nuake/dependencies/Coral/Coral.Native/Include/" }
@@ -365,7 +366,7 @@ project "Editor"
"asound"
}
buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 gtk-3 atk tk-3.0 glib-2.0`" }
buildoptions { "`pkg-config --cflags glib-2.0 pango gdk-pixbuf-2.0 gtk-3 atk tk-3.0 glib-2.0`" }
linkoptions { "`pkg-config --libs glib-2.0 pango gdk-pixbuf-2.0 gtk-3 glib-2.0 lgobject-2.0`" }
@@ -389,7 +390,8 @@ project "Editor"
symbols "on"
defines
{
"WIN32_LEAN_AND_MEAN"
"WIN32_LEAN_AND_MEAN",
"IMGUI_DEFINE_MATH_OPERATORS"
}
filter "configurations:Release"
@@ -401,7 +403,8 @@ project "Editor"
optimize "on"
defines
{
"WIN32_LEAN_AND_MEAN"
"WIN32_LEAN_AND_MEAN",
"IMGUI_DEFINE_MATH_OPERATORS"
}
-- Removes the console for windows