This commit is contained in:
Antoine Pilote
2023-09-18 08:38:26 -04:00
25 changed files with 456 additions and 80 deletions

View File

@@ -27,5 +27,5 @@ void main()
vec4 a = texture(u_Source, UV);
vec4 b = texture(u_Source2, UV);
FragColor = vec4(vec3(a.rgb + b.rgb / 2.0), a.a * b.a);
FragColor = vec4(vec3(a.rgb + (b.rgb) / 2.0), a.a);
}

View File

@@ -180,7 +180,7 @@ float ShadowCalculation(Light light, vec3 FragPos, vec3 normal)
float bias = max(0.005 * (1.0 - dot(normal, light.Direction)), 0.0005);
//float pcfDepth = texture(ShadowMaps[shadowmap], vec3(projCoords.xy, currentDepth), bias);
if (shadowmap <= 3)
if (shadowmap <= 4)
{
const float NUM_SAMPLES = 4.f;
const float SAMPLES_START = (NUM_SAMPLES - 1.0f) / 2.0f;
@@ -272,7 +272,7 @@ void main()
// scale light by NdotL
float NdotL = max(dot(N, L), 0.0);
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
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
}
/// ambient lighting (we now use IBL as the ambient term)
@@ -282,7 +282,7 @@ void main()
vec3 kD = 1.0 - kS;
kD *= 1.0 - metallic;
vec3 ambient = (kD * albedo) * (ao) * ssao;
vec3 ambient = (vec3(0.5) * albedo) * (ao)*ssao;
vec3 color = (ambient) + Lo;
// Display CSM splits..

View File

@@ -0,0 +1,45 @@
#shader vertex
#version 460 core
layout(location = 0) in vec3 Position;
layout(location = 1) in vec2 UVPosition;
layout(location = 2) in vec3 Normal;
layout(location = 3) in vec3 Tangent;
layout(location = 4) in vec3 Bitangent;
layout(location = 5) in ivec4 BoneIDs;
layout(location = 6) in vec4 Weights;
uniform mat4 u_LightTransform;
const int MAX_BONES = 200;
const int MAX_BONES_INFLUENCE = 4;
uniform mat4 u_FinalBonesMatrice[MAX_BONES];
void main()
{
vec4 totalPosition = vec4(0.0f);
for (int i = 0; i < MAX_BONES_INFLUENCE; i++)
{
if (BoneIDs[i] == -1)
{
continue;
}
if (BoneIDs[i] >= MAX_BONES)
{
totalPosition = vec4(Position, 1.0f);
break;
}
vec4 localPosition = u_FinalBonesMatrice[BoneIDs[i]] * vec4(Position, 1.0f);
totalPosition += localPosition * Weights[i];
// vec3 localNormal = mat3(u_FinalBonesMatrice[BoneIDs[i]]) * Normal;
}
gl_Position = u_LightTransform * totalPosition;
}
#shader fragment
#version 460 core
void main() { }

View File

@@ -46,6 +46,7 @@
#include "src/Rendering/SceneRenderer.h"
#include <dependencies/glfw/include/GLFW/glfw3.h>
#include <src/Rendering/Buffers/Framebuffer.h>
#include "UIDemoWindow.h"
namespace Nuake {
Ref<UI::UserInterface> userInterface;
@@ -1544,6 +1545,7 @@ namespace Nuake {
bool isLoadingProject = false;
bool isLoadingProjectQueue = false;
UIDemoWindow m_DemoWindow;
int frameCount = 2;
void EditorInterface::Draw()
@@ -1610,6 +1612,8 @@ namespace Nuake {
pInterface.m_CurrentProject = Engine::GetProject();
m_DemoWindow.Draw();
_audioWindow->Draw();
DrawMenuBar();

View File

@@ -62,9 +62,9 @@ namespace Nuake
void FileSystemUI::DrawDirectory(Ref<Directory> directory, uint32_t drawId)
{
ImGui::PushFont(FontManager::GetFont(Icons));
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.0f);
const char* icon = ICON_FA_FOLDER;
const std::string id = ICON_FA_FOLDER + std::string("##") + directory->name;
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.0f);
if (ImGui::Button(id.c_str(), ImVec2(100, 100)))
{
m_CurrentDirectory = directory;

View File

@@ -0,0 +1,20 @@
#include "UIDemoWindow.h"
#include "src/UI/ImUI.h"
float floatSlider = 0.6f;
bool checkbox = false;
void UIDemoWindow::Draw()
{
using namespace Nuake;
UI::BeginWindow("UI Demo");
{
UI::PrimaryButton("Primary Button");
UI::SecondaryButton("Secondary Button");
UI::FloatSlider("Float slider", floatSlider);
UI::CheckBox("Checkbox", checkbox);
}
UI::EndWindow();
}

View File

@@ -0,0 +1,13 @@
#pragma once
class UIDemoWindow
{
public:
UIDemoWindow() = default;
~UIDemoWindow() = default;
void Draw();
};