Fix: Correction du specular shader ainsi que le normal shader + Rangement du rendus
This commit is contained in:
parent
499ece1b69
commit
4d75b3433f
@ -26,7 +26,6 @@ ApplicationClass::ApplicationClass()
|
|||||||
m_Frustum = 0;
|
m_Frustum = 0;
|
||||||
m_DisplayPlane = 0;
|
m_DisplayPlane = 0;
|
||||||
m_ReflectionShader = 0;
|
m_ReflectionShader = 0;
|
||||||
/*m_TransparentShader = 0;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,8 +140,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create and initialize the render to texture object.
|
// Create and initialize the render to texture object.
|
||||||
m_RenderTexture = new RenderTextureClass;
|
m_RenderTexture = new RenderTextureClass;
|
||||||
@ -213,7 +210,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the file name of the model.
|
// Set the file name of the model.
|
||||||
strcpy_s(modelFilename, "cube.txt");
|
strcpy_s(modelFilename, "cube.txt");
|
||||||
|
|
||||||
@ -224,7 +220,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
strcpy_s(textureFilename4, "alpha01.tga");
|
strcpy_s(textureFilename4, "alpha01.tga");
|
||||||
strcpy_s(textureFilename5, "light01.tga");
|
strcpy_s(textureFilename5, "light01.tga");
|
||||||
strcpy_s(textureFilename6, "moss01.tga");
|
strcpy_s(textureFilename6, "moss01.tga");
|
||||||
// A FAIRE: Ajouter une nouvelle texture pour le multitexturing
|
|
||||||
|
|
||||||
// Create and initialize the model object.
|
// Create and initialize the model object.
|
||||||
m_Model = new ModelClass;
|
m_Model = new ModelClass;
|
||||||
@ -237,18 +232,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//// Create and initialize the transparent shader object.
|
|
||||||
//m_TransparentShader = new TransparentShaderClass;
|
|
||||||
|
|
||||||
//result = m_TransparentShader->Initialize(m_Direct3D->GetDevice(), hwnd);
|
|
||||||
//if (!result)
|
|
||||||
//{
|
|
||||||
// MessageBox(hwnd, L"Could not initialize the transparent shader object.", L"Error", MB_OK);
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Create and initialize the light shader object.
|
// Create and initialize the light shader object.
|
||||||
m_LightShader = new LightShaderClass;
|
m_LightShader = new LightShaderClass;
|
||||||
|
|
||||||
@ -263,7 +246,7 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
m_Light = new LightClass;
|
m_Light = new LightClass;
|
||||||
|
|
||||||
m_Light->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Light->SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
m_Light->SetDirection(0.0f, 0.0f, 1.0f);
|
m_Light->SetDirection(0.0f, 0.0f, -1.0f);
|
||||||
m_Light->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Light->SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
m_Light->SetSpecularPower(16.0f);
|
m_Light->SetSpecularPower(16.0f);
|
||||||
|
|
||||||
@ -274,24 +257,24 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
m_Lights = new LightClass[m_numLights];
|
m_Lights = new LightClass[m_numLights];
|
||||||
|
|
||||||
m_Lights[0].SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
|
m_Lights[0].SetDiffuseColor(1.0f, 1.0f, 1.0f, 1.0f); // White
|
||||||
m_Lights[0].SetPosition(10.0f, -5.0f, -15.0f);
|
m_Lights[0].SetDirection(0.0f, 0.0f, -1.0f);
|
||||||
m_Lights[0].SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Lights[0].SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
m_Lights[0].SetSpecularPower(16.0f);
|
m_Lights[0].SetSpecularPower(16.0f);
|
||||||
|
|
||||||
// Manually set the color and position of each light.
|
// Manually set the color and position of each light.
|
||||||
m_Lights[1].SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f); // Red
|
m_Lights[1].SetDiffuseColor(1.0f, 0.0f, 0.0f, 1.0f); // Red
|
||||||
m_Lights[1].SetPosition(-3.0f, 1.0f, 3.0f);
|
m_Lights[1].SetDirection(0.0f, 0.0f, -1.0f);
|
||||||
m_Lights[1].SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Lights[1].SetSpecularColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
m_Lights[1].SetSpecularPower(16.0f);
|
m_Lights[1].SetSpecularPower(16.0f);
|
||||||
|
|
||||||
m_Lights[2].SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f); // Green
|
m_Lights[2].SetDiffuseColor(0.0f, 1.0f, 0.0f, 1.0f); // Green
|
||||||
m_Lights[2].SetPosition(3.0f, 1.0f, 3.0f);
|
m_Lights[2].SetDirection(0.0f, 0.0f, -1.0f);
|
||||||
m_Lights[2].SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Lights[2].SetSpecularColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
m_Lights[2].SetSpecularPower(16.0f);
|
m_Lights[2].SetSpecularPower(16.0f);
|
||||||
|
|
||||||
m_Lights[3].SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue
|
m_Lights[3].SetDiffuseColor(0.0f, 0.0f, 1.0f, 1.0f); // Blue
|
||||||
m_Lights[3].SetPosition(-3.0f, 1.0f, -3.0f);
|
m_Lights[3].SetDirection(0.0f, 0.0f, 1.0f);
|
||||||
m_Lights[3].SetSpecularColor(1.0f, 1.0f, 1.0f, 1.0f);
|
m_Lights[3].SetSpecularColor(0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
m_Lights[3].SetSpecularPower(16.0f);
|
m_Lights[3].SetSpecularPower(16.0f);
|
||||||
|
|
||||||
|
|
||||||
@ -380,16 +363,6 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
|
|||||||
|
|
||||||
void ApplicationClass::Shutdown()
|
void ApplicationClass::Shutdown()
|
||||||
{
|
{
|
||||||
//// Release the transparent shader object.
|
|
||||||
//if (m_TransparentShader)
|
|
||||||
//{
|
|
||||||
// m_TransparentShader->Shutdown();
|
|
||||||
// delete m_TransparentShader;
|
|
||||||
// m_TransparentShader = 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Release the shader manager object.
|
// Release the shader manager object.
|
||||||
if (m_ShaderManager)
|
if (m_ShaderManager)
|
||||||
{
|
{
|
||||||
@ -1171,10 +1144,10 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
|||||||
|
|
||||||
// Setup matrices.
|
// Setup matrices.
|
||||||
rotateMatrix = XMMatrixRotationY(rotation);
|
rotateMatrix = XMMatrixRotationY(rotation);
|
||||||
translateMatrix = XMMatrixTranslation(-9.0f, -5.0f, -20.0f);
|
translateMatrix = XMMatrixTranslation(-10.0f, -5.0f, -20.0f);
|
||||||
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
worldMatrix = XMMatrixMultiply(rotateMatrix, translateMatrix);
|
||||||
|
|
||||||
// Render the model using the specular map shader.
|
// Render the model using the transparent shader.
|
||||||
m_Model->Render(m_Direct3D->GetDeviceContext());
|
m_Model->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
result = m_ShaderManager->RenderTransparentShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), blendAmount);
|
result = m_ShaderManager->RenderTransparentShader(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model->GetTexture(0), blendAmount);
|
||||||
@ -1183,30 +1156,6 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Render the first model that is using the dirt texture using the regular texture shader.
|
|
||||||
//m_Model1->Render(m_Direct3D->GetDeviceContext());
|
|
||||||
|
|
||||||
//result = m_TextureShader->Render(m_Direct3D->GetDeviceContext(), m_Model1->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model1->GetTexture(0));
|
|
||||||
//if (!result)
|
|
||||||
//{
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//// Translate to the right by one unit and towards the camera by one unit.
|
|
||||||
//worldMatrix = XMMatrixTranslation(1.0f, 0.0f, -1.0f);
|
|
||||||
|
|
||||||
//// Turn on alpha blending for the transparency to work.
|
|
||||||
//m_Direct3D->EnableAlphaBlending();
|
|
||||||
|
|
||||||
//// Render the second square model with the stone texture and use the 50% blending amount for transparency.
|
|
||||||
//m_Model2->Render(m_Direct3D->GetDeviceContext());
|
|
||||||
|
|
||||||
//result = m_TransparentShader->Render(m_Direct3D->GetDeviceContext(), m_Model2->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix, m_Model2->GetTexture(5), blendAmount);
|
|
||||||
//if (!result)
|
|
||||||
//{
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Turn off alpha blending.
|
// Turn off alpha blending.
|
||||||
m_Direct3D->DisableAlphaBlending();
|
m_Direct3D->DisableAlphaBlending();
|
||||||
|
|
||||||
|
@ -3,14 +3,17 @@ Pos=60,60
|
|||||||
Size=400,400
|
Size=400,400
|
||||||
|
|
||||||
[Window][Khaotic Engine]
|
[Window][Khaotic Engine]
|
||||||
Pos=819,137
|
Pos=824,13
|
||||||
Size=694,210
|
Size=694,210
|
||||||
|
Collapsed=1
|
||||||
|
|
||||||
[Window][Objects]
|
[Window][Objects]
|
||||||
Pos=222,19
|
Pos=35,13
|
||||||
Size=492,353
|
Size=492,353
|
||||||
|
Collapsed=1
|
||||||
|
|
||||||
[Window][Terrain]
|
[Window][Terrain]
|
||||||
Pos=892,19
|
Pos=1123,109
|
||||||
Size=418,94
|
Size=418,94
|
||||||
|
Collapsed=1
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
// MY CLASS INCLUDES //
|
// MY CLASS INCLUDES //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
#include "textureshaderclass.h"
|
#include "textureshaderclass.h"
|
||||||
#include "lightshaderclass.h"
|
|
||||||
#include "normalmapshaderclass.h"
|
#include "normalmapshaderclass.h"
|
||||||
#include "Multitextureshaderclass.h"
|
#include "Multitextureshaderclass.h"
|
||||||
#include "translateshaderclass.h"
|
#include "translateshaderclass.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user