diff --git a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
index 3db8292..5fc6bda 100644
--- a/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
+++ b/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
@@ -6,7 +6,10 @@
-
+
+
+
+
@@ -21,6 +24,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -39,25 +169,25 @@
- {
- "keyToString": {
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "C++ Project.enginecustom.executor": "Run",
- "C/C++ Project.enginecustom.executor": "Run",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "git-widget-placeholder": "main",
- "ignore.virus.scanning.warn.message": "true",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "settings.editor.selected.configurable": "preferences.build.unityPlugin",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
@@ -183,7 +313,7 @@
-
+
diff --git a/enginecustom/src/inc/system/modelclass.h b/enginecustom/src/inc/system/modelclass.h
index 632bcfe..c441dae 100644
--- a/enginecustom/src/inc/system/modelclass.h
+++ b/enginecustom/src/inc/system/modelclass.h
@@ -201,7 +201,8 @@ protected:
public:
ModelClass();
- ModelClass(const ModelClass&);
+ ModelClass(const ModelClass&) = delete;
+ ModelClass& operator=(const ModelClass&) = delete;
~ModelClass();
//bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector);
diff --git a/enginecustom/src/inc/system/object.h b/enginecustom/src/inc/system/object.h
index fcce138..13a5b68 100644
--- a/enginecustom/src/inc/system/object.h
+++ b/enginecustom/src/inc/system/object.h
@@ -32,6 +32,9 @@ public:
Object();
~Object();
+ Object(const Object&) = delete;
+ Object& operator=(const Object&) = delete;
+
void SetScaleMatrix(XMMATRIX scaleMatrix);
void SetRotateMatrix(XMMATRIX rotateMatrix);
void SetTranslateMatrix(XMMATRIX translateMatrix);
@@ -50,7 +53,6 @@ public:
XMVECTOR GetPosition();
XMVECTOR GetRotation();
- void Render(ID3D11DeviceContext* deviceContext);
XMVECTOR GetScale();
void SetVelocity(XMVECTOR);
@@ -148,10 +150,5 @@ private:
float m_alpha = 0.0f;
float m_initialStretch = 0.0f;
float m_springConstant = 10.0f;
-
- bool m_instancingEnabled;
- int m_instanceCount;
- ID3D11Buffer* m_instanceBuffer;
- std::vector m_instanceTransforms;
};
diff --git a/enginecustom/src/src/system/applicationclass.cpp b/enginecustom/src/src/system/applicationclass.cpp
index af1ee21..de21155 100644
--- a/enginecustom/src/src/system/applicationclass.cpp
+++ b/enginecustom/src/src/system/applicationclass.cpp
@@ -1286,7 +1286,7 @@ void ApplicationClass::AddKobject(std::wstring& filepath)
string filename = p.stem().string();
size_t convertedChars = 0;
- wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
+ (void)wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
filesystem::current_path(m_WFolder);
@@ -1672,7 +1672,7 @@ bool ApplicationClass::RenderPass(const std::vectorUpdatePosition(m_Timer->GetTime());
}
-
-
+
if (!object->IsVisible())
{
continue;
diff --git a/enginecustom/src/src/system/imguiManager.cpp b/enginecustom/src/src/system/imguiManager.cpp
index 30fbcec..7e857fd 100644
--- a/enginecustom/src/src/system/imguiManager.cpp
+++ b/enginecustom/src/src/system/imguiManager.cpp
@@ -644,23 +644,6 @@ void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
ImGui::Separator();
- // int input area for the number of cubes
- static int numCubes = 10;
- ImGui::InputInt("Number of Cubes", &numCubes);
- if (numCubes < 1)
- {
- numCubes = 1;
- }
-
- ImGui::Separator();
-
- if (ImGui::Button("Generate Big Cube Terrain"))
- {
- app->CreateBigCube(numCubes);
- }
-
- ImGui::Separator();
-
if (ImGui::Button("Delete All Terrain Cubes"))
{
app->DeleteTerrain();
diff --git a/enginecustom/src/src/system/modelclass.cpp b/enginecustom/src/src/system/modelclass.cpp
index 6a91d7c..17022d9 100644
--- a/enginecustom/src/src/system/modelclass.cpp
+++ b/enginecustom/src/src/system/modelclass.cpp
@@ -6,16 +6,23 @@ ModelClass::ModelClass()
m_vertexBuffer = 0;
m_indexBuffer = 0;
m_model = 0;
+ m_vertexCount = 0;
+ m_indexCount = 0;
+ m_Textures.diffuse.clear();
+ m_Textures.normal.clear();
+ m_Textures.specular.clear();
+ m_Textures.alpha.clear();
+ m_Textures.diffusePaths.clear();
+ m_Textures.normalPaths.clear();
+ m_Textures.specularPaths.clear();
+ m_Textures.alphaPaths.clear();
}
-
-ModelClass::ModelClass(const ModelClass& other)
-{
-}
-
-
ModelClass::~ModelClass()
{
+
+ // Destructor
+ Shutdown();
}
bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename, const TextureContainer& textures) {
diff --git a/enginecustom/src/src/system/object.cpp b/enginecustom/src/src/system/object.cpp
index 2a3e2ad..8ac285d 100644
--- a/enginecustom/src/src/system/object.cpp
+++ b/enginecustom/src/src/system/object.cpp
@@ -18,19 +18,10 @@ Object::Object()// Initialize the reference here
m_isGrounded = false;
m_id = NULL;
m_boundingRadius = 1.0f;
- m_instancingEnabled = false;
- m_instanceCount = 0;
- m_instanceBuffer = nullptr;
}
Object::~Object()
{
- // Libérer le buffer d'instances
- if (m_instanceBuffer)
- {
- m_instanceBuffer->Release();
- m_instanceBuffer = nullptr;
- }
}
void Object::SetScaleMatrix(XMMATRIX scaleMatrix)
@@ -100,45 +91,6 @@ XMVECTOR Object::GetRotation()
return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
}
-void Object::Render(ID3D11DeviceContext* deviceContext)
-{
- unsigned int strides[2];
- unsigned int offsets[2];
- ID3D11Buffer* bufferPointers[2];
-
- // Configurer les vertex et index buffers
- strides[0] = sizeof(VertexType);
- offsets[0] = 0;
- bufferPointers[0] = m_vertexBuffer;
-
- // Si l'instanciation est activée
- if (m_instancingEnabled && m_instanceBuffer)
- {
- // Configurer le buffer d'instances
- strides[1] = sizeof(XMMATRIX);
- offsets[1] = 0;
- bufferPointers[1] = m_instanceBuffer;
-
- // Définir les deux buffers (vertex et instance) sur le pipeline
- deviceContext->IASetVertexBuffers(0, 2, bufferPointers, strides, offsets);
- deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
- deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
-
- // Dessiner les instances
- deviceContext->DrawIndexedInstanced(m_indexCount, m_instanceCount, 0, 0, 0);
- }
- else
- {
- // Rendu normal sans instanciation
- deviceContext->IASetVertexBuffers(0, 1, bufferPointers, strides, offsets);
- deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
- deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
-
- // Dessiner l'objet normalement
- deviceContext->DrawIndexed(m_indexCount, 0, 0);
- }
-}
-
XMVECTOR Object::GetScale()
{
XMFLOAT4X4 matrix;
@@ -435,66 +387,4 @@ bool Object::LoadTexturesFromPath(std::vector& texturePaths, Textu
}
return true;
-}
-
-bool Object::SetupInstancing(ID3D11Device* device, const std::vector& instanceTransforms)
-{
- // Stocker les matrices de transformation
- m_instanceTransforms = instanceTransforms;
- m_instanceCount = static_cast(instanceTransforms.size());
-
- // Libérer le buffer d'instances existant si nécessaire
- if (m_instanceBuffer)
- {
- m_instanceBuffer->Release();
- m_instanceBuffer = nullptr;
- }
-
- // Créer le buffer d'instances
- D3D11_BUFFER_DESC instanceBufferDesc;
- ZeroMemory(&instanceBufferDesc, sizeof(instanceBufferDesc));
- instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
- instanceBufferDesc.ByteWidth = sizeof(XMMATRIX) * m_instanceCount;
- instanceBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- instanceBufferDesc.MiscFlags = 0;
- instanceBufferDesc.StructureByteStride = 0;
-
- D3D11_SUBRESOURCE_DATA instanceData;
- ZeroMemory(&instanceData, sizeof(instanceData));
- instanceData.pSysMem = instanceTransforms.data();
-
- HRESULT result = device->CreateBuffer(&instanceBufferDesc, &instanceData, &m_instanceBuffer);
- if (FAILED(result))
- {
- return false;
- }
-
- return true;
-}
-
-void Object::EnableInstancing(bool enabled)
-{
- m_instancingEnabled = enabled;
-}
-
-void Object::SetInstanceCount(int count)
-{
- m_instanceCount = count;
-}
-
-// Ajoutez également ces méthodes pour accéder aux données d'instanciation
-bool Object::IsInstancingEnabled() const
-{
- return m_instancingEnabled;
-}
-
-int Object::GetInstanceCount() const
-{
- return m_instanceCount;
-}
-
-ID3D11Buffer* Object::GetInstanceBuffer() const
-{
- return m_instanceBuffer;
}
\ No newline at end of file