Moved shaders to separate OpenGL and DirectX folders
This commit is contained in:
@@ -110,8 +110,8 @@ void dd::Renderer::Initialize()
|
|||||||
m_DeviceContext->RSSetViewports(1, &viewport);
|
m_DeviceContext->RSSetViewports(1, &viewport);
|
||||||
|
|
||||||
shaderProgram = new ShaderProgram();
|
shaderProgram = new ShaderProgram();
|
||||||
shaderProgram->CompileVertexShader(L"vertex.hlsl");
|
shaderProgram->CompileVertexShader(L"Shaders/DirectX/vertex.hlsl");
|
||||||
shaderProgram->CompilePixelShader(L"pixel.hlsl");
|
shaderProgram->CompilePixelShader(L"Shaders/DirectX/pixel.hlsl");
|
||||||
D3D11_INPUT_ELEMENT_DESC VertexIED[] = {
|
D3D11_INPUT_ELEMENT_DESC VertexIED[] = {
|
||||||
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
cbuffer ConstantBuffer
|
||||||
|
{
|
||||||
|
float4x4 MVP;
|
||||||
|
float4x4 ModelMatrix;
|
||||||
|
float4x4 ViewMatrix;
|
||||||
|
float4x4 ProjectionMatrix;
|
||||||
|
float4x4 InverseTransposeViewModel;
|
||||||
|
float3 LightPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture2D Texture;
|
||||||
|
SamplerState samplerState;
|
||||||
|
|
||||||
|
struct VOut
|
||||||
|
{
|
||||||
|
float4 PixelPosition : SV_POSITION;
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float4 Normal : NORMAL;
|
||||||
|
float4 Tangent : TANGENT0;
|
||||||
|
float4 BiTangent : TANGENT1;
|
||||||
|
float2 TextureCoord : TEXCOORD;
|
||||||
|
float4 DiffuseColor : COLOR0;
|
||||||
|
float4 SpecularColor : COLOR1;
|
||||||
|
float4 BoneIndices1 : BLENDINDICES0;
|
||||||
|
float4 BoneIndices2 : BLENDINDICES1;
|
||||||
|
float4 BoneWeights1 : BLENDWEIGHT0;
|
||||||
|
float4 BoneWeights2 : BLENDWEIGHT1;
|
||||||
|
};
|
||||||
|
|
||||||
|
float4 main(VOut input) : SV_TARGET
|
||||||
|
{
|
||||||
|
float4 ambientLight = float4(1.0f, 1.0f, 1.0f, 1.0f) * 0.1f;
|
||||||
|
////float4 lightPos = float4(0.0f, -1.0f, 2.0f, 0.0f);
|
||||||
|
float4 lightColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
|
||||||
|
float3 lightToPixel = normalize(LightPosition - mul(input.Position, transpose(ModelMatrix)));
|
||||||
|
|
||||||
|
//float3 lightModelPos = mul(ModelMatrix, LightPosition);
|
||||||
|
float diffuseBrightness = saturate(dot(lightToPixel, normalize(mul(input.Normal, transpose(ModelMatrix)))));
|
||||||
|
|
||||||
|
//input.texcoord.y = 1 - input.texcoord.y;
|
||||||
|
//return float4(input.normal.xy, 0.0f, 0.0f);
|
||||||
|
return Texture.Sample(samplerState, input.TextureCoord);
|
||||||
|
//return float4(input.color.xy, 0.0f, 0.0f);
|
||||||
|
//return (ambientLight + lightColor * diffuseBrightness) * Texture.Sample(samplerState, input.texcoord);
|
||||||
|
//return float4(0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
cbuffer ConstantBuffer
|
||||||
|
{
|
||||||
|
float4x4 MVP;
|
||||||
|
float4x4 ModelMatrix;
|
||||||
|
float4x4 ViewMatrix;
|
||||||
|
float4x4 ProjectionMatrix;
|
||||||
|
float4x4 InverseTransposeViewModel;
|
||||||
|
float3 LightPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct VIn
|
||||||
|
{
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float4 Normal : NORMAL;
|
||||||
|
float4 Tangent : TANGENT0;
|
||||||
|
float4 BiTangent : TANGENT1;
|
||||||
|
float2 TextureCoord : TEXCOORD;
|
||||||
|
float4 DiffuseColor : COLOR0;
|
||||||
|
float4 SpecularColor : COLOR1;
|
||||||
|
float4 BoneIndices1 : BLENDINDICES0;
|
||||||
|
float4 BoneIndices2 : BLENDINDICES1;
|
||||||
|
float4 BoneWeights1 : BLENDWEIGHT0;
|
||||||
|
float4 BoneWeights2 : BLENDWEIGHT1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VOut
|
||||||
|
{
|
||||||
|
float4 PixelPosition : SV_POSITION;
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float4 Normal : NORMAL;
|
||||||
|
float4 Tangent : TANGENT0;
|
||||||
|
float4 BiTangent : TANGENT1;
|
||||||
|
float2 TextureCoord : TEXCOORD;
|
||||||
|
float4 DiffuseColor : COLOR0;
|
||||||
|
float4 SpecularColor : COLOR1;
|
||||||
|
float4 BoneIndices1 : BLENDINDICES0;
|
||||||
|
float4 BoneIndices2 : BLENDINDICES1;
|
||||||
|
float4 BoneWeights1 : BLENDWEIGHT0;
|
||||||
|
float4 BoneWeights2 : BLENDWEIGHT1;
|
||||||
|
};
|
||||||
|
|
||||||
|
VOut main(VIn input)
|
||||||
|
{
|
||||||
|
/*float4 ambientLight = float4(1.0f, 1.0f, 1.0f, 1.0f) * 0.1f;
|
||||||
|
float4 lightPos = float4(0.0f, 0.0f, 8.0f, 0.0f);
|
||||||
|
float4 lightColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
float diffuseBrightness = saturate(dot(normal, lightPos));*/
|
||||||
|
|
||||||
|
VOut output;
|
||||||
|
|
||||||
|
output.PixelPosition = mul(MVP, input.Position);
|
||||||
|
//TODO: Make sure that boneTransform works here.
|
||||||
|
//output.Position = (V * M * boneTransform * vec4(Position, 1.0)).xyz;
|
||||||
|
//output.Normal = (inverse(transpose(V * M)) * boneTransform * vec4(Normal, 0.0)).xyz;
|
||||||
|
output.Tangent = input.Tangent;
|
||||||
|
output.BiTangent = input.BiTangent;
|
||||||
|
output.TextureCoord = input.TextureCoord;
|
||||||
|
output.DiffuseColor = input.DiffuseColor;
|
||||||
|
output.SpecularColor = input.SpecularColor;
|
||||||
|
output.BoneIndices1 = input.BoneIndices1;
|
||||||
|
output.BoneIndices2 = input.BoneIndices2;
|
||||||
|
output.BoneWeights1 = input.BoneWeights1;
|
||||||
|
output.BoneWeights2 = input.BoneWeights2;
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
@@ -80,7 +80,7 @@ void dd::Renderer::LoadShaders()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Pass #1: Fill G-buffers
|
// Pass #1: Fill G-buffers
|
||||||
m_SpDeferred1 = ResourceManager::Load<ShaderProgram>("Shaders/Deferred/1/");
|
m_SpDeferred1 = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Deferred/1/");
|
||||||
m_SpDeferred1->BindFragDataLocation(0, "GDiffuse");
|
m_SpDeferred1->BindFragDataLocation(0, "GDiffuse");
|
||||||
m_SpDeferred1->BindFragDataLocation(1, "GPosition");
|
m_SpDeferred1->BindFragDataLocation(1, "GPosition");
|
||||||
m_SpDeferred1->BindFragDataLocation(2, "GNormal");
|
m_SpDeferred1->BindFragDataLocation(2, "GNormal");
|
||||||
@@ -88,30 +88,30 @@ void dd::Renderer::LoadShaders()
|
|||||||
m_SpDeferred1->Link();
|
m_SpDeferred1->Link();
|
||||||
|
|
||||||
// Pass #2: Lighting
|
// Pass #2: Lighting
|
||||||
m_SpDeferred2 = ResourceManager::Load<ShaderProgram>("Shaders/Deferred/2/");
|
m_SpDeferred2 = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Deferred/2/");
|
||||||
//glBindFragDataLocation(m_SPDeferred2, 0, "FragmentLighting");
|
//glBindFragDataLocation(m_SPDeferred2, 0, "FragmentLighting");
|
||||||
m_SpDeferred2->Link();
|
m_SpDeferred2->Link();
|
||||||
|
|
||||||
//Water Pass
|
//Water Pass
|
||||||
m_SpWater = ResourceManager::Load<ShaderProgram>("Shaders/Deferred/water/");
|
m_SpWater = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Deferred/water/");
|
||||||
m_SpWater->Link();
|
m_SpWater->Link();
|
||||||
m_SpWater2 = ResourceManager::Load<ShaderProgram>("Shaders/Deferred/water2/");
|
m_SpWater2 = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Deferred/water2/");
|
||||||
m_SpWater2->Link();
|
m_SpWater2->Link();
|
||||||
|
|
||||||
// Pass #3: Combining into final image
|
// Pass #3: Combining into final image
|
||||||
m_SpDeferred3 = ResourceManager::Load<ShaderProgram>("Shaders/Deferred/3/");
|
m_SpDeferred3 = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Deferred/3/");
|
||||||
m_SpDeferred3->Link();
|
m_SpDeferred3->Link();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Forward rendering
|
Forward rendering
|
||||||
*/
|
*/
|
||||||
m_SpForward = ResourceManager::Load<ShaderProgram>("Shaders/Forward/");
|
m_SpForward = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Forward/");
|
||||||
m_SpForward->Link();
|
m_SpForward->Link();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Screen draw
|
Screen draw
|
||||||
*/
|
*/
|
||||||
m_SpScreen = ResourceManager::Load<ShaderProgram>("Shaders/Screen/");
|
m_SpScreen = ResourceManager::Load<ShaderProgram>("Shaders/OpenGL/Screen/");
|
||||||
m_SpScreen->Link();
|
m_SpScreen->Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+7
-1
@@ -4,13 +4,19 @@ SET DeployLocation=bin\
|
|||||||
|
|
||||||
ECHO Deploying resources to %DeployLocation%
|
ECHO Deploying resources to %DeployLocation%
|
||||||
:: Asset folders
|
:: Asset folders
|
||||||
|
RMDIR "%DeployLocation%\Models"
|
||||||
|
RMDIR "%DeployLocation%\Textures"
|
||||||
|
RMDIR "%DeployLocation%\Sounds"
|
||||||
MKLINK "%DeployLocation%\Models\" "assets\Models" /J
|
MKLINK "%DeployLocation%\Models\" "assets\Models" /J
|
||||||
MKLINK "%DeployLocation%\Textures\" "assets\Textures\" /J
|
MKLINK "%DeployLocation%\Textures\" "assets\Textures\" /J
|
||||||
MKLINK "%DeployLocation%\Sounds\" "assets\Sounds\" /J
|
MKLINK "%DeployLocation%\Sounds\" "assets\Sounds\" /J
|
||||||
:: Configuration files
|
:: Configuration files
|
||||||
MKLINK "%DeployLocation%\DefaultConfig.ini" "assets\DefaultConfig.ini" /H
|
MKLINK "%DeployLocation%\DefaultConfig.ini" "assets\DefaultConfig.ini" /H
|
||||||
:: Shaders
|
:: Shaders
|
||||||
MKLINK "%DeployLocation%\Shaders\" "src\game\Core\Shaders\" /J
|
RMDIR /S /Q "%DeployLocation%\Shaders"
|
||||||
|
MKDIR "%DeployLocation%\Shaders"
|
||||||
|
MKLINK "%DeployLocation%\Shaders\OpenGL\" "src\game\Rendering\OpenGL\Shaders\" /J
|
||||||
|
MKLINK "%DeployLocation%\Shaders\DirectX\" "src\game\Rendering\DirectX\Shaders\" /J
|
||||||
:: Platform specific binaries
|
:: Platform specific binaries
|
||||||
IF "%~1"=="" GOTO :EOF
|
IF "%~1"=="" GOTO :EOF
|
||||||
ECHO Deploying %1 binaries to %DeployLocation%
|
ECHO Deploying %1 binaries to %DeployLocation%
|
||||||
|
|||||||
Reference in New Issue
Block a user