Improvements

This commit is contained in:
antopilo
2024-09-18 17:10:12 -04:00
parent 67d7865a20
commit 7fc10b4e56
15 changed files with 968 additions and 756 deletions

View File

@@ -10,27 +10,27 @@ public:
float dummyVolume = 1.0f;
void Draw()
{
constexpr int numBus = 6;
if(ImGui::Begin("Audio mixer"))
{
for (int i = 0; i < numBus; i++)
{
const std::string busName = "Bus " + std::to_string(i);
//ImGui::BeginTable(busName.c_str(), 1, 0, ImVec2(300, ImGui::GetContentRegionAvail().y));
//
//ImGui::TableSetupColumn(busName.c_str(), 0, 1.0f);
//ImGui::TableNextColumn ();
//ImGui::TableHeader(busName.c_str());
//ImGui::TableNextColumn();
//
//const float height = ImGui::GetContentRegionAvail().y - 50;
//const std::string id = "##Volume" + std::to_string(i);
//ImGui::VSliderFloat(id.c_str(), ImVec2(50, height), &dummyVolume, -60.0f, 6.0f, "%.3dB", ImGuiSliderFlags_Logarithmic);
//ImGui::TableNextColumn();
//ImGui::EndTable();
}
}
//constexpr int numBus = 6;
//if(ImGui::Begin("Audio mixer"))
//{
// for (int i = 0; i < numBus; i++)
// {
// const std::string busName = "Bus " + std::to_string(i);
// //ImGui::BeginTable(busName.c_str(), 1, 0, ImVec2(300, ImGui::GetContentRegionAvail().y));
// //
// //ImGui::TableSetupColumn(busName.c_str(), 0, 1.0f);
// //ImGui::TableNextColumn ();
// //ImGui::TableHeader(busName.c_str());
// //ImGui::TableNextColumn();
// //
// //const float height = ImGui::GetContentRegionAvail().y - 50;
// //const std::string id = "##Volume" + std::to_string(i);
// //ImGui::VSliderFloat(id.c_str(), ImVec2(50, height), &dummyVolume, -60.0f, 6.0f, "%.3dB", ImGuiSliderFlags_Logarithmic);
// //ImGui::TableNextColumn();
// //ImGui::EndTable();
// }
//}
ImGui::End();
//ImGui::End();
}
};

View File

@@ -261,6 +261,20 @@ namespace Nuake {
modelComponent.ModelResource = modelResource;
entity.GetComponent<TransformComponent>().SetLocalPosition(dragnDropWorldPos);
}
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Map"))
{
char* file = (char*)payload->Data;
std::string fullPath = std::string(file, 256);
fullPath = Nuake::FileSystem::AbsoluteToRelative(fullPath);
auto entity = Engine::GetCurrentScene()->CreateEntity(FileSystem::GetFileNameFromPath(fullPath));
QuakeMapComponent& mapComponent = entity.AddComponent<QuakeMapComponent>();
mapComponent.Path = FileSystem::GetFile(fullPath);
mapComponent.AutoRebuild = true;
mapComponent.HasCollisions = true;
mapComponent.ActionRebuild();
}
}
else
{
@@ -468,31 +482,31 @@ namespace Nuake {
{
if (ImGui::BeginMenuBar())
{
float availWidth = ImGui::GetContentRegionAvail().x;
float windowWidth = ImGui::GetWindowWidth();
float used = windowWidth - availWidth;
float half = windowWidth / 2.0;
float needed = half - used;
//float availWidth = ImGui::GetContentRegionAvail().x;
//float windowWidth = ImGui::GetWindowWidth();
//
//float used = windowWidth - availWidth;
//float half = windowWidth / 2.0;
//float needed = half - used;
//
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2, 2));
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
if (ImGui::Button(ICON_FA_ARROWS_ALT, ImVec2(30, 30)) || Input::IsKeyDown(Key::W))
{
CurrentOperation = ImGuizmo::OPERATION::TRANSLATE;
}
ImGui::SameLine();
if (ImGui::Button(ICON_FA_SYNC_ALT, ImVec2(30, 30)) || Input::IsKeyDown(Key::E))
{
CurrentOperation = ImGuizmo::OPERATION::ROTATE;
}
ImGui::SameLine();
if (ImGui::Button(ICON_FA_EXPAND_ALT, ImVec2(30, 30)) || Input::IsKeyDown(Key::R))
{
CurrentOperation = ImGuizmo::OPERATION::SCALE;
}
ImGui::SameLine();
//if (ImGui::Button(ICON_FA_ARROWS_ALT, ImVec2(30, 30)) || Input::IsKeyDown(Key::W))
//{
// CurrentOperation = ImGuizmo::OPERATION::TRANSLATE;
//}
//ImGui::SameLine();
//if (ImGui::Button(ICON_FA_SYNC_ALT, ImVec2(30, 30)) || Input::IsKeyDown(Key::E))
//{
// CurrentOperation = ImGuizmo::OPERATION::ROTATE;
//}
//ImGui::SameLine();
//if (ImGui::Button(ICON_FA_EXPAND_ALT, ImVec2(30, 30)) || Input::IsKeyDown(Key::R))
//{
// CurrentOperation = ImGuizmo::OPERATION::SCALE;
//}
//ImGui::SameLine();
ImGui::Dummy({ ImGui::GetContentRegionAvail().x / 2.0f - (76.0f / 2.0f), 8.0f });
ImGui::SameLine();
@@ -560,7 +574,12 @@ namespace Nuake {
JobSystem::Get().Dispatch(job, [this]()
{
if (errors.size() > 0)
bool containsError = false;
std::find_if(errors.begin(), errors.end(), [](const CompilationError& error) {
return error.isWarning == false;
});
if (errors.size() > 0 && containsError)
{
SetStatusMessage("Failed to build scripts! See Logger for more info", { 1.0f, 0.1f, 0.1f, 1.0f });
@@ -575,10 +594,17 @@ namespace Nuake {
{
Engine::GetProject()->ExportEntitiesToTrenchbroom();
ImGui::SetWindowFocus("Logger");
SetStatusMessage("Entering play mode...");
PushCommand(SetGameState(GameState::Playing));
for (CompilationError error : errors)
{
const std::string errorMessage = error.file + "( line " + std::to_string(error.line) + "): " + error.message;
Logger::Log(errorMessage, ".net", WARNING);
}
std::string statusMessage = ICON_FA_RUNNING + std::string(" Playing...");
SetStatusMessage(statusMessage.c_str(), Engine::GetProject()->Settings.PrimaryColor);
}
@@ -676,18 +702,33 @@ namespace Nuake {
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2, 2));
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
if (ImGui::Button(ICON_FA_HAMMER, ImVec2(30, 30)))
static bool isBuilding = false;
std::string icon = isBuilding ? ICON_FA_SYNC_ALT : ICON_FA_HAMMER;
if (isBuilding)
{
ImGui::BeginDisabled();
}
if (ImGui::Button(icon.c_str(), ImVec2(30, 30)) && !isBuilding)
{
SetStatusMessage(std::string(ICON_FA_HAMMER)+ " Building solution...", { 0.1f, 0.1f, 1.0f, 1.0f });
auto job = [this]()
{
isBuilding = true;
this->errors = ScriptingEngineNet::Get().BuildProjectAssembly(Engine::GetProject());
};
JobSystem::Get().Dispatch(job, [this]()
{
if (errors.size() > 0)
isBuilding = false;
bool containsError = false;
std::find_if(errors.begin(), errors.end(), [](const CompilationError& error) {
return error.isWarning == false;
});
if (errors.size() > 0 && containsError)
{
SetStatusMessage("Failed to build scripts! See Logger for more info", { 1.0f, 0.1f, 0.1f, 1.0f });
@@ -700,12 +741,25 @@ namespace Nuake {
}
else
{
for (CompilationError error : errors)
{
const std::string errorMessage = error.file + "( line " + std::to_string(error.line) + "): " + error.message;
Logger::Log(errorMessage, ".net", WARNING);
}
Logger::Log("Build Successful!", ".net", VERBOSE);
ScriptingEngineNet::Get().LoadProjectAssembly(Engine::GetProject());
Engine::GetProject()->ExportEntitiesToTrenchbroom();
SetStatusMessage("Build succesful!");
SetStatusMessage("Build Successful!");
}
});
}
if (isBuilding)
{
ImGui::EndDisabled();
}
if (ImGui::BeginItemTooltip())
{
ImGui::Text("Built .Net project");
@@ -821,8 +875,25 @@ namespace Nuake {
parent.Children.push_back(payload_entity);
}
}
else if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_NetScript"))
{
char* file = (char*)payload->Data;
std::string fullPath = std::string(file, 512);
std::string path = Nuake::FileSystem::AbsoluteToRelative(std::move(fullPath));
if (e.HasComponent<NetScriptComponent>())
{
e.GetComponent<NetScriptComponent>().ScriptPath = path;
}
else
{
e.AddComponent<NetScriptComponent>().ScriptPath = path;
}
}
ImGui::EndDragDropTarget();
}
if (!isDragging && ImGui::IsItemHovered() && ImGui::IsMouseReleased(0))
{
@@ -2244,20 +2315,109 @@ namespace Nuake {
{
if (ImGui::Begin("Logger"))
{
if (ImGui::Button("Clear Logs"))
if (ImGui::Button("Clear"))
{
Logger::ClearLogs();
SetStatusMessage("Logs cleared.");
}
ImGui::SameLine();
ImGui::Checkbox("Errors", &LogErrors);
if (ImGui::BeginMenu("Edit"))
{
if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
ImGui::Separator();
if (ImGui::MenuItem("Project Settings", ""))
{
}
ImGui::EndMenu();
}
ImGui::SameLine();
ImGui::Checkbox("Warning", &LogWarnings);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2, 2));
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 100);
bool isEnabled = LogErrors;
if (isEnabled)
{
Color color = Engine::GetProject()->Settings.PrimaryColor;
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_BAN, ImVec2(30, 28)))
{
LogErrors = !LogErrors;
}
UI::Tooltip("Display Errors");
if (isEnabled)
{
ImGui::PopStyleColor();
}
ImGui::SameLine();
ImGui::Checkbox("Debug", &LogDebug);
isEnabled = LogWarnings;
if (isEnabled)
{
Color color = Engine::GetProject()->Settings.PrimaryColor;
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_EXCLAMATION_TRIANGLE, ImVec2(30, 28)))
{
LogWarnings = !LogWarnings;
}
UI::Tooltip("Display Warnings");
if (isEnabled)
{
ImGui::PopStyleColor();
}
ImGui::SameLine();
ImGui::Checkbox("Autoscroll", &AutoScroll);
isEnabled = LogDebug;
if (isEnabled)
{
Color color = Engine::GetProject()->Settings.PrimaryColor;
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_INFO, ImVec2(30, 28)))
{
LogDebug = !LogDebug;
}
UI::Tooltip("Display Verbose");
if (isEnabled)
{
ImGui::PopStyleColor();
}
ImGui::SameLine();
isEnabled = AutoScroll;
if (isEnabled)
{
Color color = Engine::GetProject()->Settings.PrimaryColor;
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_ARROW_DOWN, ImVec2(30, 28)))
{
AutoScroll = !AutoScroll;
}
UI::Tooltip("Auto-Scroll");
if (isEnabled)
{
ImGui::PopStyleColor();
}
ImGui::PopStyleColor();
ImGui::PopStyleVar(2);
//ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
//if (ImGui::BeginChild("Log window", ImGui::GetContentRegionAvail(), false))
//{
@@ -2471,7 +2631,7 @@ namespace Nuake {
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_ARROWS_ALT, ImVec2(30, 28)) || Input::IsKeyDown(Key::W))
if (ImGui::Button(ICON_FA_ARROWS_ALT, ImVec2(30, 28)) || (ImGui::Shortcut(ImGuiKey_W, 0, ImGuiInputFlags_RouteGlobalLow) && !ImGui::IsAnyItemActive() && !isControllingCamera))
{
CurrentOperation = ImGuizmo::OPERATION::TRANSLATE;
}
@@ -2492,7 +2652,7 @@ namespace Nuake {
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_SYNC_ALT, ImVec2(30, 28)) || Input::IsKeyDown(Key::E))
if (ImGui::Button(ICON_FA_SYNC_ALT, ImVec2(30, 28)) || (ImGui::Shortcut(ImGuiKey_E, 0, ImGuiInputFlags_RouteGlobalLow) && !ImGui::IsAnyItemActive() && !isControllingCamera))
{
CurrentOperation = ImGuizmo::OPERATION::ROTATE;
}
@@ -2513,7 +2673,7 @@ namespace Nuake {
ImGui::PushStyleColor(ImGuiCol_Button, { color.r, color.g, color.b, 1.0f });
}
if (ImGui::Button(ICON_FA_EXPAND_ALT, ImVec2(30, 28)) || Input::IsKeyDown(Key::R))
if (ImGui::Button(ICON_FA_EXPAND_ALT, ImVec2(30, 28)) || (ImGui::Shortcut(ImGuiKey_R, 0, ImGuiInputFlags_RouteGlobalLow) && !ImGui::IsAnyItemActive() && !isControllingCamera))
{
CurrentOperation = ImGuizmo::OPERATION::SCALE;
}
@@ -2573,6 +2733,7 @@ namespace Nuake {
ImGui::PushItemWidth(75);
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 6, 6 });
ImGui::DragFloat("##snapping", &CurrentSnapping.x, 0.01f, 0.0f, 100.0f);
CurrentSnapping = { CurrentSnapping.x, CurrentSnapping.x, CurrentSnapping.z };
ImGui::PopStyleVar();
ImGui::PopItemWidth();
@@ -2651,8 +2812,8 @@ namespace Nuake {
const float camSpeed = editorCam->Speed;
const float maxSpeed = 50.0f;
const float minSpeed = 0.1f;
const float normalizedSpeed = glm::clamp(camSpeed / maxSpeed, 0.0f, 1.0f);
const float minSpeed = 0.05f;
const float normalizedSpeed = glm::clamp((camSpeed / maxSpeed), 0.0f, 1.0f);
ImVec2 start = ImGui::GetWindowPos() - ImVec2(0.0, 4.0) ;
ImVec2 end = start + ImGui::GetWindowSize() - ImVec2(0, 16.0);
@@ -3081,13 +3242,13 @@ namespace Nuake {
// Shortcuts
if(ImGui::IsKeyDown(ImGuiKey_LeftCtrl))
{
if(ImGui::IsKeyPressed(ImGuiKey_S))
if(ImGui::IsKeyPressed(ImGuiKey_S, false))
{
Engine::GetProject()->Save();
Engine::GetCurrentScene()->Save();
}
else if(ImGui::IsKeyPressed(ImGuiKey_O))
else if(ImGui::IsKeyPressed(ImGuiKey_O, false))
{
OpenScene();
@@ -3131,7 +3292,7 @@ namespace Nuake {
DrawStatusBar();
pInterface.DrawEntitySettings();
//pInterface.DrawEntitySettings();
DrawViewport();
DrawSceneTree();
SelectionPanel.Draw(Selection);
@@ -3187,7 +3348,7 @@ namespace Nuake {
}
auto& editorCam = Engine::GetCurrentScene()->m_EditorCamera;
editorCam->Update(ts, m_IsHoveringViewport && m_IsViewportFocused);
isControllingCamera = editorCam->Update(ts, m_IsHoveringViewport && m_IsViewportFocused);
const bool entityIsSelected = Selection.Type == EditorSelectionType::Entity && Selection.Entity.IsValid();
if (editorCam->IsFlying() && entityIsSelected && Input::IsKeyPressed(Key::F))

View File

@@ -34,6 +34,7 @@ namespace Nuake
Ref<Scene> SceneSnapshot;
static NuakeEditor::CommandBuffer* mCommandBuffer;
bool isControllingCamera = false;
bool m_DrawGrid = false;
bool m_DrawAxis = true;
bool m_ShowImGuiDemo = false;

View File

@@ -41,6 +41,7 @@ EditorSelectionPanel::EditorSelectionPanel()
RegisterTypeDrawer<bool, &EditorSelectionPanel::DrawFieldTypeBool>(this);
RegisterTypeDrawer<float, &EditorSelectionPanel::DrawFieldTypeFloat>(this);
RegisterTypeDrawer<Vector2, &EditorSelectionPanel::DrawFieldTypeVector2>(this);
RegisterTypeDrawer<Vector3, &EditorSelectionPanel::DrawFieldTypeVector3>(this);
RegisterTypeDrawer<std::string, &EditorSelectionPanel::DrawFieldTypeString>(this);
RegisterTypeDrawer<ResourceFile, &EditorSelectionPanel::DrawFieldTypeResourceFile>(this);
@@ -722,7 +723,7 @@ void EditorSelectionPanel::DrawFieldTypeVector3(entt::meta_data& field, entt::me
std::string controlId = std::string("##") + displayName;
ImGui::PushID(controlId.c_str());
if (ImGuiHelper::DrawVec3("BoxSize", vec3Ptr, 0.5f, 100.0, 0.01f))
if (ImGuiHelper::DrawVec3(controlId, vec3Ptr, 0.5f, 100.0, 0.01f))
{
field.set(component, *vec3Ptr);
}
@@ -731,6 +732,31 @@ void EditorSelectionPanel::DrawFieldTypeVector3(entt::meta_data& field, entt::me
}
}
void EditorSelectionPanel::DrawFieldTypeVector2(entt::meta_data& field, entt::meta_any& component)
{
auto prop = field.prop(HashedName::DisplayName);
auto propVal = prop.value();
const char* displayName = *propVal.try_cast<const char*>();
if (displayName != nullptr)
{
ImGui::Text(displayName);
ImGui::TableNextColumn();
auto fieldVal = field.get(component);
Vector2* vec2Ptr = fieldVal.try_cast<Vector2>();
std::string controlId = std::string("##") + displayName;
ImGui::PushID(controlId.c_str());
if (ImGuiHelper::DrawVec2(controlId, vec2Ptr, 0.5f, 100.0, 0.01f))
{
field.set(component, *vec2Ptr);
}
ImGui::PopID();
}
}
void EditorSelectionPanel::DrawFieldTypeString(entt::meta_data& field, entt::meta_any& component)
{
auto prop = field.prop(HashedName::DisplayName);

View File

@@ -88,6 +88,7 @@ private:
void DrawFieldTypeFloat(entt::meta_data& field, entt::meta_any& component);
void DrawFieldTypeBool(entt::meta_data& field, entt::meta_any& component);
void DrawFieldTypeVector2(entt::meta_data& field, entt::meta_any& component);
void DrawFieldTypeVector3(entt::meta_data& field, entt::meta_any& component);
void DrawFieldTypeString(entt::meta_data& field, entt::meta_any& component);
void DrawFieldTypeResourceFile(entt::meta_data& field, entt::meta_any& component);

View File

@@ -9,12 +9,12 @@ 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();
//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

@@ -77,6 +77,7 @@ namespace Nuake
{
auto window = Window::Get()->GetHandle();
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NoMouse;
}
bool Input::IsMouseHidden()
@@ -89,6 +90,7 @@ namespace Nuake
{
auto window = Window::Get()->GetHandle();
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
}
// Action

View File

@@ -94,8 +94,6 @@ void FileSystem::SetRootDirectory(const std::string path)
return;
}
Logger::Log(normalizedPath + " event: " + filewatch::event_to_string(event), "filewatcher", VERBOSE);
if (event == filewatch::Event::modified)
{
file->SetHasBeenModified(true);

View File

@@ -67,7 +67,7 @@ namespace Nuake
Matrix4 Camera::GetPerspective()
{
//TODO: Add perspective options
m_Perspective = glm::perspectiveFov(glm::radians(Fov), 9.0f * AspectRatio, 9.0f, 0.001f, 1000.0f);
m_Perspective = glm::perspectiveFov(glm::radians(Fov), 9.0f * AspectRatio, 9.0f, 0.001f, 500.0f);
return m_Perspective;
}

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
namespace Nuake
{
void EditorCamera::Update(Timestep ts, const bool hover)
bool EditorCamera::Update(Timestep ts, const bool hover)
{
if (IsMoving)
{
@@ -28,6 +28,7 @@ namespace Nuake
const float y = Input::GetMouseY();
m_IsFlying = Input::IsMouseButtonDown(1) || Input::IsMouseButtonDown(2);
const bool isPressingMouse = m_IsFlying || Input::YScroll != 0.0f;
if (hover)
@@ -74,7 +75,7 @@ namespace Nuake
Input::YScroll = 0.0f;
}
return;
return true;
}
// Keyboard
@@ -194,6 +195,8 @@ namespace Nuake
mouseLastX = x;
mouseLastY = y;
return controlled;
}
Ref<EditorCamera> EditorCamera::Copy()

View File

@@ -20,7 +20,7 @@ namespace Nuake
Translation = Vector3(2, 2, 2);
}
void Update(Timestep ts, const bool hover);
bool Update(Timestep ts, const bool hover);
Vector3 TargetPos = Vector3(0, 0, 0);
bool IsMoving = false;

View File

@@ -111,12 +111,16 @@ namespace Nuake
{
int lineNum = std::stoi(lineCharNums[0]);
int charNum = std::stoi(lineCharNums[1]);
bool isWarning = false;
// error message
std::string errMesg = "";
int i = 0;
for (auto s : String::Split(line, ':'))
{
if (String::BeginsWith(String::RemoveWhiteSpace(s), "warning"))
{
isWarning = true;
}
if (i >= 3)
{
errMesg += s;
@@ -128,6 +132,7 @@ namespace Nuake
compilationError.message = errMesg;
compilationError.file = filePath;
compilationError.line = lineNum;
compilationError.isWarning = isWarning;
errors.push_back(compilationError);
}
@@ -334,7 +339,6 @@ namespace Nuake
}
std::string result = OS::CompileSln(FileSystem::Root + sanitizedProjectName + ".sln");
return ExtractErrors(result);
//if (errors.size() > 0)
//{

View File

@@ -69,6 +69,7 @@ namespace Nuake
std::string file;
int line;
std::string message;
bool isWarning;
};
class ScriptingEngineNet

View File

@@ -158,6 +158,7 @@ float SampleShadowMap(sampler2D shadowMap, vec2 coords, float compare)
float SampleShadowMapLinear(sampler2D shadowMap, vec2 coords, float compare, vec2 texelSize)
{
//return SampleShadowMap(shadowMap, coords.xy, compare);
vec2 pixelPos = coords / texelSize + vec2(0.5);
vec2 fracPart = fract(pixelPos);
vec2 startTexel = (pixelPos - fracPart) * texelSize;
@@ -195,12 +196,14 @@ float ShadowCalculation(vec3 FragPos, vec3 normal)
float bias = max(0.005 * (1.0 - dot(normal, u_DirectionalLight.Direction)), 0.0005);
//float pcfDepth = texture(ShadowMaps[shadowmap], vec3(projCoords.xy, currentDepth), bias);
//return SampleShadowMap(ShadowMaps[shadowmap], projCoords.xy, currentDepth - bias);
if (shadowmap <= 4)
{
const float NUM_SAMPLES = 4.f;
const float SAMPLES_START = (NUM_SAMPLES - 1.0f) / 2.0f;
const float NUM_SAMPLES_SQUARED = NUM_SAMPLES * NUM_SAMPLES;
vec2 texelSize = 1.0 / vec2(4096, 4096);
vec2 texelSize = 1.0 / vec2(2048, 2048);
float result = 0.0f;
for (float y = -SAMPLES_START; y <= SAMPLES_START; y += 1.0f)
@@ -214,7 +217,6 @@ float ShadowCalculation(vec3 FragPos, vec3 normal)
return result / NUM_SAMPLES_SQUARED;
}
else
{
return SampleShadowMap(ShadowMaps[shadowmap], projCoords.xy, currentDepth - bias);