diff --git a/Game.cpp b/Game.cpp index 5eb9327..c4ce913 100644 --- a/Game.cpp +++ b/Game.cpp @@ -89,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(false, white, 0, vertexShader, pixelShader), std::make_shared(true, white, 0, vertexShader, pixelShaderToon), }; } @@ -107,6 +108,17 @@ void Game::LoadTextures() sampDesc.MaxLOD = D3D11_FLOAT32_MAX; device->CreateSamplerState(&sampDesc, sampler.GetAddressOf()); + D3D11_BLEND_DESC blendDesc = {}; + blendDesc.RenderTarget[0].BlendEnable = true; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; + device->CreateBlendState(&blendDesc, alphaBlendState.GetAddressOf()); + demoCubemap = CreateCubemap( device, context, @@ -166,6 +178,12 @@ void Game::LoadTextures() materials[7]->LoadTexture(L"Assets/Textures/PBR/wood_metal.png", TEXTYPE_METALNESS, device.Get(), context.Get()); materials[7]->LoadTexture(L"Assets/Textures/PBR/wood_roughness.png", TEXTYPE_ROUGHNESS, device.Get(), context.Get()); materials[7]->LoadTexture(L"Assets/Textures/PBR/wood_normals.png", TEXTYPE_NORMAL, device.Get(), context.Get()); + + materials[8]->PushSampler("BasicSampler", sampler); + materials[8]->PushTexture(TEXTYPE_REFLECTION, demoCubemap); + materials[8]->hasReflectionMap = true; + materials[8]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-floor_albedo.png", TEXTYPE_ALBEDO, device.Get(), context.Get()); + materials[8]->LoadTexture(L"Assets/Textures/HQGame/structure-endgame-floor_specular.png", TEXTYPE_SPECULAR, device.Get(), context.Get()); } // -------------------------------------------------------- @@ -303,6 +321,8 @@ void Game::Draw(float deltaTime, float totalTime) 1.0f, 0); + context->OMSetBlendState(alphaBlendState.Get(), 0, 0xFFFFFFFF); + for (auto entity : entities) { entity->Draw(camera, ambient, lights); diff --git a/Game.h b/Game.h index 940176e..3432cb2 100644 --- a/Game.h +++ b/Game.h @@ -68,5 +68,6 @@ private: Microsoft::WRL::ComPtr demoCubemap; Microsoft::WRL::ComPtr constantBufferVS; + Microsoft::WRL::ComPtr alphaBlendState; };