diff --git a/DX11Starter.vcxproj b/DX11Starter.vcxproj index bb39583..84b4ea4 100644 --- a/DX11Starter.vcxproj +++ b/DX11Starter.vcxproj @@ -212,6 +212,12 @@ Vertex Vertex + + Pixel + Pixel + Pixel + Pixel + Vertex 5.0 diff --git a/DX11Starter.vcxproj.filters b/DX11Starter.vcxproj.filters index d963d1f..089b7ba 100644 --- a/DX11Starter.vcxproj.filters +++ b/DX11Starter.vcxproj.filters @@ -139,6 +139,9 @@ Shaders + + Shaders + diff --git a/Game.cpp b/Game.cpp index 39f9cb9..5eb9327 100644 --- a/Game.cpp +++ b/Game.cpp @@ -76,6 +76,7 @@ void Game::LoadShadersAndMaterials() pixelShader = std::make_shared(device, context, GetFullPathTo_Wide(L"SimplePixelShader.cso").c_str()); vertexShaderPBR = std::make_shared(device, context, GetFullPathTo_Wide(L"SimpleVertexPBR.cso").c_str()); pixelShaderPBR = std::make_shared(device, context, GetFullPathTo_Wide(L"SimplePixelPBR.cso").c_str()); + pixelShaderToon = std::make_shared(device, context, GetFullPathTo_Wide(L"ToonShader.cso").c_str()); XMFLOAT3 white = XMFLOAT3(1.0f, 1.0f, 1.0f); @@ -88,6 +89,7 @@ void Game::LoadShadersAndMaterials() std::make_shared(true, white, 0, vertexShaderPBR, pixelShaderPBR), std::make_shared(true, white, 0, vertexShaderPBR, pixelShaderPBR), std::make_shared(true, white, 0, vertexShaderPBR, pixelShaderPBR), + std::make_shared(true, white, 0, vertexShader, pixelShaderToon), }; } @@ -222,11 +224,25 @@ void Game::CreateBasicGeometry() std::make_shared(materials[6], shapes[3]), std::make_shared(materials[7], shapes[3]), std::make_shared(materials[0], shapes[3]), + + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), + std::make_shared(materials[8], shapes[3]), }; - for (int i = 0; i < entities.size(); ++i) + for (int i = 0; i < entities.size() / 2; ++i) { - entities[i]->GetTransform()->SetPosition((-(int)(entities.size() / 2) + i + 0.5f) * 2.5f, 0, 0); + entities[i]->GetTransform()->SetPosition((-(int)(entities.size() / 4) + i + 0.5f) * 2.5f, -1.5f, 0); + } + + for (int i = entities.size() / 2; i < entities.size(); ++i) + { + entities[i]->GetTransform()->SetPosition((-(int)(entities.size() / 4) + (i - (int)entities.size() / 2) + 0.5f) * 2.5f, 1.5f, 0); } skybox = std::make_shared( diff --git a/Game.h b/Game.h index acac3b8..940176e 100644 --- a/Game.h +++ b/Game.h @@ -49,6 +49,7 @@ private: std::shared_ptr vertexShader; std::shared_ptr pixelShaderPBR; std::shared_ptr vertexShaderPBR; + std::shared_ptr pixelShaderToon; // A2 shapes std::vector> shapes; diff --git a/ToonShader.hlsl b/ToonShader.hlsl new file mode 100644 index 0000000..c22ed58 --- /dev/null +++ b/ToonShader.hlsl @@ -0,0 +1,37 @@ +#include "Defines.hlsli" +#include "Helpers.hlsli" +#include "Lights.hlsli" + +#define MAX_LIGHTS 128 + +cbuffer ExternalData : register(b0) +{ + float3 cameraPosition; + float roughness; + + float2 offset; + float2 scale; + + float3 ambient; + float emitAmount; + + float3 tint; + float lightCount; + + int hasEmissiveMap; + int hasSpecularMap; + int hasNormalMap; + + Light lights[MAX_LIGHTS]; +} + +Texture2D Albedo : register(t0); +Texture2D Specular : register(t1); +Texture2D Emissive : register(t2); +Texture2D Normal : register(t3); +SamplerState BasicSampler : register(s0); + +float4 main(VertexToPixel input) : SV_TARGET +{ + return float4(1.0f, 1.0f, 1.0f, 1.0f); +} \ No newline at end of file