diff --git a/Source/Core/Editor/Windows/GUI_Window_ObjectProperties/GUI_Window_ObjectProperties.cpp b/Source/Core/Editor/Windows/GUI_Window_ObjectProperties/GUI_Window_ObjectProperties.cpp index 21256c3aa6..e9c1484fff 100644 --- a/Source/Core/Editor/Windows/GUI_Window_ObjectProperties/GUI_Window_ObjectProperties.cpp +++ b/Source/Core/Editor/Windows/GUI_Window_ObjectProperties/GUI_Window_ObjectProperties.cpp @@ -293,8 +293,18 @@ void GUI_Window_ObjectProperties::Draw() { ImGui::SameLine(); ImGui::HelpMarker("Sets the maximum distance after which geometry is ignored."); + ImGui::Spacing(); + + ImGui::SliderInt("Asset Streaming Priority", &Camera->StreamingPriority_, 0, 10); + ImGui::SameLine(); + ImGui::HelpMarker("Sets the priority of the camera on a scale from 1-10."); + + + ImGui::Spacing(); + + ImGui::Checkbox("Enforce Aspect Ratio", &Camera->EnforceAspectRatio_); ImGui::SameLine(); ImGui::HelpMarker("Manually override the camera's aspect ratio. Will cause letterboxing if the ratios don't match."); @@ -368,16 +378,8 @@ void GUI_Window_ObjectProperties::Draw() { } ImGui::EndChild(); - - - - } - - - - } // End System Controls Window @@ -385,8 +387,6 @@ void GUI_Window_ObjectProperties::Draw() { } - - } diff --git a/Source/Core/Editor/Windows/GUI_Window_RenderingSettings/GUI_Window_RenderingSettings.cpp b/Source/Core/Editor/Windows/GUI_Window_RenderingSettings/GUI_Window_RenderingSettings.cpp index 22d3b04f45..2bfeb1b58f 100644 --- a/Source/Core/Editor/Windows/GUI_Window_RenderingSettings/GUI_Window_RenderingSettings.cpp +++ b/Source/Core/Editor/Windows/GUI_Window_RenderingSettings/GUI_Window_RenderingSettings.cpp @@ -143,12 +143,6 @@ void GUI_Window_RenderingSettings::Draw() { } } - // FOV Slider - ImGui::SliderFloat("FOV", &Settings->FOV_, 0.0f, 180.0f); - - - - ImGui::Separator(); ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f), "Shadow Maps"); diff --git a/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_AssetStreamingManager.cpp b/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_AssetStreamingManager.cpp index c8417444e7..ed8ed78b6b 100644 --- a/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_AssetStreamingManager.cpp +++ b/Source/Core/Loader/ERS_ModelLoader/ERS_CLASS_AssetStreamingManager.cpp @@ -273,6 +273,7 @@ std::map ERS_CLASS_AssetStreamingManager::CalculateCameraMaxU for (unsigned int i = 0; i < Cameras.size(); i++) { TotalCameraPriorities += Cameras[i]->GetStreamingPriority(); } + TotalCameraPriorities = std::max(1, TotalCameraPriorities); // Calculate Percentage Of Total Updates Each Camera Should Have std::vector CameraUpdatePercentages; diff --git a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp index 4d478c09ac..18e0eb2285 100644 --- a/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp +++ b/Source/Core/Renderer/ERS_CLASS_VisualRenderer/ERS_CLASS_VisualRenderer.cpp @@ -66,6 +66,26 @@ void ERS_CLASS_VisualRenderer::UpdateViewports(float DeltaTime, ERS_CLASS_SceneM ProjectUtils_->ModelLoader_->AssetStreamingManager_->UpdateSceneStreamingQueue(SceneManager->Scenes_[SceneManager->ActiveScene_].get(), Cameras); + // // Update Camera Location If System Running + // if (!IsEditorMode_ && Index == 0 && Scene->ActiveSceneCameraIndex != -1) { + // Viewport->Camera->SetPosition(Scene->SceneCameras[Scene->ActiveSceneCameraIndex]->Pos_); + // Viewport->Camera->SetRotation(Scene->SceneCameras[Scene->ActiveSceneCameraIndex]->Rot_); + // } + + // Apply Scene Camera Transforms + ERS_STRUCT_Scene* Scene = ProjectUtils_->SceneManager_->Scenes_[ProjectUtils_->SceneManager_->ActiveScene_].get(); + if (!IsEditorMode_ && Scene->ActiveSceneCameraIndex != -1) { + ERS_STRUCT_Camera* Camera = Viewports_[0]->Camera.get(); + ERS_STRUCT_SceneCamera* SceneCamera = Scene->SceneCameras[Scene->ActiveSceneCameraIndex].get(); + if (SceneCamera->EnforceAspectRatio_) { + Camera->SetAspectRatio(SceneCamera->AspectRatio_); + } + Camera->SetClipBoundries(SceneCamera->NearClip_, SceneCamera->FarClip_); + Camera->SetFOV(SceneCamera->FOV_); + Camera->SetPosition(SceneCamera->Pos_); + Camera->SetRotation(SceneCamera->Rot_); + Camera->SetStreamingPriority(SceneCamera->StreamingPriority_); + } // Set Depth Shader For Shadow System DepthMapShader_ = Shaders_[ERS_FUNCTION_FindShaderByName(std::string("_DepthMap"), &Shaders_)].get(); @@ -324,10 +344,7 @@ void ERS_CLASS_VisualRenderer::UpdateViewport(int Index, ERS_CLASS_SceneManager* bool MouseXInRange = (MousePositionX >= WindowTopLeftCornerX) && (MousePositionX < WindowBottomRightCornerX); bool MouseYInRange = (MousePositionY >= WindowTopLeftCornerY) && (MousePositionY < WindowBottomRightCornerY); bool MouseInRange = MouseXInRange && MouseYInRange; - - // Update FOV - Viewport->Camera->SetFOV(SystemUtils_->RendererSettings_->FOV_); // Check If Input Enabled bool EnableCameraMovement = !Cursors3D_->IsUsing(); @@ -445,12 +462,12 @@ void ERS_CLASS_VisualRenderer::UpdateViewport(int Index, ERS_CLASS_SceneManager* } - // Update Camera Location If System Running - if (!IsEditorMode_ && Index == 0 && Scene->ActiveSceneCameraIndex != -1) { - Viewport->Camera->SetPosition(Scene->SceneCameras[Scene->ActiveSceneCameraIndex]->Pos_); - Viewport->Camera->SetRotation(Scene->SceneCameras[Scene->ActiveSceneCameraIndex]->Rot_); + // // Update Camera Location If System Running + // if (!IsEditorMode_ && Index == 0 && Scene->ActiveSceneCameraIndex != -1) { + // Viewport->Camera->SetPosition(Scene->SceneCameras[Scene->ActiveSceneCameraIndex]->Pos_); + // Viewport->Camera->SetRotation(Scene->SceneCameras[Scene->ActiveSceneCameraIndex]->Rot_); - } + // } // Render diff --git a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.cpp b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.cpp index 02bafdf09c..8805d32a4a 100644 --- a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.cpp +++ b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.cpp @@ -13,65 +13,6 @@ ERS_STRUCT_Camera::~ERS_STRUCT_Camera() { } -// // Callbacks -// void ERS_STRUCT_Camera::ProcessKeyboard(CameraMovement Direction, float DeltaTime) { - -// // Calculate Velocity -// float Velocity = MovementSpeed_ * DeltaTime; - -// // Update Position(s) -// if (Direction == FORWARD) -// Position_ += Front_ * Velocity; -// if (Direction == BACKWARD) -// Position_ -= Front_ * Velocity; -// if (Direction == LEFT) -// Position_ -= Right_ * Velocity; -// if (Direction == RIGHT) -// Position_ += Right_ * Velocity; -// if (Direction == UP) -// Position_ += Up_ * Velocity; -// if (Direction == DOWN) -// Position_ -= Up_ * Velocity; - -// } -// void ERS_STRUCT_Camera::ProcessMouseMovement(float XOffset, float YOffset, GLboolean ConstrainPitch) { - -// // Change Offset By Sensitivity -// XOffset *= MouseSensitivity_; -// YOffset *= MouseSensitivity_; - -// // Update Pitch/Yaw -// Orientation_.y += XOffset; -// Orientation_.p += YOffset; - - - -// // Bound Pitch -// if (ConstrainPitch) { - -// if (Orientation_.p > 89.0f) { -// Orientation_.p = 89.0f; -// } -// if (Orientation_.p < -89.0f) { -// Orientation_.p = -89.0f; -// } -// } - -// } -// void ERS_STRUCT_Camera::ProcessMouseScroll(float YOffset) { - -// // Update Movement Speed -// MovementSpeed_ += (MovementSpeed_*(float)YOffset/10.0f); - -// // Adjust Movement Speed -// if (MovementSpeed_ < MinMovementSpeed_) -// MovementSpeed_ = MinMovementSpeed_; -// if (MovementSpeed_ > MaxMovementSpeed_) -// MovementSpeed_ = MaxMovementSpeed_; - -// } - - // Update Matricies void ERS_STRUCT_Camera::Update() { @@ -109,23 +50,6 @@ void ERS_STRUCT_Camera::GetClipBoundires(float &NearClip, float &FarClip) { NearClip = NearClip_; FarClip = FarClip_; } -// void ERS_STRUCT_Camera::SetMovementSpeedBoundries(float MinSpeed, float MaxSpeed) { -// MinMovementSpeed_ = MinSpeed; -// MaxMovementSpeed_ = MaxSpeed; -// } -// void ERS_STRUCT_Camera::GetMovementSpeedBoundries(float &MinSpeed, float &MaxSpeed) { -// MinSpeed = MinMovementSpeed_; -// MaxSpeed = MaxMovementSpeed_; -// } -// void ERS_STRUCT_Camera::SetMovementSpeed(float Speed, bool EnforceSpeedBoundries) { -// if (EnforceSpeedBoundries) { -// Speed = std::max(MinMovementSpeed_, Speed); -// Speed = std::min(MaxMovementSpeed_, Speed); -// MovementSpeed_ = Speed; -// } else { -// MovementSpeed_ = Speed; -// } -// } void ERS_STRUCT_Camera::SetFOV(float FOV) { FOV_ = FOV; } @@ -138,12 +62,6 @@ float ERS_STRUCT_Camera::GetFOV() { void ERS_STRUCT_Camera::SetAspectRatio(float AspectRatio) { AspectRatio_ = AspectRatio; } -// void ERS_STRUCT_Camera::GetMouseSensitivity(float &Sensitivity) { -// Sensitivity = MouseSensitivity_; -// } -// void ERS_STRUCT_Camera::SetMouseSensitivity(float Sensitivity) { -// MouseSensitivity_ = Sensitivity; -// } void ERS_STRUCT_Camera::SetRotation(glm::vec3 Rotation) { Orientation_ = Rotation; } diff --git a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h index 50bca23d25..dde6d55b2c 100644 --- a/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h +++ b/Source/Core/Structures/ERS_STRUCT_Camera/ERS_STRUCT_Camera.h @@ -55,32 +55,6 @@ struct ERS_STRUCT_Camera { ~ERS_STRUCT_Camera(); - - // /** - // * @brief Processes keyboard input for the camera. - // * - // * @param Direction Direction currently being pressed. - // * @param DeltaTime Frame time used to ensure speed isn't tied to framerate - // */ - // void ProcessKeyboard(CameraMovement Direction, float DeltaTime); - - // /** - // * @brief Processed mouse movement across the camera's viewport. - // * - // * @param XOffset Pixels moved in the x direction - // * @param Yoffset Pixels moved in the y direction - // * @param ConstrainPitch Stops the camera from turning above/bleow vertical - // */ - // void ProcessMouseMovement(float XOffset, float Yoffset, GLboolean ConstrainPitch = true); - - // /** - // * @brief Handles the mouse scrolling inputs - // * - // * @param YOffset mouse scroll amount - // */ - // void ProcessMouseScroll(float YOffset); - - /** * @brief Updates the camera's matricies, should be called once per frame. @@ -115,44 +89,6 @@ struct ERS_STRUCT_Camera { */ void GetClipBoundires(float &NearClip, float &FarClip); - // /** - // * @brief Helper function, sets the camera's maximum and minimum freeflying movement speeds. - // * - // * @param MinSpeed Slowest speed that the user can set the camera's keys to move in units per second. - // * @param MaxSpeed Fastest speed that the user can set the camera's keys to move in units per second. - // */ - // void SetMovementSpeedBoundries(float MinSpeed, float MaxSpeed); - - // /** - // * @brief Helper Function, gets the camera's maximum and minimum freeflying movement speeds. - // * - // * @param MinSpeed Slowest speed that the user can set the camera's keys to move in units per second. - // * @param MaxSpeed Fastest speed that the user can set the camera's keys to move in units per second. - // */ - // void GetMovementSpeedBoundries(float &MinSpeed, float &MaxSpeed); - - // /** - // * @brief Helper function, Sets the speed of the camera. - // * - // * @param Speed Desired speed in units per second. - // * @param EnforceSpeedBoundries Enable/disable hard boundry enforcement. - // */ - // void SetMovementSpeed(float Speed, bool EnforceSpeedBoundries = true); - - // /** - // * @brief Gets the mouse sensitivity multiplier. - // * - // * @param Sensitivity Mouse sensitivity multiplier. - // */ - // void GetMouseSensitivity(float &Sensitivity); - - // /** - // * @brief Sets the mouse sensitivity multiplier. - // * - // * @param Sensitivity Mouse sensitivity multiplier. - // */ - // void SetMouseSensitivity(float Sensitivity); - /** * @brief Gets the current field of view angle. * @@ -232,7 +168,7 @@ struct ERS_STRUCT_Camera { // Internal Camera State Information float MovementSpeed_ = 0.2f; /**