Done with 2D
This commit is contained in:
parent
1121bbdebf
commit
e6e56ba21b
|
@ -61,6 +61,11 @@ namespace Oyster
|
|||
Math::Matrix Translation;
|
||||
};
|
||||
|
||||
struct PostData
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace Oyster
|
|||
void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights)
|
||||
{
|
||||
Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,0,0,1));
|
||||
Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,1));
|
||||
Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,0));
|
||||
Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Gather::Pass);
|
||||
|
||||
void* data;
|
||||
|
@ -39,6 +39,14 @@ namespace Oyster
|
|||
data = Resources::Light::PointLightsData.Map();
|
||||
memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights);
|
||||
Resources::Light::PointLightsData.Unmap();
|
||||
|
||||
Definitions::PostData pd;
|
||||
pd.x = lc.Pixels.x;
|
||||
pd.y = lc.Pixels.y;
|
||||
|
||||
data = Resources::Post::Data.Map();
|
||||
memcpy(data, &pd, sizeof(Definitions::PostData));
|
||||
Resources::Post::Data.Unmap();
|
||||
}
|
||||
|
||||
Math::Matrix RecursiveBindPosRotation(int index, Model::ModelInfo* mi)
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace Oyster
|
|||
Buffer Resources::Gather::AnimationData = Buffer();
|
||||
Buffer Resources::Light::LightConstantsData = Buffer();
|
||||
Buffer Resources::Gui::Data = Buffer();
|
||||
Buffer Resources::Post::Data = Buffer();
|
||||
|
||||
Buffer Resources::Light::PointLightsData = Buffer();
|
||||
ID3D11ShaderResourceView* Resources::Light::PointLightView = NULL;
|
||||
|
@ -109,10 +110,11 @@ namespace Oyster
|
|||
desc.ElementSize = sizeof(Definitions::GuiData);
|
||||
Gui::Data.Init(desc);
|
||||
|
||||
desc.ElementSize = sizeof(Definitions::LightConstants);
|
||||
desc.NumElements = 1;
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS;
|
||||
desc.ElementSize = sizeof(Definitions::PostData);
|
||||
Post::Data.Init(desc);
|
||||
|
||||
desc.ElementSize = sizeof(Definitions::LightConstants);
|
||||
Light::LightConstantsData.Init(desc);
|
||||
|
||||
desc.ElementSize = sizeof(Definitions::Pointlight);
|
||||
|
@ -332,6 +334,7 @@ namespace Oyster
|
|||
Post::Pass.SRV.Compute.push_back(LBufferSRV[i]);
|
||||
}
|
||||
Post::Pass.UAV.Compute.push_back(Core::backBufferUAV);
|
||||
Post::Pass.CBuffers.Compute.push_back(Post::Data);
|
||||
|
||||
////---------------- GUI Pass Setup ----------------------------
|
||||
Gui::Pass.Shaders.Vertex = GetShader::Vertex(L"2D");
|
||||
|
@ -379,8 +382,6 @@ namespace Oyster
|
|||
return Core::Init::State::Success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Resources::Clean()
|
||||
{
|
||||
Gather::ModelData.~Buffer();
|
||||
|
@ -388,6 +389,7 @@ namespace Oyster
|
|||
Light::LightConstantsData.~Buffer();
|
||||
Light::PointLightsData.~Buffer();
|
||||
Gui::Data.~Buffer();
|
||||
Post::Data.~Buffer();
|
||||
SAFE_RELEASE(Light::PointLightView);
|
||||
SAFE_RELEASE(Light::SSAOKernel);
|
||||
SAFE_RELEASE(Light::SSAORandom);
|
||||
|
|
|
@ -35,7 +35,8 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID )
|
|||
{
|
||||
float AmbValue = GetSSAO(ViewPos, UV, DTid.xy, GTid.xy/2);
|
||||
Ambient[DTid.xy/2] = float4(DiffuseGlow[DTid.xy].xyz, AmbValue);
|
||||
Ambient[DTid.xy + Pixels/2] = GUI[DTid.xy];
|
||||
Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy];
|
||||
//Ambient[DTid.xy] = GUI[DTid.xy];
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,13 @@ void main( uint3 DTid : SV_DispatchThreadID )
|
|||
float4 Amb = float4(Ambient[DTid.xy/2].xyz,1);// * Ambient[DTid.xy/2].w,1);
|
||||
//Output[DTid.xy] = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */, 1);
|
||||
//Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy];
|
||||
Output[DTid.xy] = Light + Amb * AmbFactor;
|
||||
//Output[DTid.xy] = Light + Amb * AmbFactor;
|
||||
//Output[DTid.xy] = Ambient[DTid.xy/2].w;
|
||||
Output[DTid.xy] = Ambient[DTid.xy/2 + Pixels/2];
|
||||
float4 GUI;
|
||||
uint2 index = DTid.xy/2 + int2(Pixels.x/2,0);
|
||||
float3 PostLight = Light.xyz + Amb.xyz * AmbFactor;
|
||||
GUI = float4(Ambient[index]);
|
||||
PostLight = PostLight * (1-GUI.w);
|
||||
//Output[DTid.xy] = float4((GUI.xyz * GUI.w) + ((Light + Amb * AmbFactor) * (1 - GUI.w)),0);
|
||||
Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1);
|
||||
}
|
Loading…
Reference in New Issue