diff --git a/Nuake/src/Core/Input.cpp b/Nuake/src/Core/Input.cpp index b5cd1db5..47e8e115 100644 --- a/Nuake/src/Core/Input.cpp +++ b/Nuake/src/Core/Input.cpp @@ -121,7 +121,6 @@ namespace Nuake { auto window = Window::Get()->GetHandle(); auto state = glfwGetMouseButton(window, button); - return state == GLFW_RELEASE && m_MouseButtons[button] == true; } diff --git a/Nuake/src/Core/Physics/CharacterController.cpp b/Nuake/src/Core/Physics/CharacterController.cpp index 93c8518c..ddcd671c 100644 --- a/Nuake/src/Core/Physics/CharacterController.cpp +++ b/Nuake/src/Core/Physics/CharacterController.cpp @@ -29,38 +29,6 @@ namespace Nuake { PhysicsManager::Get().GetWorld()->MoveAndSlideCharacterController(Owner, velocity); } - - void CharacterController::ParseGhostContacts() - { - - } - - void CharacterController::UpdatePosition() - { - - - } - - void CharacterController::UpdateVelocity() - { - // Decelerate - //m_manualVelocity -= m_manualVelocity * m_deceleration * m_pPhysicsWorld->GetScene()->m_frameTimer.GetTimeMultiplier(); - - if (m_hittingWall) - { - for (size_t i = 0, size = m_surfaceHitNormals.size(); i < size; i++) - { - // Cancel velocity across normal - glm::vec3 velInNormalDir(glm::reflect(m_manualVelocity, m_surfaceHitNormals[i])); - - // Apply correction - m_manualVelocity -= velInNormalDir * 1.05f; - } - - // Do not adjust rigid body velocity manually (so bodies can still be pushed by character) - return; - } - } } } diff --git a/Nuake/src/Core/Physics/CharacterController.h b/Nuake/src/Core/Physics/CharacterController.h index 791ee773..b4bf99ab 100644 --- a/Nuake/src/Core/Physics/CharacterController.h +++ b/Nuake/src/Core/Physics/CharacterController.h @@ -42,11 +42,6 @@ namespace Nuake { return IsOnGround; } - - private: - void ParseGhostContacts(); - void UpdatePosition(); - void UpdateVelocity(); }; } } diff --git a/Nuake/src/Scene/Components/LightComponent.cpp b/Nuake/src/Scene/Components/LightComponent.cpp index bbc00d16..42b69d47 100644 --- a/Nuake/src/Scene/Components/LightComponent.cpp +++ b/Nuake/src/Scene/Components/LightComponent.cpp @@ -7,25 +7,13 @@ #include "src/Core/Core.h" #include -namespace Nuake { - LightComponent::LightComponent() +namespace Nuake +{ + LightComponent::LightComponent() : + Color(1, 1, 1), + Strength(10.0f), + Direction(0, 1, 0) { - Color = glm::vec3(1, 1, 1); - Strength = 10.0f; - Direction = glm::vec3(0, -1, 0); - - - //m_Framebuffers = std::vector>(); - //mViewProjections = std::vector(); - //mCascadeSplitDepth = std::vector(); - //mCascadeSplits = std::vector(); - // Framebuffer used for shadow mapping. - - //for (int i = 0; i < 4; i++) - //{ - // m_Framebuffers[i] = CreateRef(false, glm::vec2(4096, 4096)); - // m_Framebuffers[i]->SetTexture(CreateRef(glm::vec2(4096, 4096), GL_DEPTH_COMPONENT), GL_DEPTH_ATTACHMENT); - //} } void LightComponent::SetCastShadows(bool toggle) @@ -42,7 +30,8 @@ namespace Nuake { } } - else { + else + { for (int i = 0; i < CSM_AMOUNT; i++) { m_Framebuffers[i] = nullptr; @@ -55,87 +44,8 @@ namespace Nuake { return glm::ortho(-25.0f, 25.0f, -25.0f, 25.0f, -25.0f, 25.0f); } - void LightComponent::SetDirection(glm::vec3 dir) + Vector3 LightComponent::GetDirection() { - - } - - glm::vec3 LightComponent::GetDirection() - { - //glm::mat4 start = glm::mat4(1.0f); - //glm::vec3 defaultDirection(0, 0, 1); // forward - // - //start = glm::rotate(start, glm::radians(Direction.x), glm::vec3(1, 0, 0)); - //start = glm::rotate(start, glm::radians(Direction.y), glm::vec3(0, 1, 0)); - //start = glm::rotate(start, glm::radians(Direction.z), glm::vec3(0, 0, 1)); - - //return glm::vec3(start * glm::vec4(defaultDirection, 1.0f)); return glm::normalize(Direction); } - - - void LightComponent::BeginDrawShadow() - { - Renderer::m_ShadowmapShader->Bind(); - //m_Framebuffer->Bind(); - - // Render scene... - - } - - void LightComponent::EndDrawShadow() - { - //m_Framebuffer->Unbind(); - } - - void LightComponent::DrawShadow() - { - if (Type != Directional) - return; - - Renderer::m_ShadowmapShader->Bind(); - } - - void LightComponent::DrawEditor() { - ImGui::TextColored(ImGui::GetStyleColorVec4(1), "Light properties"); - ImGui::ColorEdit3("Light Color", &Color.r); - ImGui::SliderFloat("Strength", &Strength, 0.0f, 50.0f); - bool before = CastShadows; - ImGui::Checkbox("Cast shadows", &CastShadows); - - if (CastShadows && before == false) - SetCastShadows(true); - - const char* types[] = { "Directional", "Point", "Spot" }; - static const char* current_item = types[Type]; - - if (ImGui::BeginCombo("Type", current_item)) // The second parameter is the label previewed before opening the combo. - { - for (int n = 0; n < IM_ARRAYSIZE(types); n++) - { - bool is_selected = (current_item == types[n]); // You can store your selection however you want, outside or inside your objects - if (ImGui::Selectable(types[n], is_selected)) { - current_item = types[n]; - Type = (LightType)n; - } - if (is_selected) - ImGui::SetItemDefaultFocus(); // You may set the initial focus when opening the combo (scrolling + for keyboard navigation support) - } - ImGui::EndCombo(); - } - - if (Type == Directional) { - ImGui::Checkbox("Sync with sky", &SyncDirectionWithSky); - ImGui::Checkbox("Volumetric?", &IsVolumetric); - ImGuiHelper::DrawVec3("Direction", &Direction); - } - - //if (Type == 1) { - // ImGui::SliderFloat("Attenuation", &Attenuation, 0.0f, 1.0f); - // ImGui::SliderFloat("Linear attenuation", &LinearAttenuation, 0.0f, 1.0f); - // ImGui::SliderFloat("Quadratic attenuation", &QuadraticAttenuation, 0.0f, 1.0f); - //} - - //Direction = glm::normalize(Direction); - } }