Skip to content

Commit

Permalink
Merge pull request #280 from carboncopies/277-create-object-propertie…
Browse files Browse the repository at this point in the history
…s-settings-for-viewport-camera

277 create object properties settings for viewport camera
  • Loading branch information
datacrystals authored Aug 12, 2022
2 parents 6ada4dc + 5187869 commit f54a490
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ void GUI_Window_ObjectProperties::Draw() {
unsigned long Index = SceneManager_->Scenes_[SceneManager_->ActiveScene_]->SceneObjects_[SelectedSceneObject].Index_;
if (ImGui::CollapsingHeader("Camera Settings", ImGuiTreeNodeFlags_DefaultOpen)) {

// Get Current Camera
//ERS_STRUCT_SceneCamera* Camera = SceneManager_->Scenes_[SceneManager_->ActiveScene_]->SceneCameras[Index].get();
// Get Current Camera, Get Properties
ERS_STRUCT_SceneCamera* Camera = SceneManager_->Scenes_[SceneManager_->ActiveScene_]->SceneCameras[Index].get();


bool Selected = (bool)SceneManager_->Scenes_[SceneManager_->ActiveScene_]->ActiveSceneCameraIndex == Index;
if (ImGui::Checkbox("Active Camera", &Selected)) {
Expand All @@ -273,6 +274,41 @@ void GUI_Window_ObjectProperties::Draw() {
ImGui::SameLine();
ImGui::HelpMarker("Indicates if this is the active camera or not. There can only be one active camera at a time. The system then renders the scene from the active camera's perspective on viewport 0.");


ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();



ImGui::DragFloat("FOV", &Camera->FOV_, 0.25f, 0.0f, 180.0f);
ImGui::SameLine();
ImGui::HelpMarker("Sets the field of view (in degrees) of the camera");

ImGui::DragFloat("Near Clip Plane", &Camera->NearClip_, 0.25f, 0.0f, 10.0f);
ImGui::SameLine();
ImGui::HelpMarker("Sets the minimum distance before which geometry is ignored.");

ImGui::DragFloat("Far Clip Plane", &Camera->FarClip_, 1.0f, 5.0f, 500.0f);
ImGui::SameLine();
ImGui::HelpMarker("Sets the maximum distance after which geometry is ignored.");

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.");

if (!Camera->EnforceAspectRatio_) {
ImGui::BeginDisabled();
}
ImGui::DragFloat("Aspect Ratio", &Camera->AspectRatio_, 0.05f, 0.1f, 4.0f);
ImGui::SameLine();
ImGui::HelpMarker("Aspect ratio to override the camera's automatic one with. Ratio is width/height.");
if (!Camera->EnforceAspectRatio_) {
ImGui::EndDisabled();
}

}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,20 @@
*/
struct ERS_STRUCT_SceneCamera {

// Camea Configuration Information
float NearClip_ = 0.01f; /**<Closest distance before geometry is culled.*/
float FarClip_ = 100.0f; /**<Farthest distance before geometry is called*/
std::vector<long> AttachedScriptIndexes_; /**<Indices of scripts that are attached to this camera*/
std::string UserDefinedName_; /**<Name that appears in the editor's scene tree*/

// Internal Camera State Information
float FOV_ = 50.0f; /**<Field of view in degrees*/
bool EnforceAspectRatio_ = false; /**<Manually Override the aspect ratio with a set one*/
float AspectRatio_ = 1.25f; /**<Internal variable used to setup the projection matrix*/
glm::vec3 Pos_; /**<Position of the camera object*/
glm::vec3 Rot_; /**<Rotation of the camera object*/

std::vector<long> AttachedScriptIndexes_; /**<Indices of scripts that are attached to this camera*/
std::string UserDefinedName_; /**<Name that appears in the editor's scene tree*/
// Asset Streaming Settings
int StreamingPriority_ = 1; /**< Higher this is, the more the system will try and load assets for this camera. Should be in range (1-10)*/

};

0 comments on commit f54a490

Please sign in to comment.