Compare commits
14 Commits
Reborn_V1
...
Cel-Shad-V
Author | SHA1 | Date | |
---|---|---|---|
01a9c940f0 | |||
ab0355ed97 | |||
915c0cdd7f | |||
bce659e55d | |||
79f266b479 | |||
b4804c2df2 | |||
7d2b962420 | |||
d7965fec64 | |||
7f84ab39a1 | |||
975edf0e62 | |||
b3af9f4ce7 | |||
8f20397130 | |||
3aafec5bf8 | |||
79558eed4f |
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C/C++ Runner: Debug Session",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": true,
|
||||
"cwd": "c:/Users/arivas/Documents/GitHub/khaotic-engine-Reborn/enginecustom",
|
||||
"program": "c:/Users/arivas/Documents/GitHub/khaotic-engine-Reborn/enginecustom/build/Debug/outDebug",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
59
.vscode/settings.json
vendored
Normal file
59
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"C_Cpp_Runner.cCompilerPath": "gcc",
|
||||
"C_Cpp_Runner.cppCompilerPath": "g++",
|
||||
"C_Cpp_Runner.debuggerPath": "gdb",
|
||||
"C_Cpp_Runner.cStandard": "",
|
||||
"C_Cpp_Runner.cppStandard": "",
|
||||
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||
"C_Cpp_Runner.useMsvc": false,
|
||||
"C_Cpp_Runner.warnings": [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wpedantic",
|
||||
"-Wshadow",
|
||||
"-Wformat=2",
|
||||
"-Wcast-align",
|
||||
"-Wconversion",
|
||||
"-Wsign-conversion",
|
||||
"-Wnull-dereference"
|
||||
],
|
||||
"C_Cpp_Runner.msvcWarnings": [
|
||||
"/W4",
|
||||
"/permissive-",
|
||||
"/w14242",
|
||||
"/w14287",
|
||||
"/w14296",
|
||||
"/w14311",
|
||||
"/w14826",
|
||||
"/w44062",
|
||||
"/w44242",
|
||||
"/w14905",
|
||||
"/w14906",
|
||||
"/w14263",
|
||||
"/w44265",
|
||||
"/w14928"
|
||||
],
|
||||
"C_Cpp_Runner.enableWarnings": true,
|
||||
"C_Cpp_Runner.warningsAsError": false,
|
||||
"C_Cpp_Runner.compilerArgs": [],
|
||||
"C_Cpp_Runner.linkerArgs": [],
|
||||
"C_Cpp_Runner.includePaths": [],
|
||||
"C_Cpp_Runner.includeSearch": [
|
||||
"*",
|
||||
"**/*"
|
||||
],
|
||||
"C_Cpp_Runner.excludeSearch": [
|
||||
"**/build",
|
||||
"**/build/**",
|
||||
"**/.*",
|
||||
"**/.*/**",
|
||||
"**/.vscode",
|
||||
"**/.vscode/**"
|
||||
],
|
||||
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
||||
"C_Cpp_Runner.useLeakSanitizer": false,
|
||||
"C_Cpp_Runner.showCompilationTime": false,
|
||||
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
||||
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
||||
}
|
@@ -6,6 +6,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline,
|
||||
SystemClass* System;
|
||||
bool result;
|
||||
|
||||
wchar_t path[MAX_PATH];
|
||||
HMODULE hmodule = GetModuleHandle(NULL);
|
||||
if (hmodule != NULL)
|
||||
{
|
||||
GetModuleFileName(hmodule, path, (sizeof(path) / sizeof(wchar_t)));
|
||||
}
|
||||
|
||||
std::filesystem::path exePath(path);
|
||||
std::filesystem::path WFolder = exePath.parent_path();
|
||||
|
||||
// Create the system object.
|
||||
System = new SystemClass;
|
||||
|
||||
@@ -14,6 +24,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline,
|
||||
if (result)
|
||||
{
|
||||
Logger::Get().Log("System initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||
System->SendPath(path,WFolder);
|
||||
System->Run();
|
||||
}
|
||||
|
||||
|
@@ -9,34 +9,28 @@ SystemClass::SystemClass()
|
||||
m_Input = 0;
|
||||
m_Application = 0;
|
||||
m_imguiManager = 0;
|
||||
m_applicationName = 0;
|
||||
m_hinstance = 0;
|
||||
m_hwnd = 0;
|
||||
m_initialWindowWidth = 0;
|
||||
m_initialWindowHeight = 0;
|
||||
m_isDirect3DInitialized = false;
|
||||
|
||||
}
|
||||
|
||||
SystemClass::SystemClass(const SystemClass& other)
|
||||
{
|
||||
}
|
||||
|
||||
SystemClass::~SystemClass()
|
||||
{
|
||||
}
|
||||
|
||||
bool SystemClass::Initialize()
|
||||
{
|
||||
int screenWidth, screenHeight;
|
||||
int screenHeight, screenWidth = 0;
|
||||
bool result;
|
||||
|
||||
Logger::Get().Log("Initializing system class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||
|
||||
try
|
||||
{
|
||||
// Initialize the width and height of the screen to zero before sending the variables into the function.
|
||||
screenWidth = 0;
|
||||
screenHeight = 0;
|
||||
|
||||
m_initialWindowWidth = 0;
|
||||
m_initialWindowHeight = 0;
|
||||
m_isDirect3DInitialized = false;
|
||||
|
||||
// Initialize the windows api.
|
||||
InitializeWindows(screenWidth, screenHeight);
|
||||
|
||||
@@ -149,6 +143,10 @@ void SystemClass::Run()
|
||||
|
||||
// Loop until there is a quit message from the window or the user.
|
||||
done = false;
|
||||
|
||||
auto fixedUpdateInterval = std::chrono::milliseconds(16);
|
||||
auto m_lastFixedUpdateTime = std::chrono::steady_clock::now();
|
||||
|
||||
while (!done)
|
||||
{
|
||||
// Handle the windows messages.
|
||||
@@ -180,6 +178,13 @@ void SystemClass::Run()
|
||||
Logger::Get().Log("Failed to process frame", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
done = true;
|
||||
}
|
||||
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
if (now - m_lastFixedUpdateTime >= fixedUpdateInterval)
|
||||
{
|
||||
FixedUpdate();
|
||||
m_lastFixedUpdateTime = now;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -257,6 +262,8 @@ LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam
|
||||
// If Direct3D is initialized, update the swap chain. Otherwise, store the window dimensions
|
||||
if (m_isDirect3DInitialized && m_Application && m_Application->GetDirect3D())
|
||||
{
|
||||
m_Application->SetScreenWidth(newWidth);
|
||||
m_Application->SetScreenHeight(newHeight);
|
||||
m_Application->GetDirect3D()->ResizeSwapChain(newWidth, newHeight);
|
||||
}
|
||||
else
|
||||
@@ -264,6 +271,7 @@ LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam
|
||||
m_initialWindowWidth = newWidth;
|
||||
m_initialWindowHeight = newHeight;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_ENTERSIZEMOVE:
|
||||
{
|
||||
@@ -462,4 +470,15 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam)
|
||||
return ApplicationHandle->MessageHandler(hwnd, umessage, wparam, lparam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SystemClass::SendPath(wchar_t* path, std::filesystem::path WFolder)
|
||||
{
|
||||
m_Application->SetPath(path);
|
||||
m_Application->SetWFolder(WFolder);
|
||||
}
|
||||
|
||||
void SystemClass::FixedUpdate()
|
||||
{
|
||||
m_Application->GetPhysics()->Update();
|
||||
}
|
@@ -17,7 +17,6 @@ ApplicationClass::ApplicationClass() : m_ShouldQuit(false)
|
||||
m_RenderCountString = 0;
|
||||
m_ModelList = 0;
|
||||
m_Position = 0;
|
||||
m_Frustum = 0;
|
||||
m_DisplayPlane = 0;
|
||||
m_BathModel = 0;
|
||||
m_WaterModel = 0;
|
||||
@@ -25,14 +24,12 @@ ApplicationClass::ApplicationClass() : m_ShouldQuit(false)
|
||||
m_RefractionTexture = 0;
|
||||
m_ReflectionTexture = 0;
|
||||
m_Physics = 0;
|
||||
m_cubes.clear();
|
||||
m_terrainChunk.clear();
|
||||
m_object.clear();
|
||||
m_RenderQueues.clear();
|
||||
}
|
||||
|
||||
|
||||
ApplicationClass::ApplicationClass(const ApplicationClass& other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ApplicationClass::~ApplicationClass()
|
||||
{
|
||||
}
|
||||
@@ -51,10 +48,20 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
char spriteFilename[128];
|
||||
char fpsString[32];
|
||||
bool result;
|
||||
HRESULT Hresult;
|
||||
|
||||
m_RenderQueues.push_back(std::ref(m_object));
|
||||
m_RenderQueues.push_back(std::ref(m_cubes));
|
||||
m_RenderQueues.push_back(std::ref(m_terrainChunk));
|
||||
|
||||
m_screenWidth = screenWidth;
|
||||
m_screenHeight = screenHeight;
|
||||
|
||||
SetHwnd(hwnd);
|
||||
SetWindowed(FULL_SCREEN);
|
||||
SetScreenHeight(screenHeight);
|
||||
SetScreenWidth(screenWidth);
|
||||
|
||||
// Create the Direct3D object.
|
||||
m_Direct3D = new D3DClass;
|
||||
if (!m_Direct3D)
|
||||
@@ -182,8 +189,8 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
for (const auto& textureFilename : textureFilenames)
|
||||
{
|
||||
ID3D11ShaderResourceView* texture = nullptr;
|
||||
result = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(result))
|
||||
Hresult = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(Hresult))
|
||||
{
|
||||
Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
@@ -283,8 +290,8 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
for (const auto& textureFilename : bathTextures)
|
||||
{
|
||||
ID3D11ShaderResourceView* texture = nullptr;
|
||||
result = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(result))
|
||||
Hresult = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(Hresult))
|
||||
{
|
||||
Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
@@ -316,8 +323,8 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
for (const auto& textureFilename : waterTextures)
|
||||
{
|
||||
ID3D11ShaderResourceView* texture = nullptr;
|
||||
result = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(result))
|
||||
Hresult = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(Hresult))
|
||||
{
|
||||
Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
@@ -374,9 +381,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
||||
// Create the position class object.
|
||||
m_Position = new PositionClass;
|
||||
|
||||
// Create the frustum class object.
|
||||
m_Frustum = new FrustumClass;
|
||||
|
||||
// Create and initialize the fps object.
|
||||
m_Fps = new FpsClass();
|
||||
|
||||
@@ -464,17 +468,6 @@ void ApplicationClass::Shutdown()
|
||||
m_Physics = 0;
|
||||
}
|
||||
|
||||
// Release the frustum class object.
|
||||
if (m_Frustum)
|
||||
{
|
||||
Logger::Get().Log("Releasing the frustum class object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
||||
|
||||
delete m_Frustum;
|
||||
m_Frustum = 0;
|
||||
|
||||
Logger::Get().Log("Frustum class object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
||||
}
|
||||
|
||||
// Release the display plane object.
|
||||
if (m_DisplayPlane)
|
||||
{
|
||||
@@ -719,7 +712,7 @@ bool ApplicationClass::Frame(InputClass* Input)
|
||||
m_Camera->SetRotation(rotationX, rotationY, 0.0f);
|
||||
m_Camera->Render();
|
||||
|
||||
// Render the graphics scene.
|
||||
// Render the static graphics scene.
|
||||
result = Render(rotation, x, y, z, textureTranslation);
|
||||
if (!result)
|
||||
{
|
||||
@@ -845,7 +838,7 @@ bool ApplicationClass::Frame(InputClass* Input)
|
||||
position = position + object->GetVelocity() * frameTime;
|
||||
object->SetPosition(position);
|
||||
|
||||
m_Physics->ApplyGravity(object, 1.0f, frameTime);
|
||||
m_Physics->ApplyGravity(object, 1.0f);
|
||||
|
||||
// Check if the object has fallen below a certain position
|
||||
if (XMVectorGetY(object->GetPosition()) < -30.0f)
|
||||
@@ -909,9 +902,9 @@ bool ApplicationClass::RenderRefractionToTexture()
|
||||
m_Camera->Render();
|
||||
|
||||
// Get the world, view, and projection matrices from the camera and d3d objects.
|
||||
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||
worldMatrix = m_Direct3D->GetWorldMatrix();
|
||||
m_Camera->GetViewMatrix(viewMatrix);
|
||||
m_Direct3D->GetProjectionMatrix(projectionMatrix);
|
||||
projectionMatrix = m_Direct3D->GetProjectionMatrix();
|
||||
|
||||
// Get the light properties.
|
||||
for (i = 0; i < m_numLights; i++)
|
||||
@@ -964,8 +957,8 @@ bool ApplicationClass::RenderReflectionToTexture()
|
||||
m_Camera->GetReflectionViewMatrix(reflectionViewMatrix);
|
||||
|
||||
// Get the world and projection matrices from the d3d object.
|
||||
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||
m_Direct3D->GetProjectionMatrix(projectionMatrix);
|
||||
worldMatrix = m_Direct3D->GetWorldMatrix();
|
||||
projectionMatrix = m_Direct3D->GetProjectionMatrix();
|
||||
|
||||
|
||||
// Reset the render target back to the original back buffer and not the render to texture anymore. And reset the viewport back to the original.
|
||||
@@ -988,7 +981,7 @@ bool ApplicationClass::RenderSceneToTexture(float rotation)
|
||||
m_Camera->Render();
|
||||
|
||||
// Get the matrices.
|
||||
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||
worldMatrix = m_Direct3D->GetWorldMatrix();
|
||||
m_Camera->GetViewMatrix(viewMatrix);
|
||||
m_RenderTexture->GetProjectionMatrix(projectionMatrix);
|
||||
|
||||
@@ -1029,10 +1022,10 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
|
||||
|
||||
// Get the world, view, and projection matrices from the camera and d3d objects.
|
||||
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||
worldMatrix = m_Direct3D->GetWorldMatrix();
|
||||
m_Camera->GetViewMatrix(viewMatrix);
|
||||
m_Direct3D->GetProjectionMatrix(projectionMatrix);
|
||||
m_Direct3D->GetOrthoMatrix(orthoMatrix);
|
||||
projectionMatrix = m_Direct3D->GetProjectionMatrix();
|
||||
orthoMatrix = m_Direct3D->GetOrthoMatrix();
|
||||
|
||||
// Get the light properties.
|
||||
for (i = 0; i < m_numLights; i++)
|
||||
@@ -1068,128 +1061,25 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
diffuseColor, lightPosition, ambientColor);
|
||||
|
||||
for (auto cube : m_cubes)
|
||||
|
||||
// -------------------------------------------------------- //
|
||||
// ------------ Render the object in the queue ------------ //
|
||||
// -------------------------------------------------------- //
|
||||
result = RenderPass(m_RenderQueues, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
||||
if (!result)
|
||||
{
|
||||
|
||||
scaleMatrix = cube->GetScaleMatrix();
|
||||
|
||||
if (cube->m_demoSpinning)
|
||||
rotateMatrix = XMMatrixRotationY(rotation);
|
||||
else
|
||||
{
|
||||
rotateMatrix = cube->GetRotateMatrix();
|
||||
}
|
||||
|
||||
|
||||
translateMatrix = cube->GetTranslateMatrix();
|
||||
srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
|
||||
worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
|
||||
|
||||
cube->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
|
||||
if (!m_enableCelShading) {
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), cube->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, cube->GetTexture(0),
|
||||
diffuseColor, lightPosition, ambientColor);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the cube model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Render cel shading globally to the scene using the cel shader if the checkbox is checked.
|
||||
if (m_enableCelShading) {
|
||||
result = m_ShaderManager->RenderCelShadingShader(m_Direct3D->GetDeviceContext(), cube->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, cube->GetTexture(0),
|
||||
m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(), TrueLightPosition);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the cel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto& object : m_object)
|
||||
// Update the render count text.
|
||||
result = UpdateRenderCountString(GetRenderCount());
|
||||
if (!result)
|
||||
{
|
||||
scaleMatrix = object->GetScaleMatrix();
|
||||
if (object->m_demoSpinning)
|
||||
rotateMatrix = XMMatrixRotationY(rotation);
|
||||
else
|
||||
{
|
||||
rotateMatrix = object->GetRotateMatrix();
|
||||
}
|
||||
translateMatrix = object->GetTranslateMatrix();
|
||||
srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
|
||||
worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
|
||||
|
||||
object->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
if (!m_enableCelShading) {
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, object->GetTexture(0),
|
||||
diffuseColor, lightPosition, ambientColor);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the object model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Render cel shading globally to the scene using the cel shader if the checkbox is checked.
|
||||
if (m_enableCelShading) {
|
||||
result = m_ShaderManager->RenderCelShadingShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, object->GetTexture(0),
|
||||
m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(), TrueLightPosition);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the cel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Logger::Get().Log("Could not update the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Render terrain
|
||||
for (auto& chunk : m_terrainChunk)
|
||||
{
|
||||
|
||||
scaleMatrix = chunk->GetScaleMatrix();
|
||||
rotateMatrix = chunk->GetRotateMatrix();
|
||||
translateMatrix = chunk->GetTranslateMatrix();
|
||||
|
||||
srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
|
||||
worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
|
||||
|
||||
chunk->Render(m_Direct3D->GetDeviceContext());
|
||||
if (!m_enableCelShading) {
|
||||
if (chunk->GetTexture(0) == nullptr)
|
||||
{
|
||||
Logger::Get().Log("Could not render the terrain model using the light shader, texture is null", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = m_ShaderManager->RenderSpecMapShader(m_Direct3D->GetDeviceContext(), chunk->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
|
||||
chunk->GetTexture(0), chunk->GetTexture(1), chunk->GetTexture(2), m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(),
|
||||
m_Camera->GetPosition(), m_Lights[0]->GetSpecularColor(), m_Lights[0]->GetSpecularPower());
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the terrain model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Render cel shading globally to the scene using the cel shader if the checkbox is checked.
|
||||
if (m_enableCelShading) {
|
||||
result = m_ShaderManager->RenderCelShadingShader(m_Direct3D->GetDeviceContext(), chunk->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, chunk->GetTexture(0),
|
||||
m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(), TrueLightPosition);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the cel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Translate to where the bath model will be rendered.
|
||||
worldMatrix = XMMatrixTranslation(0.0f, -10.0f, 0.0f);
|
||||
@@ -1206,7 +1096,7 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
}
|
||||
|
||||
// Reset the world matrix.
|
||||
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||
worldMatrix = m_Direct3D->GetWorldMatrix();
|
||||
|
||||
// Get the camera reflection view matrix.
|
||||
m_Camera->GetReflectionViewMatrix(reflectionMatrix);
|
||||
@@ -1268,63 +1158,12 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
||||
return false;
|
||||
}
|
||||
|
||||
// Construct the frustum.
|
||||
m_Frustum->ConstructFrustum(viewMatrix, projectionMatrix, SCREEN_DEPTH);
|
||||
|
||||
// Get the number of models that will be rendered.
|
||||
modelCount = m_ModelList->GetModelCount();
|
||||
|
||||
// Initialize the count of models that have been rendered.
|
||||
renderCount = 0;
|
||||
|
||||
// Go through all the models and render them only if they can be seen by the camera view.
|
||||
for (i = 0; i < modelCount; i++)
|
||||
{
|
||||
// Get the position and color of the sphere model at this index.
|
||||
m_ModelList->GetData(i, positionX, positionY, positionZ);
|
||||
|
||||
// Set the radius of the sphere to 1.0 since this is already known.
|
||||
radius = 1.0f;
|
||||
|
||||
// Check if the sphere model is in the view frustum.
|
||||
renderModel = m_Frustum->CheckSphere(positionX, positionY, positionZ, radius);
|
||||
|
||||
// If it can be seen then render it, if not skip this model and check the next sphere.
|
||||
if (renderModel)
|
||||
{
|
||||
// Move the model to the location it should be rendered at.
|
||||
worldMatrix = XMMatrixTranslation(positionX, positionY, positionZ);
|
||||
|
||||
// Render the model using the light shader.
|
||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0),
|
||||
diffuseColor, lightPosition, ambientColor);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Since this model was rendered then increase the count for this frame.
|
||||
renderCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the render count text.
|
||||
result = UpdateRenderCountString(renderCount);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not update the render count string", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Disable the Z buffer and enable alpha blending for 2D rendering.
|
||||
m_Direct3D->TurnZBufferOff();
|
||||
m_Direct3D->EnableAlphaBlending();
|
||||
|
||||
// Reset the world matrix.
|
||||
m_Direct3D->GetWorldMatrix(worldMatrix);
|
||||
worldMatrix = m_Direct3D->GetWorldMatrix();
|
||||
|
||||
// Render the render count text string using the font shader.
|
||||
m_RenderCountString->Render(m_Direct3D->GetDeviceContext());
|
||||
@@ -1581,7 +1420,7 @@ void ApplicationClass::GenerateTerrain()
|
||||
scaleMatrix = XMMatrixScaling(scaleX, scaleY, scaleZ);
|
||||
|
||||
// Set the file name of the model.
|
||||
strcpy_s(modelFilename, "assets/Model/TXT/plane.txt");
|
||||
strcpy_s(modelFilename, "assets/Model/OBJ/plane.obj");
|
||||
|
||||
// Liste des fichiers de texture
|
||||
std::vector<std::wstring> terrainTexture = {
|
||||
@@ -1625,16 +1464,16 @@ void ApplicationClass::GenerateTerrain()
|
||||
|
||||
|
||||
// for loop to generate terrain chunks for a 10x10 grid
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
for (int j = 0; j < 10; j++)
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
Object* newTerrain = new Object();
|
||||
newTerrain->Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), modelFilename, textures);
|
||||
|
||||
newTerrain->SetScaleMatrix(scaleMatrix);
|
||||
|
||||
newTerrain->SetTranslateMatrix(XMMatrixTranslation(i / 2 * (scaleX * 2), -12.0f, j * (scaleZ * 2)));
|
||||
newTerrain->SetTranslateMatrix(XMMatrixTranslation(i / 2 * scaleX , -12.0f, j * scaleZ));
|
||||
|
||||
newTerrain->SetName(filenameWithoutExtension);
|
||||
|
||||
@@ -1652,7 +1491,7 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
|
||||
|
||||
char modelFilename[128];
|
||||
vector<string> Filename;
|
||||
bool result;
|
||||
HRESULT result;
|
||||
|
||||
filesystem::path p(filepath);
|
||||
string filename = p.stem().string();
|
||||
@@ -1660,13 +1499,14 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
|
||||
size_t convertedChars = 0;
|
||||
wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath, _TRUNCATE);
|
||||
|
||||
filesystem::current_path(m_WFolder);
|
||||
|
||||
/// Liste des fichiers de texture
|
||||
// Liste des fichiers de texture
|
||||
std::vector<std::wstring> kobjTexture = {
|
||||
L"assets/Texture/moss01.png"
|
||||
L"assets/Texture/Bricks2K.png",
|
||||
L"assets/Texture/EmptyTexture.png"
|
||||
};
|
||||
|
||||
|
||||
textures.clear();
|
||||
for (const auto& textureFilename : kobjTexture)
|
||||
{
|
||||
@@ -1674,13 +1514,27 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
|
||||
result = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
|
||||
if (FAILED(result))
|
||||
{
|
||||
Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()), __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return;
|
||||
// Utiliser _com_error pour obtenir des informations d<>taill<6C>es sur l'erreur
|
||||
_com_error err(result);
|
||||
LPCTSTR errMsg = err.ErrorMessage();
|
||||
|
||||
//convertie errMessage en std::wstring
|
||||
std::wstring ws(errMsg);
|
||||
std::string str(ws.begin(), ws.end());
|
||||
|
||||
// Log the current working directory
|
||||
std::filesystem::path cwd = std::filesystem::current_path();
|
||||
Logger::Get().Log("Current working directory: " + cwd.string(), __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
|
||||
Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()) +
|
||||
"\nError: " + std::to_string(result) +
|
||||
"\nDescription: " + str,
|
||||
__FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return; // Assurez-vous de retourner false ou de g<>rer l'erreur de mani<6E>re appropri<72>e
|
||||
}
|
||||
textures.push_back(texture);
|
||||
}
|
||||
|
||||
|
||||
Object* newObject = new Object();
|
||||
newObject->Initialize(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), modelFilename, textures);
|
||||
newObject->SetMass(1.0f);
|
||||
@@ -1691,6 +1545,13 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
|
||||
m_ObjectId++;
|
||||
|
||||
m_object.push_back(newObject);
|
||||
|
||||
|
||||
// V<>rifiez que l'objet a bien re<72>u les textures
|
||||
if (newObject->GetTexture(0) == nullptr)
|
||||
{
|
||||
Logger::Get().Log("Object texture is null after initialization", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationClass::AddCube()
|
||||
@@ -1699,7 +1560,7 @@ void ApplicationClass::AddCube()
|
||||
Logger::Get().Log("Adding cube", __FILE__, __LINE__);
|
||||
|
||||
char modelFilename[128];
|
||||
bool result;
|
||||
HRESULT result;
|
||||
|
||||
// Set the file name of the model.
|
||||
strcpy_s(modelFilename, "assets/Model/TXT/cube.txt");
|
||||
@@ -1731,6 +1592,7 @@ void ApplicationClass::AddCube()
|
||||
newCube->SetTranslateMatrix(XMMatrixTranslation(position, 0.0f, 0.0f));
|
||||
|
||||
m_cubes.push_back(newCube);
|
||||
|
||||
}
|
||||
|
||||
void ApplicationClass::DeleteKobject(int index)
|
||||
@@ -1944,4 +1806,154 @@ void ApplicationClass::SetLightPosition(int index, XMVECTOR position)
|
||||
|
||||
//set the position
|
||||
m_Lights[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z);
|
||||
}
|
||||
|
||||
void ApplicationClass::SetVsync(bool vsync)
|
||||
{
|
||||
VSYNC_ENABLED = vsync;
|
||||
|
||||
if (m_Direct3D)
|
||||
{
|
||||
Logger::Get().Log("Setting Vsync to " + std::to_string(vsync) + " with a screen width : " + std::to_string(GetScreenWidth()) + "and a screen height : " + std::to_string(GetScreenHeight()), __FILE__, __LINE__);
|
||||
m_Direct3D->SetVsync(vsync);
|
||||
}
|
||||
}
|
||||
|
||||
HWND ApplicationClass::GetHwnd() const
|
||||
{
|
||||
return m_hwnd;
|
||||
}
|
||||
|
||||
void ApplicationClass::SetHwnd(HWND hwnd)
|
||||
{
|
||||
m_hwnd = hwnd;
|
||||
}
|
||||
|
||||
bool ApplicationClass::IsWindowed() const
|
||||
{
|
||||
return m_windowed;
|
||||
}
|
||||
|
||||
void ApplicationClass::SetWindowed(bool windowed)
|
||||
{
|
||||
// log the new windowed mode
|
||||
Logger::Get().Log("Setting windowed mode to " + std::to_string(windowed), __FILE__, __LINE__);
|
||||
m_windowed = windowed;
|
||||
}
|
||||
|
||||
void ApplicationClass::SetScreenHeight(int height)
|
||||
{
|
||||
// log the new screen height
|
||||
Logger::Get().Log("Setting screen height to " + std::to_string(height), __FILE__, __LINE__);
|
||||
m_screenHeight = height;
|
||||
}
|
||||
|
||||
void ApplicationClass::SetScreenWidth(int width)
|
||||
{
|
||||
// log the new screen width
|
||||
Logger::Get().Log("Setting screen width to " + std::to_string(width), __FILE__, __LINE__);
|
||||
m_screenWidth = width;
|
||||
}
|
||||
|
||||
bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::vector<Object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection)
|
||||
{
|
||||
XMMATRIX worldMatrix, scaleMatrix, rotateMatrix, translateMatrix, srMatrix;
|
||||
bool result;
|
||||
|
||||
int renderCount = 0;
|
||||
|
||||
ConstructFrustum();
|
||||
|
||||
|
||||
for (const auto& RenderQueue : RenderQueues)
|
||||
{
|
||||
for (auto& object : RenderQueue.get())
|
||||
{
|
||||
if (object == nullptr)
|
||||
{
|
||||
Logger::Get().Log("Object is null", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
XMVECTOR objposition = object->GetPosition();
|
||||
float x = XMVectorGetX(objposition);
|
||||
float y = XMVectorGetY(objposition);
|
||||
float z = XMVectorGetZ(objposition);
|
||||
float radius = object->GetBoundingRadius();
|
||||
|
||||
// V<>rifie si l'objet est dans le frustum
|
||||
if (!m_FrustumCulling.CheckCube(x, y, z, radius, GetFrustumTolerance()))
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
renderCount++;
|
||||
|
||||
scaleMatrix = object->GetScaleMatrix();
|
||||
rotateMatrix = object->GetRotateMatrix();
|
||||
translateMatrix = object->GetTranslateMatrix();
|
||||
|
||||
srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
|
||||
worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
|
||||
|
||||
object->Render(m_Direct3D->GetDeviceContext());
|
||||
|
||||
// Utiliser l'enum ShaderType pour d<>terminer quel shader utiliser
|
||||
switch (object->GetActiveShader())
|
||||
{
|
||||
case Object::CEL_SHADING:
|
||||
result = m_ShaderManager->RenderCelShadingShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection, object->GetTexture(0),
|
||||
m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(), TrueLightPosition);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the cel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case Object::NORMAL_MAPPING:
|
||||
result = m_ShaderManager->RenderNormalMapShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection, object->GetTexture(0), object->GetTexture(1), m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor());
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the normal map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case Object::SPECULAR_MAPPING:
|
||||
result = m_ShaderManager->RenderSpecMapShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection, object->GetTexture(0), object->GetTexture(1), object->GetTexture(2), m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(), m_Camera->GetPosition(), m_Lights[0]->GetSpecularColor(), m_Lights[0]->GetSpecularPower());
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the model using the specular map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case Object::LIGHTING:
|
||||
default:
|
||||
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection,
|
||||
object->GetTexture(0), diffuse, position, ambient);
|
||||
if (!result)
|
||||
{
|
||||
Logger::Get().Log("Could not render the object model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetRenderCount(renderCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ApplicationClass::ConstructFrustum()
|
||||
{
|
||||
XMMATRIX projectionMatrix = m_Direct3D->GetProjectionMatrix();
|
||||
XMMATRIX viewMatrix;
|
||||
m_Camera->GetViewMatrix(viewMatrix);
|
||||
|
||||
m_FrustumCulling.ConstructFrustum(SCREEN_DEPTH, projectionMatrix, viewMatrix);
|
||||
}
|
@@ -29,6 +29,7 @@
|
||||
#include "translateshaderclass.h"
|
||||
#include "reflectionshaderclass.h"
|
||||
#include "physics.h"
|
||||
#include "frustum.h"
|
||||
|
||||
#include <WICTextureLoader.h>
|
||||
#include <comdef.h> // Pour _com_error
|
||||
@@ -38,7 +39,6 @@
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
const bool FULL_SCREEN = false;
|
||||
const bool VSYNC_ENABLED = true;
|
||||
const float SCREEN_DEPTH = 1000.0f;
|
||||
const float SCREEN_NEAR = 0.3f;
|
||||
|
||||
@@ -59,7 +59,9 @@ public:
|
||||
bool Frame(InputClass*);
|
||||
|
||||
int GetScreenWidth() const;
|
||||
void SetScreenWidth(int screenWidth);
|
||||
int GetScreenHeight() const;
|
||||
void SetScreenHeight(int screenHeight);
|
||||
|
||||
float GetSpeed() const { return m_speed; };
|
||||
void SetSpeed(float speed) { this->m_speed = speed; };
|
||||
@@ -72,6 +74,8 @@ public:
|
||||
std::vector<Object*> GetTerrainCubes() const { return m_terrainChunk; };
|
||||
std::vector<Object*> GetKobjects() const { return m_object; };
|
||||
void AddKobject(WCHAR* filepath);
|
||||
void SetPath(WCHAR* path) { m_path = path; };
|
||||
void SetWFolder(std::filesystem::path WFolder) { m_WFolder = WFolder; };
|
||||
|
||||
void GenerateTerrain();
|
||||
void DeleteTerrain();
|
||||
@@ -90,14 +94,41 @@ public:
|
||||
|
||||
std::vector<ID3D11ShaderResourceView*> textures;
|
||||
|
||||
void SetVsync(bool vsync);
|
||||
bool GetVsync() const { return VSYNC_ENABLED; };
|
||||
|
||||
HWND GetHwnd() const;
|
||||
void SetHwnd(HWND hwnd);
|
||||
|
||||
bool IsWindowed() const;
|
||||
void SetWindowed(bool windowed);
|
||||
|
||||
Physics* GetPhysics() const { return m_Physics; };
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- Frustum ------------- //
|
||||
// ----------------------------------- //
|
||||
|
||||
Frustum GetFrustum() const { return m_FrustumCulling; };
|
||||
void SetFrustum(Frustum frustum) { m_FrustumCulling = frustum; };
|
||||
|
||||
void ConstructFrustum();
|
||||
int GetRenderCount() const { return m_renderCount; };
|
||||
void SetRenderCount(int renderCount) { m_renderCount = renderCount; };
|
||||
float GetFrustumTolerance() const { return m_FrustumCullingTolerance; };
|
||||
void SetFrustumTolerance(float frustumTolerance) { m_FrustumCullingTolerance = frustumTolerance; };
|
||||
|
||||
private:
|
||||
bool Render(float, float, float, float, float);
|
||||
bool RenderPhysics(float x, float y, float z);
|
||||
bool UpdateMouseStrings(int, int, bool);
|
||||
bool UpdateFps();
|
||||
bool UpdateRenderCountString(int);
|
||||
bool RenderSceneToTexture(float);
|
||||
bool RenderRefractionToTexture();
|
||||
bool RenderReflectionToTexture();
|
||||
bool RenderPass(const std::vector<std::reference_wrapper<std::vector<Object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
|
||||
|
||||
|
||||
private :
|
||||
|
||||
@@ -109,6 +140,10 @@ private :
|
||||
IDXGISwapChain* m_swapChain;
|
||||
ModelClass* m_Model,* m_GroundModel, * m_WallModel, * m_BathModel, * m_WaterModel;
|
||||
ModelListClass* m_ModelList;
|
||||
bool VSYNC_ENABLED = true;
|
||||
|
||||
HWND m_hwnd;
|
||||
bool m_windowed;
|
||||
|
||||
// ------------------------------------- //
|
||||
// ------------- RENDERING ------------- //
|
||||
@@ -120,7 +155,6 @@ private :
|
||||
int m_screenWidth, m_screenHeight;
|
||||
CameraClass* m_Camera;
|
||||
PositionClass* m_Position;
|
||||
FrustumClass* m_Frustum;
|
||||
|
||||
// ------------------------------------ //
|
||||
// ------------- OBJECTS -------------- //
|
||||
@@ -132,6 +166,7 @@ private :
|
||||
float m_speed = 0.1f; // speed for the demo spinning object
|
||||
std::vector<Object*> m_object;
|
||||
int m_ObjectId = 0;
|
||||
std::vector<std::reference_wrapper<std::vector<Object*>>> m_RenderQueues;
|
||||
|
||||
// ----------------------------------- //
|
||||
// ------------- LIGHTS -------------- //
|
||||
@@ -160,6 +195,8 @@ private :
|
||||
// ----------------------------------- //
|
||||
|
||||
float m_waterHeight, m_waterTranslation;
|
||||
wchar_t* m_path;
|
||||
std::filesystem::path m_WFolder;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------- FPS AND INFO ON SCREEN ------------ //
|
||||
@@ -181,6 +218,14 @@ private :
|
||||
Physics* m_Physics;
|
||||
float m_gravity;
|
||||
XMVECTOR m_previousPosition;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
// ------------------- Frustum --------------------- //
|
||||
// ------------------------------------------------- //
|
||||
|
||||
Frustum m_FrustumCulling;
|
||||
int m_renderCount;
|
||||
float m_FrustumCullingTolerance = 5.f;
|
||||
};
|
||||
|
||||
#endif
|
16
enginecustom/assets/Model/OBJ/plane.obj
Normal file
16
enginecustom/assets/Model/OBJ/plane.obj
Normal file
@@ -0,0 +1,16 @@
|
||||
# Simple 2D plane in OBJ format
|
||||
|
||||
v -0.5 0.0 -0.5
|
||||
v 0.5 0.0 -0.5
|
||||
v -0.5 0.0 0.5
|
||||
v 0.5 0.0 0.5
|
||||
|
||||
vt 0.0 0.0
|
||||
vt 1.0 0.0
|
||||
vt 0.0 1.0
|
||||
vt 1.0 1.0
|
||||
|
||||
vn 0.0 1.0 0.0
|
||||
|
||||
f 1/1/1 4/4/1 2/2/1
|
||||
f 1/1/1 3/3/1 4/4/1
|
24
enginecustom/assets/Model/imgui.ini
Normal file
24
enginecustom/assets/Model/imgui.ini
Normal file
@@ -0,0 +1,24 @@
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
|
||||
[Window][Khaotic Engine]
|
||||
Pos=1120,51
|
||||
Size=392,273
|
||||
|
||||
[Window][Objects]
|
||||
Pos=930,39
|
||||
Size=457,294
|
||||
|
||||
[Window][Terrain]
|
||||
Pos=60,60
|
||||
Size=342,82
|
||||
|
||||
[Window][Light]
|
||||
Pos=1551,17
|
||||
Size=358,535
|
||||
|
||||
[Window][Shader Manager]
|
||||
Pos=30,255
|
||||
Size=172,284
|
||||
|
BIN
enginecustom/assets/Texture/EmptyTexture.png
Normal file
BIN
enginecustom/assets/Texture/EmptyTexture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
@@ -565,28 +565,6 @@ ID3D11DeviceContext* D3DClass::GetDeviceContext()
|
||||
return m_deviceContext;
|
||||
}
|
||||
|
||||
|
||||
XMMATRIX D3DClass::GetProjectionMatrix(XMMATRIX& projectionMatrix)
|
||||
{
|
||||
projectionMatrix = m_projectionMatrix;
|
||||
return m_projectionMatrix;
|
||||
}
|
||||
|
||||
|
||||
void D3DClass::GetWorldMatrix(XMMATRIX& worldMatrix)
|
||||
{
|
||||
worldMatrix = m_worldMatrix;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void D3DClass::GetOrthoMatrix(XMMATRIX& orthoMatrix)
|
||||
{
|
||||
orthoMatrix = m_orthoMatrix;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void D3DClass::GetVideoCardInfo(char* cardName, int& memory)
|
||||
{
|
||||
strcpy_s(cardName, 128, m_videoCardDescription);
|
||||
@@ -717,7 +695,8 @@ IDXGISwapChain* D3DClass::GetSwapChain()
|
||||
void D3DClass::ResizeSwapChain(int newWidth, int newHeight)
|
||||
{
|
||||
|
||||
Logger::Get().Log("Resizing swap chain", __FILE__, __LINE__);
|
||||
// log the new width and height
|
||||
Logger::Get().Log("Resizing swap chain to " + std::to_string(newWidth) + "x" + std::to_string(newHeight), __FILE__, __LINE__);
|
||||
|
||||
HRESULT result;
|
||||
|
||||
@@ -788,3 +767,8 @@ void D3DClass::DisableAlphaBlending()
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void D3DClass::SetVsync(bool vsync)
|
||||
{
|
||||
m_vsync_enabled = vsync;
|
||||
}
|
@@ -42,14 +42,16 @@ public:
|
||||
|
||||
ID3D11Device* GetDevice();
|
||||
ID3D11DeviceContext* GetDeviceContext();
|
||||
XMMATRIX GetProjectionMatrix(XMMATRIX& projectionMatrix);
|
||||
//XMMATRIX GetProjectionMatrix(XMMATRIX& projectionMatrix);
|
||||
IDXGISwapChain* m_swapChain;
|
||||
IDXGISwapChain* GetSwapChain();
|
||||
void ResizeSwapChain(int, int);
|
||||
void SetVsync(bool vsync);
|
||||
|
||||
XMMATRIX GetProjectionMatrix();
|
||||
void GetWorldMatrix(XMMATRIX&);
|
||||
void GetOrthoMatrix(XMMATRIX&);
|
||||
|
||||
XMMATRIX GetProjectionMatrix() const { return m_projectionMatrix; };
|
||||
XMMATRIX GetWorldMatrix() const { return m_worldMatrix;};
|
||||
XMMATRIX GetOrthoMatrix() const { return m_orthoMatrix; };
|
||||
|
||||
void GetVideoCardInfo(char*, int&);
|
||||
|
||||
|
@@ -22,15 +22,11 @@
|
||||
<ClCompile Include="alphamapshaderclass.cpp" />
|
||||
<ClCompile Include="applicationclass.cpp" />
|
||||
<ClCompile Include="bitmapclass.cpp" />
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDSTextureLoader.cpp" />
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DirectXHelpers.cpp" />
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.cpp" />
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\SimpleMath.cpp" />
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\WICTextureLoader.cpp" />
|
||||
<ClCompile Include="Cameraclass.cpp" />
|
||||
<ClCompile Include="CelShadingShader.cpp" />
|
||||
<ClCompile Include="Colorshaderclass.cpp" />
|
||||
<ClCompile Include="d3dclass.cpp" />
|
||||
<ClCompile Include="frustum.cpp" />
|
||||
<ClCompile Include="imguiManager.cpp" />
|
||||
<ClCompile Include="include\backends\imgui_impl_dx11.cpp" />
|
||||
<ClCompile Include="include\backends\imgui_impl_win32.cpp" />
|
||||
@@ -44,6 +40,11 @@
|
||||
<ClCompile Include="fontshaderclass.cpp" />
|
||||
<ClCompile Include="fpsclass.cpp" />
|
||||
<ClCompile Include="frustumclass.cpp" />
|
||||
<ClCompile Include="include\Src\DDSTextureLoader.cpp" />
|
||||
<ClCompile Include="include\Src\DirectXHelpers.cpp" />
|
||||
<ClCompile Include="include\Src\pch.cpp" />
|
||||
<ClCompile Include="include\Src\SimpleMath.cpp" />
|
||||
<ClCompile Include="include\Src\WICTextureLoader.cpp" />
|
||||
<ClCompile Include="inputclass.cpp" />
|
||||
<ClCompile Include="Lightclass.cpp" />
|
||||
<ClCompile Include="lightmapshaderclass.cpp" />
|
||||
@@ -75,15 +76,11 @@
|
||||
<ClInclude Include="alphamapshaderclass.h" />
|
||||
<ClInclude Include="applicationclass.h" />
|
||||
<ClInclude Include="bitmapclass.h" />
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\CMO.h" />
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDS.h" />
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\LoaderHelpers.h" />
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.h" />
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\PlatformHelpers.h" />
|
||||
<ClInclude Include="Cameraclass.h" />
|
||||
<ClInclude Include="CelShadingShader.h" />
|
||||
<ClInclude Include="Colorshaderclass.h" />
|
||||
<ClInclude Include="d3dclass.h" />
|
||||
<ClInclude Include="frustum.h" />
|
||||
<ClInclude Include="imguiManager.h" />
|
||||
<ClInclude Include="include\backends\imgui_impl_dx11.h" />
|
||||
<ClInclude Include="include\backends\imgui_impl_win32.h" />
|
||||
@@ -98,6 +95,11 @@
|
||||
<ClInclude Include="fontshaderclass.h" />
|
||||
<ClInclude Include="fpsclass.h" />
|
||||
<ClInclude Include="frustumclass.h" />
|
||||
<ClInclude Include="include\Src\CMO.h" />
|
||||
<ClInclude Include="include\Src\DDS.h" />
|
||||
<ClInclude Include="include\Src\LoaderHelpers.h" />
|
||||
<ClInclude Include="include\Src\pch.h" />
|
||||
<ClInclude Include="include\Src\PlatformHelpers.h" />
|
||||
<ClInclude Include="inputclass.h" />
|
||||
<ClInclude Include="lightclass.h" />
|
||||
<ClInclude Include="lightmapshaderclass.h" />
|
||||
@@ -225,26 +227,89 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="font01.tga" />
|
||||
<Image Include="assets\Texture\alpha01.png" />
|
||||
<Image Include="assets\Texture\Bricks2K.png" />
|
||||
<Image Include="assets\Texture\BricksGLOSS2K.png" />
|
||||
<Image Include="assets\Texture\BricksNRM2K.png" />
|
||||
<Image Include="assets\Texture\dirt01.png" />
|
||||
<Image Include="assets\Texture\font01.png" />
|
||||
<Image Include="assets\Texture\ground01.png" />
|
||||
<Image Include="assets\Texture\light01.png" />
|
||||
<Image Include="assets\Texture\marble01.png" />
|
||||
<Image Include="assets\Texture\moss01.png" />
|
||||
<Image Include="assets\Texture\normal01.png" />
|
||||
<Image Include="assets\Texture\spec02.png" />
|
||||
<Image Include="assets\Texture\sprite01.png" />
|
||||
<Image Include="assets\Texture\sprite02.png" />
|
||||
<Image Include="assets\Texture\sprite03.png" />
|
||||
<Image Include="assets\Texture\sprite04.png" />
|
||||
<Image Include="assets\Texture\stone01.png" />
|
||||
<Image Include="assets\Texture\wall.png" />
|
||||
<Image Include="assets\Texture\wall01.png" />
|
||||
<Image Include="assets\Texture\water01.png" />
|
||||
<CopyFileToFolders Include="assets\Texture\alpha01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\Bricks2K.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\dirt01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\font01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\ground01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\light01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\marble01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\moss01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\normal01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\spec02.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite02.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite03.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite04.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\stone01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\stone01.tga">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\wall.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\wall01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\water01.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<Image Include="KhaoticIcon.ico" />
|
||||
<CopyFileToFolders Include="sprite01.tga" />
|
||||
<CopyFileToFolders Include="sprite02.tga" />
|
||||
@@ -270,32 +335,78 @@
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
|
||||
<FileType>Document</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
|
||||
<FileType>Document</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
|
||||
<FileType>Document</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
|
||||
<FileType>Document</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
|
||||
<FileType>Document</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\bath.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\bath.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
|
||||
<FileType>Text</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="sprite_data_01.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
|
||||
<FileType>Document</FileType>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\TXT\cube.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\ground.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\plane.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\square.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\wall.txt" />
|
||||
<CopyFileToFolders Include="assets\Model\TXT\water.txt" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
|
@@ -49,32 +49,23 @@
|
||||
<Filter Include="Assets\Model\TXT">
|
||||
<UniqueIdentifier>{f67d85e0-106e-47a1-bb9c-a5ea9111509a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Fichiers d%27en-tête\Shader">
|
||||
<UniqueIdentifier>{e087647e-a306-4246-9320-bab0830bb634}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Fichiers d%27en-tête\System">
|
||||
<UniqueIdentifier>{14b07251-cf6d-4391-9fca-ec94e08d4427}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Fichiers sources\Shader">
|
||||
<UniqueIdentifier>{3c669b93-a9fd-4b74-813f-f9780413f76b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Fichiers sources\System">
|
||||
<UniqueIdentifier>{b2659b1e-695d-488e-9a1c-341691d312bc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Systemclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="inputclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="applicationclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3dclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Colorshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modelclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Cameraclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="include\imgui_demo.cpp">
|
||||
<Filter>Fichiers sources\ImGui</Filter>
|
||||
</ClCompile>
|
||||
@@ -96,140 +87,146 @@
|
||||
<ClCompile Include="include\imgui_widgets.cpp">
|
||||
<Filter>Fichiers sources\ImGui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="imguiManager.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lightclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lightshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="object.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textureclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bitmapclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fontclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fontshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fpsclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Spriteclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Multitextureshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textureshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Timerclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="fpsclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="alphamapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="specmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="frustumclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modellistclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="positionclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="displayplaneclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rendertextureclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<ClCompile Include="include\Src\DDSTextureLoader.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="translateshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<ClCompile Include="include\Src\DirectXHelpers.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="reflectionshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<ClCompile Include="include\Src\pch.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="shadermanagerclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<ClCompile Include="include\Src\SimpleMath.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="transparentshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<ClCompile Include="include\Src\WICTextureLoader.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lightmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="watershaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="refractionshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="physics.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="normalmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<ClCompile Include="alphamapshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CelShadingShader.cpp">
|
||||
<Filter>Fichiers sources</Filter>
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDSTextureLoader.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
<ClCompile Include="Colorshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DirectXHelpers.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
<ClCompile Include="fontshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
<ClCompile Include="lightmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\SimpleMath.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
<ClCompile Include="Lightshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\WICTextureLoader.cpp">
|
||||
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
|
||||
<ClCompile Include="Multitextureshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="normalmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="reflectionshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="refractionshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="shadermanagerclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="specmapshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="watershaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="transparentshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="translateshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textureshaderclass.cpp">
|
||||
<Filter>Fichiers sources\Shader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="applicationclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Cameraclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d3dclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="imguiManager.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="inputclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Lightclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="object.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="physics.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modelclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="positionclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rendertextureclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Systemclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Timerclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="textureclass.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="frustum.cpp">
|
||||
<Filter>Fichiers sources\System</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="systemclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inputclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="applicationclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3dclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Colorshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modelclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Cameraclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\imconfig.h">
|
||||
<Filter>Fichiers d%27en-tête\ImGui</Filter>
|
||||
</ClInclude>
|
||||
@@ -254,188 +251,149 @@
|
||||
<ClInclude Include="include\backends\imgui_impl_win32.h">
|
||||
<Filter>Fichiers d%27en-tête\ImGui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imguiManager.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lightshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="object.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textureclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="bitmapclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fontclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fontshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fpsclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lightclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Multitextureshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Spriteclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textureshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Timerclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fpsclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lightmapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="alphamapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="normalmapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="specmapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="frustumclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modellistclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="positionclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="displayplaneclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="rendertextureclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<ClInclude Include="include\Src\CMO.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="translateshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<ClInclude Include="include\Src\DDS.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="reflectionshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<ClInclude Include="include\Src\LoaderHelpers.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resources.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<ClInclude Include="include\Src\pch.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="shadermanagerclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<ClInclude Include="include\Src\PlatformHelpers.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="transparentshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Logger.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="watershaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="refractionshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="physics.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<ClInclude Include="alphamapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CelShadingShader.h">
|
||||
<Filter>Fichiers d%27en-tête</Filter>
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\PlatformHelpers.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
<ClInclude Include="Colorshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
<ClInclude Include="fontshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\LoaderHelpers.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
<ClInclude Include="lightmapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDS.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
<ClInclude Include="lightshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\CMO.h">
|
||||
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
|
||||
<ClInclude Include="Multitextureshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="normalmapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="reflectionshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="refractionshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="shadermanagerclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="specmapshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textureshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="translateshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="transparentshaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="watershaderclass.h">
|
||||
<Filter>Fichiers d%27en-tête\Shader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="applicationclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="d3dclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Cameraclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imguiManager.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Logger.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inputclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lightclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modelclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="physics.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Timerclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="textureclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resources.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="rendertextureclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="positionclass.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="object.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="frustum.h">
|
||||
<Filter>Fichiers d%27en-tête\System</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="KhaoticIcon.ico">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\BricksGLOSS2K.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\BricksNRM2K.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\alpha01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\Bricks2K.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\dirt01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\font01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\ground01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\light01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\marble01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\moss01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\normal01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\spec02.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\sprite01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\sprite02.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\sprite03.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\sprite04.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\stone01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\wall.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\wall01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
<Image Include="assets\Texture\water01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
@@ -596,5 +554,77 @@
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
|
||||
<Filter>Assets\Model\OBJ</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="sprite_data_01.txt">
|
||||
<Filter>Assets</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\stone01.tga">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\alpha01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\Bricks2K.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\dirt01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\font01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\ground01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\light01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\marble01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\moss01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\normal01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\spec02.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite01.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite02.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite03.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\sprite04.png">
|
||||
<Filter>Fichiers de ressources</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\stone01.png">
|
||||
<Filter>Fichiers de ressources</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\wall.png">
|
||||
<Filter>Fichiers de ressources</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\wall01.png">
|
||||
<Filter>Fichiers de ressources</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\water01.png">
|
||||
<Filter>Fichiers de ressources</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
|
||||
<Filter>Assets\Model\OBJ</Filter>
|
||||
</CopyFileToFolders>
|
||||
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
|
||||
<Filter>Assets\Texture</Filter>
|
||||
</CopyFileToFolders>
|
||||
</ItemGroup>
|
||||
</Project>
|
88
enginecustom/frustum.cpp
Normal file
88
enginecustom/frustum.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
#include "frustum.h"
|
||||
|
||||
void Frustum::ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix)
|
||||
{
|
||||
XMMATRIX matrix;
|
||||
XMVECTOR planes[6];
|
||||
|
||||
// Calculate the minimum Z distance in the frustum.
|
||||
float zMinimum = -projectionMatrix.r[3].m128_f32[2] / projectionMatrix.r[2].m128_f32[2];
|
||||
float r = screenDepth / (screenDepth - zMinimum);
|
||||
projectionMatrix.r[2].m128_f32[2] = r;
|
||||
projectionMatrix.r[3].m128_f32[2] = -r * zMinimum;
|
||||
|
||||
// Create the frustum matrix from the view matrix and updated projection matrix.
|
||||
matrix = XMMatrixMultiply(viewMatrix, projectionMatrix);
|
||||
|
||||
// Calculate near plane of frustum.
|
||||
planes[0] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[2],
|
||||
matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[2],
|
||||
matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[2],
|
||||
matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[2]));
|
||||
|
||||
// Calculate far plane of frustum.
|
||||
planes[1] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[2],
|
||||
matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[2],
|
||||
matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[2],
|
||||
matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[2]));
|
||||
|
||||
// Calculate left plane of frustum.
|
||||
planes[2] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[0],
|
||||
matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[0],
|
||||
matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[0],
|
||||
matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[0]));
|
||||
|
||||
// Calculate right plane of frustum.
|
||||
planes[3] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[0],
|
||||
matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[0],
|
||||
matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[0],
|
||||
matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[0]));
|
||||
|
||||
// Calculate top plane of frustum.
|
||||
planes[4] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] - matrix.r[0].m128_f32[1],
|
||||
matrix.r[1].m128_f32[3] - matrix.r[1].m128_f32[1],
|
||||
matrix.r[2].m128_f32[3] - matrix.r[2].m128_f32[1],
|
||||
matrix.r[3].m128_f32[3] - matrix.r[3].m128_f32[1]));
|
||||
|
||||
// Calculate bottom plane of frustum.
|
||||
planes[5] = XMPlaneNormalize(XMVectorSet(matrix.r[0].m128_f32[3] + matrix.r[0].m128_f32[1],
|
||||
matrix.r[1].m128_f32[3] + matrix.r[1].m128_f32[1],
|
||||
matrix.r[2].m128_f32[3] + matrix.r[2].m128_f32[1],
|
||||
matrix.r[3].m128_f32[3] + matrix.r[3].m128_f32[1]));
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
m_planes[i] = planes[i];
|
||||
}
|
||||
}
|
||||
|
||||
bool Frustum::CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance)
|
||||
{
|
||||
// V<>rifiez chaque plan du frustum pour voir si le cube est <20> l'int<6E>rieur
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
XMVECTOR plane = m_planes[i];
|
||||
if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter - radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter - radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter - radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
if (XMVectorGetX(plane) * (xCenter + radius) + XMVectorGetY(plane) * (yCenter + radius) + XMVectorGetZ(plane) * (zCenter + radius) + XMVectorGetW(plane) > -tolerance)
|
||||
continue;
|
||||
|
||||
// Si le cube est en dehors de l'un des plans, il n'est pas dans le frustum
|
||||
return false;
|
||||
}
|
||||
|
||||
// Si le cube est <20> l'int<6E>rieur de tous les plans, il est dans le frustum
|
||||
return true;
|
||||
}
|
12
enginecustom/frustum.h
Normal file
12
enginecustom/frustum.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <DirectXMath.h>
|
||||
using namespace DirectX;
|
||||
|
||||
class Frustum
|
||||
{
|
||||
public:
|
||||
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);
|
||||
bool CheckCube(float xCenter, float yCenter, float zCenter, float radius, float tolerance);
|
||||
|
||||
private:
|
||||
XMVECTOR m_planes[6];
|
||||
};
|
@@ -3,7 +3,7 @@ Pos=60,60
|
||||
Size=400,400
|
||||
|
||||
[Window][Khaotic Engine]
|
||||
Pos=1128,39
|
||||
Pos=1143,44
|
||||
Size=392,273
|
||||
|
||||
[Window][Objects]
|
||||
@@ -11,14 +11,18 @@ Pos=934,36
|
||||
Size=457,294
|
||||
|
||||
[Window][Terrain]
|
||||
Pos=60,60
|
||||
Pos=58,62
|
||||
Size=342,82
|
||||
|
||||
[Window][Light]
|
||||
Pos=1551,17
|
||||
Pos=1548,17
|
||||
Size=358,535
|
||||
|
||||
[Window][Shader Manager]
|
||||
Pos=34,253
|
||||
Size=172,284
|
||||
Pos=471,90
|
||||
Size=180,79
|
||||
|
||||
[Window][Engine Settings]
|
||||
Pos=106,212
|
||||
Size=407,81
|
||||
|
||||
|
@@ -161,10 +161,16 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
||||
|
||||
// Texture
|
||||
// add all texture category names to a vector
|
||||
std::vector<std::string> textureCategories = { "Diffuse", "Normal", "Specular", "Alpha", "Light", "Change Me" };
|
||||
std::vector<std::string> textureCategories = {
|
||||
"Diffuse",
|
||||
"Normal",
|
||||
"Specular",
|
||||
"Reflection",
|
||||
"Refraction"
|
||||
};
|
||||
|
||||
|
||||
for (int count = 0; count < 6; count++)
|
||||
for (int count = 0; count < 1; count++)
|
||||
{
|
||||
std::string textureLabel = "Texture##" + std::to_string(index);
|
||||
ID3D11ShaderResourceView* texture = object->GetTexture(count);
|
||||
@@ -185,7 +191,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
||||
}
|
||||
|
||||
// Display all images
|
||||
for (int count = 0; count < 6; count++)
|
||||
for (int count = 0; count < 1; count++)
|
||||
{
|
||||
std::string textureLabel = "Texture##" + std::to_string(index);
|
||||
ID3D11ShaderResourceView* texture = object->GetTexture(count);
|
||||
@@ -244,6 +250,34 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
||||
app->DeleteKobject(index);
|
||||
}
|
||||
|
||||
// Shader selection
|
||||
std::string shaderLabel = "Shader##" + std::to_string(index);
|
||||
|
||||
// Radio buttons for shader options
|
||||
Object::ShaderType activeShader = object->GetActiveShader();
|
||||
|
||||
if (ImGui::RadioButton("Enable Lighting", activeShader == Object::LIGHTING))
|
||||
{
|
||||
object->SetActiveShader(Object::LIGHTING);
|
||||
}
|
||||
|
||||
if (ImGui::RadioButton("Enable Cel Shading", activeShader == Object::CEL_SHADING))
|
||||
{
|
||||
object->SetActiveShader(Object::CEL_SHADING);
|
||||
}
|
||||
|
||||
if (ImGui::RadioButton("Enable Normal Mapping", activeShader == Object::NORMAL_MAPPING))
|
||||
{
|
||||
object->SetActiveShader(Object::NORMAL_MAPPING);
|
||||
}
|
||||
|
||||
if (ImGui::RadioButton("Enable Specular Mapping", activeShader == Object::SPECULAR_MAPPING))
|
||||
{
|
||||
object->SetActiveShader(Object::SPECULAR_MAPPING);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
// Demo spinning
|
||||
@@ -316,6 +350,11 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
|
||||
showShaderWindow = true;
|
||||
}
|
||||
|
||||
if (ImGui::Button("Open Engine Settings Window"))
|
||||
{
|
||||
showEngineSettingsWindow = true;
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
// Show windows if their corresponding variables are true
|
||||
@@ -339,6 +378,11 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
|
||||
WidgetShaderWindow(app);
|
||||
}
|
||||
|
||||
if (showEngineSettingsWindow)
|
||||
{
|
||||
WidgetEngineSettingsWindow(app);
|
||||
}
|
||||
|
||||
//render imgui
|
||||
Render();
|
||||
|
||||
@@ -377,5 +421,26 @@ void imguiManager::WidgetLightWindow(ApplicationClass* app)
|
||||
index++;
|
||||
};
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void imguiManager::WidgetEngineSettingsWindow(ApplicationClass* app)
|
||||
{
|
||||
ImGui::Begin("Engine Settings", &showEngineSettingsWindow);
|
||||
|
||||
// Checkbox for toggling vsync globally in the application class by calling the SetVsync function in the application class when the checkbox state changes
|
||||
bool vsync = app->GetVsync();
|
||||
if (ImGui::Checkbox("Vsync", &vsync))
|
||||
{
|
||||
app->SetVsync(vsync);
|
||||
}
|
||||
|
||||
// float input for frustum tolerance
|
||||
float frustumTolerance = app->GetFrustumTolerance();
|
||||
if (ImGui::DragFloat("Frustum Tolerance", &frustumTolerance, 0.1f, 0.0f, 100.0f))
|
||||
{
|
||||
app->SetFrustumTolerance(frustumTolerance);
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
@@ -32,6 +32,7 @@ public:
|
||||
void WidgetTerrainWindow(ApplicationClass* app);
|
||||
void WidgetLightWindow(ApplicationClass* app);
|
||||
void WidgetShaderWindow(ApplicationClass* app);
|
||||
void WidgetEngineSettingsWindow(ApplicationClass* app);
|
||||
|
||||
bool ImGuiWidgetRenderer(ApplicationClass* app);
|
||||
|
||||
@@ -44,6 +45,7 @@ private :
|
||||
bool showTerrainWindow = false;
|
||||
bool showLightWindow = false;
|
||||
bool showShaderWindow = false;
|
||||
bool showEngineSettingsWindow = false;
|
||||
|
||||
private:
|
||||
ImGuiIO* io;
|
||||
|
181
enginecustom/include/Src/CMO.h
Normal file
181
enginecustom/include/Src/CMO.h
Normal file
@@ -0,0 +1,181 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// File: CMO.h
|
||||
//
|
||||
// .CMO files are built by Visual Studio's MeshContentTask and an example renderer was
|
||||
// provided in the VS Direct3D Starter Kit
|
||||
// https://devblogs.microsoft.com/cppblog/developing-an-app-with-the-visual-studio-3d-starter-kit-part-1-of-3/
|
||||
// https://devblogs.microsoft.com/cppblog/developing-an-app-with-the-visual-studio-3d-starter-kit-part-2-of-3/
|
||||
// https://devblogs.microsoft.com/cppblog/developing-an-app-with-the-visual-studio-3d-starter-kit-part-3-of-3/
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
// http://go.microsoft.com/fwlink/?LinkID=615561
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace VSD3DStarter
|
||||
{
|
||||
// .CMO files
|
||||
|
||||
// UINT - Mesh count
|
||||
// { [Mesh count]
|
||||
// UINT - Length of name
|
||||
// wchar_t[] - Name of mesh (if length > 0)
|
||||
// UINT - Material count
|
||||
// { [Material count]
|
||||
// UINT - Length of material name
|
||||
// wchar_t[] - Name of material (if length > 0)
|
||||
// Material structure
|
||||
// UINT - Length of pixel shader name
|
||||
// wchar_t[] - Name of pixel shader (if length > 0)
|
||||
// { [8]
|
||||
// UINT - Length of texture name
|
||||
// wchar_t[] - Name of texture (if length > 0)
|
||||
// }
|
||||
// }
|
||||
// BYTE - 1 if there is skeletal animation data present
|
||||
// UINT - SubMesh count
|
||||
// { [SubMesh count]
|
||||
// SubMesh structure
|
||||
// }
|
||||
// UINT - IB Count
|
||||
// { [IB Count]
|
||||
// UINT - Number of USHORTs in IB
|
||||
// USHORT[] - Array of indices
|
||||
// }
|
||||
// UINT - VB Count
|
||||
// { [VB Count]
|
||||
// UINT - Number of verts in VB
|
||||
// Vertex[] - Array of vertices
|
||||
// }
|
||||
// UINT - Skinning VB Count
|
||||
// { [Skinning VB Count]
|
||||
// UINT - Number of verts in Skinning VB
|
||||
// SkinningVertex[] - Array of skinning verts
|
||||
// }
|
||||
// MeshExtents structure
|
||||
// [If skeleton animation data is not present, file ends here]
|
||||
// UINT - Bone count
|
||||
// { [Bone count]
|
||||
// UINT - Length of bone name
|
||||
// wchar_t[] - Bone name (if length > 0)
|
||||
// Bone structure
|
||||
// }
|
||||
// UINT - Animation clip count
|
||||
// { [Animation clip count]
|
||||
// UINT - Length of clip name
|
||||
// wchar_t[] - Clip name (if length > 0)
|
||||
// float - Start time
|
||||
// float - End time
|
||||
// UINT - Keyframe count
|
||||
// { [Keyframe count]
|
||||
// Keyframe structure
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
struct Material
|
||||
{
|
||||
DirectX::XMFLOAT4 Ambient;
|
||||
DirectX::XMFLOAT4 Diffuse;
|
||||
DirectX::XMFLOAT4 Specular;
|
||||
float SpecularPower;
|
||||
DirectX::XMFLOAT4 Emissive;
|
||||
DirectX::XMFLOAT4X4 UVTransform;
|
||||
};
|
||||
|
||||
constexpr uint32_t MAX_TEXTURE = 8;
|
||||
|
||||
struct SubMesh
|
||||
{
|
||||
uint32_t MaterialIndex;
|
||||
uint32_t IndexBufferIndex;
|
||||
uint32_t VertexBufferIndex;
|
||||
uint32_t StartIndex;
|
||||
uint32_t PrimCount;
|
||||
};
|
||||
|
||||
constexpr uint32_t NUM_BONE_INFLUENCES = 4;
|
||||
|
||||
// Vertex struct for Visual Studio Shader Designer (DGSL) holding position, normal,
|
||||
// tangent, color (RGBA), and texture mapping information
|
||||
struct VertexPositionNormalTangentColorTexture
|
||||
{
|
||||
DirectX::XMFLOAT3 position;
|
||||
DirectX::XMFLOAT3 normal;
|
||||
DirectX::XMFLOAT4 tangent;
|
||||
uint32_t color;
|
||||
DirectX::XMFLOAT2 textureCoordinate;
|
||||
};
|
||||
|
||||
struct SkinningVertex
|
||||
{
|
||||
uint32_t boneIndex[NUM_BONE_INFLUENCES];
|
||||
float boneWeight[NUM_BONE_INFLUENCES];
|
||||
};
|
||||
|
||||
struct MeshExtents
|
||||
{
|
||||
float CenterX, CenterY, CenterZ;
|
||||
float Radius;
|
||||
|
||||
float MinX, MinY, MinZ;
|
||||
float MaxX, MaxY, MaxZ;
|
||||
};
|
||||
|
||||
struct Bone
|
||||
{
|
||||
int32_t ParentIndex;
|
||||
DirectX::XMFLOAT4X4 InvBindPos;
|
||||
DirectX::XMFLOAT4X4 BindPos;
|
||||
DirectX::XMFLOAT4X4 LocalTransform;
|
||||
};
|
||||
|
||||
struct Clip
|
||||
{
|
||||
float StartTime;
|
||||
float EndTime;
|
||||
uint32_t keys;
|
||||
};
|
||||
|
||||
struct Keyframe
|
||||
{
|
||||
uint32_t BoneIndex;
|
||||
float Time;
|
||||
DirectX::XMFLOAT4X4 Transform;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
const Material s_defMaterial =
|
||||
{
|
||||
{ 0.2f, 0.2f, 0.2f, 1.f },
|
||||
{ 0.8f, 0.8f, 0.8f, 1.f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.f },
|
||||
1.f,
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f },
|
||||
{ 1.f, 0.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f,
|
||||
0.f, 0.f, 0.f, 1.f },
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static_assert(sizeof(VSD3DStarter::Material) == 132, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::SubMesh) == 20, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::VertexPositionNormalTangentColorTexture) == 52, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::SkinningVertex) == 32, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::MeshExtents) == 40, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::Bone) == 196, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::Clip) == 12, "CMO Mesh structure size incorrect");
|
||||
static_assert(sizeof(VSD3DStarter::Keyframe) == 72, "CMO Mesh structure size incorrect");
|
330
enginecustom/include/Src/DDS.h
Normal file
330
enginecustom/include/Src/DDS.h
Normal file
@@ -0,0 +1,330 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// DDS.h
|
||||
//
|
||||
// This header defines constants and structures that are useful when parsing
|
||||
// DDS files. DDS files were originally designed to use several structures
|
||||
// and constants that are native to DirectDraw and are defined in ddraw.h,
|
||||
// such as DDSURFACEDESC2 and DDSCAPS2. This file defines similar
|
||||
// (compatible) constants and structures so that one can use DDS files
|
||||
// without needing to include ddraw.h.
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248926
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
// http://go.microsoft.com/fwlink/?LinkID=615561
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
constexpr uint32_t DDS_MAGIC = 0x20534444; // "DDS "
|
||||
|
||||
struct DDS_PIXELFORMAT
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t flags;
|
||||
uint32_t fourCC;
|
||||
uint32_t RGBBitCount;
|
||||
uint32_t RBitMask;
|
||||
uint32_t GBitMask;
|
||||
uint32_t BBitMask;
|
||||
uint32_t ABitMask;
|
||||
};
|
||||
|
||||
#define DDS_FOURCC 0x00000004 // DDPF_FOURCC
|
||||
#define DDS_RGB 0x00000040 // DDPF_RGB
|
||||
#define DDS_RGBA 0x00000041 // DDPF_RGB | DDPF_ALPHAPIXELS
|
||||
#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE
|
||||
#define DDS_LUMINANCEA 0x00020001 // DDPF_LUMINANCE | DDPF_ALPHAPIXELS
|
||||
#define DDS_ALPHAPIXELS 0x00000001 // DDPF_ALPHAPIXELS
|
||||
#define DDS_ALPHA 0x00000002 // DDPF_ALPHA
|
||||
#define DDS_PAL8 0x00000020 // DDPF_PALETTEINDEXED8
|
||||
#define DDS_PAL8A 0x00000021 // DDPF_PALETTEINDEXED8 | DDPF_ALPHAPIXELS
|
||||
#define DDS_BUMPLUMINANCE 0x00040000 // DDPF_BUMPLUMINANCE
|
||||
#define DDS_BUMPDUDV 0x00080000 // DDPF_BUMPDUDV
|
||||
#define DDS_BUMPDUDVA 0x00080001 // DDPF_BUMPDUDV | DDPF_ALPHAPIXELS
|
||||
|
||||
#ifndef MAKEFOURCC
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
(static_cast<uint32_t>(static_cast<uint8_t>(ch0)) \
|
||||
| (static_cast<uint32_t>(static_cast<uint8_t>(ch1)) << 8) \
|
||||
| (static_cast<uint32_t>(static_cast<uint8_t>(ch2)) << 16) \
|
||||
| (static_cast<uint32_t>(static_cast<uint8_t>(ch3)) << 24))
|
||||
#endif /* MAKEFOURCC */
|
||||
|
||||
#ifndef DDSGLOBALCONST
|
||||
#if defined(__GNUC__) && !defined(__MINGW32__)
|
||||
#define DDSGLOBALCONST extern const __attribute__((weak))
|
||||
#else
|
||||
#define DDSGLOBALCONST extern const __declspec(selectany)
|
||||
#endif
|
||||
#endif /* DDSGLOBALCONST */
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT1 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT2 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT3 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT4 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC4_UNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','U'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC4_SNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','S'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC5_UNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','U'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC5_SNORM =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','S'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R8G8_B8G8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_G8R8_G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_YUY2 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_UYVY =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8R8G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8B8G8R8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8B8G8R8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_G16R16 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R5G6B5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0xf800, 0x07e0, 0x001f, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x7c00, 0x03e0, 0x001f, 0x8000 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X1R5G5B5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x7c00, 0x03e0, 0x001f, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x0f00, 0x00f0, 0x000f, 0xf000 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X4R4G4B4 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0f00, 0x00f0, 0x000f, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R8G8B8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0xff0000, 0x00ff00, 0x0000ff, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8R3G3B2 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00e0, 0x001c, 0x0003, 0xff00 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R3G3B2 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 8, 0xe0, 0x1c, 0x03, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A4L4 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x0f, 0, 0, 0xf0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 8, 0xff, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L16 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0, 0, 0xff00 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8_ALT =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x00ff, 0, 0, 0xff00 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L8_NVTT1 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 8, 0xff, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L16_NVTT1 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0xffff, 0, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8_NVTT1 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00ff, 0, 0, 0xff00 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0, 0, 0, 0xff };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_V8U8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0, 0 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_Q8W8V8U8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
|
||||
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_V16U16 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0, 0 };
|
||||
|
||||
// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2R10G10B10 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 };
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2B10G10R10 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 };
|
||||
|
||||
// The following legacy Direct3D 9 formats use 'mixed' signed & unsigned channels so requires special handling
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2W10V10U10 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDVA, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 };
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L6V5U5 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPLUMINANCE, 0, 16, 0x001f, 0x03e0, 0xfc00, 0 };
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8L8V8U8 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPLUMINANCE, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0 };
|
||||
|
||||
// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat)
|
||||
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DX10 =
|
||||
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','1','0'), 0, 0, 0, 0, 0 };
|
||||
|
||||
#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
|
||||
#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT
|
||||
#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH
|
||||
#define DDS_HEADER_FLAGS_PITCH 0x00000008 // DDSD_PITCH
|
||||
#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000 // DDSD_LINEARSIZE
|
||||
|
||||
#define DDS_HEIGHT 0x00000002 // DDSD_HEIGHT
|
||||
#define DDS_WIDTH 0x00000004 // DDSD_WIDTH
|
||||
|
||||
#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE
|
||||
#define DDS_SURFACE_FLAGS_MIPMAP 0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
|
||||
#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX
|
||||
|
||||
#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
|
||||
#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
|
||||
#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
|
||||
#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
|
||||
#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
|
||||
#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
|
||||
|
||||
#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\
|
||||
DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\
|
||||
DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ )
|
||||
|
||||
#define DDS_CUBEMAP 0x00000200 // DDSCAPS2_CUBEMAP
|
||||
|
||||
#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME
|
||||
|
||||
// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION
|
||||
enum DDS_RESOURCE_DIMENSION : uint32_t
|
||||
{
|
||||
DDS_DIMENSION_TEXTURE1D = 2,
|
||||
DDS_DIMENSION_TEXTURE2D = 3,
|
||||
DDS_DIMENSION_TEXTURE3D = 4,
|
||||
};
|
||||
|
||||
// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG
|
||||
enum DDS_RESOURCE_MISC_FLAG : uint32_t
|
||||
{
|
||||
DDS_RESOURCE_MISC_TEXTURECUBE = 0x4L,
|
||||
};
|
||||
|
||||
enum DDS_MISC_FLAGS2 : uint32_t
|
||||
{
|
||||
DDS_MISC_FLAGS2_ALPHA_MODE_MASK = 0x7L,
|
||||
};
|
||||
|
||||
#ifndef DDS_ALPHA_MODE_DEFINED
|
||||
#define DDS_ALPHA_MODE_DEFINED
|
||||
enum DDS_ALPHA_MODE : uint32_t
|
||||
{
|
||||
DDS_ALPHA_MODE_UNKNOWN = 0,
|
||||
DDS_ALPHA_MODE_STRAIGHT = 1,
|
||||
DDS_ALPHA_MODE_PREMULTIPLIED = 2,
|
||||
DDS_ALPHA_MODE_OPAQUE = 3,
|
||||
DDS_ALPHA_MODE_CUSTOM = 4,
|
||||
};
|
||||
#endif
|
||||
|
||||
struct DDS_HEADER
|
||||
{
|
||||
uint32_t size;
|
||||
uint32_t flags;
|
||||
uint32_t height;
|
||||
uint32_t width;
|
||||
uint32_t pitchOrLinearSize;
|
||||
uint32_t depth; // only if DDS_HEADER_FLAGS_VOLUME is set in flags
|
||||
uint32_t mipMapCount;
|
||||
uint32_t reserved1[11];
|
||||
DDS_PIXELFORMAT ddspf;
|
||||
uint32_t caps;
|
||||
uint32_t caps2;
|
||||
uint32_t caps3;
|
||||
uint32_t caps4;
|
||||
uint32_t reserved2;
|
||||
};
|
||||
|
||||
struct DDS_HEADER_DXT10
|
||||
{
|
||||
DXGI_FORMAT dxgiFormat;
|
||||
uint32_t resourceDimension;
|
||||
uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG
|
||||
uint32_t arraySize;
|
||||
uint32_t miscFlags2; // see DDS_MISC_FLAGS2
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
static_assert(sizeof(DDS_PIXELFORMAT) == 32, "DDS pixel format size mismatch");
|
||||
static_assert(sizeof(DDS_HEADER) == 124, "DDS Header size mismatch");
|
||||
static_assert(sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch");
|
||||
|
||||
constexpr size_t DDS_MIN_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER);
|
||||
constexpr size_t DDS_DX10_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
|
||||
static_assert(DDS_DX10_HEADER_SIZE > DDS_MIN_HEADER_SIZE, "DDS DX10 Header should be larger than standard header");
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Xbox
|
||||
{
|
||||
DDSGLOBALCONST DirectX::DDS_PIXELFORMAT DDSPF_XBOX =
|
||||
{ sizeof(DirectX::DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('X','B','O','X'), 0, 0, 0, 0, 0 };
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
struct DDS_HEADER_XBOX
|
||||
// Must match structure in XboxDDSTextureLoader module
|
||||
{
|
||||
DXGI_FORMAT dxgiFormat;
|
||||
uint32_t resourceDimension;
|
||||
uint32_t miscFlag; // see DDS_RESOURCE_MISC_FLAG
|
||||
uint32_t arraySize;
|
||||
uint32_t miscFlags2; // see DDS_MISC_FLAGS2
|
||||
uint32_t tileMode; // see XG_TILE_MODE / XG_SWIZZLE_MODE
|
||||
uint32_t baseAlignment;
|
||||
uint32_t dataSize;
|
||||
uint32_t xdkVer; // matching _XDK_VER / _GXDK_VER
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
static_assert(sizeof(DDS_HEADER_XBOX) == 36, "DDS XBOX Header size mismatch");
|
||||
static_assert(sizeof(DDS_HEADER_XBOX) > sizeof(DirectX::DDS_HEADER_DXT10), "DDS XBOX Header should be larger than DX10 header");
|
||||
|
||||
constexpr size_t DDS_XBOX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DirectX::DDS_HEADER) + sizeof(DDS_HEADER_XBOX);
|
||||
|
||||
constexpr uint32_t XBOX_TILEMODE_SCARLETT = 0x1000000;
|
||||
} // namespace
|
1439
enginecustom/include/Src/DDSTextureLoader.cpp
Normal file
1439
enginecustom/include/Src/DDSTextureLoader.cpp
Normal file
File diff suppressed because it is too large
Load Diff
54
enginecustom/include/Src/DirectXHelpers.cpp
Normal file
54
enginecustom/include/Src/DirectXHelpers.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// File: DirectXHelpers.cpp
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#include "pch.h"
|
||||
#include "DirectXHelpers.h"
|
||||
#include "Effects.h"
|
||||
#include "PlatformHelpers.h"
|
||||
|
||||
|
||||
using namespace DirectX;
|
||||
|
||||
_Use_decl_annotations_
|
||||
HRESULT DirectX::CreateInputLayoutFromEffect(
|
||||
ID3D11Device* device,
|
||||
IEffect* effect,
|
||||
const D3D11_INPUT_ELEMENT_DESC* desc,
|
||||
size_t count,
|
||||
ID3D11InputLayout** pInputLayout) noexcept
|
||||
{
|
||||
if (!pInputLayout)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*pInputLayout = nullptr;
|
||||
|
||||
if (!device || !effect || !desc || !count)
|
||||
return E_INVALIDARG;
|
||||
|
||||
void const* shaderByteCode;
|
||||
size_t byteCodeLength;
|
||||
|
||||
try
|
||||
{
|
||||
effect->GetVertexShaderBytecode(&shaderByteCode, &byteCodeLength);
|
||||
}
|
||||
catch (com_exception e)
|
||||
{
|
||||
return e.get_result();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return device->CreateInputLayout(
|
||||
desc, static_cast<UINT>(count),
|
||||
shaderByteCode, byteCodeLength,
|
||||
pInputLayout);
|
||||
}
|
1107
enginecustom/include/Src/LoaderHelpers.h
Normal file
1107
enginecustom/include/Src/LoaderHelpers.h
Normal file
File diff suppressed because it is too large
Load Diff
94
enginecustom/include/Src/PlatformHelpers.h
Normal file
94
enginecustom/include/Src/PlatformHelpers.h
Normal file
@@ -0,0 +1,94 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// File: PlatformHelpers.h
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
// http://go.microsoft.com/fwlink/?LinkID=615561
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4324)
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
|
||||
#ifndef MAKEFOURCC
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
(static_cast<uint32_t>(static_cast<uint8_t>(ch0)) \
|
||||
| (static_cast<uint32_t>(static_cast<uint8_t>(ch1)) << 8) \
|
||||
| (static_cast<uint32_t>(static_cast<uint8_t>(ch2)) << 16) \
|
||||
| (static_cast<uint32_t>(static_cast<uint8_t>(ch3)) << 24))
|
||||
#endif /* defined(MAKEFOURCC) */
|
||||
|
||||
// See https://walbourn.github.io/modern-c++-bitmask-types/
|
||||
#ifndef ENUM_FLAGS_CONSTEXPR
|
||||
#if defined(NTDDI_WIN10_RS1) && !defined(__MINGW32__)
|
||||
#define ENUM_FLAGS_CONSTEXPR constexpr
|
||||
#else
|
||||
#define ENUM_FLAGS_CONSTEXPR const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
// Helper class for COM exceptions
|
||||
class com_exception : public std::exception
|
||||
{
|
||||
public:
|
||||
com_exception(HRESULT hr) noexcept : result(hr) {}
|
||||
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
static char s_str[64] = {};
|
||||
sprintf_s(s_str, "Failure with HRESULT of %08X", static_cast<unsigned int>(result));
|
||||
return s_str;
|
||||
}
|
||||
|
||||
HRESULT get_result() const noexcept { return result; }
|
||||
|
||||
private:
|
||||
HRESULT result;
|
||||
};
|
||||
|
||||
// Helper utility converts D3D API failures into exceptions.
|
||||
inline void ThrowIfFailed(HRESULT hr) noexcept(false)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
throw com_exception(hr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Helper for output debug tracing
|
||||
inline void DebugTrace(_In_z_ _Printf_format_string_ const char* format, ...) noexcept
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
char buff[1024] = {};
|
||||
vsprintf_s(buff, format, args);
|
||||
OutputDebugStringA(buff);
|
||||
va_end(args);
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(format);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Helper smart-pointers
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10) || (defined(_XBOX_ONE) && defined(_TITLE)) || !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
|
||||
struct virtual_deleter { void operator()(void* p) noexcept { if (p) VirtualFree(p, 0, MEM_RELEASE); } };
|
||||
#endif
|
||||
|
||||
struct handle_closer { void operator()(HANDLE h) noexcept { if (h) CloseHandle(h); } };
|
||||
|
||||
using ScopedHandle = std::unique_ptr<void, handle_closer>;
|
||||
|
||||
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
|
||||
}
|
247
enginecustom/include/Src/SimpleMath.cpp
Normal file
247
enginecustom/include/Src/SimpleMath.cpp
Normal file
@@ -0,0 +1,247 @@
|
||||
//-------------------------------------------------------------------------------------
|
||||
// SimpleMath.cpp -- Simplified C++ Math wrapper for DirectXMath
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
// http://go.microsoft.com/fwlink/?LinkID=615561
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#include "pch.h"
|
||||
#include "SimpleMath.h"
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Constants
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
namespace DirectX
|
||||
{
|
||||
namespace SimpleMath
|
||||
{
|
||||
const Vector2 Vector2::Zero = { 0.f, 0.f };
|
||||
const Vector2 Vector2::One = { 1.f, 1.f };
|
||||
const Vector2 Vector2::UnitX = { 1.f, 0.f };
|
||||
const Vector2 Vector2::UnitY = { 0.f, 1.f };
|
||||
|
||||
const Vector3 Vector3::Zero = { 0.f, 0.f, 0.f };
|
||||
const Vector3 Vector3::One = { 1.f, 1.f, 1.f };
|
||||
const Vector3 Vector3::UnitX = { 1.f, 0.f, 0.f };
|
||||
const Vector3 Vector3::UnitY = { 0.f, 1.f, 0.f };
|
||||
const Vector3 Vector3::UnitZ = { 0.f, 0.f, 1.f };
|
||||
const Vector3 Vector3::Up = { 0.f, 1.f, 0.f };
|
||||
const Vector3 Vector3::Down = { 0.f, -1.f, 0.f };
|
||||
const Vector3 Vector3::Right = { 1.f, 0.f, 0.f };
|
||||
const Vector3 Vector3::Left = { -1.f, 0.f, 0.f };
|
||||
const Vector3 Vector3::Forward = { 0.f, 0.f, -1.f };
|
||||
const Vector3 Vector3::Backward = { 0.f, 0.f, 1.f };
|
||||
|
||||
const Vector4 Vector4::Zero = { 0.f, 0.f, 0.f, 0.f };
|
||||
const Vector4 Vector4::One = { 1.f, 1.f, 1.f, 1.f };
|
||||
const Vector4 Vector4::UnitX = { 1.f, 0.f, 0.f, 0.f };
|
||||
const Vector4 Vector4::UnitY = { 0.f, 1.f, 0.f, 0.f };
|
||||
const Vector4 Vector4::UnitZ = { 0.f, 0.f, 1.f, 0.f };
|
||||
const Vector4 Vector4::UnitW = { 0.f, 0.f, 0.f, 1.f };
|
||||
|
||||
const Matrix Matrix::Identity = { 1.f, 0.f, 0.f, 0.f,
|
||||
0.f, 1.f, 0.f, 0.f,
|
||||
0.f, 0.f, 1.f, 0.f,
|
||||
0.f, 0.f, 0.f, 1.f };
|
||||
|
||||
const Quaternion Quaternion::Identity = { 0.f, 0.f, 0.f, 1.f };
|
||||
}
|
||||
}
|
||||
|
||||
using namespace DirectX;
|
||||
using namespace DirectX::SimpleMath;
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Quaternion
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void Quaternion::RotateTowards(const Quaternion& target, float maxAngle, Quaternion& result) const noexcept
|
||||
{
|
||||
const XMVECTOR T = XMLoadFloat4(this);
|
||||
|
||||
// We can use the conjugate here instead of inverse assuming q1 & q2 are normalized.
|
||||
const XMVECTOR R = XMQuaternionMultiply(XMQuaternionConjugate(T), target);
|
||||
|
||||
const float rs = XMVectorGetW(R);
|
||||
const XMVECTOR L = XMVector3Length(R);
|
||||
const float angle = 2.f * atan2f(XMVectorGetX(L), rs);
|
||||
if (angle > maxAngle)
|
||||
{
|
||||
const XMVECTOR delta = XMQuaternionRotationAxis(R, maxAngle);
|
||||
const XMVECTOR Q = XMQuaternionMultiply(delta, T);
|
||||
XMStoreFloat4(&result, Q);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't overshoot.
|
||||
result = target;
|
||||
}
|
||||
}
|
||||
|
||||
void Quaternion::FromToRotation(const Vector3& fromDir, const Vector3& toDir, Quaternion& result) noexcept
|
||||
{
|
||||
// Melax, "The Shortest Arc Quaternion", Game Programming Gems, Charles River Media (2000).
|
||||
|
||||
const XMVECTOR F = XMVector3Normalize(fromDir);
|
||||
const XMVECTOR T = XMVector3Normalize(toDir);
|
||||
|
||||
const float dot = XMVectorGetX(XMVector3Dot(F, T));
|
||||
if (dot >= 1.f)
|
||||
{
|
||||
result = Identity;
|
||||
}
|
||||
else if (dot <= -1.f)
|
||||
{
|
||||
XMVECTOR axis = XMVector3Cross(F, Vector3::Right);
|
||||
if (XMVector3NearEqual(XMVector3LengthSq(axis), g_XMZero, g_XMEpsilon))
|
||||
{
|
||||
axis = XMVector3Cross(F, Vector3::Up);
|
||||
}
|
||||
|
||||
const XMVECTOR Q = XMQuaternionRotationAxis(axis, XM_PI);
|
||||
XMStoreFloat4(&result, Q);
|
||||
}
|
||||
else
|
||||
{
|
||||
const XMVECTOR C = XMVector3Cross(F, T);
|
||||
XMStoreFloat4(&result, C);
|
||||
|
||||
const float s = sqrtf((1.f + dot) * 2.f);
|
||||
result.x /= s;
|
||||
result.y /= s;
|
||||
result.z /= s;
|
||||
result.w = s * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
void Quaternion::LookRotation(const Vector3& forward, const Vector3& up, Quaternion& result) noexcept
|
||||
{
|
||||
Quaternion q1;
|
||||
FromToRotation(Vector3::Forward, forward, q1);
|
||||
|
||||
const XMVECTOR C = XMVector3Cross(forward, up);
|
||||
if (XMVector3NearEqual(XMVector3LengthSq(C), g_XMZero, g_XMEpsilon))
|
||||
{
|
||||
// forward and up are co-linear
|
||||
result = q1;
|
||||
return;
|
||||
}
|
||||
|
||||
const XMVECTOR U = XMQuaternionMultiply(q1, Vector3::Up);
|
||||
|
||||
Quaternion q2;
|
||||
FromToRotation(U, up, q2);
|
||||
|
||||
XMStoreFloat4(&result, XMQuaternionMultiply(q2, q1));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Viewport
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(__d3d11_h__) || defined(__d3d11_x_h__)
|
||||
static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D11_VIEWPORT), "Size mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, x) == offsetof(D3D11_VIEWPORT, TopLeftX), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, y) == offsetof(D3D11_VIEWPORT, TopLeftY), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, width) == offsetof(D3D11_VIEWPORT, Width), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, height) == offsetof(D3D11_VIEWPORT, Height), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, minDepth) == offsetof(D3D11_VIEWPORT, MinDepth), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, maxDepth) == offsetof(D3D11_VIEWPORT, MaxDepth), "Layout mismatch");
|
||||
#endif
|
||||
|
||||
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
|
||||
static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D12_VIEWPORT), "Size mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, x) == offsetof(D3D12_VIEWPORT, TopLeftX), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, y) == offsetof(D3D12_VIEWPORT, TopLeftY), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, width) == offsetof(D3D12_VIEWPORT, Width), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, height) == offsetof(D3D12_VIEWPORT, Height), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, minDepth) == offsetof(D3D12_VIEWPORT, MinDepth), "Layout mismatch");
|
||||
static_assert(offsetof(DirectX::SimpleMath::Viewport, maxDepth) == offsetof(D3D12_VIEWPORT, MaxDepth), "Layout mismatch");
|
||||
#endif
|
||||
|
||||
#if defined(__dxgi1_2_h__) || defined(__d3d11_x_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
|
||||
RECT Viewport::ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight) noexcept
|
||||
{
|
||||
RECT rct = {};
|
||||
|
||||
switch (int(scaling))
|
||||
{
|
||||
case DXGI_SCALING_STRETCH:
|
||||
// Output fills the entire window area
|
||||
rct.top = 0;
|
||||
rct.left = 0;
|
||||
rct.right = outputWidth;
|
||||
rct.bottom = outputHeight;
|
||||
break;
|
||||
|
||||
case 2 /*DXGI_SCALING_ASPECT_RATIO_STRETCH*/:
|
||||
// Output fills the window area but respects the original aspect ratio, using pillar boxing or letter boxing as required
|
||||
// Note: This scaling option is not supported for legacy Win32 windows swap chains
|
||||
{
|
||||
assert(backBufferHeight > 0);
|
||||
const float aspectRatio = float(backBufferWidth) / float(backBufferHeight);
|
||||
|
||||
// Horizontal fill
|
||||
float scaledWidth = float(outputWidth);
|
||||
float scaledHeight = float(outputWidth) / aspectRatio;
|
||||
if (scaledHeight >= float(outputHeight))
|
||||
{
|
||||
// Do vertical fill
|
||||
scaledWidth = float(outputHeight) * aspectRatio;
|
||||
scaledHeight = float(outputHeight);
|
||||
}
|
||||
|
||||
const float offsetX = (float(outputWidth) - scaledWidth) * 0.5f;
|
||||
const float offsetY = (float(outputHeight) - scaledHeight) * 0.5f;
|
||||
|
||||
rct.left = static_cast<LONG>(offsetX);
|
||||
rct.top = static_cast<LONG>(offsetY);
|
||||
rct.right = static_cast<LONG>(offsetX + scaledWidth);
|
||||
rct.bottom = static_cast<LONG>(offsetY + scaledHeight);
|
||||
|
||||
// Clip to display window
|
||||
rct.left = std::max<LONG>(0, rct.left);
|
||||
rct.top = std::max<LONG>(0, rct.top);
|
||||
rct.right = std::min<LONG>(outputWidth, rct.right);
|
||||
rct.bottom = std::min<LONG>(outputHeight, rct.bottom);
|
||||
}
|
||||
break;
|
||||
|
||||
case DXGI_SCALING_NONE:
|
||||
default:
|
||||
// Output is displayed in the upper left corner of the window area
|
||||
rct.top = 0;
|
||||
rct.left = 0;
|
||||
rct.right = std::min<LONG>(static_cast<LONG>(backBufferWidth), outputWidth);
|
||||
rct.bottom = std::min<LONG>(static_cast<LONG>(backBufferHeight), outputHeight);
|
||||
break;
|
||||
}
|
||||
|
||||
return rct;
|
||||
}
|
||||
#endif
|
||||
|
||||
RECT Viewport::ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight) noexcept
|
||||
{
|
||||
const float safew = (float(backBufferWidth) + 19.f) / 20.f;
|
||||
const float safeh = (float(backBufferHeight) + 19.f) / 20.f;
|
||||
|
||||
RECT rct;
|
||||
rct.left = static_cast<LONG>(safew);
|
||||
rct.top = static_cast<LONG>(safeh);
|
||||
rct.right = static_cast<LONG>(float(backBufferWidth) - safew + 0.5f);
|
||||
rct.bottom = static_cast<LONG>(float(backBufferHeight) - safeh + 0.5f);
|
||||
|
||||
return rct;
|
||||
}
|
1294
enginecustom/include/Src/WICTextureLoader.cpp
Normal file
1294
enginecustom/include/Src/WICTextureLoader.cpp
Normal file
File diff suppressed because it is too large
Load Diff
10
enginecustom/include/Src/pch.cpp
Normal file
10
enginecustom/include/Src/pch.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// File: pch.cpp
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#include "pch.h"
|
193
enginecustom/include/Src/pch.h
Normal file
193
enginecustom/include/Src/pch.h
Normal file
@@ -0,0 +1,193 @@
|
||||
//--------------------------------------------------------------------------------------
|
||||
// File: pch.h
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//
|
||||
// http://go.microsoft.com/fwlink/?LinkId=248929
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Off by default warnings
|
||||
#pragma warning(disable : 4619 4616 4061 4265 4365 4571 4623 4625 4626 4628 4668 4710 4711 4746 4774 4820 4987 5026 5027 5031 5032 5039 5045 5219 5264 26812)
|
||||
// C4619/4616 #pragma warning warnings
|
||||
// C4061 enumerator 'X' in switch of enum 'X' is not explicitly handled by a case label
|
||||
// C4265 class has virtual functions, but destructor is not virtual
|
||||
// C4365 signed/unsigned mismatch
|
||||
// C4571 behavior change
|
||||
// C4623 default constructor was implicitly defined as deleted
|
||||
// C4625 copy constructor was implicitly defined as deleted
|
||||
// C4626 assignment operator was implicitly defined as deleted
|
||||
// C4628 digraphs not supported
|
||||
// C4668 not defined as a preprocessor macro
|
||||
// C4710 function not inlined
|
||||
// C4711 selected for automatic inline expansion
|
||||
// C4746 volatile access of '<expression>' is subject to /volatile:<iso|ms> setting
|
||||
// C4774 format string expected in argument 3 is not a string literal
|
||||
// C4820 padding added after data member
|
||||
// C4987 nonstandard extension used
|
||||
// C5026 move constructor was implicitly defined as deleted
|
||||
// C5027 move assignment operator was implicitly defined as deleted
|
||||
// C5031/5032 push/pop mismatches in windows headers
|
||||
// C5039 pointer or reference to potentially throwing function passed to extern C function under - EHc
|
||||
// C5045 Spectre mitigation warning
|
||||
// C5219 implicit conversion from 'int' to 'float', possible loss of data
|
||||
// C5264 'const' variable is not used
|
||||
// 26812: The enum type 'x' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
|
||||
|
||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||
// Xbox One XDK related Off by default warnings
|
||||
#pragma warning(disable : 4471 4643 4917 4986 5029 5038 5040 5043 5204 5246 5256 5262 5267)
|
||||
// C4471 forward declaration of an unscoped enumeration must have an underlying type
|
||||
// C4643 Forward declaring in namespace std is not permitted by the C++ Standard
|
||||
// C4917 a GUID can only be associated with a class, interface or namespace
|
||||
// C4986 exception specification does not match previous declaration
|
||||
// C5029 nonstandard extension used
|
||||
// C5038 data member 'X' will be initialized after data member 'Y'
|
||||
// C5040 dynamic exception specifications are valid only in C++14 and earlier; treating as noexcept(false)
|
||||
// C5043 exception specification does not match previous declaration
|
||||
// C5204 class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
|
||||
// C5246 'anonymous struct or union': the initialization of a subobject should be wrapped in braces
|
||||
// C5256 a non-defining declaration of an enumeration with a fixed underlying type is only permitted as a standalone declaration
|
||||
// C5262 implicit fall-through occurs here; are you missing a break statement?
|
||||
// C5267 definition of implicit copy constructor for 'X' is deprecated because it has a user-provided assignment operator
|
||||
#endif // _XBOX_ONE && _TITLE
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#pragma warning(disable : 161 2960 3280)
|
||||
// warning #161: unrecognized #pragma
|
||||
// message #2960: allocation may not satisfy the type's alignment; consider using <aligned_new> header
|
||||
// message #3280: declaration hides member
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat-local-type-template-args"
|
||||
#pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||
#pragma clang diagnostic ignored "-Wfloat-equal"
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors"
|
||||
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
|
||||
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
|
||||
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
||||
#pragma clang diagnostic ignored "-Wmicrosoft-include"
|
||||
#pragma clang diagnostic ignored "-Wnested-anon-types"
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||
#pragma clang diagnostic ignored "-Wswitch-enum"
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
#pragma clang diagnostic ignored "-Wunused-member-function"
|
||||
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4005)
|
||||
#define NOMINMAX 1
|
||||
#define NODRAWTEXT
|
||||
#define NOGDI
|
||||
#define NOBITMAP
|
||||
#define NOMCX
|
||||
#define NOSERVICE
|
||||
#define NOHELP
|
||||
#pragma warning(pop)
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#ifndef _WIN32_WINNT_WIN10
|
||||
#define _WIN32_WINNT_WIN10 0x0A00
|
||||
#endif
|
||||
|
||||
#ifndef WINAPI_FAMILY_GAMES
|
||||
#define WINAPI_FAMILY_GAMES 6
|
||||
#endif
|
||||
|
||||
#ifdef _GAMING_XBOX
|
||||
#error This version of DirectX Tool Kit not supported for GDKX
|
||||
#elif defined(_XBOX_ONE) && defined(_TITLE)
|
||||
#include <xdk.h>
|
||||
|
||||
#if _XDK_VER < 0x42EE13B6 /* XDK Edition 180704 */
|
||||
#error DirectX Tool Kit for Direct3D 11 requires the July 2018 QFE4 XDK or later
|
||||
#endif
|
||||
|
||||
#include <d3d11_x.h>
|
||||
#else
|
||||
#include <d3d11_1.h>
|
||||
#endif
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cwchar>
|
||||
#include <exception>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4702)
|
||||
#include <functional>
|
||||
#pragma warning(pop)
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#define _XM_NO_XMVECTOR_OVERLOADS_
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <DirectXPackedVector.h>
|
||||
#include <DirectXCollision.h>
|
||||
|
||||
#if (DIRECTX_MATH_VERSION < 315)
|
||||
#define XM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4467 4986 5038 5204 5220 6101)
|
||||
#ifdef __MINGW32__
|
||||
#include <wrl/client.h>
|
||||
#else
|
||||
#include <wrl.h>
|
||||
#endif
|
||||
#pragma warning(pop)
|
||||
|
||||
#include <wincodec.h>
|
||||
|
||||
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
|
||||
#include <ocidl.h>
|
||||
#else
|
||||
#include <OCIdl.h>
|
||||
#endif
|
||||
|
||||
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4471 5204 5256)
|
||||
#include <Windows.UI.Core.h>
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <mutex>
|
@@ -84,7 +84,6 @@ ID3D11ShaderResourceView* ModelClass::GetTexture(int index) const {
|
||||
return nullptr; // Retourne nullptr si l'index est hors limites
|
||||
}
|
||||
|
||||
|
||||
bool ModelClass::InitializeBuffers(ID3D11Device* device)
|
||||
{
|
||||
Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||
|
@@ -13,6 +13,7 @@ Object::Object() : ModelClass()
|
||||
m_mass = NULL;
|
||||
m_isGrounded = false;
|
||||
m_id = NULL;
|
||||
m_boundingRadius = 1.0f;
|
||||
}
|
||||
|
||||
Object::~Object()
|
||||
@@ -225,3 +226,17 @@ int Object::GetId() const
|
||||
return m_id;
|
||||
}
|
||||
|
||||
bool Object::IsPhysicsEnabled() const
|
||||
{
|
||||
return m_isPhysicsEnabled;
|
||||
}
|
||||
|
||||
void Object::SetPhysicsEnabled(bool state)
|
||||
{
|
||||
m_isPhysicsEnabled = state;
|
||||
}
|
||||
|
||||
float Object::GetBoundingRadius() const
|
||||
{
|
||||
return m_boundingRadius;
|
||||
}
|
||||
|
@@ -38,6 +38,9 @@ public:
|
||||
float GetMass() const;
|
||||
void SetGrounded(bool);
|
||||
bool IsGrounded() const;
|
||||
bool IsPhysicsEnabled() const;
|
||||
void SetPhysicsEnabled(bool state);
|
||||
|
||||
|
||||
void UpdateWorldMatrix();
|
||||
void UpdateSRMatrix();
|
||||
@@ -54,6 +57,21 @@ public:
|
||||
|
||||
bool LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, const std::wstring& filename);
|
||||
|
||||
enum ShaderType
|
||||
{
|
||||
CEL_SHADING,
|
||||
LIGHTING,
|
||||
NORMAL_MAPPING,
|
||||
SPECULAR_MAPPING,
|
||||
REFLECTION,
|
||||
REFRACTION
|
||||
};
|
||||
|
||||
ShaderType GetActiveShader() const { return m_activeShader; };
|
||||
void SetActiveShader(ShaderType activeShader) { m_activeShader = activeShader; };
|
||||
|
||||
float GetBoundingRadius() const;
|
||||
|
||||
public :
|
||||
bool m_demoSpinning = false;
|
||||
XMVECTOR m_previousPosition;
|
||||
@@ -70,6 +88,11 @@ private:
|
||||
XMVECTOR m_acceleration;
|
||||
float m_mass;
|
||||
bool m_isGrounded;
|
||||
bool m_isPhysicsEnabled;
|
||||
|
||||
std::string m_name;
|
||||
|
||||
ShaderType m_activeShader = LIGHTING;
|
||||
|
||||
float m_boundingRadius;
|
||||
};
|
||||
|
@@ -28,7 +28,7 @@ void Physics::SetGravity(XMVECTOR gravity)
|
||||
}
|
||||
|
||||
// Apply gravity to an object
|
||||
void Physics::ApplyGravity(Object* object, float dragValue, float frameTime)
|
||||
void Physics::ApplyGravity(Object* object, float dragValue)
|
||||
{
|
||||
if (object == nullptr) // Verify if the object is not null
|
||||
{
|
||||
@@ -53,7 +53,7 @@ void Physics::ApplyGravity(Object* object, float dragValue, float frameTime)
|
||||
XMVECTOR velocity = object->GetVelocity();
|
||||
|
||||
// Update the velocity with the object's acceleration
|
||||
velocity += object->GetAcceleration() * frameTime;
|
||||
velocity += object->GetAcceleration();
|
||||
|
||||
// Set the new velocity
|
||||
object->SetVelocity(velocity);
|
||||
@@ -174,5 +174,4 @@ bool Physics::SphereCubeOverlap(Object* cube, Object* sphere)
|
||||
float radius = XMVectorGetX(XMVector3Length(scale2));
|
||||
|
||||
return distance < radius;
|
||||
}
|
||||
|
||||
}
|
@@ -13,7 +13,7 @@ public:
|
||||
|
||||
XMVECTOR GetGravity() const; // Get the gravity value
|
||||
void SetGravity(XMVECTOR gravity); // Define the gravity value
|
||||
void ApplyGravity(Object*, float, float); // Apply gravity to an object
|
||||
void ApplyGravity(Object*, float); // Apply gravity to an object
|
||||
void AddForce(Object*, XMVECTOR);
|
||||
bool IsColliding(Object*, Object*);
|
||||
bool CubesOverlap(Object*, Object*);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "imguiManager.h"
|
||||
#include <mutex>
|
||||
#include "resources.h"
|
||||
#include <chrono>
|
||||
|
||||
class SystemClass
|
||||
{
|
||||
@@ -21,9 +22,12 @@ public:
|
||||
bool Initialize();
|
||||
void Shutdown();
|
||||
void Run();
|
||||
void FixedUpdate();
|
||||
|
||||
LRESULT CALLBACK MessageHandler(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
void SendPath(wchar_t* path, std::filesystem::path WFolder);
|
||||
|
||||
private:
|
||||
bool Frame();
|
||||
void InitializeWindows(int&, int&);
|
||||
|
Reference in New Issue
Block a user