Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9aaa2786b6 | |||
| e3bb138cb2 | |||
| 040d919b69 | |||
| 1a92ac64d7 | |||
| 145a1b323f | |||
| 2e33adf4a9 | |||
| c67a805bd7 | |||
| cb234f64f0 | |||
| 5ab98c9a0a | |||
| 37bba7866c | |||
| ebbbd181e3 | |||
| ba7d0ca27e | |||
| 13fc189ee8 | |||
| af5473f6e3 | |||
| 526b38eb4f | |||
| 295b7354d9 | |||
| b31b242775 | |||
| 7c6562719f | |||
| 00339aa6c2 | |||
| 2b8e222d7c | |||
| 7c5a6435bb | |||
| fe77100612 | |||
| 985e4de77d | |||
| b1ba23f9c0 | |||
| 884db4877e | |||
| 38569b18a7 | |||
| aa8e5c0782 | |||
| 6680e4689b | |||
| a2dc31f49c | |||
| fc9a4bdc47 | |||
| 4922305921 | |||
| 14c07f8750 | |||
| 2f5a970a4e | |||
| 6667a57585 | |||
| 9da4a5e852 | |||
| 871d7c8265 | |||
| 3352f2afa7 | |||
| 715955ef6a | |||
| 90a43254f3 | |||
| f1db564fb3 | |||
| 97b5483cc9 | |||
| ad056fa2a8 | |||
| 1bdcd5cd1b | |||
| 467b357620 | |||
| 0368276fbf | |||
| 9515b18d1e | |||
| d131c78a59 | |||
| 56389b5dee | |||
| 389cde97c2 | |||
| 0e41fb0ec9 | |||
| e4836174b4 | |||
| 284e282679 | |||
| 4b47346208 |
8
.gitattributes
vendored
@@ -8,3 +8,11 @@ x64/Debug/lua54.dll filter=lfs diff=lfs merge=lfs -text
|
||||
x64/Release/lua54.dll filter=lfs diff=lfs merge=lfs -text
|
||||
x64/Debug/config.txt filter=lfs diff=lfs merge=lfs -text
|
||||
x64/Release/config.txt filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/Skybox/*.png filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/sounds/*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/sounds/*.opus filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/Texture/*.png filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/Texture/*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/Texture/*.tga filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/Model/TXT/* filter=lfs diff=lfs merge=lfs -text
|
||||
enginecustom/assets/Model/OBJ/* filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
136
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
pipeline {
|
||||
agent { label 'windows' }
|
||||
|
||||
parameters {
|
||||
string(name: 'DISCORD_USER_ID', defaultValue: '378262266723696651', description: 'ID Discord pour recevoir le DM')
|
||||
choice(name: 'BUILD_TYPE', choices: ['Both', 'Debug', 'Release'], description: 'Type de build à exécuter')
|
||||
}
|
||||
|
||||
options {
|
||||
timestamps()
|
||||
disableConcurrentBuilds()
|
||||
timeout(time: 30, unit: 'MINUTES')
|
||||
}
|
||||
|
||||
triggers {
|
||||
pollSCM('')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
parallel {
|
||||
stage('Build Debug') {
|
||||
when { expression { params.BUILD_TYPE in ['Both', 'Debug'] } }
|
||||
steps {
|
||||
echo 'Building Debug...'
|
||||
bat """
|
||||
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^
|
||||
"%WORKSPACE%\\KhaoticEngineReborn.sln" ^
|
||||
/p:Configuration=Debug ^
|
||||
/p:Platform=x64 ^
|
||||
/m ^
|
||||
/verbosity:minimal
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Build Release') {
|
||||
when { expression { params.BUILD_TYPE in ['Both', 'Release'] } }
|
||||
steps {
|
||||
echo 'Building Release...'
|
||||
bat """
|
||||
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^
|
||||
"%WORKSPACE%\\KhaoticEngineReborn.sln" ^
|
||||
/p:Configuration=Release ^
|
||||
/p:Platform=x64 ^
|
||||
/m ^
|
||||
/verbosity:minimal
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Package') {
|
||||
parallel {
|
||||
stage('Package Debug') {
|
||||
when { expression { params.BUILD_TYPE in ['Both', 'Debug'] } }
|
||||
steps {
|
||||
echo 'Packaging Debug into ZIP'
|
||||
bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
|
||||
bat """
|
||||
powershell -Command "Compress-Archive -Path '%WORKSPACE%\\**\\Debug\\*' -DestinationPath '%WORKSPACE%\\builds\\KhaoticEngineReborn_Debug.zip' -Force"
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage('Package Release') {
|
||||
when { expression { params.BUILD_TYPE in ['Both', 'Release'] } }
|
||||
steps {
|
||||
echo 'Packaging Release into ZIP'
|
||||
bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
|
||||
bat """
|
||||
powershell -Command "Compress-Archive -Path '%WORKSPACE%\\**\\Release\\*' -DestinationPath '%WORKSPACE%\\builds\\KhaoticEngineReborn_Release.zip' -Force"
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: 'builds/*.zip', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
def urlsList = []
|
||||
if (params.BUILD_TYPE in ['Both', 'Debug']) {
|
||||
urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
|
||||
}
|
||||
if (params.BUILD_TYPE in ['Both', 'Release']) {
|
||||
urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
|
||||
}
|
||||
|
||||
def data = [
|
||||
userId: params.DISCORD_USER_ID,
|
||||
status: 'success',
|
||||
urls: urlsList
|
||||
]
|
||||
def jsonFile = "${env.WORKSPACE}\\payload.json"
|
||||
writeFile file: jsonFile, text: groovy.json.JsonOutput.toJson(data)
|
||||
|
||||
bat """
|
||||
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
||||
-H "Content-Type: application/json" ^
|
||||
--data @${jsonFile}
|
||||
"""
|
||||
}
|
||||
}
|
||||
failure {
|
||||
script {
|
||||
def data = [
|
||||
userId: params.DISCORD_USER_ID,
|
||||
status: 'failure',
|
||||
urls: []
|
||||
]
|
||||
def jsonFile = "${env.WORKSPACE}\\payload-fail.json"
|
||||
writeFile file: jsonFile, text: groovy.json.JsonOutput.toJson(data)
|
||||
|
||||
bat """
|
||||
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
||||
-H "Content-Type: application/json" ^
|
||||
--data @${jsonFile}
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
6014
enginecustom/DemoScene_V14.7.0.ker
Normal file
BIN
enginecustom/assets/Model/TXT/bath.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/chunk.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/cube.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/ground.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/plane.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/square.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/wall.txt
(Stored with Git LFS)
BIN
enginecustom/assets/Model/TXT/water.txt
(Stored with Git LFS)
|
Before Width: | Height: | Size: 11 MiB After Width: | Height: | Size: 133 B |
|
Before Width: | Height: | Size: 331 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 273 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 493 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 510 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 498 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 422 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 7.5 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 8.4 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 588 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 599 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 917 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 934 KiB After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 131 B |
@@ -141,6 +141,7 @@
|
||||
<ClInclude Include="src\inc\system\input_class.h" />
|
||||
<ClInclude Include="src\inc\system\light_class.h" />
|
||||
<ClInclude Include="src\inc\system\Logger.h" />
|
||||
<ClInclude Include="src\inc\system\macro.h" />
|
||||
<ClInclude Include="src\inc\system\model_class.h" />
|
||||
<ClInclude Include="src\inc\system\Modellistclass.h" />
|
||||
<ClInclude Include="src\inc\system\object.h" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[Window][DockSpace]
|
||||
Pos=0,0
|
||||
Size=1584,861
|
||||
Size=1536,793
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
@@ -15,22 +15,22 @@ Collapsed=0
|
||||
DockId=0x00000006,0
|
||||
|
||||
[Window][render Stats]
|
||||
Pos=0,630
|
||||
Size=1584,231
|
||||
Pos=0,562
|
||||
Size=1217,231
|
||||
Collapsed=0
|
||||
DockId=0x00000009,0
|
||||
|
||||
[Window][Objects]
|
||||
Pos=0,19
|
||||
Size=234,842
|
||||
Size=15,22
|
||||
Collapsed=0
|
||||
DockId=0x0000000B,0
|
||||
|
||||
[Window][Terrain]
|
||||
Pos=0,19
|
||||
Size=266,842
|
||||
Size=15,22
|
||||
Collapsed=0
|
||||
DockId=0x00000007,0
|
||||
DockId=0x0000000B,1
|
||||
|
||||
[Window][Log Window]
|
||||
Pos=0,630
|
||||
@@ -45,23 +45,27 @@ Collapsed=0
|
||||
DockId=0x0000000B,0
|
||||
|
||||
[Window][Engine Settings]
|
||||
Pos=1267,462
|
||||
Size=317,166
|
||||
Pos=1219,19
|
||||
Size=317,774
|
||||
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
|
||||
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1536,774 Split=X
|
||||
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=251,842 Selected=0x031DC75C
|
||||
DockNode ID=0x0000000C Parent=0x00000003 SizeRef=964,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
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
Texture2D shaderTexture : register(t0);
|
||||
SamplerState SampleType : register(s0);
|
||||
|
||||
//////////////
|
||||
// TYPEDEFS //
|
||||
@@ -10,7 +8,6 @@ SamplerState SampleType : register(s0);
|
||||
struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -14,13 +14,11 @@ cbuffer MatrixBuffer
|
||||
struct VertexInputType
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
|
||||
@@ -40,8 +38,5 @@ PixelInputType DepthVertexShader(VertexInputType input)
|
||||
output.position = mul(output.position, viewMatrix);
|
||||
output.position = mul(output.position, projectionMatrix);
|
||||
|
||||
// Store the texture coordinates for the pixel shader.
|
||||
output.tex = input.tex;
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
@@ -34,14 +35,14 @@ public:
|
||||
|
||||
bool initialize(ID3D11Device*, HWND);
|
||||
void shutdown();
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX);
|
||||
|
||||
private:
|
||||
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
|
||||
void shutdown_shader();
|
||||
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
|
||||
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
|
||||
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX);
|
||||
void render_shader(ID3D11DeviceContext*, int);
|
||||
|
||||
private:
|
||||
@@ -49,7 +50,6 @@ private:
|
||||
ID3D11PixelShader* pixel_shader_;
|
||||
ID3D11InputLayout* layout_;
|
||||
ID3D11Buffer* matrix_buffer_;
|
||||
ID3D11SamplerState* sample_state_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ constexpr int num_lights = 4;
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <d3d11.h>
|
||||
#include <DirectXMath.h>
|
||||
#include <string>
|
||||
#include "macro.h"
|
||||
|
||||
|
||||
class master_shader
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "skybox_shader_class.h"
|
||||
#include "sunlight_shader_class.h"
|
||||
#include "depth_shader_class.h"
|
||||
#include "macro.h"
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
@@ -53,8 +54,7 @@ public:
|
||||
int indexCount,
|
||||
XMMATRIX worldMatrix,
|
||||
XMMATRIX viewMatrix,
|
||||
XMMATRIX projectionMatrix,
|
||||
ID3D11ShaderResourceView* texture
|
||||
XMMATRIX projectionMatrix
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <d3dcompiler.h>
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "camera_class.h"
|
||||
#include "light_class.h"
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
#include "Fmod/core/inc/fmod.hpp"
|
||||
|
||||
#include "bitmap_class.h"
|
||||
@@ -61,8 +63,6 @@
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
constexpr bool full_screen = false;
|
||||
constexpr float screen_depth = 1000.0f;
|
||||
constexpr float screen_near = 0.3f;
|
||||
|
||||
static std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
|
||||
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
* Construct the frustum for culling.
|
||||
* This function will calculate the frustum based on the current camera view and projection matrices.
|
||||
*/
|
||||
void construct_frustum();
|
||||
void construct_frustum(frustum& frustum, float screen_depth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);
|
||||
|
||||
/**
|
||||
* Get the number of objects rendered in the current frame.
|
||||
@@ -450,6 +450,50 @@ public:
|
||||
* @return A reference to the global model cache as a map of strings to shared pointers of model_class.
|
||||
*/
|
||||
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_; }
|
||||
|
||||
/** Get the Sky entity as a shared pointer.
|
||||
* @return A shared pointer to the sky entity.
|
||||
*/
|
||||
std::shared_ptr<ecs::Entity> get_sky_entity_shared_ptr() const { return sky_entity_; }
|
||||
|
||||
/**
|
||||
* Update the screen depth.
|
||||
*/
|
||||
bool update_screen_depth(float new_screen_depth);
|
||||
|
||||
/**
|
||||
* Update the screen near.
|
||||
*/
|
||||
bool update_screen_near(float new_screen_near);
|
||||
|
||||
/**
|
||||
* Get the screen depth.
|
||||
* @return The screen depth as a float.
|
||||
*/
|
||||
float get_screen_depth() const { return screen_depth; }
|
||||
/**
|
||||
* Get the screen near.
|
||||
* @return The screen near as a float.
|
||||
*/
|
||||
float get_screen_near() const { return screen_near; }
|
||||
|
||||
/**
|
||||
* Get the target fps for the application.
|
||||
* @return The target fps as an integer.
|
||||
*/
|
||||
int get_target_fps() const { return target_fps_; };
|
||||
/**
|
||||
* Set the target fps for the application.
|
||||
* @param target_fps The new target fps as an integer.
|
||||
*/
|
||||
void set_target_fps(int target_fps) { target_fps_ = target_fps; };
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -500,6 +544,13 @@ private:
|
||||
* @return True if the refraction was rendered to the texture successfully, false otherwise.
|
||||
*/
|
||||
bool render_refraction_to_texture();
|
||||
|
||||
/**
|
||||
* Render the shadow map texture for the scene.
|
||||
* @return True if the shadow map was rendered successfully, false otherwise.
|
||||
*/
|
||||
bool render_shadow_map();
|
||||
|
||||
/**
|
||||
* Render the reflection of the scene to a texture.
|
||||
* This function will render the reflection effects, such as water or mirrors, to a texture.
|
||||
@@ -530,6 +581,16 @@ private:
|
||||
* The thread function for culling objects in the scene.
|
||||
*/
|
||||
void culling_thread_function();
|
||||
|
||||
/**
|
||||
* A thread function to handle culling of objects no visible by sun light.
|
||||
*/
|
||||
void sun_culling_thread_function();
|
||||
|
||||
/**
|
||||
* Create the skysphere entity.
|
||||
*/
|
||||
bool create_skysphere();
|
||||
|
||||
public :
|
||||
std::vector<ID3D11ShaderResourceView*> textures;
|
||||
@@ -540,6 +601,11 @@ private :
|
||||
std::thread culling_thread_;
|
||||
std::atomic<bool> culling_active_;
|
||||
std::mutex objects_mutex_;
|
||||
|
||||
// Thread de culling pour les shadows
|
||||
std::thread culling_sun_thread_;
|
||||
std::atomic<bool> culling_sun_active_;
|
||||
std::mutex objects_sun_mutex_;
|
||||
|
||||
std::mutex terrain_mutex_;
|
||||
std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
|
||||
@@ -559,12 +625,15 @@ private :
|
||||
HWND hwnd_;
|
||||
bool windowed_;
|
||||
|
||||
float screen_depth = 1000.0f;
|
||||
float screen_near = 0.3f;
|
||||
|
||||
// ------------------------------------- //
|
||||
// ------------- RENDERING ------------- //
|
||||
// ------------------------------------- //
|
||||
|
||||
XMMATRIX base_view_matrix_;
|
||||
render_texture_class* render_texture_, * refraction_texture_, * reflection_texture_;
|
||||
render_texture_class* render_texture_, * refraction_texture_, * reflection_texture_,* shadow_texture_ ;
|
||||
render_texture_class* scene_texture_;
|
||||
display_plane_class* display_plane_;
|
||||
int screen_width_, screen_height_;
|
||||
@@ -587,7 +656,9 @@ 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_;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- LIGHTS -------------- //
|
||||
@@ -647,12 +718,14 @@ private :
|
||||
ID3D11ShaderResourceView* back_buffer_srv_;
|
||||
|
||||
stats* stats_;
|
||||
int target_fps_ = 60;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- Culling --------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
frustum frustum_culling_;
|
||||
frustum sun_culling_;
|
||||
int render_count_;
|
||||
float frustum_culling_tolerance_ = 5.f;
|
||||
|
||||
@@ -662,6 +735,7 @@ private :
|
||||
|
||||
input inputs_;
|
||||
bool tab_was_pressed_;
|
||||
std::shared_ptr<CameraInput> camera_input_;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- SOUND ----------------------- //
|
||||
|
||||
@@ -13,6 +13,7 @@ using namespace DirectX;
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "texture_class.h"
|
||||
#include "macro.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
|
||||
#include "input_class.h"
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
@@ -69,6 +72,10 @@ public:
|
||||
*/
|
||||
XMMATRIX get_view_matrix(XMMATRIX& view_matrix) const;
|
||||
|
||||
/**
|
||||
* Update the camera's view matrix without
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Renders the reflection of the scene from the camera's perspective.
|
||||
*
|
||||
@@ -120,7 +127,40 @@ public:
|
||||
return upF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the camera
|
||||
* @param std::vector<bool> inputs : forward, backward, left, right, up, down, scrollUp, scrollDown, rightClick
|
||||
* @param float deltaTime : time since last frame
|
||||
* @return void
|
||||
*/
|
||||
void move(float deltatime, float delta_x, float delta_y);
|
||||
|
||||
/**
|
||||
* Rotate the camera
|
||||
* @param float delta_x : mouse delta x
|
||||
* @param float delta_y : mouse delta y
|
||||
* @return void
|
||||
*/
|
||||
void rotate(float delta_x, float delta_y);
|
||||
|
||||
/**
|
||||
* Update the camera input states based on the provided input_class instance.
|
||||
* This method updates the internal state of the camera's input handling.
|
||||
* @param imputs A pointer to an input_class instance containing the current input states.
|
||||
*/
|
||||
void update_camera_inputs_states(input_class* imputs);
|
||||
|
||||
/**
|
||||
* Set the camera inputs structure.
|
||||
* @param inputs A shared pointer to a CameraInput structure containing the input states.
|
||||
*/
|
||||
void set_camera_inputs(std::shared_ptr<CameraInput> inputs) { inputs_ = inputs; }
|
||||
|
||||
/**
|
||||
* Get the camera inputs structure.
|
||||
* @return A shared pointer to the CameraInput structure containing the input states.
|
||||
*/
|
||||
std::shared_ptr<CameraInput> get_camera_inputs() { return inputs_; }
|
||||
|
||||
private:
|
||||
float position_x_, position_y_, position_z_;
|
||||
@@ -128,6 +168,9 @@ private:
|
||||
XMMATRIX view_matrix_;
|
||||
XMMATRIX reflection_view_matrix_;
|
||||
|
||||
float camera_speed_;
|
||||
std::shared_ptr<CameraInput> inputs_;
|
||||
float camera_sensitivity_ = 0.1f;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "font_shader_class.h"
|
||||
#include "font_class.h"
|
||||
#include "text_class.h"
|
||||
#include "macro.h"
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
@@ -74,20 +75,20 @@ public:
|
||||
*
|
||||
* @return Pointer to the ID3D11Device interface.
|
||||
*/
|
||||
ID3D11Device* get_device();
|
||||
ID3D11Device* get_device() const { return device_; };
|
||||
/**
|
||||
* @brief Gets the Direct3D device context.
|
||||
*
|
||||
* @return Pointer to the ID3D11DeviceContext interface.
|
||||
*/
|
||||
ID3D11DeviceContext* get_device_context();
|
||||
ID3D11DeviceContext* get_device_context() const { return device_context_; };
|
||||
//XMMATRIX get_projection_matrix(XMMATRIX& projectionMatrix);
|
||||
IDXGISwapChain* swap_chain;
|
||||
/**
|
||||
* Get the swap chain associated with the Direct3D device.
|
||||
* @return Pointer to the IDXGISwapChain interface.
|
||||
*/
|
||||
IDXGISwapChain* get_swap_chain();
|
||||
IDXGISwapChain* get_swap_chain() const { return swap_chain; };
|
||||
/**
|
||||
* Resizes the swap chain to the specified width and height.
|
||||
* @param width New width of the swap chain.
|
||||
@@ -99,7 +100,7 @@ public:
|
||||
*
|
||||
* @param vsync True to enable vertical sync, false to disable.
|
||||
*/
|
||||
void set_vsync(bool vsync);
|
||||
void set_vsync(bool vsync) { vsync_enabled_ = vsync; };
|
||||
|
||||
/**
|
||||
* Get the projection matrix.
|
||||
@@ -134,7 +135,10 @@ public:
|
||||
/**
|
||||
* Resets the viewport to the default settings.
|
||||
*/
|
||||
void reset_viewport();
|
||||
void reset_viewport() const
|
||||
{
|
||||
device_context_->RSSetViewports(1, &viewport_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release all Direct3D resources.
|
||||
@@ -150,11 +154,17 @@ public:
|
||||
/**
|
||||
* Turn on the Z-buffer to enable depth.
|
||||
*/
|
||||
void turn_z_buffer_on();
|
||||
void turn_z_buffer_on()const
|
||||
{
|
||||
device_context_->OMSetDepthStencilState(depth_stencil_state_, 1);
|
||||
}
|
||||
/**
|
||||
* Turn off the Z-buffer to disable depth.
|
||||
*/
|
||||
void turn_z_buffer_off();
|
||||
void turn_z_buffer_off() const
|
||||
{
|
||||
device_context_->OMSetDepthStencilState(depth_disabled_stencil_state_, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on alpha blending for transparency effects.
|
||||
@@ -165,6 +175,16 @@ public:
|
||||
*/
|
||||
void disable_alpha_blending();
|
||||
|
||||
/**
|
||||
* Set new projection parameters.
|
||||
* @param width The new width for the projection matrix.
|
||||
* @param height The new height for the projection matrix.
|
||||
* @param screenDepth The new screen depth.
|
||||
* @param screenNear The new near clipping plane distance.
|
||||
* @return True if the projection parameters were set successfully, false otherwise.
|
||||
*/
|
||||
bool set_projection_params(int width,int height,float screenDepth, float screenNear);
|
||||
|
||||
private:
|
||||
bool vsync_enabled_;
|
||||
int video_card_memory_;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// MY CLASS INCLUDES //
|
||||
///////////////////////
|
||||
#include "d_3d_class.h"
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: display_plane_class
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <imgui.h>
|
||||
#include "entity.h"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "macro.h"
|
||||
|
||||
/**
|
||||
* namespace for the Entity-Component-System (ECS)
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
* @param data The string data to deserialize from.
|
||||
* @return True if deserialization was successful, otherwise false.
|
||||
*/
|
||||
virtual bool Deserialize(const std::string& data) { return false;}
|
||||
virtual bool Deserialize(const std::string& data) { R_FALSE}
|
||||
|
||||
/**
|
||||
* Virtual function to render ImGui controls for the component.
|
||||
|
||||
@@ -77,17 +77,17 @@ public:
|
||||
bool Load(const std::string& path) {
|
||||
if (!m_system) {
|
||||
Initialize();
|
||||
if (!m_system) return false;
|
||||
if (!m_system) R_FALSE
|
||||
}
|
||||
|
||||
Logger::Get().Log("Loading audio file: " + path, __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||
LOG_INFO("Loading audio file: " + path);
|
||||
|
||||
m_soundPath = path;
|
||||
|
||||
if (!std::filesystem::exists(path)) {
|
||||
m_lastError = "Fichier non trouv<75>: " + path;
|
||||
Logger::Get().Log(m_lastError, __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
LOG_ERROR(m_lastError);
|
||||
R_FALSE
|
||||
}
|
||||
|
||||
if (m_sound) {
|
||||
@@ -109,10 +109,11 @@ public:
|
||||
if (result != FMOD_OK) {
|
||||
m_lastError = "<EFBFBD>chec du chargement du son: " + std::to_string(result) +
|
||||
" (chemin: " + absolutePath.string() + ")";
|
||||
return false;
|
||||
LOG_ERROR(m_lastError);
|
||||
R_FALSE
|
||||
}
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,6 +298,7 @@ public:
|
||||
|
||||
if (!m_lastError.empty()) {
|
||||
ImGui::TextColored(ImVec4(1, 0, 0, 1), "Error: %s", m_lastError.c_str());
|
||||
LOG_ERROR(m_lastError);
|
||||
}
|
||||
} else {
|
||||
ImGui::Text("Loaded: %s", m_soundPath.c_str());
|
||||
@@ -493,7 +495,7 @@ public:
|
||||
std::stringstream ss(data);
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
if (type != "AudioComponent") return false;
|
||||
if (type != "AudioComponent") R_FALSE
|
||||
|
||||
std::string s_volume, s_pan, s_pitch, s_looping, s_muted, s_paused, s_priority, s_spatialized, s_use_velocity;
|
||||
|
||||
@@ -507,8 +509,6 @@ public:
|
||||
std::getline(ss, s_priority, ':');
|
||||
std::getline(ss, s_spatialized, ':');
|
||||
std::getline(ss, s_use_velocity, ':');
|
||||
|
||||
Logger::Get().Log("Deserializing AudioComponent: path=" + m_soundPath, __FILE__, __LINE__, Logger::LogLevel::Warning);
|
||||
|
||||
m_volume = std::stof(s_volume);
|
||||
m_pan = std::stof(s_pan);
|
||||
@@ -525,7 +525,7 @@ public:
|
||||
Load(m_soundPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
|
||||
if (type != "IdentityComponent") return false;
|
||||
if (type != "IdentityComponent") R_FALSE
|
||||
|
||||
std::string token, name, objectTypeStr;
|
||||
int id;
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
SetId(id);
|
||||
SetName(name);
|
||||
SetType(StringToObjectType(objectTypeStr));
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
void OnImGuiRender() override {
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
|
||||
bool CreateScriptFile() {
|
||||
if (strlen(scriptNameBuffer) == 0)
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
scriptName = scriptNameBuffer;
|
||||
if (scriptName.length() < 4 || scriptName.substr(scriptName.length() - 4) != ".lua") {
|
||||
@@ -81,19 +81,19 @@ private:
|
||||
std::filesystem::create_directories(scriptFolder, ec);
|
||||
if (ec) {
|
||||
// Log erreur
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
|
||||
std::string fullPath = scriptFolder + scriptName;
|
||||
|
||||
// Cr<43>er un fichier script vide ou template simple
|
||||
std::ofstream ofs(fullPath);
|
||||
if (!ofs) return false;
|
||||
if (!ofs) R_FALSE
|
||||
|
||||
ofs << "-- Script Lua vide pour ECS\n\nfunction on_update(dt)\n -- Code ici\nend\n";
|
||||
ofs.close();
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ public:
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
|
||||
if (type != "ModelPathComponent") return false;
|
||||
if (type != "ModelPathComponent") R_FALSE
|
||||
|
||||
std::string modelPath;
|
||||
std::getline(ss, modelPath);
|
||||
|
||||
SetPath(std::wstring(modelPath.begin(), modelPath.end()));
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
void OnImGuiRender() override {
|
||||
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
|
||||
if (type != "PhysicsComponent") return false;
|
||||
if (type != "PhysicsComponent") R_FALSE
|
||||
|
||||
std::string token;
|
||||
float mass, boundingRadius;
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
SetPhysicsEnabled(physicsEnabled);
|
||||
SetGravityEnabled(gravityEnabled);
|
||||
SetGrounded(isGrounded);
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
void OnImGuiRender() override {
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
* @return True if initialization was successful, false otherwise.
|
||||
*/
|
||||
bool InitializeWithModel(std::shared_ptr<model_class> model) {
|
||||
if (!model) return false;
|
||||
if (!model) R_FALSE
|
||||
m_model = model;
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,14 +73,14 @@ public:
|
||||
// Cr<43>er un nouveau mod<6F>le
|
||||
auto new_model = std::make_shared<model_class>();
|
||||
if (!new_model->Initialize(device, deviceContext, const_cast<char*>(modelFilename), textureContainer)) {
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
g_model_cache[filename] = new_model;
|
||||
m_model = new_model;
|
||||
}
|
||||
|
||||
m_modelFilePath = modelFilename;
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,13 +101,13 @@ public:
|
||||
ID3D11ShaderResourceView* texture = nullptr;
|
||||
result = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
|
||||
if (FAILED(result)) {
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
texturesContainer.AssignTexture(texturesContainer, texture, texturePath, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,6 +190,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void RenderOnlyGeometryFromSun(ID3D11DeviceContext* ctx)
|
||||
{
|
||||
if (m_model && m_is_in_sun_pov) m_model->Render(ctx);
|
||||
|
||||
}
|
||||
|
||||
void set_is_sun_visible(bool v) { m_is_in_sun_pov = v; }
|
||||
bool is_in_sun_pov() const { return m_is_in_sun_pov; }
|
||||
|
||||
/**
|
||||
* Serialize the RenderComponent's state to a string.
|
||||
* This method is useful for saving the component's state or debugging.
|
||||
@@ -224,6 +233,7 @@ public:
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "RenderComponent:HasModel:"
|
||||
<< is_shadow_caster_ << ":"
|
||||
<< diffuse_count << ":" << diffuse_paths_ << ":"
|
||||
<< normal_count << ":" << normal_paths_ << ":"
|
||||
<< specular_count << ":" << specular_paths_ << ":"
|
||||
@@ -245,12 +255,15 @@ public:
|
||||
std::string type;
|
||||
|
||||
if (!std::getline(ss, type, ':') || type != "RenderComponent")
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
std::string token;
|
||||
|
||||
if (!std::getline(ss, token, ':') || token != "HasModel")
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
std::getline(ss,token, ':');
|
||||
is_shadow_caster_ = std::stoi(token);
|
||||
|
||||
int diffuse_count = 0, normal_count = 0, specular_count = 0, alpha_count = 0;
|
||||
|
||||
@@ -258,14 +271,14 @@ public:
|
||||
|
||||
auto read_count = [&](int& count) -> bool {
|
||||
if (!std::getline(ss, token, ':'))
|
||||
return false;
|
||||
R_FALSE
|
||||
try {
|
||||
count = std::stoi(token);
|
||||
}
|
||||
catch (...) {
|
||||
return false;
|
||||
R_FALSE
|
||||
}
|
||||
return true;
|
||||
R_TRUE
|
||||
};
|
||||
|
||||
auto clean_token = [](std::string& str) {
|
||||
@@ -278,29 +291,29 @@ public:
|
||||
auto read_paths = [&](int count, std::vector<std::wstring>& paths) -> bool {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (!std::getline(ss, token, ':'))
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
clean_token(token);
|
||||
|
||||
if (!token.empty()) {
|
||||
paths.emplace_back(token.begin(), token.end());
|
||||
Logger::Get().Log("Loaded path: " + std::string(token.begin(), token.end()), __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||
LOG_INFO("Loaded path: " + std::string(token.begin(), token.end()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
R_TRUE
|
||||
};
|
||||
|
||||
if (!read_count(diffuse_count)) return false;
|
||||
if (!read_paths(diffuse_count, paths_diffuse)) return false;
|
||||
if (!read_count(diffuse_count)) R_FALSE
|
||||
if (!read_paths(diffuse_count, paths_diffuse)) R_FALSE
|
||||
|
||||
if (!read_count(normal_count)) return false;
|
||||
if (!read_paths(normal_count, paths_normal)) return false;
|
||||
if (!read_count(normal_count)) R_FALSE
|
||||
if (!read_paths(normal_count, paths_normal)) R_FALSE
|
||||
|
||||
if (!read_count(specular_count)) return false;
|
||||
if (!read_paths(specular_count, paths_specular)) return false;
|
||||
if (!read_count(specular_count)) R_FALSE
|
||||
if (!read_paths(specular_count, paths_specular)) R_FALSE
|
||||
|
||||
if (!read_count(alpha_count)) return false;
|
||||
if (!read_paths(alpha_count, paths_alpha)) return false;
|
||||
if (!read_count(alpha_count)) R_FALSE
|
||||
if (!read_paths(alpha_count, paths_alpha)) R_FALSE
|
||||
|
||||
// Lib<69>rer textures existantes
|
||||
for (auto& tex : texture_container_buffer.diffuse) if (tex) { tex->Release(); tex = nullptr; }
|
||||
@@ -318,7 +331,7 @@ public:
|
||||
texture_container_buffer.specularPaths = std::move(paths_specular);
|
||||
texture_container_buffer.alphaPaths = std::move(paths_alpha);
|
||||
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -328,6 +341,7 @@ public:
|
||||
*/
|
||||
void OnImGuiRender() override {
|
||||
ImGui::Checkbox("Visible", &m_isVisible);
|
||||
C_BOX("Is shadow caster" , &is_shadow_caster_);
|
||||
ImGui::Text("Model File Path: %s", m_modelFilePath.c_str());
|
||||
if (m_model) {
|
||||
ImGui::Text("Index Count: %d", m_model->GetIndexCount());
|
||||
@@ -453,6 +467,17 @@ public:
|
||||
void SetTextureContainer(const TextureContainer& texContainer) { texture_container_buffer = texContainer; }
|
||||
const TextureContainer& GetTextureContainerBuffer() const { return texture_container_buffer; }
|
||||
|
||||
/**
|
||||
* Get whether the model casts shadows.
|
||||
* @return True if the model casts shadows, false otherwise.
|
||||
*/
|
||||
bool IsShadowCaster() const { return is_shadow_caster_; }
|
||||
/**
|
||||
* Set whether the model casts shadows.
|
||||
* @param isCaster True to make the model cast shadows, false otherwise.
|
||||
*/
|
||||
void SetShadowCaster(bool isCaster) { is_shadow_caster_ = isCaster; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<model_class> m_model;
|
||||
std::string m_modelFilePath;
|
||||
@@ -460,6 +485,8 @@ private:
|
||||
ID3D11Device* device;
|
||||
ID3D11DeviceContext* context;
|
||||
TextureContainer texture_container_buffer;
|
||||
bool is_shadow_caster_ = true;
|
||||
bool m_is_in_sun_pov;
|
||||
};
|
||||
|
||||
} // namespace ecs
|
||||
|
||||
@@ -53,17 +53,17 @@ public:
|
||||
* @return The ShaderType enum corresponding to the provided string.
|
||||
*/
|
||||
static ShaderType StringToShaderType(const std::string& str) {
|
||||
if (str == "ALPHA_MAPPING") return ShaderType::ALPHA_MAPPING;
|
||||
if (str == "CEL_SHADING") return ShaderType::CEL_SHADING;
|
||||
if (str == "NORMAL_MAPPING") return ShaderType::NORMAL_MAPPING;
|
||||
if (str == "SPECULAR_MAPPING") return ShaderType::SPECULAR_MAPPING;
|
||||
if (str == "TEXTURE") return ShaderType::TEXTURE;
|
||||
if (str == "LIGHTING") return ShaderType::LIGHTING;
|
||||
if (str == "SUNLIGHT") return ShaderType::SUNLIGHT;
|
||||
if (str == "SKYBOX") return ShaderType::SKYBOX;
|
||||
if (str == "REFLECTION") return ShaderType::REFLECTION;
|
||||
if (str == "REFRACTION") return ShaderType::REFRACTION;
|
||||
return ShaderType::TEXTURE;
|
||||
if (str == "ALPHA_MAPPING") return SHD_ALPHA;
|
||||
if (str == "CEL_SHADING") return SHD_CEL;
|
||||
if (str == "NORMAL_MAPPING") return SHD_NORM;
|
||||
if (str == "SPECULAR_MAPPING") return SHD_SPEC;
|
||||
if (str == "TEXTURE") return SHD_TEX;
|
||||
if (str == "LIGHTING") return SHD_LIGHT;
|
||||
if (str == "SUNLIGHT") return SHD_SUN;
|
||||
if (str == "SKYBOX") return SHD_SKYBOX;
|
||||
if (str == "REFLECTION") return SHD_REFL;
|
||||
if (str == "REFRACTION") return SHD_REFR;
|
||||
return SHD_TEX;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,17 +74,17 @@ public:
|
||||
*/
|
||||
static std::string ShaderTypeToString(ShaderType type) {
|
||||
switch (type) {
|
||||
case ShaderType::ALPHA_MAPPING: return "ALPHA_MAPPING";
|
||||
case ShaderType::CEL_SHADING: return "CEL_SHADING";
|
||||
case ShaderType::NORMAL_MAPPING: return "NORMAL_MAPPING";
|
||||
case ShaderType::SPECULAR_MAPPING: return "SPECULAR_MAPPING";
|
||||
case ShaderType::TEXTURE: return "TEXTURE";
|
||||
case ShaderType::LIGHTING: return "LIGHTING";
|
||||
case ShaderType::SUNLIGHT: return "SUNLIGHT";
|
||||
case ShaderType::SKYBOX: return "SKYBOX";
|
||||
case ShaderType::REFLECTION: return "REFLECTION";
|
||||
case ShaderType::REFRACTION: return "REFRACTION";
|
||||
default: return "TEXTURE";
|
||||
case SHD_ALPHA: return "ALPHA_MAPPING";
|
||||
case SHD_CEL: return "CEL_SHADING";
|
||||
case SHD_NORM: return "NORMAL_MAPPING";
|
||||
case SHD_SPEC: return "SPECULAR_MAPPING";
|
||||
case SHD_TEX: return "TEXTURE";
|
||||
case SHD_LIGHT: return "LIGHTING";
|
||||
case SHD_SUN: return "SUNLIGHT";
|
||||
case SHD_SKYBOX: return "SKYBOX";
|
||||
case SHD_REFL: return "REFLECTION";
|
||||
case SHD_REFR: return "REFRACTION";
|
||||
default: return "TEXTURE";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,13 +101,13 @@ public:
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
|
||||
if (type != "ShaderComponent") return false;
|
||||
if (type != "ShaderComponent") R_FALSE
|
||||
|
||||
std::string shaderTypeStr;
|
||||
std::getline(ss, shaderTypeStr);
|
||||
|
||||
SetActiveShader(StringToShaderType(shaderTypeStr));
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
void OnImGuiRender() override {
|
||||
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
|
||||
if (type != "TransformComponent") return false;
|
||||
if (type != "TransformComponent") R_FALSE
|
||||
|
||||
std::string token;
|
||||
XMFLOAT3 position, rotation, scale;
|
||||
@@ -206,7 +206,7 @@ public:
|
||||
SetPosition(XMLoadFloat3(&position));
|
||||
SetRotation(XMLoadFloat3(&rotation));
|
||||
SetScale(XMLoadFloat3(&scale));
|
||||
return true;
|
||||
R_TRUE
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -178,6 +178,9 @@ public:
|
||||
ID3D11Device* GetDevice() const { return device; }
|
||||
ID3D11DeviceContext* GetContext() const { return context; }
|
||||
|
||||
int GetSkyID() const { return sky_id_; }
|
||||
void SetSkyID(int id) { sky_id_ = id; }
|
||||
|
||||
private:
|
||||
EntityID m_NextEntityID;
|
||||
std::unordered_map<EntityID, std::shared_ptr<Entity>> m_Entities;
|
||||
@@ -186,6 +189,7 @@ private:
|
||||
FMOD::System* sound_system_ = nullptr;
|
||||
ID3D11Device* device;
|
||||
ID3D11DeviceContext* context;
|
||||
int sky_id_ = -1;
|
||||
};
|
||||
|
||||
} // namespace ecs
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
auto shader = entity->GetComponent<ShaderComponent>();
|
||||
|
||||
if (!transform || !render || !shader || !render->GetModel())
|
||||
return false;
|
||||
R_FALSE
|
||||
|
||||
// Calculer la matrice monde
|
||||
XMMATRIX scaleMatrix = transform->GetScaleMatrix();
|
||||
@@ -238,6 +238,16 @@ public:
|
||||
// V<>rifier si le mod<6F>le est visible
|
||||
if (!render->IsVisible()) continue;
|
||||
|
||||
// check if the id the sky id to disabled the z buffer
|
||||
if (entity->GetID() == entityManager->GetSkyID())
|
||||
{
|
||||
// D<>sactiver le Z-buffer pour le skysphere
|
||||
m_deviceContext->OMSetDepthStencilState(nullptr, 0);
|
||||
} else {
|
||||
// Activer le Z-buffer pour les autres entit<69>s
|
||||
m_deviceContext->OMSetDepthStencilState(nullptr, 1);
|
||||
}
|
||||
|
||||
// Effectuer le rendu
|
||||
if (RenderEntity(entity, viewMatrix, projectionMatrix,
|
||||
diffuseColors, lightPositions, ambientColors,cameraPos,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
#include <fstream>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
|
||||
class fps_limiter {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Builder for fps_limiter class
|
||||
* This class is used to limit the execution rate of a loop based on a target frames per second (FPS).
|
||||
* @param target_fps Target frames per second for the limiter. The default is 60.0f FPS.
|
||||
* Constructor for fps_limiter class
|
||||
* @param target_fps Target frames per second for the limiter. Default is 60.0f FPS.
|
||||
*/
|
||||
explicit fps_limiter(const float target_fps = 60.0f)
|
||||
: min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}
|
||||
@@ -25,7 +23,17 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically set the target FPS limit.
|
||||
* @param target_fps New target frames per second.
|
||||
*/
|
||||
void set_target_fps(float target_fps) {
|
||||
if (target_fps > 0.0f) {
|
||||
min_delta_ = 1.0f / target_fps;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
float min_delta_;
|
||||
std::chrono::high_resolution_clock::time_point last_time_;
|
||||
};
|
||||
float min_delta_; // Minimum time in seconds between frames
|
||||
std::chrono::high_resolution_clock::time_point last_time_; // Time point of last allowed execution
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <DirectXMath.h>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
|
||||
class frustum
|
||||
@@ -13,12 +14,14 @@ public:
|
||||
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);
|
||||
/**
|
||||
* Check if a point is inside the frustum.
|
||||
* @param x X coordinate of the point.
|
||||
* @param y Y coordinate of the point.
|
||||
* @param z Z coordinate of the point.
|
||||
* @param x_center X coordinate of the point.
|
||||
* @param y_center Y coordinate of the point.
|
||||
* @param z_center Z coordinate of the point.
|
||||
* @param radius Radius of the point (for bounding sphere).
|
||||
* @param tolerance Tolerance value for the check.
|
||||
* @return True if the point is inside the frustum, otherwise false.
|
||||
*/
|
||||
bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance);
|
||||
bool CheckCube(float x_center, float y_center, float z_center, float radius, float tolerance);
|
||||
|
||||
private:
|
||||
XMVECTOR m_planes[6];
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Logger.h"
|
||||
#include "sceneManager.h"
|
||||
#include "fps_limiter.h"
|
||||
#include "macro.h"
|
||||
|
||||
#include <imgui.h>
|
||||
#include <imgui_impl_dx11.h>
|
||||
@@ -38,6 +39,12 @@ struct ComponentEntry {
|
||||
std::function<void()> addFunc;
|
||||
};
|
||||
|
||||
struct CachedEntity
|
||||
{
|
||||
std::string name;
|
||||
int id;
|
||||
};
|
||||
|
||||
class imguiManager
|
||||
{
|
||||
public:
|
||||
@@ -174,6 +181,10 @@ private:
|
||||
// --------------------------------------------- //
|
||||
// ----------------- Functions ----------------- //
|
||||
// --------------------------------------------- //
|
||||
/**
|
||||
* Update the cached entity list if there is a new, delete or rename entity
|
||||
*/
|
||||
void UpdateCachedEntitiesIfNeeded();
|
||||
|
||||
// --------------------------------------------- //
|
||||
// ----------------- Variables ----------------- //
|
||||
@@ -185,6 +196,8 @@ private:
|
||||
scene_manager* scene_manager_;
|
||||
stats* stats_;
|
||||
ecs::EntityManager* entity_manager_;
|
||||
|
||||
std::shared_ptr<ecs::Entity> sky_entity_shared_ptr_;
|
||||
|
||||
bool showObjectWindow;
|
||||
bool showTerrainWindow;
|
||||
@@ -229,6 +242,8 @@ private:
|
||||
std::string version_driver_;
|
||||
|
||||
ecs::EntityID m_selected_entity_id = 0; // ID of the currently selected entity
|
||||
std::vector<CachedEntity> cachedEntities_;
|
||||
bool entityListDirty = true;
|
||||
|
||||
int BUILD_VERSION_VER = -1;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <dinput.h>
|
||||
#include "macro.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Class name: input_class
|
||||
@@ -24,6 +25,17 @@
|
||||
class input_class
|
||||
{
|
||||
public:
|
||||
|
||||
template<typename Container>
|
||||
std::vector<bool> get_key_states(const Container& key) const
|
||||
{
|
||||
std::vector<bool> key_states;
|
||||
key_states.reserve(key.size());
|
||||
for (auto k : key)
|
||||
key_states.push_back(this->is_key_pressed(k));
|
||||
return key_states;
|
||||
}
|
||||
|
||||
input_class();
|
||||
input_class(const input_class&);
|
||||
~input_class();
|
||||
@@ -44,15 +56,11 @@ public:
|
||||
bool IsScrollDown() const;
|
||||
bool IsUpArrowPressed() const;
|
||||
bool IsDownArrowPressed() const;
|
||||
bool IsAPressed() const;
|
||||
bool IsDPressed() const;
|
||||
bool IsWPressed() const;
|
||||
bool IsSPressed() const;
|
||||
bool IsQPressed() const;
|
||||
bool IsEPressed()const;
|
||||
bool IsKeyDown(unsigned int) const;
|
||||
bool is_key_pressed(const unsigned int);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
bool m_keys[256];
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include <directxmath.h>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
|
||||
200
enginecustom/src/inc/system/macro.h
Normal file
@@ -0,0 +1,200 @@
|
||||
#pragma once
|
||||
#include "imgui.h"
|
||||
#include "Logger.h"
|
||||
#include <limits>
|
||||
#include <DirectXMath.h>
|
||||
// --------------------- //
|
||||
// --- Global Macros --- //
|
||||
// --------------------- //
|
||||
#define R_FALSE return false;
|
||||
#define R_TRUE return true;
|
||||
#define TO_RAD 0.0174532925f
|
||||
#define TO_DEG (180.0f/3.141593f)
|
||||
|
||||
#ifdef max
|
||||
#pragma push_macro("max")
|
||||
#undef max
|
||||
#define PUSHED_MAX_DEFINED
|
||||
#endif
|
||||
|
||||
|
||||
// convert unsigned long long int to int safely
|
||||
inline int ulli_to_int(unsigned long long x)
|
||||
{
|
||||
return (x > static_cast<unsigned long long>(std::numeric_limits<int>::max())) ? std::numeric_limits<int>::max() : static_cast<int>(x);
|
||||
}
|
||||
|
||||
// convert int to float safely
|
||||
inline float int_to_float(int x)
|
||||
{
|
||||
return (x > static_cast<int>(std::numeric_limits<float>::max())) ? std::numeric_limits<float>::max() : static_cast<float>(x);
|
||||
}
|
||||
|
||||
// convert size_t to int safely
|
||||
inline int size_t_to_int(size_t x)
|
||||
{
|
||||
return (x > static_cast<size_t>(std::numeric_limits<int>::max())) ? std::numeric_limits<int>::max() : static_cast<int>(x);
|
||||
}
|
||||
|
||||
#ifdef PUSHED_MAX_DEFINED
|
||||
#pragma pop_macro("max")
|
||||
#undef PUSHED_MAX_DEFINED
|
||||
#endif
|
||||
// --------------------------------------------------------- //
|
||||
// --- Macros for logging with different severity levels --- //
|
||||
// --------------------------------------------------------- //
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define LOG(msg, level) Logger::Get().Log(msg, __FILE__, __LINE__, level)
|
||||
#define LOG_INFO(msg) Logger::Get().Log(msg, __FILE__, __LINE__, Logger::LogLevel::Info)
|
||||
#define LOG_WARNING(msg) Logger::Get().Log(msg, __FILE__, __LINE__, Logger::LogLevel::Warning)
|
||||
#define LOG_ERROR(msg) Logger::Get().Log(msg, __FILE__, __LINE__, Logger::LogLevel::Error)
|
||||
#define LOG_DEBUG(msg) Logger::Get().Log(msg, __FILE__, __LINE__, Logger::LogLevel::Debug)
|
||||
#define LOG_SHUTDOWN(msg) Logger::Get().Log(msg, __FILE__, __LINE__, Logger::LogLevel::Shutdown)
|
||||
#define LOG_INIT(msg) Logger::Get().Log(msg, __FILE__, __LINE__, Logger::LogLevel::Initialize)
|
||||
|
||||
#define R_LOG_ERROR(result,msg) \
|
||||
if(!(result)) { \
|
||||
LOG_ERROR(msg); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define LOG(msg, level) ((void)0)
|
||||
#define LOG_INFO(msg) ((void)0)
|
||||
#define LOG_WARNING(msg)((void)0)
|
||||
#define LOG_ERROR(msg) ((void)0)
|
||||
#define LOG_DEBUG(msg) ((void)0)
|
||||
#define LOG_SHUTDOWN(msg) ((void)0)
|
||||
#define LOG_INIT(msg) ((void)0)
|
||||
|
||||
#define R_LOG_ERROR(result,msg) ((void)0);
|
||||
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------- //
|
||||
// --- Macros for the Entity Component System (ECS) --- //
|
||||
// ---------------------------------------------------- //
|
||||
#define CREATE_ENTITY entity_manager_->CreateEntity();
|
||||
|
||||
#define SHD_ALPHA ecs::ShaderType::ALPHA_MAPPING
|
||||
#define SHD_CEL ecs::ShaderType::CEL_SHADING
|
||||
#define SHD_LIGHT ecs::ShaderType::LIGHTING
|
||||
#define SHD_NORM ecs::ShaderType::NORMAL_MAPPING
|
||||
#define SHD_REFL ecs::ShaderType::REFLECTION
|
||||
#define SHD_REFR ecs::ShaderType::REFRACTION
|
||||
#define SHD_SKYBOX ecs::ShaderType::SKYBOX
|
||||
#define SHD_SPEC ecs::ShaderType::SPECULAR_MAPPING
|
||||
#define SHD_SUN ecs::ShaderType::SUNLIGHT
|
||||
#define SHD_TEX ecs::ShaderType::TEXTURE
|
||||
|
||||
// ---------------------------------------- //
|
||||
// --- Macros for the application class --- //
|
||||
// ---------------------------------------- //
|
||||
#define CHECK_2_CONDITION_INDEPENDENT_RETURN(cond1, cond2) \
|
||||
if(!(cond1)) { \
|
||||
LOG_ERROR("Condition 1 failed: " #cond1); \
|
||||
return false; \
|
||||
} \
|
||||
if (!(cond2)) { \
|
||||
LOG_ERROR("Condition 2 failed: " #cond2); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
#define CHECK_CONDITION_RETURN(cond) \
|
||||
if(!(cond)) { \
|
||||
LOG_ERROR("Condition failed: " #cond); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
// ------------------------------------------------ //
|
||||
// --- Macros and constexpr for the ImGUI class --- //
|
||||
// ------------------------------------------------ //
|
||||
constexpr ImVec4 BG_DK_GRAY = ImVec4(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
constexpr ImVec4 BG_GRAY = ImVec4(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
constexpr ImVec4 BG_LT_GRAY = ImVec4(0.3f, 0.3f, 0.3f, 1.0f);
|
||||
constexpr ImVec4 ACCENT_COLOR = ImVec4(0.14f, 0.5f, 0.8f, 0.5f);
|
||||
constexpr ImVec4 ACCENT_LT_COLOR= ImVec4(0.14f, 0.5f, 0.8f, 1.0f);
|
||||
constexpr ImVec4 TEXT_COLOR = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
constexpr ImVec4 TEXT_DIM_COLOR = ImVec4(0.6f, 0.6f, 0.6f, 1.0f);
|
||||
constexpr ImVec4 BORDER_COLOR = ImVec4(0.25f, 0.25f, 0.27f, 1.00f);
|
||||
constexpr ImVec4 BLK = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
#define BASIC_DOCK_STYLE_1 \
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); \
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); \
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); \
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_DockingSeparatorSize, 1.0f);
|
||||
|
||||
#define BEGIN(name, p_open) ImGui::Begin(name, p_open);
|
||||
#define S_LINE ImGui::SameLine();
|
||||
#define E_MENU ImGui::EndMenu();
|
||||
#define END ImGui::End();
|
||||
#define TEXT_V(label,var) ImGui::Text(label, var);
|
||||
#define SEP ImGui::Separator();
|
||||
#define PSV ImGui::PopStyleVar();
|
||||
#define O_POPUP(str) ImGui::OpenPopup(str);
|
||||
#define E_POPUP ImGui::EndPopup();
|
||||
#define TEX(label) ImGui::Text(label);
|
||||
|
||||
#define BUTTON(label) ImGui::Button(label)
|
||||
#define B_MENU(label) ImGui::BeginMenu(label)
|
||||
#define M_ITEM_LP(label, p_open) ImGui::MenuItem(label, NULL, p_open)
|
||||
#define M_ITEM_L(label) ImGui::MenuItem(label)
|
||||
#define F_SLIDER(label, value, min, max) ImGui::SliderFloat(label, value, min, max)
|
||||
#define I_SLIDER(label, value, min, max) ImGui::SliderInt(label, value, min, max)
|
||||
#define C_HEADER(label) ImGui::CollapsingHeader(label)
|
||||
#define SEL(label, isSelected) ImGui::Selectable(label, isSelected)
|
||||
#define I_TEX(label, buf, buf_size) ImGui::InputText(label, buf, buf_size)
|
||||
#define C_BOX(label, v) ImGui::Checkbox(label, v)
|
||||
#define B_POPUP(str) ImGui::BeginPopup(str)
|
||||
|
||||
// ------------------------------------ //
|
||||
// --- Macros for the frustum class --- //
|
||||
// ------------------------------------ //
|
||||
inline bool TestPlaneCorner(
|
||||
const DirectX::XMVECTOR& plane,
|
||||
float xPos, float yPos, float zPos,
|
||||
float tolerance)
|
||||
{
|
||||
float val =
|
||||
DirectX::XMVectorGetX(plane) * xPos +
|
||||
DirectX::XMVectorGetY(plane) * yPos +
|
||||
DirectX::XMVectorGetZ(plane) * zPos +
|
||||
DirectX::XMVectorGetW(plane);
|
||||
return val > -tolerance;
|
||||
}
|
||||
|
||||
#define CHECK_FRUSTRUM_CUBE_CORNERS(plane, xCenter, yCenter, zCenter, radius, tolerance) \
|
||||
do { \
|
||||
const float offsets[2] = { -radius, radius }; \
|
||||
bool inside = false; \
|
||||
for (int xi = 0; xi < 2 && !inside; ++xi) { \
|
||||
for (int yi = 0; yi < 2 && !inside; ++yi) { \
|
||||
for (int zi = 0; zi < 2 && !inside; ++zi) { \
|
||||
if (TestPlaneCorner(plane, xCenter + offsets[xi], yCenter + offsets[yi], zCenter + offsets[zi], tolerance)) { \
|
||||
inside = true; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
if (!inside) { \
|
||||
R_FALSE; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
// ---------------------------------------------- //
|
||||
// --- Macros for the camera input processing --- //
|
||||
// ---------------------------------------------- //
|
||||
struct CameraInput {
|
||||
bool move_forward = false;
|
||||
bool move_backward = false;
|
||||
bool move_left = false;
|
||||
bool move_right = false;
|
||||
bool move_up = false;
|
||||
bool move_down = false;
|
||||
bool scroll_up = false;
|
||||
bool scroll_down = false;
|
||||
bool right_click = false;
|
||||
};
|
||||
@@ -6,6 +6,7 @@
|
||||
// INCLUDES //
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include "macro.h"
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <directxmath.h>
|
||||
|
||||
@@ -22,16 +22,10 @@ public:
|
||||
void GetRotation(float&, float&) const;
|
||||
void GetPosition(float&, float&, float&) const;
|
||||
|
||||
void TurnLeft(bool);
|
||||
void TurnRight(bool);
|
||||
void TurnMouse(float, float, float, bool);
|
||||
void MoveCamera(bool, bool, bool, bool, bool, bool, bool, bool, bool);
|
||||
|
||||
private:
|
||||
float m_frameTime;
|
||||
float m_rotationY, m_rotationX;
|
||||
float m_positionX, m_positionY, m_positionZ;
|
||||
float m_leftTurnSpeed, m_rightTurnSpeed, m_horizontalTurnSpeed, m_verticalTurnSpeed, m_cameraSpeed, m_speed;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <directxmath.h>
|
||||
#include "macro.h"
|
||||
using namespace DirectX;
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "macro.h"
|
||||
|
||||
#include "ecs/entity.h"
|
||||
#include "ecs/ComponentFactory.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <d3d11.h>
|
||||
#include <directxmath.h>
|
||||
#include "macro.h"
|
||||
|
||||
class shadow_map {
|
||||
public:
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
static bool DEBUG_MODE = true;
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
#include "input_class.h"
|
||||
@@ -64,6 +62,8 @@ private:
|
||||
bool is_debug_key_pressed_ = false;
|
||||
|
||||
std::mutex render_mutex_;
|
||||
|
||||
std::unique_ptr<fps_limiter> fps_limiter_ = std::make_unique<fps_limiter>(60);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Logger.h"
|
||||
#include <d3d11.h>
|
||||
#include <stdio.h>
|
||||
#include "macro.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//////////////
|
||||
#include "Logger.h"
|
||||
#include <windows.h>
|
||||
#include "macro.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
#pragma once
|
||||
#include "imgui.h"
|
||||
/**
|
||||
* Definitions for build versioning.
|
||||
* The build version is composed of:
|
||||
* - Major version (BUILD_VERSION_MAJOR)
|
||||
* - Minor version (BUILD_VERSION_MINOR)
|
||||
* - Patch version (BUILD_VERSION_PATCH)
|
||||
* - Build number (BUILD_VERSION_VER) which is incremented at each build.
|
||||
* - Build type (BUILD_VERSION_TYPE) which can be "Debug" or "Release"
|
||||
* - Build state (BUILD_VERSION_STATE) which can be "Dev" or "Stable"
|
||||
*/
|
||||
#define BUILD_VERSION_MAJOR 14
|
||||
#define BUILD_VERSION_MINOR 1
|
||||
#define BUILD_VERSION_PATCH 1
|
||||
#define BUILD_VERSION_MINOR 5
|
||||
#define BUILD_VERSION_PATCH 27
|
||||
|
||||
// BUILD_VERSION_VER est un int persist<73> dans un fichier, <20> charger au lancement et incr<63>menter <20> chaque build (voir point 3)
|
||||
extern int BUILD_VERSION_VER;
|
||||
|
||||