diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index 81650049..e6f95f79 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -136,9 +136,11 @@ namespace DanBias Oyster::Graphics::API::Option p; p.modelPath = L"..\\Content\\Models\\"; p.texturePath = L"..\\Content\\Textures\\"; - Oyster::Graphics::API::SetOptions(p); + p.Resolution = Oyster::Math::Float2( 1024, 768); + //! @todo fix proper amb value + p.AmbientValue = 1.0f; - if(Oyster::Graphics::API::Init(data.window->GetHWND(), false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess) + if(Oyster::Graphics::API::Init(data.window->GetHWND(), false, false, p) != Oyster::Graphics::API::Sucsess) return E_FAIL; return S_OK; } diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index ffd2869a..fcfd865c 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -61,8 +61,7 @@ namespace Oyster struct PostData { - int x; - int y; + float Amb; }; struct Text2D diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index ec0be45e..bdfa0bde 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -27,9 +27,11 @@ namespace Oyster #endif } - API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion) + API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, API::Option o) { - Core::resolution = resulotion; + Core::resolution = o.Resolution; + Core::modelPath = o.modelPath; + Core::texturePath = o.texturePath; if(Core::Init::FullInit(Window, MSAA_Quality, Fullscreen) == Core::Init::Fail) { @@ -38,6 +40,13 @@ namespace Oyster Render::Resources::Gui::Text::Font = (ID3D11ShaderResourceView*)API::CreateTexture(L"font_generic.png"); Render::Resources::Init(); + Definitions::PostData pd; + pd.Amb = o.AmbientValue; + + void* data = Render::Resources::Post::Data.Map(); + memcpy(data,&pd,sizeof(Definitions::PostData)); + Render::Resources::Post::Data.Unmap(); + Render::Preparations::Basic::SetViewPort(); #ifdef _DEBUG //fix load model @@ -102,6 +111,14 @@ namespace Oyster { Core::modelPath = option.modelPath; Core::texturePath = option.texturePath; + + Definitions::PostData pd; + pd.Amb = option.AmbientValue; + + void* data = Render::Resources::Post::Data.Map(); + memcpy(data,&pd,sizeof(Definitions::PostData)); + Render::Resources::Post::Data.Unmap(); + return API::Sucsess; } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index e123e59a..71e12662 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -37,7 +37,7 @@ namespace Oyster }; typedef void* Texture; - static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); + static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Option options); #ifdef _DEBUG static State ReloadShaders(); diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index fbf11f08..097fcedb 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -39,14 +39,6 @@ namespace Oyster data = Resources::Light::PointLightsData.Map(); memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); Resources::Light::PointLightsData.Unmap(); - - Definitions::PostData pd; - pd.x = (int)lc.Pixels.x; - pd.y = (int)lc.Pixels.y; - - data = Resources::Post::Data.Map(); - memcpy(data, &pd, sizeof(Definitions::PostData)); - Resources::Post::Data.Unmap(); } void DefaultRenderer::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float deltaTime) diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 0c6ad9ca..346913d8 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -8,11 +8,9 @@ SamplerState S1 : register(s0); cbuffer Size : register(b0) { - int2 Pixels; + float AmbFactor; } -#define AmbFactor 0.1f; - float4 SuperSample(float4 Glow, uint3 DTid) { // Line X @@ -36,7 +34,7 @@ void main( uint3 DTid : SV_DispatchThreadID ) Glow = SuperSample(Glow,DTid); float4 GUI; - uint2 index = DTid.xy/2 + uint2((uint)Pixels.x/(uint)2,0); + uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0); float3 PostLight = Amb.xyz * AmbFactor; PostLight = PostLight + Light.xyz + Glow; GUI = float4(Ambient[index]);