Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
7d33e2da72 |
20
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
20
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
@@ -5,13 +5,18 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/audio_component.h" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/component.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj.filters" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj.filters" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/audio_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/audio_component.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/identity_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/identity_component.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/ComponentFactory.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/ComponentFactory.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/model_path_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/model_path_component.h" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Main.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/physics_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/physics_component.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/render_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/render_component.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/shader_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/shader_component.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/transform_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/transform_component.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity_manager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity_manager.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -250,6 +255,9 @@
|
|||||||
<workItem from="1757182479393" duration="1386000" />
|
<workItem from="1757182479393" duration="1386000" />
|
||||||
<workItem from="1757427950015" duration="2864000" />
|
<workItem from="1757427950015" duration="2864000" />
|
||||||
<workItem from="1757431548883" duration="986000" />
|
<workItem from="1757431548883" duration="986000" />
|
||||||
|
<workItem from="1757449929378" duration="1107000" />
|
||||||
|
<workItem from="1757456559331" duration="2094000" />
|
||||||
|
<workItem from="1757458683204" duration="3628000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
BIN
enginecustom/assets/sounds/default.mp3
Normal file
BIN
enginecustom/assets/sounds/default.mp3
Normal file
Binary file not shown.
BIN
enginecustom/assets/sounds/default.opus
Normal file
BIN
enginecustom/assets/sounds/default.opus
Normal file
Binary file not shown.
@@ -2,6 +2,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <typeindex>
|
#include <typeindex>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* namespace for the Entity-Component-System (ECS)
|
* namespace for the Entity-Component-System (ECS)
|
||||||
@@ -46,6 +47,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool Deserialize(const std::string& data) { return false;}
|
virtual bool Deserialize(const std::string& data) { return false;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual function to render ImGui controls for the component.
|
||||||
|
* This can be overridden by derived components to provide custom UI.
|
||||||
|
*/
|
||||||
|
virtual void OnImGuiRender() { /* Default implementation does nothing */ }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
// AudioComponent.h
|
// AudioComponent.h
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ecs/component.h"
|
#include "../component.h"
|
||||||
#include <Fmod/core/inc/fmod.hpp>
|
#include <Fmod/core/inc/fmod.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
namespace ecs {
|
namespace ecs {
|
||||||
class AudioComponent : public Component {
|
class AudioComponent : public Component {
|
||||||
@@ -10,11 +11,59 @@ public:
|
|||||||
AudioComponent() : m_system(nullptr), m_sound(nullptr), m_channel(nullptr) {}
|
AudioComponent() : m_system(nullptr), m_sound(nullptr), m_channel(nullptr) {}
|
||||||
~AudioComponent() override {
|
~AudioComponent() override {
|
||||||
if (m_sound) m_sound->release();
|
if (m_sound) m_sound->release();
|
||||||
|
// Ne pas lib<69>rer m_system ici car il peut <20>tre partag<61>
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Load(FMOD::System* system, const std::string& path) {
|
void Initialize() override
|
||||||
m_system = system;
|
{
|
||||||
return m_system->createSound(path.c_str(), FMOD_DEFAULT, nullptr, &m_sound) == FMOD_OK;
|
// create FMOD system if not already created
|
||||||
|
if (!m_system)
|
||||||
|
{
|
||||||
|
FMOD_RESULT result = FMOD::System_Create(&m_system);
|
||||||
|
if (result != FMOD_OK) {
|
||||||
|
m_lastError = "<EFBFBD>chec de la cr<63>ation du syst<73>me FMOD: " + std::to_string(result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = m_system->init(512, FMOD_INIT_NORMAL, nullptr);
|
||||||
|
if (result != FMOD_OK) {
|
||||||
|
m_lastError = "<EFBFBD>chec de l'initialisation du syst<73>me FMOD: " + std::to_string(result);
|
||||||
|
m_system->release();
|
||||||
|
m_system = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Load(const std::string& path) {
|
||||||
|
if (!m_system) {
|
||||||
|
Initialize();
|
||||||
|
if (!m_system) return false; // L'erreur est d<>j<EFBFBD> d<>finie dans Initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
m_soundPath = path;
|
||||||
|
|
||||||
|
// V<>rifier si le fichier existe
|
||||||
|
if (!std::filesystem::exists(path)) {
|
||||||
|
m_lastError = "Fichier non trouv<75>: " + path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lib<69>rer le son pr<70>c<EFBFBD>dent s'il existe
|
||||||
|
if (m_sound) {
|
||||||
|
m_sound->release();
|
||||||
|
m_sound = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Essayer de charger avec le chemin absolu
|
||||||
|
std::filesystem::path absolutePath = std::filesystem::absolute(path);
|
||||||
|
FMOD_RESULT result = m_system->createSound(absolutePath.string().c_str(), FMOD_DEFAULT, nullptr, &m_sound);
|
||||||
|
if (result != FMOD_OK) {
|
||||||
|
m_lastError = "<EFBFBD>chec du chargement du son: " + std::to_string(result) +
|
||||||
|
" (chemin: " + absolutePath.string() + ")";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Play() {
|
void Play() {
|
||||||
@@ -27,9 +76,44 @@ public:
|
|||||||
m_channel->stop();
|
m_channel->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
// Afficher le r<>pertoire de travail actuel
|
||||||
|
std::string currentDir = std::filesystem::current_path().string();
|
||||||
|
ImGui::Text("R<EFBFBD>pertoire actuel: %s", currentDir.c_str());
|
||||||
|
|
||||||
|
if (m_sound) {
|
||||||
|
ImGui::Text("Son charg<72>: %s", m_soundPath.c_str());
|
||||||
|
if (ImGui::Button("Jouer")) {
|
||||||
|
Play();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Arr<EFBFBD>ter")) {
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ImGui::Text("Aucun son charg<72>");
|
||||||
|
|
||||||
|
// Montrer l'erreur s'il y en a une
|
||||||
|
if (!m_lastError.empty()) {
|
||||||
|
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Erreur: %s", m_lastError.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
static char path[256] = "F:/Github_Repo/khaotic-engine-Reborn/x64/Release/assets/sounds/default.mp3";
|
||||||
|
ImGui::InputText("Chemin du fichier", path, sizeof(path));
|
||||||
|
|
||||||
|
if (ImGui::Button("Charger le son")) {
|
||||||
|
if (!Load(path)) {
|
||||||
|
// L'erreur est d<>j<EFBFBD> d<>finie dans Load()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FMOD::System* m_system;
|
FMOD::System* m_system;
|
||||||
FMOD::Sound* m_sound;
|
FMOD::Sound* m_sound;
|
||||||
FMOD::Channel* m_channel;
|
FMOD::Channel* m_channel;
|
||||||
|
std::string m_soundPath;
|
||||||
|
std::string m_lastError;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -134,6 +134,20 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
ImGui::Text("ID: %d", m_id);
|
||||||
|
char nameBuffer[256];
|
||||||
|
strncpy_s(nameBuffer, m_name.c_str(), sizeof(nameBuffer));
|
||||||
|
if (ImGui::InputText("#Name", nameBuffer, sizeof(nameBuffer))) {
|
||||||
|
m_name = std::string(nameBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* objectTypes[] = { "Unknown", "Cube", "Sphere", "Terrain" };
|
||||||
|
int currentTypeIndex = static_cast<int>(m_type);
|
||||||
|
if (ImGui::Combo("Object Type", ¤tTypeIndex, objectTypes, IM_ARRAYSIZE(objectTypes))) {
|
||||||
|
m_type = static_cast<ObjectType>(currentTypeIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_id; // ID unique de l'objet
|
int m_id; // ID unique de l'objet
|
||||||
|
@@ -55,6 +55,16 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
char path[260];
|
||||||
|
std::string currentPath = convert_w_string_to_string(m_path);
|
||||||
|
strcpy_s(path, currentPath.c_str());
|
||||||
|
|
||||||
|
if (ImGui::InputText("Model Path", path, sizeof(path))) {
|
||||||
|
SetPath(std::wstring(path, path + strlen(path)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::wstring m_path;
|
std::wstring m_path;
|
||||||
};
|
};
|
||||||
|
@@ -233,6 +233,45 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
float mass = GetMass();
|
||||||
|
if (ImGui::DragFloat("Mass", &mass, 0.1f, 0.1f, 100.0f)) {
|
||||||
|
SetMass(mass);
|
||||||
|
}
|
||||||
|
|
||||||
|
float radius = GetBoundingRadius();
|
||||||
|
if (ImGui::DragFloat("Bounding Radius", &radius, 0.1f, 0.1f, 100.0f)) {
|
||||||
|
SetBoundingRadius(radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool physicsEnabled = IsPhysicsEnabled();
|
||||||
|
if (ImGui::Checkbox("Physics Enabled", &physicsEnabled)) {
|
||||||
|
SetPhysicsEnabled(physicsEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gravityEnabled = IsGravityEnabled();
|
||||||
|
if (ImGui::Checkbox("Gravity Enabled", &gravityEnabled)) {
|
||||||
|
SetGravityEnabled(gravityEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isGrounded = IsGrounded();
|
||||||
|
if (ImGui::Checkbox("Is Grounded", &isGrounded)) {
|
||||||
|
SetGrounded(isGrounded);
|
||||||
|
}
|
||||||
|
|
||||||
|
XMFLOAT3 velocity;
|
||||||
|
XMStoreFloat3(&velocity, GetVelocity());
|
||||||
|
if (ImGui::DragFloat3("Velocity", &velocity.x, 0.1f)) {
|
||||||
|
SetVelocity(XMLoadFloat3(&velocity));
|
||||||
|
}
|
||||||
|
|
||||||
|
XMFLOAT3 acceleration;
|
||||||
|
XMStoreFloat3(&acceleration, GetAcceleration());
|
||||||
|
if (ImGui::DragFloat3("Acceleration", &acceleration.x, 0.1f)) {
|
||||||
|
SetAcceleration(XMLoadFloat3(&acceleration));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMVECTOR m_Velocity;
|
XMVECTOR m_Velocity;
|
||||||
XMVECTOR m_Acceleration;
|
XMVECTOR m_Acceleration;
|
||||||
|
@@ -208,6 +208,16 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
ImGui::Checkbox("Visible", &m_isVisible);
|
||||||
|
ImGui::Text("Model File Path: %s", m_modelFilePath.c_str());
|
||||||
|
if (m_model) {
|
||||||
|
ImGui::Text("Index Count: %d", m_model->GetIndexCount());
|
||||||
|
} else {
|
||||||
|
ImGui::Text("No model loaded.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<model_class> m_model;
|
std::shared_ptr<model_class> m_model;
|
||||||
std::string m_modelFilePath;
|
std::string m_modelFilePath;
|
||||||
|
@@ -110,6 +110,27 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
ShaderType currentShader = GetActiveShader();
|
||||||
|
int shaderIndex = static_cast<int>(currentShader);
|
||||||
|
const char* shaderNames[] = {
|
||||||
|
"CEL_SHADING",
|
||||||
|
"LIGHTING",
|
||||||
|
"NORMAL_MAPPING",
|
||||||
|
"SPECULAR_MAPPING",
|
||||||
|
"REFLECTION",
|
||||||
|
"REFRACTION",
|
||||||
|
"TEXTURE",
|
||||||
|
"SKYBOX",
|
||||||
|
"SUNLIGHT",
|
||||||
|
"ALPHA_MAPPING"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ImGui::Combo("Active Shader", &shaderIndex, shaderNames, IM_ARRAYSIZE(shaderNames))) {
|
||||||
|
SetActiveShader(static_cast<ShaderType>(shaderIndex));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ShaderType m_activeShader;
|
ShaderType m_activeShader;
|
||||||
};
|
};
|
||||||
|
@@ -197,6 +197,26 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnImGuiRender() override {
|
||||||
|
XMFLOAT3 position, rotation, scale;
|
||||||
|
XMStoreFloat3(&position, GetPosition());
|
||||||
|
XMStoreFloat3(&rotation, GetRotation());
|
||||||
|
XMStoreFloat3(&scale, GetScale());
|
||||||
|
|
||||||
|
if (ImGui::DragFloat3("Position", &position.x, 0.1f)) {
|
||||||
|
SetPosition(XMLoadFloat3(&position));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::DragFloat3("Rotation", &rotation.x, 0.01f)) {
|
||||||
|
SetRotation(XMLoadFloat3(&rotation));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::DragFloat3("Scale", &scale.x, 0.1f, 0.01f, 100.0f)) {
|
||||||
|
SetScale(XMLoadFloat3(&scale));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMMATRIX m_ScaleMatrix;
|
XMMATRIX m_ScaleMatrix;
|
||||||
XMMATRIX m_RotateMatrix;
|
XMMATRIX m_RotateMatrix;
|
||||||
|
@@ -128,6 +128,22 @@ public:
|
|||||||
m_NextEntityID = 0;
|
m_NextEntityID = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get entity by ID (const version).
|
||||||
|
* @param id The ID of the entity to retrieve.
|
||||||
|
* @return A shared pointer to the entity, or nullptr if it does not exist.
|
||||||
|
*/
|
||||||
|
std::shared_ptr<Entity> GetEntityByID(EntityID entityID)
|
||||||
|
{
|
||||||
|
if (entityID < m_Entities.size())
|
||||||
|
{
|
||||||
|
return m_Entities[entityID];
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EntityID m_NextEntityID;
|
EntityID m_NextEntityID;
|
||||||
std::unordered_map<EntityID, std::shared_ptr<Entity>> m_Entities;
|
std::unordered_map<EntityID, std::shared_ptr<Entity>> m_Entities;
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "render_texture_class.h"
|
#include "render_texture_class.h"
|
||||||
#include "scene_manager.h"
|
#include "scene_manager.h"
|
||||||
|
#include "ecs/entity_manager.h"
|
||||||
|
|
||||||
class application_class;
|
class application_class;
|
||||||
class stats;
|
class stats;
|
||||||
@@ -87,7 +88,7 @@ public:
|
|||||||
void WidgetAddObject();
|
void WidgetAddObject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a window to display the object list and their properties.
|
* create a window to display the object list and allow to add objects to the scene.
|
||||||
*/
|
*/
|
||||||
void WidgetObjectWindow();
|
void WidgetObjectWindow();
|
||||||
/**
|
/**
|
||||||
@@ -124,6 +125,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool ImGuiWidgetRenderer();
|
bool ImGuiWidgetRenderer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a window to display the inspector.
|
||||||
|
* This window shows the components of the selected entity and allows to edit them.
|
||||||
|
*/
|
||||||
|
void WidgetInspectorWindow();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the Old scene window size.
|
* set the Old scene window size.
|
||||||
* @param size
|
* @param size
|
||||||
@@ -160,6 +167,7 @@ private:
|
|||||||
std::shared_ptr<application_class> app_;
|
std::shared_ptr<application_class> app_;
|
||||||
scene_manager* scene_manager_;
|
scene_manager* scene_manager_;
|
||||||
stats* stats_;
|
stats* stats_;
|
||||||
|
ecs::EntityManager* entity_manager_;
|
||||||
|
|
||||||
bool showObjectWindow;
|
bool showObjectWindow;
|
||||||
bool showTerrainWindow;
|
bool showTerrainWindow;
|
||||||
@@ -168,6 +176,7 @@ private:
|
|||||||
bool showEngineSettingsWindow;
|
bool showEngineSettingsWindow;
|
||||||
bool showLogWindow;
|
bool showLogWindow;
|
||||||
bool showStatsWindow;
|
bool showStatsWindow;
|
||||||
|
bool show_inspector_window_;
|
||||||
|
|
||||||
int m_SideCount = 0;
|
int m_SideCount = 0;
|
||||||
|
|
||||||
@@ -201,6 +210,8 @@ private:
|
|||||||
// cpu information
|
// cpu information
|
||||||
std::string cpu_name_;
|
std::string cpu_name_;
|
||||||
std::string version_driver_;
|
std::string version_driver_;
|
||||||
|
|
||||||
|
ecs::EntityID m_selected_entity_id = 0; // ID of the currently selected entity
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@@ -25,8 +25,9 @@ imguiManager::imguiManager()
|
|||||||
showEngineSettingsWindow = false;
|
showEngineSettingsWindow = false;
|
||||||
showLogWindow = false;
|
showLogWindow = false;
|
||||||
showStatsWindow = false;
|
showStatsWindow = false;
|
||||||
|
show_inspector_window_ = false;
|
||||||
|
|
||||||
// Initialiser l'historique des frametimes <20> z<>ro
|
// Initialiser l'historique des frametimes <20> z<>ro
|
||||||
for (int i = 0; i < FRAME_HISTORY_COUNT; i++)
|
for (int i = 0; i < FRAME_HISTORY_COUNT; i++)
|
||||||
{
|
{
|
||||||
m_frameTimeHistory[i] = 0.0f;
|
m_frameTimeHistory[i] = 0.0f;
|
||||||
@@ -39,7 +40,8 @@ imguiManager::imguiManager()
|
|||||||
{&showLightWindow, [&](){WidgetLightWindow();}},
|
{&showLightWindow, [&](){WidgetLightWindow();}},
|
||||||
{&showLogWindow, [&](){WidgetLogWindow();}},
|
{&showLogWindow, [&](){WidgetLogWindow();}},
|
||||||
{&showOldSceneWindow, [&](){WidgetRenderWindow(ImVec2(800, 600));}},
|
{&showOldSceneWindow, [&](){WidgetRenderWindow(ImVec2(800, 600));}},
|
||||||
{&showStatsWindow, [&](){WidgetRenderStats();}}
|
{&showStatsWindow, [&](){WidgetRenderStats();}},
|
||||||
|
{&show_inspector_window_, [&](){WidgetInspectorWindow();}}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,14 +66,14 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
ImGui_ImplWin32_Init(hwnd);
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
ImGui_ImplDX11_Init(m_device, m_deviceContext);
|
ImGui_ImplDX11_Init(m_device, m_deviceContext);
|
||||||
|
|
||||||
// Appliquer un th<74>me sombre de base
|
// Appliquer un th<74>me sombre de base
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
// D<>finir les couleurs pour une interface de type <20>diteur sobre
|
// D<>finir les couleurs pour une interface de type <20>diteur sobre
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
|
|
||||||
// Palette de couleurs sobres inspir<69>e des <20>diteurs modernes
|
// Palette de couleurs sobres inspir<69>e des <20>diteurs modernes
|
||||||
ImVec4 background_dark = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); // Fond fonc<6E>
|
ImVec4 background_dark = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); // Fond fonc<6E>
|
||||||
ImVec4 background = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Fond principal
|
ImVec4 background = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Fond principal
|
||||||
ImVec4 background_light = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Fond clair
|
ImVec4 background_light = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Fond clair
|
||||||
ImVec4 accent = ImVec4(0.14f, 0.44f, 0.80f, 0.50f); // Accent bleu
|
ImVec4 accent = ImVec4(0.14f, 0.44f, 0.80f, 0.50f); // Accent bleu
|
||||||
@@ -79,8 +81,8 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
ImVec4 text = ImVec4(1.0f, 1.0f, 1.0f, 1.00f); // Texte plus blanc
|
ImVec4 text = ImVec4(1.0f, 1.0f, 1.0f, 1.00f); // Texte plus blanc
|
||||||
ImVec4 text_dim = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
|
ImVec4 text_dim = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
|
||||||
|
|
||||||
// Ajustements de style g<>n<EFBFBD>raux
|
// Ajustements de style g<>n<EFBFBD>raux
|
||||||
style.WindowPadding = ImVec2(4.0f, 4.0f); // Moins de padding dans les fen<65>tres
|
style.WindowPadding = ImVec2(4.0f, 4.0f); // Moins de padding dans les fen<65>tres
|
||||||
style.FramePadding = ImVec2(4.0f, 3.0f); // Moins de padding dans les cadres
|
style.FramePadding = ImVec2(4.0f, 3.0f); // Moins de padding dans les cadres
|
||||||
style.ItemSpacing = ImVec2(4.0f, 3.0f); // Moins d'espace entre les widgets
|
style.ItemSpacing = ImVec2(4.0f, 3.0f); // Moins d'espace entre les widgets
|
||||||
style.ItemInnerSpacing = ImVec2(3.0f, 3.0f); // Moins d'espace interne
|
style.ItemInnerSpacing = ImVec2(3.0f, 3.0f); // Moins d'espace interne
|
||||||
@@ -119,7 +121,7 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
style.Colors[ImGuiCol_TitleBgActive] = accent;
|
style.Colors[ImGuiCol_TitleBgActive] = accent;
|
||||||
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.12f, 0.12f, 0.12f, 0.90f);
|
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.12f, 0.12f, 0.12f, 0.90f);
|
||||||
|
|
||||||
// <20>l<EFBFBD>ments de menu
|
// <20>l<EFBFBD>ments de menu
|
||||||
style.Colors[ImGuiCol_MenuBarBg] = background_dark;
|
style.Colors[ImGuiCol_MenuBarBg] = background_dark;
|
||||||
style.Colors[ImGuiCol_ScrollbarBg] = background_dark;
|
style.Colors[ImGuiCol_ScrollbarBg] = background_dark;
|
||||||
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f);
|
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f);
|
||||||
@@ -134,7 +136,7 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
|
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
|
||||||
style.Colors[ImGuiCol_ButtonActive] = accent;
|
style.Colors[ImGuiCol_ButtonActive] = accent;
|
||||||
|
|
||||||
// En-t<>tes et onglets
|
// En-t<>tes et onglets
|
||||||
style.Colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
|
style.Colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
|
||||||
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
|
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
|
||||||
style.Colors[ImGuiCol_HeaderActive] = accent;
|
style.Colors[ImGuiCol_HeaderActive] = accent;
|
||||||
@@ -149,21 +151,21 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
style.Colors[ImGuiCol_TabUnfocused] = background_dark;
|
style.Colors[ImGuiCol_TabUnfocused] = background_dark;
|
||||||
style.Colors[ImGuiCol_TabUnfocusedActive] = background;
|
style.Colors[ImGuiCol_TabUnfocusedActive] = background;
|
||||||
|
|
||||||
// Autres <20>l<EFBFBD>ments
|
// Autres <20>l<EFBFBD>ments
|
||||||
style.Colors[ImGuiCol_DockingPreview] = accent;
|
style.Colors[ImGuiCol_DockingPreview] = accent;
|
||||||
style.Colors[ImGuiCol_DockingEmptyBg] = background_light;
|
style.Colors[ImGuiCol_DockingEmptyBg] = background_light;
|
||||||
|
|
||||||
// Charger une police avec une meilleure nettet<65>
|
// Charger une police avec une meilleure nettet<65>
|
||||||
ImFontConfig fontConfig;
|
ImFontConfig fontConfig;
|
||||||
fontConfig.OversampleH = 2; // Sur<75>chantillonnage horizontal
|
fontConfig.OversampleH = 2; // Sur<75>chantillonnage horizontal
|
||||||
fontConfig.OversampleV = 2; // Sur<75>chantillonnage vertical
|
fontConfig.OversampleV = 2; // Sur<75>chantillonnage vertical
|
||||||
fontConfig.PixelSnapH = true; // Alignement sur la grille de pixels
|
fontConfig.PixelSnapH = true; // Alignement sur la grille de pixels
|
||||||
fontConfig.RasterizerMultiply = 1.2f; // L<>g<EFBFBD>re augmentation de l'<27>paisseur
|
fontConfig.RasterizerMultiply = 1.2f; // L<>g<EFBFBD>re augmentation de l'<27>paisseur
|
||||||
io->Fonts->AddFontDefault(&fontConfig);
|
io->Fonts->AddFontDefault(&fontConfig);
|
||||||
|
|
||||||
io->Fonts->Build();
|
io->Fonts->Build();
|
||||||
|
|
||||||
// OU charger une police personnalis<69>e (d<>commenter si vous avez la police)
|
// OU charger une police personnalis<69>e (d<>commenter si vous avez la police)
|
||||||
// io->Fonts->AddFontFromFileTTF("assets/fonts/roboto.ttf", 16.0f, &fontConfig);
|
// io->Fonts->AddFontFromFileTTF("assets/fonts/roboto.ttf", 16.0f, &fontConfig);
|
||||||
|
|
||||||
|
|
||||||
@@ -183,6 +185,8 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
total_triangle_count_ = stats_->get_triangle_count_ptr();
|
total_triangle_count_ = stats_->get_triangle_count_ptr();
|
||||||
total_vertex_count_ = stats_->get_vertex_count_ptr();
|
total_vertex_count_ = stats_->get_vertex_count_ptr();
|
||||||
|
|
||||||
|
entity_manager_ = app_->get_entity_manager();
|
||||||
|
|
||||||
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -218,15 +222,15 @@ void imguiManager::NewFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void imguiManager::SetupDockspace() {
|
void imguiManager::SetupDockspace() {
|
||||||
// Configuration du style pour supprimer l'espace autour des fen<65>tres dock<63>es
|
// Configuration du style pour supprimer l'espace autour des fen<65>tres dock<63>es
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||||
|
|
||||||
// Configuration du style pour les n<>uds de dock
|
// Configuration du style pour les n<>uds de dock
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_DockingSeparatorSize, 1.0f); // R<>duit l'<27>paisseur des s<>parateurs
|
ImGui::PushStyleVar(ImGuiStyleVar_DockingSeparatorSize, 1.0f); // R<>duit l'<27>paisseur des s<>parateurs
|
||||||
|
|
||||||
// Configuration de la fen<65>tre principale
|
// Configuration de la fen<65>tre principale
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
|
||||||
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||||
ImGui::SetNextWindowPos(viewport->Pos);
|
ImGui::SetNextWindowPos(viewport->Pos);
|
||||||
@@ -239,8 +243,8 @@ void imguiManager::SetupDockspace() {
|
|||||||
|
|
||||||
ImGui::Begin("DockSpace", nullptr, window_flags);
|
ImGui::Begin("DockSpace", nullptr, window_flags);
|
||||||
|
|
||||||
// Pop des styles apr<70>s avoir cr<63><72> la fen<65>tre principale
|
// Pop des styles apr<70>s avoir cr<63><72> la fen<65>tre principale
|
||||||
ImGui::PopStyleVar(4); // 4 car nous avons pouss<73> 4 variables de style
|
ImGui::PopStyleVar(4); // 4 car nous avons pouss<73> 4 variables de style
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
// Configuration du DockSpace
|
// Configuration du DockSpace
|
||||||
@@ -363,15 +367,15 @@ void imguiManager::WidgetAddObject()
|
|||||||
|
|
||||||
if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
|
if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
|
||||||
{
|
{
|
||||||
// En cas d'erreur, vous pouvez g<>rer ici l'erreur (par exemple afficher un message)
|
// En cas d'erreur, vous pouvez g<>rer ici l'erreur (par exemple afficher un message)
|
||||||
MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
|
MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// On r<>cup<75>re le chemin relatif par rapport <20> exeDir
|
// On r<>cup<75>re le chemin relatif par rapport <20> exeDir
|
||||||
std::wstring relativePath = targetPath.substr(exeDir.size());
|
std::wstring relativePath = targetPath.substr(exeDir.size());
|
||||||
|
|
||||||
// Suppression du premier caract<63>re s'il s'agit d'un antislash
|
// Suppression du premier caract<63>re s'il s'agit d'un antislash
|
||||||
if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
|
if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
|
||||||
{
|
{
|
||||||
relativePath.erase(0, 1);
|
relativePath.erase(0, 1);
|
||||||
@@ -386,7 +390,7 @@ void imguiManager::WidgetAddObject()
|
|||||||
|
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("Number of cubes: %d", app_->get_entity_manager()->GetEntityCount());
|
ImGui::Text("Number of cubes: %d", entity_manager_->GetEntityCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,305 +398,228 @@ void imguiManager::WidgetObjectWindow()
|
|||||||
{
|
{
|
||||||
ImGui::Begin("Objects", &showObjectWindow);
|
ImGui::Begin("Objects", &showObjectWindow);
|
||||||
|
|
||||||
// Obtenir toutes les entit<69>s avec un composant d'identit<69> et de transformation
|
if (ImGui::Button("Add Cube")) { app_->add_cube(); }
|
||||||
auto entities = app_->get_entity_manager()->GetEntitiesWithComponent<ecs::IdentityComponent>();
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Import Object"))
|
||||||
|
{
|
||||||
|
// Open file dialog
|
||||||
|
OPENFILENAME ofn;
|
||||||
|
WCHAR szFile[260];
|
||||||
|
ZeroMemory(&ofn, sizeof(ofn));
|
||||||
|
ofn.lStructSize = sizeof(ofn);
|
||||||
|
ofn.hwndOwner = NULL;
|
||||||
|
ofn.lpstrFile = szFile;
|
||||||
|
ofn.lpstrFile[0] = '\0';
|
||||||
|
ofn.nMaxFile = sizeof(szFile);
|
||||||
|
ofn.lpstrFilter = L"OBJ\0*.obj\0KOBJ\0*.kobj\0TXT\0*.txt";
|
||||||
|
ofn.nFilterIndex = 1;
|
||||||
|
ofn.lpstrFileTitle = NULL;
|
||||||
|
ofn.nMaxFileTitle = 0;
|
||||||
|
ofn.lpstrInitialDir = NULL;
|
||||||
|
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
||||||
|
|
||||||
|
if (GetOpenFileName(&ofn))
|
||||||
|
{
|
||||||
|
std::wstring filepath = ofn.lpstrFile;
|
||||||
|
|
||||||
|
WCHAR exePath[MAX_PATH];
|
||||||
|
GetModuleFileName(NULL,exePath,MAX_PATH);
|
||||||
|
std::wstring exeDir = exePath;
|
||||||
|
size_t pos = exeDir.find_last_of(L"\\/");
|
||||||
|
if(pos != std::wstring::npos)
|
||||||
|
{
|
||||||
|
exeDir = exeDir.substr(0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring targetDir = exeDir + L"\\Content\\Assets\\Kobject";
|
||||||
|
|
||||||
|
|
||||||
|
DWORD ftyp = GetFileAttributesW(targetDir.c_str());
|
||||||
|
if( ftyp == INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
std::wstring contentDir = exeDir + L"\\Content";
|
||||||
|
if (GetFileAttributes(contentDir.c_str()) == INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
CreateDirectory(contentDir.c_str(), NULL);
|
||||||
|
}
|
||||||
|
std::wstring assetsDir = contentDir + L"\\Assets";
|
||||||
|
if (GetFileAttributes(assetsDir.c_str()) == INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
CreateDirectory(assetsDir.c_str(), NULL);
|
||||||
|
}
|
||||||
|
std::wstring kobjectDir = assetsDir + L"\\Kobject";
|
||||||
|
if (GetFileAttributes(kobjectDir.c_str()) == INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
CreateDirectory(kobjectDir.c_str(), NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t posFile = filepath.find_last_of(L"\\/");
|
||||||
|
std::wstring filename = (posFile != std::wstring::npos) ? filepath.substr(posFile + 1) : filepath;
|
||||||
|
|
||||||
|
std::wstring targetPath = targetDir + L"\\" + filename;
|
||||||
|
|
||||||
|
if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
|
||||||
|
{
|
||||||
|
// En cas d'erreur, vous pouvez g<>rer ici l'erreur (par exemple afficher un message)
|
||||||
|
MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// On r<>cup<75>re le chemin relatif par rapport <20> exeDir
|
||||||
|
std::wstring relativePath = targetPath.substr(exeDir.size());
|
||||||
|
|
||||||
|
// Suppression du premier caract<63>re s'il s'agit d'un antislash
|
||||||
|
if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
|
||||||
|
{
|
||||||
|
relativePath.erase(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remplacer les antislashs par des slashs
|
||||||
|
std::replace(relativePath.begin(), relativePath.end(), L'\\', L'/');
|
||||||
|
app_->add_kobject(relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Number of objects: %d", entity_manager_->GetEntityCount());
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
auto entities = entity_manager_->GetAllEntities();
|
||||||
|
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(4,2));
|
||||||
|
|
||||||
int index = 0;
|
|
||||||
for (auto& entity : entities)
|
for (auto& entity : entities)
|
||||||
{
|
{
|
||||||
auto identity = entity->GetComponent<ecs::IdentityComponent>();
|
auto identity = entity->GetComponent<ecs::IdentityComponent>();
|
||||||
auto transform = entity->GetComponent<ecs::TransformComponent>();
|
if (identity)
|
||||||
auto render = entity->GetComponent<ecs::RenderComponent>();
|
{
|
||||||
auto shader = entity->GetComponent<ecs::ShaderComponent>();
|
std::string name = identity->GetName();
|
||||||
auto physics = entity->GetComponent<ecs::PhysicsComponent>();
|
if (name.empty()) name = "Entity #" + std::to_string(identity->GetId());
|
||||||
|
|
||||||
if (identity && transform)
|
bool isSelected = (entity->GetID() == m_selected_entity_id);
|
||||||
|
if (ImGui::Selectable(name.c_str(), isSelected))
|
||||||
{
|
{
|
||||||
std::string headerName = identity->GetName() + " " + std::to_string(identity->GetId());
|
m_selected_entity_id = entity->GetID();
|
||||||
if (ImGui::CollapsingHeader(headerName.c_str()))
|
show_inspector_window_ = true;
|
||||||
{
|
}
|
||||||
// Position, Rotation, Scale
|
}
|
||||||
XMVECTOR position = transform->GetPosition();
|
|
||||||
XMVECTOR rotation = transform->GetRotation();
|
|
||||||
XMVECTOR scale = transform->GetScale();
|
|
||||||
|
|
||||||
float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
|
|
||||||
std::string posLabel = "Position##" + std::to_string(identity->GetId());
|
|
||||||
if (ImGui::DragFloat3(posLabel.c_str(), pos))
|
|
||||||
{
|
|
||||||
transform->SetPosition(XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
|
|
||||||
transform->UpdateWorldMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float rot[3] = { XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation) };
|
ImGui::PopStyleVar();
|
||||||
std::string rotLabel = "Rotation##" + std::to_string(identity->GetId());
|
ImGui::End();
|
||||||
if (ImGui::DragFloat3(rotLabel.c_str(), rot))
|
}
|
||||||
{
|
|
||||||
transform->SetRotation(XMVectorSet(rot[0], rot[1], rot[2], 0.0f));
|
|
||||||
transform->UpdateWorldMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
float scl[3] = { XMVectorGetX(scale), XMVectorGetY(scale), XMVectorGetZ(scale) };
|
void imguiManager::WidgetInspectorWindow()
|
||||||
std::string sclLabel = "Scale##" + std::to_string(identity->GetId());
|
{
|
||||||
if (ImGui::DragFloat3(sclLabel.c_str(), scl))
|
ImGui::Begin("Inspector", &show_inspector_window_);
|
||||||
|
|
||||||
|
auto entity = entity_manager_->GetEntityByID(m_selected_entity_id);
|
||||||
|
if (entity)
|
||||||
{
|
{
|
||||||
transform->SetScale(XMVectorSet(scl[0], scl[1], scl[2], 0.0f));
|
auto identity = entity->GetComponent<ecs::IdentityComponent>();
|
||||||
transform->UpdateWorldMatrix();
|
if (identity)
|
||||||
|
{
|
||||||
|
char name[256];
|
||||||
|
strcpy_s(name, identity->GetName().c_str());
|
||||||
|
if (ImGui::InputText("Name", name, sizeof(name)))
|
||||||
|
{
|
||||||
|
identity->SetName(std::string(name));
|
||||||
|
}
|
||||||
|
ImGui::Text("ID: %d", identity->GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Textures - Seulement si le composant de rendu existe
|
// Lister et afficher les composants
|
||||||
if (render && render->GetModel())
|
auto components = entity->GetAllComponents();
|
||||||
|
for (auto& pair : components)
|
||||||
{
|
{
|
||||||
// D<>finir les types de textures_
|
auto& comp = pair.second;
|
||||||
std::vector<std::string> textureCategories = {
|
// Utiliser le nom du type comme en-tete
|
||||||
"Diffuse", "Normal", "Specular", "Alpha"
|
std::string compName = typeid(*comp).name();
|
||||||
};
|
if (ImGui::CollapsingHeader(compName.c_str()))
|
||||||
|
|
||||||
std::vector<TextureType> textureTypes = {
|
|
||||||
TextureType::Diffuse, TextureType::Normal,
|
|
||||||
TextureType::Specular, TextureType::Alpha
|
|
||||||
};
|
|
||||||
|
|
||||||
// Cr<43>er un espace pour afficher les textures_ avec d<>filement
|
|
||||||
std::string textureChildId = "TextureChild##" + std::to_string(identity->GetId());
|
|
||||||
ImGui::BeginChild(textureChildId.c_str(), ImVec2(0, 200), true, ImGuiWindowFlags_HorizontalScrollbar);
|
|
||||||
|
|
||||||
// Pour chaque type de texture
|
|
||||||
for (int typeIndex = 0; typeIndex < textureCategories.size(); typeIndex++)
|
|
||||||
{
|
{
|
||||||
TextureType type = textureTypes[typeIndex];
|
comp->OnImGuiRender();
|
||||||
std::string typeName = textureCategories[typeIndex];
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Afficher le titre de la cat<61>gorie
|
if (ImGui::Button("Delete Entity"))
|
||||||
std::string categoryLabel = typeName + "##" + std::to_string(identity->GetId());
|
{
|
||||||
ImGui::Text("%s:", typeName.c_str());
|
entity_manager_->DestroyEntity(m_selected_entity_id);
|
||||||
|
m_selected_entity_id = -1;
|
||||||
|
show_inspector_window_ = false;
|
||||||
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
// Compter combien de textures_ de ce type existent
|
if (ImGui::Button("Add Component"))
|
||||||
int textureCount = 0;
|
|
||||||
while (render->GetModel()->GetTexture(type, textureCount) != nullptr)
|
|
||||||
{
|
{
|
||||||
textureCount++;
|
ImGui::OpenPopup("AddComponentPopup");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Afficher toutes les textures_ existantes
|
if (ImGui::BeginPopup("AddComponentPopup"))
|
||||||
std::string groupId = "TextureGroup_" + std::to_string(identity->GetId()) + "_" + std::to_string(typeIndex);
|
|
||||||
ImGui::BeginGroup();
|
|
||||||
for (int texIndex = 0; texIndex < textureCount; texIndex++)
|
|
||||||
{
|
{
|
||||||
ID3D11ShaderResourceView* texture = render->GetModel()->GetTexture(type, texIndex);
|
ImGui::Text("Select Component to Add:");
|
||||||
if (texture)
|
|
||||||
{
|
|
||||||
// ID unique pour chaque bouton de texture
|
|
||||||
std::string buttonId = "tex##" + std::to_string(identity->GetId()) + "_" +
|
|
||||||
std::to_string(typeIndex) + "_" +
|
|
||||||
std::to_string(texIndex);
|
|
||||||
|
|
||||||
if (ImGui::ImageButton(buttonId.c_str(), (ImTextureID)texture, ImVec2(48, 48)))
|
|
||||||
{
|
|
||||||
// Ouvrir une bo<62>te de dialogue pour changer la texture
|
|
||||||
OPENFILENAME ofn;
|
|
||||||
WCHAR szFile[260] = {0};
|
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
|
||||||
ofn.lStructSize = sizeof(ofn);
|
|
||||||
ofn.hwndOwner = NULL;
|
|
||||||
ofn.lpstrFile = szFile;
|
|
||||||
ofn.nMaxFile = sizeof(szFile);
|
|
||||||
ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
|
|
||||||
ofn.nFilterIndex = 1;
|
|
||||||
ofn.lpstrInitialDir = NULL;
|
|
||||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
|
||||||
|
|
||||||
if (GetOpenFileName(&ofn))
|
|
||||||
{
|
|
||||||
// Changer la texture existante
|
|
||||||
render->GetModel()->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, type, texIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Afficher l'indice de texture et pr<70>visualisation au survol
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
{
|
|
||||||
ImGui::BeginTooltip();
|
|
||||||
ImGui::Text("%s %d", typeName.c_str(), texIndex);
|
|
||||||
ImGui::Image((ImTextureID)texture, ImVec2(192, 192));
|
|
||||||
ImGui::EndTooltip();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bouton pour ajouter une nouvelle texture
|
|
||||||
std::string addButtonLabel = "+##" + std::to_string(identity->GetId()) + "_" + std::to_string(typeIndex);
|
|
||||||
if (ImGui::Button(addButtonLabel.c_str(), ImVec2(48, 48)))
|
|
||||||
{
|
|
||||||
// Ouvrir une bo<62>te de dialogue pour ajouter une texture
|
|
||||||
OPENFILENAME ofn;
|
|
||||||
WCHAR szFile[260] = {0};
|
|
||||||
ZeroMemory(&ofn, sizeof(ofn));
|
|
||||||
ofn.lStructSize = sizeof(ofn);
|
|
||||||
ofn.hwndOwner = NULL;
|
|
||||||
ofn.lpstrFile = szFile;
|
|
||||||
ofn.nMaxFile = sizeof(szFile);
|
|
||||||
ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
|
|
||||||
ofn.nFilterIndex = 1;
|
|
||||||
ofn.lpstrInitialDir = NULL;
|
|
||||||
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
|
||||||
|
|
||||||
if (GetOpenFileName(&ofn))
|
|
||||||
{
|
|
||||||
// Ajouter une nouvelle texture
|
|
||||||
render->GetModel()->AddTexture(m_device, m_deviceContext, ofn.lpstrFile, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndGroup();
|
|
||||||
ImGui::Separator();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndChild();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Delete button
|
if (ImGui::MenuItem("Transform Component"))
|
||||||
std::string deleteLabel = "Delete##" + std::to_string(identity->GetId());
|
|
||||||
if (ImGui::Button(deleteLabel.c_str()))
|
|
||||||
{
|
{
|
||||||
app_->delete_entity_by_id(identity->GetId());
|
if (!entity->HasComponent<ecs::TransformComponent>())
|
||||||
// Sortir du boucle apr<70>s suppression pour <20>viter des acc<63>s invalides
|
{
|
||||||
break;
|
entity->AddComponent<ecs::TransformComponent>();
|
||||||
}
|
}
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
// Shader options
|
|
||||||
if (shader)
|
|
||||||
{
|
|
||||||
// Liste des options de shader
|
|
||||||
const char* shaderOptions[] = {
|
|
||||||
"Enable Global Lighting",
|
|
||||||
"Enable Lighting",
|
|
||||||
"Enable Cel Shading",
|
|
||||||
"Enable Normal Mapping",
|
|
||||||
"Enable Specular Mapping",
|
|
||||||
"Enable Alpha Mapping"
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<ecs::ShaderType> shaderTypes = {
|
|
||||||
ecs::ShaderType::SUNLIGHT,
|
|
||||||
ecs::ShaderType::LIGHTING,
|
|
||||||
ecs::ShaderType::CEL_SHADING,
|
|
||||||
ecs::ShaderType::NORMAL_MAPPING,
|
|
||||||
ecs::ShaderType::SPECULAR_MAPPING,
|
|
||||||
ecs::ShaderType::ALPHA_MAPPING
|
|
||||||
};
|
|
||||||
|
|
||||||
// Trouver l'index actuel du shader pour cette entit<69> sp<73>cifique
|
|
||||||
int currentShader = 0;
|
|
||||||
ecs::ShaderType activeShader = shader->GetActiveShader();
|
|
||||||
for (size_t i = 0; i < shaderTypes.size(); i++)
|
|
||||||
{
|
|
||||||
if (shaderTypes[i] == activeShader)
|
|
||||||
{
|
|
||||||
currentShader = static_cast<int>(i);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
if (ImGui::MenuItem("Model Path Component"))
|
||||||
|
|
||||||
// Cr<43>ation du menu d<>roulant avec un ID unique pour chaque entit<69>
|
|
||||||
std::string shaderComboId = "Shader Options##" + std::to_string(identity->GetId());
|
|
||||||
if (ImGui::BeginCombo(shaderComboId.c_str(), shaderOptions[currentShader]))
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(shaderOptions); i++)
|
if (!entity->HasComponent<ecs::ModelPathComponent>())
|
||||||
{
|
{
|
||||||
// Cr<43>e une option s<>lectionnable pour chaque shader avec ID unique
|
entity->AddComponent<ecs::ModelPathComponent>();
|
||||||
std::string shaderSelectableId = std::to_string(i) + "##shader_" + std::to_string(identity->GetId());
|
}
|
||||||
bool isSelected = (currentShader == i);
|
ImGui::CloseCurrentPopup();
|
||||||
if (ImGui::Selectable(shaderOptions[i], isSelected))
|
}
|
||||||
|
if (ImGui::MenuItem("Audio Component"))
|
||||||
{
|
{
|
||||||
// Met <20> jour l'option s<>lectionn<6E>e uniquement pour cette entit<69>
|
if (!entity->HasComponent<ecs::AudioComponent>())
|
||||||
currentShader = i;
|
|
||||||
shader->SetActiveShader(shaderTypes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si l'option s<>lectionn<6E>e est active, nous mettons en surbrillance
|
|
||||||
if (isSelected)
|
|
||||||
ImGui::SetItemDefaultFocus();
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
// Physics
|
|
||||||
bool isPhysicsEnabled = (physics != nullptr);
|
|
||||||
std::string physicsLabel = "Physics##" + std::to_string(identity->GetId());
|
|
||||||
|
|
||||||
if (ImGui::Checkbox(physicsLabel.c_str(), &isPhysicsEnabled))
|
|
||||||
{
|
{
|
||||||
if (isPhysicsEnabled && !physics)
|
entity->AddComponent<ecs::AudioComponent>();
|
||||||
{
|
|
||||||
// Ajouter un composant de physique
|
|
||||||
physics = entity->AddComponent<ecs::PhysicsComponent>();
|
|
||||||
physics->Initialize();
|
|
||||||
}
|
}
|
||||||
else if (!isPhysicsEnabled && physics)
|
ImGui::CloseCurrentPopup();
|
||||||
{
|
|
||||||
// Retirer le composant de physique
|
|
||||||
entity->RemoveComponent<ecs::PhysicsComponent>();
|
|
||||||
physics = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
if (ImGui::MenuItem("Physics Component"))
|
||||||
|
|
||||||
if (physics)
|
|
||||||
{
|
{
|
||||||
// Gravity Enabled checkbox
|
if (!entity->HasComponent<ecs::PhysicsComponent>())
|
||||||
bool gravityEnabled = physics->IsGravityEnabled();
|
|
||||||
std::string gravityLabel = "Gravity##" + std::to_string(identity->GetId());
|
|
||||||
if (ImGui::Checkbox(gravityLabel.c_str(), &gravityEnabled))
|
|
||||||
{
|
{
|
||||||
physics->SetGravityEnabled(gravityEnabled);
|
entity->AddComponent<ecs::PhysicsComponent>();
|
||||||
}
|
}
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
// 3 radio buttons pour le type d'objet physique avec IDs uniques
|
}
|
||||||
std::string typeLabel = "Type##" + std::to_string(identity->GetId());
|
if (ImGui::MenuItem("Render Component"))
|
||||||
ecs::ObjectType type = identity->GetType();
|
|
||||||
|
|
||||||
if (ImGui::RadioButton(("None##" + std::to_string(identity->GetId())).c_str(),
|
|
||||||
type == ecs::ObjectType::Unknown))
|
|
||||||
{
|
{
|
||||||
identity->SetType(ecs::ObjectType::Unknown);
|
if (!entity->HasComponent<ecs::RenderComponent>())
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::RadioButton(("Cube##" + std::to_string(identity->GetId())).c_str(),
|
|
||||||
type == ecs::ObjectType::Cube))
|
|
||||||
{
|
{
|
||||||
identity->SetType(ecs::ObjectType::Cube);
|
entity->AddComponent<ecs::RenderComponent>();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::CloseCurrentPopup();
|
||||||
if (ImGui::RadioButton(("Sphere##" + std::to_string(identity->GetId())).c_str(),
|
}
|
||||||
type == ecs::ObjectType::Sphere))
|
if (ImGui::MenuItem("Shader Component"))
|
||||||
{
|
{
|
||||||
identity->SetType(ecs::ObjectType::Sphere);
|
if (!entity->HasComponent<ecs::ShaderComponent>())
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::RadioButton(("Terrain##" + std::to_string(identity->GetId())).c_str(),
|
|
||||||
type == ecs::ObjectType::Terrain))
|
|
||||||
{
|
{
|
||||||
identity->SetType(ecs::ObjectType::Terrain);
|
entity->AddComponent<ecs::ShaderComponent>();
|
||||||
}
|
}
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::Text("No entity selected.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
@@ -907,7 +834,7 @@ void imguiManager::WidgetLogWindow()
|
|||||||
// Place the menu on the same line as the filter
|
// Place the menu on the same line as the filter
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
// Menu d<>roulant pour les niveaux de log
|
// Menu d<>roulant pour les niveaux de log
|
||||||
if (ImGui::BeginMenu("Log Levels"))
|
if (ImGui::BeginMenu("Log Levels"))
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < Logger::LogLevelCount; ++i)
|
for (size_t i = 0; i < Logger::LogLevelCount; ++i)
|
||||||
@@ -925,7 +852,7 @@ void imguiManager::WidgetLogWindow()
|
|||||||
std::vector<Logger::LogEntry> logfiltered;
|
std::vector<Logger::LogEntry> logfiltered;
|
||||||
int logCount = logBuffer.size();
|
int logCount = logBuffer.size();
|
||||||
|
|
||||||
// Affichage des logs filtr<74>s
|
// Affichage des logs filtr<74>s
|
||||||
ImGui::BeginChild("Log");
|
ImGui::BeginChild("Log");
|
||||||
|
|
||||||
for (const auto& log : logBuffer)
|
for (const auto& log : logBuffer)
|
||||||
@@ -976,7 +903,7 @@ void imguiManager::WidgetRenderWindow(ImVec2 availableSize)
|
|||||||
ImVec2 oldWindowSize = windowSize;
|
ImVec2 oldWindowSize = windowSize;
|
||||||
windowSize = ImGui::GetContentRegionAvail();
|
windowSize = ImGui::GetContentRegionAvail();
|
||||||
|
|
||||||
// Si la taille de la fen<65>tre a chang<6E>, ajustez la taille de la fen<65>tre de l'application
|
// Si la taille de la fen<65>tre a chang<6E>, ajustez la taille de la fen<65>tre de l'application
|
||||||
if (oldWindowSize.x != windowSize.x || oldWindowSize.y != windowSize.y)
|
if (oldWindowSize.x != windowSize.x || oldWindowSize.y != windowSize.y)
|
||||||
{
|
{
|
||||||
app_->set_window_size(windowSize);
|
app_->set_window_size(windowSize);
|
||||||
@@ -999,7 +926,7 @@ void imguiManager::WidgetRenderWindow(ImVec2 availableSize)
|
|||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Affichez la scenne projet<65> sur texture dans une fen<65>tre ImGui
|
// Affichez la scenne projet<65> sur texture dans une fen<65>tre ImGui
|
||||||
// alpha blend is not enable to render the texture
|
// alpha blend is not enable to render the texture
|
||||||
|
|
||||||
app_->get_direct_3d()->turn_z_buffer_off();
|
app_->get_direct_3d()->turn_z_buffer_off();
|
||||||
@@ -1042,7 +969,7 @@ void imguiManager::WidgetRenderStats()
|
|||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Trouver les valeurs min/max pour l'<27>chelle du graphique
|
// Trouver les valeurs min/max pour l'<27>chelle du graphique
|
||||||
float frameTimeMin = FLT_MAX;
|
float frameTimeMin = FLT_MAX;
|
||||||
float frameTimeMax = 0.0f;
|
float frameTimeMax = 0.0f;
|
||||||
for (int i = 0; i < FRAME_HISTORY_COUNT; i++) {
|
for (int i = 0; i < FRAME_HISTORY_COUNT; i++) {
|
||||||
@@ -1055,14 +982,14 @@ void imguiManager::WidgetRenderStats()
|
|||||||
if (frameTimeMax == 0.0f) frameTimeMax = 0.033f; // ~30 FPS
|
if (frameTimeMax == 0.0f) frameTimeMax = 0.033f; // ~30 FPS
|
||||||
if (frameTimeMin == FLT_MAX) frameTimeMin = 0.0f;
|
if (frameTimeMin == FLT_MAX) frameTimeMin = 0.0f;
|
||||||
|
|
||||||
// Ajouter 10% de marge pour la lisibilit<69>
|
// Ajouter 10% de marge pour la lisibilit<69>
|
||||||
float margin = (frameTimeMax - frameTimeMin) * 0.1f;
|
float margin = (frameTimeMax - frameTimeMin) * 0.1f;
|
||||||
frameTimeMin = max(0.0f, frameTimeMin - margin);
|
frameTimeMin = max(0.0f, frameTimeMin - margin);
|
||||||
frameTimeMax += margin;
|
frameTimeMax += margin;
|
||||||
|
|
||||||
// Afficher le graphique
|
// Afficher le graphique
|
||||||
ImGui::Text("Frame Time: %.3f ms", current_frame_time_ * 1000.0f);
|
ImGui::Text("Frame Time: %.3f ms", current_frame_time_ * 1000.0f);
|
||||||
ImGui::PlotLines("FrameTimeGraph", // Au lieu de cha<68>ne vide ""
|
ImGui::PlotLines("FrameTimeGraph", // Au lieu de cha<68>ne vide ""
|
||||||
m_frameTimeHistory,
|
m_frameTimeHistory,
|
||||||
FRAME_HISTORY_COUNT,
|
FRAME_HISTORY_COUNT,
|
||||||
m_frameTimeHistoryIndex,
|
m_frameTimeHistoryIndex,
|
||||||
|
BIN
x64/Release/assets/sounds/default.mp3
Normal file
BIN
x64/Release/assets/sounds/default.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user