Fixed proper start and some more option modifications

This commit is contained in:
lanariel 2014-02-18 10:19:59 +01:00
parent 80b203737a
commit 55e3aaaabc
6 changed files with 27 additions and 19 deletions

View File

@ -136,9 +136,11 @@ namespace DanBias
Oyster::Graphics::API::Option p; Oyster::Graphics::API::Option p;
p.modelPath = L"..\\Content\\Models\\"; p.modelPath = L"..\\Content\\Models\\";
p.texturePath = L"..\\Content\\Textures\\"; 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 E_FAIL;
return S_OK; return S_OK;
} }

View File

@ -61,8 +61,7 @@ namespace Oyster
struct PostData struct PostData
{ {
int x; float Amb;
int y;
}; };
struct Text2D struct Text2D

View File

@ -27,9 +27,11 @@ namespace Oyster
#endif #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) 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::Gui::Text::Font = (ID3D11ShaderResourceView*)API::CreateTexture(L"font_generic.png");
Render::Resources::Init(); 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(); Render::Preparations::Basic::SetViewPort();
#ifdef _DEBUG #ifdef _DEBUG
//fix load model //fix load model
@ -102,6 +111,14 @@ namespace Oyster
{ {
Core::modelPath = option.modelPath; Core::modelPath = option.modelPath;
Core::texturePath = option.texturePath; 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; return API::Sucsess;
} }

View File

@ -37,7 +37,7 @@ namespace Oyster
}; };
typedef void* Texture; 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 #ifdef _DEBUG
static State ReloadShaders(); static State ReloadShaders();

View File

@ -39,14 +39,6 @@ namespace Oyster
data = Resources::Light::PointLightsData.Map(); data = Resources::Light::PointLightsData.Map();
memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights);
Resources::Light::PointLightsData.Unmap(); 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) void DefaultRenderer::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float deltaTime)

View File

@ -8,11 +8,9 @@ SamplerState S1 : register(s0);
cbuffer Size : register(b0) cbuffer Size : register(b0)
{ {
int2 Pixels; float AmbFactor;
} }
#define AmbFactor 0.1f;
float4 SuperSample(float4 Glow, uint3 DTid) float4 SuperSample(float4 Glow, uint3 DTid)
{ {
// Line X // Line X
@ -36,7 +34,7 @@ void main( uint3 DTid : SV_DispatchThreadID )
Glow = SuperSample(Glow,DTid); Glow = SuperSample(Glow,DTid);
float4 GUI; 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; float3 PostLight = Amb.xyz * AmbFactor;
PostLight = PostLight + Light.xyz + Glow; PostLight = PostLight + Light.xyz + Glow;
GUI = float4(Ambient[index]); GUI = float4(Ambient[index]);