mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Huge rework of editor and other changes.
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "src/NewEditor.h"
|
||||
#include <src/Scene/Components/BSPBrushComponent.h>
|
||||
|
||||
std::string WindowTitle = "Nuake Engine";
|
||||
|
||||
void OpenProject()
|
||||
{
|
||||
// Parse the project and load it.
|
||||
@@ -45,6 +47,16 @@ void OpenProject()
|
||||
//Engine::GetCurrentScene()->AddInterface(userInterface);
|
||||
}
|
||||
|
||||
std::vector<Nuake::LineVertex> vertices
|
||||
{
|
||||
Nuake::LineVertex {{10000.f, 0.0f, 0.0f}, {1.f, 0.f, 0.f, 1.f}},
|
||||
Nuake::LineVertex {{0.0f, 0.0f, 0.0f }, {1.f, 0.f, 0.f, 1.f}},
|
||||
Nuake::LineVertex {{0.f, 0.f, 10000.f }, {0.f, 1.f, 0.f, 1.f}},
|
||||
Nuake::LineVertex {{0.0f, 0.0f, 0.0f }, {0.f, 1.f, 0.f, 1.f}},
|
||||
Nuake::LineVertex {{0.f, 10000.f, 0.0f }, {0.f, 0.f, 1.f, 1.f}},
|
||||
Nuake::LineVertex {{0.0f, 0.0f, 0.0f }, {0.f, 0.f, 1.f, 1.f}}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
Nuake::Engine::Init();
|
||||
@@ -52,6 +64,20 @@ int main()
|
||||
Nuake::EditorInterface editor;
|
||||
editor.BuildFonts();
|
||||
|
||||
glLineWidth(2.0f);
|
||||
|
||||
Nuake::Shader* lineShader = Nuake::ShaderManager::GetShader("resources/Shaders/line.shader");
|
||||
|
||||
lineShader->Bind();
|
||||
|
||||
Nuake::VertexArray* lineVertexArray = new Nuake::VertexArray();
|
||||
lineVertexArray->Bind();
|
||||
Nuake::VertexBuffer* lineVertexBuffer = new Nuake::VertexBuffer(vertices.data(), vertices.size() * sizeof(Nuake::LineVertex));
|
||||
Nuake::VertexBufferLayout* vblayout = new Nuake::VertexBufferLayout();
|
||||
vblayout->Push<float>(3);
|
||||
vblayout->Push<float>(4);
|
||||
lineVertexArray->AddBuffer(*lineVertexBuffer, *vblayout);
|
||||
|
||||
// Register Gizmo textures
|
||||
Ref<Nuake::Texture> lightTexture = Nuake::TextureManager::Get()->GetTexture("resources/Icons/Gizmo/Light.png");
|
||||
Ref<Nuake::Texture> camTexture = Nuake::TextureManager::Get()->GetTexture("resources/Icons/Gizmo/Camera.png");
|
||||
@@ -59,80 +85,110 @@ int main()
|
||||
Nuake::Shader* ditherShader = Nuake::ShaderManager::GetShader("resources/Shaders/dither.shader");
|
||||
|
||||
//Nuake::NewEditor newEditor = Nuake::NewEditor();
|
||||
|
||||
// Register shaders
|
||||
while (!Nuake::Engine::GetCurrentWindow()->ShouldClose())
|
||||
{
|
||||
Nuake::RenderCommand::Clear();
|
||||
Nuake::Engine::Tick();
|
||||
Ref<Nuake::Window> window = Nuake::Engine::GetCurrentWindow();
|
||||
window->SetTitle("Nuake Editor");
|
||||
|
||||
while (!window->ShouldClose())
|
||||
{
|
||||
Nuake::Engine::Tick();
|
||||
Nuake::Engine::Draw();
|
||||
|
||||
//newEditor.Update(0.f);
|
||||
|
||||
|
||||
|
||||
Nuake::Vector2 WindowSize = Nuake::Engine::GetCurrentWindow()->GetSize();
|
||||
Nuake::Vector2 WindowSize = window->GetSize();
|
||||
glViewport(0, 0, WindowSize.x, WindowSize.y);
|
||||
Nuake::Renderer2D::BeginDraw(WindowSize);
|
||||
|
||||
//newEditor.Draw(WindowSize);
|
||||
|
||||
Ref<Nuake::FrameBuffer> sceneFramebuffer = Nuake::Engine::GetCurrentWindow()->GetFrameBuffer();
|
||||
Ref<Nuake::FrameBuffer> sceneFramebuffer = window->GetFrameBuffer();
|
||||
sceneFramebuffer->Bind();
|
||||
|
||||
|
||||
Ref<Nuake::Scene> currentScene = Nuake::Engine::GetCurrentScene();
|
||||
if (currentScene && !Nuake::Engine::IsPlayMode)
|
||||
{
|
||||
//GuizmoShader->Bind();
|
||||
//
|
||||
//glDisable(GL_CULL_FACE);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
//auto camView = currentScene->m_Registry.view<Nuake::TransformComponent, Nuake::CameraComponent>();
|
||||
//for (auto e : camView) {
|
||||
// auto [transformComponent, cam] = camView.get<Nuake::TransformComponent, Nuake::CameraComponent>(e);
|
||||
//
|
||||
// GuizmoShader->SetUniformMat4f("model", transformComponent.GetGlobalTransform());
|
||||
// GuizmoShader->SetUniformMat4f("view", currentScene->m_EditorCamera->GetTransform());
|
||||
// GuizmoShader->SetUniformMat4f("projection", currentScene->m_EditorCamera->GetPerspective());
|
||||
//
|
||||
// camTexture->Bind(2);
|
||||
// GuizmoShader->SetUniform1i("gizmo_texture", 2);
|
||||
//
|
||||
// Nuake::Renderer::DrawQuad(transformComponent.GetGlobalTransform());
|
||||
//}
|
||||
//
|
||||
//auto view = currentScene->m_Registry.view<Nuake::TransformComponent, Nuake::LightComponent>();
|
||||
//for (auto e : view) {
|
||||
// auto [transformComponent, light] = view.get<Nuake::TransformComponent, Nuake::LightComponent>(e);
|
||||
//
|
||||
// GuizmoShader->SetUniformMat4f("model", transformComponent.GetGlobalTransform());
|
||||
// GuizmoShader->SetUniformMat4f("view", currentScene->m_EditorCamera->GetTransform());
|
||||
// GuizmoShader->SetUniformMat4f("projection", currentScene->m_EditorCamera->GetPerspective());
|
||||
//
|
||||
// lightTexture->Bind(2);
|
||||
// GuizmoShader->SetUniform1i("gizmo_texture", 2);
|
||||
//
|
||||
// Nuake::Renderer::DrawQuad(transformComponent.GetGlobalTransform());
|
||||
//}
|
||||
//
|
||||
//glEnable(GL_CULL_FACE);
|
||||
//
|
||||
//GuizmoShader->Unbind();
|
||||
//
|
||||
//ditherShader->Bind();
|
||||
//ditherShader->SetUniformMat4f("u_View", Nuake::Engine::GetCurrentScene()->m_EditorCamera->GetTransform());
|
||||
//ditherShader->SetUniformMat4f("u_Projection", Nuake::Engine::GetCurrentScene()->m_EditorCamera->GetPerspective());
|
||||
//ditherShader->SetUniform1f("u_Time", Nuake::Engine::GetTime());
|
||||
//ditherShader->SetUniform4f("u_Color", 252.0 / 255.0, 3.0 / 255.0, 65.0 / 255.0, 1.0);
|
||||
//
|
||||
//if (editor.m_IsEntitySelected && editor.m_SelectedEntity.HasComponent<Nuake::BSPBrushComponent>())
|
||||
//{
|
||||
// for (auto& m : editor.m_SelectedEntity.GetComponent<Nuake::BSPBrushComponent>().Meshes)
|
||||
// Nuake::Renderer::SubmitMesh(m, editor.m_SelectedEntity.GetComponent<Nuake::TransformComponent>().GetGlobalTransform());
|
||||
//
|
||||
// Nuake::Renderer::Flush(ditherShader, true);
|
||||
//}
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
lineShader->Bind();
|
||||
lineShader->SetUniformMat4f("u_View", Nuake::Engine::GetCurrentScene()->m_EditorCamera->GetTransform());
|
||||
lineShader->SetUniformMat4f("u_Projection", Nuake::Engine::GetCurrentScene()->m_EditorCamera->GetPerspective());
|
||||
|
||||
lineVertexArray->Bind();
|
||||
Nuake::RenderCommand::DrawLines(0, 6);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
GuizmoShader->Bind();
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
auto camView = currentScene->m_Registry.view<Nuake::TransformComponent, Nuake::CameraComponent>();
|
||||
for (auto e : camView) {
|
||||
auto [transformComponent, cam] = camView.get<Nuake::TransformComponent, Nuake::CameraComponent>(e);
|
||||
|
||||
Nuake::Vector3 cameraPos = currentScene->m_EditorCamera->GetTranslation();
|
||||
Nuake::Vector3 position = transformComponent.GlobalTranslation;
|
||||
Nuake::Vector3 look = normalize(cameraPos - position);
|
||||
Nuake::Vector3 right = glm::cross(currentScene->m_EditorCamera->GetUp(), look);
|
||||
Nuake::Vector3 up2 = currentScene->m_EditorCamera->GetUp();
|
||||
Nuake::Matrix4 transform = glm::identity<Nuake::Matrix4>();
|
||||
transform[0] = Nuake::Vector4(right, 0);
|
||||
transform[1] = Nuake::Vector4(up2, 0);
|
||||
transform[2] = Nuake::Vector4(look, 0);
|
||||
transform = glm::translate(transform, position);
|
||||
GuizmoShader->SetUniformMat4f("model", transform);
|
||||
GuizmoShader->SetUniformMat4f("view", currentScene->m_EditorCamera->GetTransform());
|
||||
GuizmoShader->SetUniformMat4f("projection", currentScene->m_EditorCamera->GetPerspective());
|
||||
|
||||
camTexture->Bind(2);
|
||||
GuizmoShader->SetUniform1i("gizmo_texture", 2);
|
||||
|
||||
Nuake::Renderer::DrawQuad(transformComponent.GetGlobalTransform());
|
||||
}
|
||||
|
||||
auto view = currentScene->m_Registry.view<Nuake::TransformComponent, Nuake::LightComponent>();
|
||||
for (auto e : view) {
|
||||
auto [transformComponent, light] = view.get<Nuake::TransformComponent, Nuake::LightComponent>(e);
|
||||
|
||||
GuizmoShader->SetUniformMat4f("model", transformComponent.GetGlobalTransform());
|
||||
GuizmoShader->SetUniformMat4f("view", currentScene->m_EditorCamera->GetTransform());
|
||||
GuizmoShader->SetUniformMat4f("projection", currentScene->m_EditorCamera->GetPerspective());
|
||||
|
||||
lightTexture->Bind(2);
|
||||
GuizmoShader->SetUniform1i("gizmo_texture", 2);
|
||||
|
||||
Nuake::Renderer::DrawQuad(transformComponent.GetGlobalTransform());
|
||||
}
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
GuizmoShader->Unbind();
|
||||
|
||||
ditherShader->Bind();
|
||||
ditherShader->SetUniformMat4f("u_View", Nuake::Engine::GetCurrentScene()->m_EditorCamera->GetTransform());
|
||||
ditherShader->SetUniformMat4f("u_Projection", Nuake::Engine::GetCurrentScene()->m_EditorCamera->GetPerspective());
|
||||
ditherShader->SetUniform1f("u_Time", Nuake::Engine::GetTime());
|
||||
ditherShader->SetUniform4f("u_Color", 252.0 / 255.0, 3.0 / 255.0, 65.0 / 255.0, 1.0);
|
||||
|
||||
if (editor.m_IsEntitySelected && editor.m_SelectedEntity.HasComponent<Nuake::BSPBrushComponent>())
|
||||
{
|
||||
for (auto& m : editor.m_SelectedEntity.GetComponent<Nuake::BSPBrushComponent>().Meshes)
|
||||
Nuake::Renderer::SubmitMesh(m, editor.m_SelectedEntity.GetComponent<Nuake::TransformComponent>().GetGlobalTransform());
|
||||
|
||||
Nuake::Renderer::Flush(ditherShader, true);
|
||||
}
|
||||
|
||||
ditherShader->SetUniform1f("u_Time", Nuake::Engine::GetTime() / 10.0f);
|
||||
ditherShader->SetUniform4f("u_Color", 52.f / 255.f, 235.f / 255.f, 88.f / 255.f, 1);
|
||||
auto cubeCollidersView = currentScene->m_Registry.view<Nuake::TransformComponent, Nuake::BoxColliderComponent>();
|
||||
if (editor.m_IsEntitySelected && editor.m_SelectedEntity.HasComponent<Nuake::BoxColliderComponent>())
|
||||
{
|
||||
auto transformComponent = editor.m_SelectedEntity.GetComponent<Nuake::TransformComponent>();
|
||||
auto colliderComponent = editor.m_SelectedEntity.GetComponent<Nuake::BoxColliderComponent>();
|
||||
Nuake::Matrix4 transform = transformComponent.GetGlobalTransform();
|
||||
transform = glm::scale(transform, colliderComponent.Size);
|
||||
Nuake::Renderer::SubmitCube(transform);
|
||||
|
||||
Nuake::Renderer::Flush(ditherShader, true);
|
||||
}
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
sceneFramebuffer->Unbind();
|
||||
|
||||
@@ -103,7 +103,7 @@ class Vector3 {
|
||||
}
|
||||
|
||||
Cross(vec) {
|
||||
Math.Cross(this, vec)
|
||||
return Math.Cross(this, vec)
|
||||
}
|
||||
|
||||
Normalize() {
|
||||
|
||||
@@ -19,7 +19,8 @@ uniform int u_Stage;
|
||||
|
||||
uniform sampler2D u_Source;
|
||||
uniform vec2 u_SourceSize;
|
||||
|
||||
uniform float u_Exposure;
|
||||
uniform float u_Gamma;
|
||||
uniform sampler2D u_Source2;
|
||||
uniform vec2 u_Source2Size;
|
||||
|
||||
@@ -99,28 +100,7 @@ vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
|
||||
return color;
|
||||
}
|
||||
|
||||
vec3 acesOperator(vec3 rgbColour)
|
||||
{
|
||||
const mat3 inputMatrix = mat3
|
||||
(
|
||||
vec3(0.59719, 0.07600, 0.02840),
|
||||
vec3(0.35458, 0.90834, 0.13383),
|
||||
vec3(0.04823, 0.01566, 0.83777)
|
||||
);
|
||||
|
||||
const mat3 outputMatrix = mat3
|
||||
(
|
||||
vec3(1.60475, -0.10208, -0.00327),
|
||||
vec3(-0.53108, 1.10813, -0.07276),
|
||||
vec3(-0.07367, -0.00605, 1.07602)
|
||||
);
|
||||
|
||||
vec3 inputColour = inputMatrix * rgbColour;
|
||||
vec3 a = inputColour * (inputColour + vec3(0.0245786)) - vec3(0.000090537);
|
||||
vec3 b = inputColour * (0.983729 * inputColour + 0.4329510) + 0.238081;
|
||||
vec3 c = a / b;
|
||||
return outputMatrix * c;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -150,15 +130,7 @@ void main()
|
||||
outputColor += texture(u_Source2, UV);
|
||||
|
||||
vec3 color = outputColor.rgb;
|
||||
|
||||
//color = acesOperator(color);
|
||||
|
||||
color = color / (color + vec3(2.0));
|
||||
color = vec3(1.0) - exp(-color * 1.0);
|
||||
color = pow(color, vec3(1.0 / 2.2));
|
||||
|
||||
outputColor = vec4(color, 1.0);//vec4(acesOperator(outputColor.rgb), 1.0f);
|
||||
|
||||
}
|
||||
FragColor = outputColor;
|
||||
}
|
||||
@@ -222,7 +222,7 @@ void main()
|
||||
|
||||
// scale light by NdotL
|
||||
float NdotL = max(dot(N, L), 0.0);
|
||||
Lo += (kD * albedo / PI + specular) * radiance * NdotL;// note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again
|
||||
Lo += (kD * albedo / PI) * radiance * NdotL;// note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again
|
||||
}
|
||||
|
||||
/// ambient lighting (we now use IBL as the ambient term)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#shader vertex
|
||||
#version 460 core
|
||||
|
||||
|
||||
layout(location = 0) in vec3 VertexPosition;
|
||||
|
||||
uniform mat4 u_Projection;
|
||||
|
||||
@@ -78,7 +78,7 @@ void main()
|
||||
if (u_HasAlbedo == 1)
|
||||
gAlbedo.rgb = texture(m_Albedo, UV).rgb;
|
||||
|
||||
gAlbedo.rgb = texture(m_Albedo, UV).rgb;
|
||||
gAlbedo.rgb = texture(m_Albedo, UV).rgb * m_AlbedoColor.rgb;
|
||||
|
||||
// Material
|
||||
float finalMetalness = u_MetalnessValue;
|
||||
|
||||
29
Editor/resources/Shaders/line.shader
Normal file
29
Editor/resources/Shaders/line.shader
Normal file
@@ -0,0 +1,29 @@
|
||||
#shader vertex
|
||||
#version 460 core
|
||||
|
||||
layout(location = 0) in vec3 VertexPosition;
|
||||
layout(location = 0) in vec4 VertexColor;
|
||||
|
||||
uniform mat4 u_Projection;
|
||||
uniform mat4 u_View;
|
||||
uniform mat4 u_Model;
|
||||
|
||||
out vec4 LineColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
LineColor = VertexColor;
|
||||
gl_Position = u_Projection * u_View * vec4(VertexPosition, 1.0f);
|
||||
}
|
||||
|
||||
#shader fragment
|
||||
#version 460 core
|
||||
|
||||
in vec4 LineColor;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = LineColor;
|
||||
}
|
||||
@@ -16,19 +16,32 @@ void main()
|
||||
#version 460 core
|
||||
|
||||
uniform sampler2D u_Source;
|
||||
uniform float u_Gamma;
|
||||
uniform float u_Exposure;
|
||||
|
||||
|
||||
in vec2 UV;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec3 aces(vec3 x) {
|
||||
const float a = 2.51;
|
||||
const float b = 0.03;
|
||||
const float c = 2.43;
|
||||
const float d = 0.59;
|
||||
const float e = 0.14;
|
||||
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture(u_Source, UV);
|
||||
vec3 color = texture(u_Source, UV).rgb;
|
||||
|
||||
color = mix(color, color * u_Exposure, 0.1f);
|
||||
// reinhard
|
||||
color = color / (color + vec3(1.0));
|
||||
const float gamma = 2.2;
|
||||
// HDR tonemapping
|
||||
color = vec3(1.0) - exp(-color * u_Exposure);
|
||||
// gamma correct
|
||||
color = pow(color, vec3(1.0 / gamma));
|
||||
FragColor = color;
|
||||
color = pow(color, vec3(1.0 / u_Gamma));
|
||||
|
||||
FragColor = vec4(color, 1.0);
|
||||
}
|
||||
15
Editor/src/Actions/EditorAction.h
Normal file
15
Editor/src/Actions/EditorAction.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
enum ActionType
|
||||
{
|
||||
SAVE, TRANSLATE
|
||||
};
|
||||
|
||||
class EditorAction
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
virtual void Do() = 0;
|
||||
virtual void Undo() = 0;
|
||||
};
|
||||
@@ -280,7 +280,7 @@ namespace Nuake {
|
||||
void EditorInterface::DrawSceneTree()
|
||||
{
|
||||
Ref<Scene> scene = Engine::GetCurrentScene();
|
||||
|
||||
|
||||
if (!scene)
|
||||
return;
|
||||
|
||||
@@ -299,8 +299,14 @@ namespace Nuake {
|
||||
ImGuiHelper::DrawVec3("Mie Scattering", &mieScattering);
|
||||
env->ProceduralSkybox->MieScattering = mieScattering / 10000.0f;
|
||||
}
|
||||
if (ImGui::CollapsingHeader("HDR", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::DragFloat("Exposure", &env->Exposure, .01f, 0.0f, 10.0f);
|
||||
ImGui::DragFloat("Gamma", &env->Gamma, 0.1f, 0.0f, 10.0f);
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Bloom", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::Checkbox("Enabled", &env->BloomEnabled);
|
||||
float threshold = env->mBloom->GetThreshold();
|
||||
ImGui::DragFloat("Threshold", &threshold, 0.01f, 0.0f, 500.0f);
|
||||
env->mBloom->SetThreshold(threshold);
|
||||
@@ -311,6 +317,7 @@ namespace Nuake {
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Fog", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::Checkbox("Enabled", &env->VolumetricEnabled);
|
||||
ImGui::DragFloat("Volumetric Scattering", &env->VolumetricFog, .01f, 0.0f, 1.0f);
|
||||
ImGui::DragFloat("Volumetric Step Count", &env->VolumetricStepCount, 1.f, 0.0f);
|
||||
}
|
||||
@@ -340,7 +347,6 @@ namespace Nuake {
|
||||
// // Unselect delted entity.
|
||||
// m_SelectedEntity = scene->GetAllEntities().at(0);
|
||||
//}
|
||||
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -388,8 +394,6 @@ namespace Nuake {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
@@ -421,24 +425,33 @@ namespace Nuake {
|
||||
QueueDeletion = Entity{ (entt::entity)-1, scene.get() };
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EditorInterface::DrawEntityPropreties()
|
||||
{
|
||||
if (ImGui::Begin("Propreties"))
|
||||
{
|
||||
if (!m_IsEntitySelected)
|
||||
{
|
||||
ImGui::Text("No entity selected");
|
||||
std::string text = "No entity selected";
|
||||
auto windowWidth = ImGui::GetWindowSize().x;
|
||||
auto windowHeight = ImGui::GetWindowSize().y;
|
||||
|
||||
auto textWidth = ImGui::CalcTextSize(text.c_str()).x;
|
||||
auto textHeight = ImGui::CalcTextSize(text.c_str()).y;
|
||||
ImGui::SetCursorPosX((windowWidth - textWidth) * 0.5f);
|
||||
ImGui::SetCursorPosY((windowHeight - textHeight) * 0.5f);
|
||||
|
||||
ImGui::PushFont(boldFont);
|
||||
ImGui::Text(text.c_str());
|
||||
ImGui::PopFont();
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (m_SelectedEntity.HasComponent<NameComponent>()) {
|
||||
auto& name = m_SelectedEntity.GetComponent<NameComponent>().Name;
|
||||
|
||||
@@ -612,10 +625,8 @@ namespace Nuake {
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
|
||||
if (m_SelectedEntity.HasComponent<MeshComponent>())
|
||||
{
|
||||
@@ -754,7 +765,13 @@ namespace Nuake {
|
||||
ImGui::Text("Cast Shadows");
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// This will create framebuffers and textures.
|
||||
bool castShadows = component.CastShadows;
|
||||
ImGui::Checkbox("##CastShadows", &component.CastShadows);
|
||||
if (castShadows != component.CastShadows)
|
||||
component.SetCastShadows(castShadows);
|
||||
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
std::string resetShadow = ICON_FA_UNDO + std::string("##resetShadow");
|
||||
@@ -1086,14 +1103,16 @@ namespace Nuake {
|
||||
else
|
||||
{
|
||||
const char* icon = ICON_FA_FILE;
|
||||
|
||||
if (file->Type == ".shader")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
if (file->Type == ".map")
|
||||
else if (file->Type == ".map")
|
||||
icon = ICON_FA_BROOM;
|
||||
if (file->Type == ".ogg" || file->Type == ".mp3" || file->Type == ".wav" || file->Type == ".flac")
|
||||
else if (file->Type == ".ogg" || file->Type == ".mp3" || file->Type == ".wav" || file->Type == ".flac")
|
||||
icon = ICON_FA_FILE_AUDIO;
|
||||
if (file->Type == ".cpp" || file->Type == ".h" || file->Type == ".cs" || file->Type == ".py" || file->Type == ".lua")
|
||||
else if (file->Type == ".cpp" || file->Type == ".h" || file->Type == ".cs" || file->Type == ".py" || file->Type == ".lua")
|
||||
icon = ICON_FA_FILE_CODE;
|
||||
|
||||
if (ImGui::Button(icon, ImVec2(100, 100)))
|
||||
{
|
||||
if (ImGui::BeginPopupContextItem("item context menu"))
|
||||
@@ -1106,7 +1125,6 @@ namespace Nuake {
|
||||
}
|
||||
ImGui::Text(file->name.c_str());
|
||||
ImGui::PopFont();
|
||||
|
||||
}
|
||||
|
||||
void EditorInterface::DrawDirectoryExplorer()
|
||||
@@ -1367,7 +1385,7 @@ namespace Nuake {
|
||||
if (ImGui::CollapsingHeader("Roughness", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
unsigned int textureID = 0;
|
||||
if (material->HasRougness())
|
||||
if (material->HasRoughness())
|
||||
textureID = material->m_Roughness->GetID();
|
||||
if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image5"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec2(2, 2), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1)))
|
||||
{
|
||||
@@ -1506,7 +1524,7 @@ namespace Nuake {
|
||||
if (ImGui::CollapsingHeader("Roughness", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
unsigned int textureID = 0;
|
||||
if (m_SelectedMaterial->HasRougness())
|
||||
if (m_SelectedMaterial->HasRoughness())
|
||||
textureID = m_SelectedMaterial->m_Roughness->GetID();
|
||||
if (ImGui::ImageButtonEx(ImGui::GetCurrentWindow()->GetID("#image5"), (void*)textureID, ImVec2(80, 80), ImVec2(0, 1), ImVec2(1, 0), ImVec2(2, 2), ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1)))
|
||||
{
|
||||
@@ -1564,6 +1582,8 @@ namespace Nuake {
|
||||
Engine::LoadProject(project);
|
||||
|
||||
pInterface.m_CurrentProject = project;
|
||||
|
||||
Engine::GetCurrentWindow()->SetTitle("Nuake Engine - Editing " + project->Name);
|
||||
}
|
||||
|
||||
void OpenScene()
|
||||
@@ -1657,12 +1677,12 @@ namespace Nuake {
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("New scene"))
|
||||
{
|
||||
OpenScene();
|
||||
Engine::LoadScene(Scene::New());
|
||||
m_IsEntitySelected = false;
|
||||
}
|
||||
if (ImGui::MenuItem("Open scene...", "CTRL+SHIFT+O"))
|
||||
{
|
||||
Engine::LoadScene(Scene::New());
|
||||
OpenScene();
|
||||
m_IsEntitySelected = false;
|
||||
}
|
||||
if (ImGui::MenuItem("Save scene", "CTR+SHIFT+L+S"))
|
||||
|
||||
8
Editor/src/GizmoDrawer.h
Normal file
8
Editor/src/GizmoDrawer.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
class GizmoDrawer
|
||||
{
|
||||
void Draw();
|
||||
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user