Minor - Improves engine settings and sky sphere - V14.3.0

Refactors the Engine Settings window into a tabbed interface, enhancing usability.

Updates the sky sphere implementation to use a configurable distance.

Adjusts ImGui layout for better docking and window arrangement.
This commit is contained in:
2025-10-01 14:07:09 +02:00
parent 4b47346208
commit 284e282679
6 changed files with 103 additions and 66 deletions

View File

@@ -16,7 +16,7 @@ DockId=0x00000006,0
[Window][render Stats]
Pos=0,630
Size=1584,231
Size=1350,231
Collapsed=0
DockId=0x00000009,0
@@ -27,7 +27,7 @@ Collapsed=0
DockId=0x0000000B,0
[Window][Terrain]
Pos=0,19
Pos=236,19
Size=266,842
Collapsed=0
DockId=0x00000007,0
@@ -45,23 +45,29 @@ Collapsed=0
DockId=0x0000000B,0
[Window][Engine Settings]
Pos=1267,462
Size=317,166
Pos=1267,19
Size=317,842
Collapsed=0
DockId=0x00000006,0
[Window][Inspector]
Pos=1352,19
Size=232,842
Collapsed=0
DockId=0x00000002,0
[Docking][Data]
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=1265,842 Split=Y
DockNode ID=0x00000003 Parent=0x00000005 SizeRef=1584,609 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=234,842 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000003 SizeRef=1348,842 Split=X
DockNode ID=0x00000007 Parent=0x0000000C SizeRef=266,842 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000C SizeRef=1316,842 Split=X
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1265,842 CentralNode=1
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=317,842 Selected=0x9F035453
DockNode ID=0x00000004 Parent=0x00000005 SizeRef=1584,231 Split=X Selected=0xF5D1BB37
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=792,231 Selected=0xF5D1BB37
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=790,231 Selected=0xAB74BEE9
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=317,842 Selected=0x9F035453
DockNode ID=0x00000001 Parent=0xCCBD8CF7 SizeRef=1350,842 Split=X
DockNode ID=0x00000005 Parent=0x00000001 SizeRef=1265,842 Split=Y
DockNode ID=0x00000003 Parent=0x00000005 SizeRef=1584,609 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=234,842 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000003 SizeRef=1348,842 Split=X
DockNode ID=0x00000007 Parent=0x0000000C SizeRef=266,842 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000C SizeRef=1316,842 CentralNode=1
DockNode ID=0x00000004 Parent=0x00000005 SizeRef=1584,231 Split=X Selected=0xF5D1BB37
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=792,231 Selected=0xF5D1BB37
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=790,231 Selected=0xAB74BEE9
DockNode ID=0x00000006 Parent=0x00000001 SizeRef=317,842 Selected=0x0B098C4B
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=232,842 Selected=0x36DC96AB

View File

@@ -451,7 +451,22 @@ public:
*/
std::map<std::string, std::shared_ptr<model_class>>& get_model_cache() { return g_model_cache; }
/**
* Get the sky entity ID.
* @return The sky entity ID as an integer.
*/
int get_sky_id() const { return sky_id_; }
/**
* Set the sky entity size.
* @return The sky entity size as a float.
*/
XMVECTOR get_sky_distance() const { return sky_distance_; };
/**
* Set the sky entity size.
* @param distance The new sky entity size as a float.
*/
void set_sky_distance(XMVECTOR distance);
private:
/**
@@ -594,9 +609,10 @@ private :
float speed_ = 0.1f; // speed for the demo spinning object
std::vector<object*> imported_object_;
int object_id_ = 0;
//std::vector<object*> skybox_;
int sky_id_ = -1;
std::shared_ptr<ecs::Entity> sky_entity_;
XMVECTOR sky_distance_ = XMVectorSet(2.0f, 2.0f, 2.0f, 0.0f);
// ----------------------------------- //
// ------------- LIGHTS -------------- //

View File

@@ -2110,7 +2110,7 @@ bool application_class::create_skysphere()
auto transform = sky_entity_->AddComponent<ecs::TransformComponent>();
transform->SetPosition(XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f));
transform->SetScale(XMVectorSet(2.0f, 2.0f, 2.0f, 0.0f));
transform->SetScale(sky_distance_);
transform->UpdateWorldMatrix();
auto render = sky_entity_->AddComponent<ecs::RenderComponent>();

View File

@@ -762,16 +762,6 @@ bool imguiManager::ImGuiWidgetRenderer()
SetupDockspace();
//ImGui Widget
ImGui::Begin("Khaotic Engine", NULL);
float speed = app_->get_speed();
WidgetSpeedSlider(&speed);
app_->set_speed(speed);
WidgetButton();
WidgetAddObject();
ImGui::End();
// Read the widget list and call the function if the show variable is true
for (const auto& entry : widgets_)
@@ -854,47 +844,72 @@ void imguiManager::WidgetEngineSettingsWindow()
{
ImGui::Begin("Engine Settings", &showEngineSettingsWindow);
// Begining Of General Setting
ImGui::Text("General");
// Checkbox for toggling vsync globally in the application class by calling the set_vsync function in the application class when the checkbox state changes
bool vsync = app_->get_vsync();
if (ImGui::Checkbox("Vsync", &vsync))
if (ImGui::BeginTabBar("Engine Settings"))
{
app_->set_vsync(vsync);
}
if (ImGui::BeginTabItem("General"))
{
bool v_sync = app_->get_vsync();
if (ImGui::Checkbox("Vsync", &v_sync))
{
app_->set_vsync(v_sync);
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Enable or disable Vsync");
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Culling Settings"))
{
float frustumTolerance = app_->get_frustum_tolerance();
if (ImGui::DragFloat("Frustum Tolerance", &frustumTolerance, 0.1f, 0.0f, 100.0f))
{
app_->set_frustum_tolerance(frustumTolerance);
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Set the frustum tolerance for culling");
}
ImGui::EndTabItem();
}
// End Of General Setting
ImGui::Separator();
// culling section
ImGui::Text("Culling");
if (ImGui::BeginTabItem("Physics Settings"))
{
int physics_tick_rate = app_->get_physics_tick_rate();
XMVECTOR gravity = app_->get_physics()->GetGravity();
float gravity_values[3] = { XMVectorGetX(gravity), XMVectorGetY(gravity), XMVectorGetZ(gravity) };
if (ImGui::InputInt("Physics Tick Rate", &physics_tick_rate))
{
app_->set_physics_tick_rate(physics_tick_rate);
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Set the physics tick rate (Fixed Update Interval)");
}
// float input for frustum tolerance
float frustumTolerance = app_->get_frustum_tolerance();
if (ImGui::DragFloat("Frustum Tolerance", &frustumTolerance, 0.1f, 0.0f, 100.0f))
{
app_->set_frustum_tolerance(frustumTolerance);
}
if (ImGui::DragFloat3("Gravity", gravity_values))
{
app_->get_physics()->SetGravity(XMVectorSet(gravity_values[0], gravity_values[1], gravity_values[2], 0.0f));
}
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Set the gravity vector for the physics engine");
}
ImGui::EndTabItem();
}
// End Of Culling Setting
ImGui::Separator();
if (ImGui::BeginTabItem("Skysphere Settings"))
{
// physics section
ImGui::Text("physics");
// Input To set the Fixed Update Interval
int physicsInterval = app_->get_physics_tick_rate();
if (ImGui::InputInt("physics Tick Rate", &physicsInterval))
{
app_->set_physics_tick_rate(physicsInterval);
}
// Input to change the gravity on same line
XMVECTOR gravity = app_->get_physics()->GetGravity();
float gravityValues[3] = { XMVectorGetX(gravity), XMVectorGetY(gravity), XMVectorGetZ(gravity) };
if (ImGui::DragFloat3("Gravity", gravityValues))
{
app_->get_physics()->SetGravity(XMVectorSet(gravityValues[0], gravityValues[1], gravityValues[2], 0.0f));
//float skysphere_size = app_->get_sky()->
}
ImGui::EndTabBar();
}
ImGui::End();