Shader Restructure
This commit is contained in:
parent
a7480ebf70
commit
bab3ab0a78
|
@ -52,12 +52,15 @@ namespace Oyster
|
|||
struct AnimationData
|
||||
{
|
||||
Math::Float4x4 AnimatedData[100];
|
||||
Math::Float4x4 BindPoseData[100];
|
||||
Math::Float4x4 RotationData[100];
|
||||
int Animated;
|
||||
Math::Float3 Pad;
|
||||
};
|
||||
|
||||
struct GuiData
|
||||
{
|
||||
Math::Matrix Translation;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#include "Buffers.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
Buffer Buffers::V2DSprites = Buffer();
|
||||
Buffer Buffers::CbufferVS = Buffer();
|
||||
Buffer Buffers::CBufferGs = Buffer();
|
||||
Buffer Buffers::CBufferPipelineCs = Buffer();
|
||||
|
||||
void Buffers::Init()
|
||||
{
|
||||
Buffer::BUFFER_INIT_DESC desc;
|
||||
|
||||
desc.ElementSize=sizeof(Math::Float2);
|
||||
desc.NumElements=1;
|
||||
desc.Type = Buffer::BUFFER_TYPE::VERTEX_BUFFER;
|
||||
desc.Usage = Buffer::BUFFER_USAGE::BUFFER_DEFAULT;
|
||||
desc.InitData = &Math::Float2(0,0);
|
||||
|
||||
V2DSprites.Init(desc);
|
||||
|
||||
desc.Type=Buffer::BUFFER_TYPE::CONSTANT_BUFFER_VS;
|
||||
desc.Usage = Buffer::BUFFER_USAGE::BUFFER_CPU_WRITE_DISCARD;
|
||||
desc.ElementSize=sizeof(Math::Float4x4);
|
||||
desc.InitData=0;
|
||||
|
||||
CbufferVS.Init(desc);
|
||||
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
|
||||
|
||||
CBufferGs.Init(desc);
|
||||
|
||||
desc.ElementSize=sizeof(Oyster::Resources::BufferDefinitions::LightStructureBuffer);
|
||||
desc.NumElements=1;
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS;
|
||||
desc.Usage = Buffer::BUFFER_USAGE::BUFFER_CPU_WRITE_DISCARD;
|
||||
desc.InitData = NULL;
|
||||
|
||||
CBufferPipelineCs.Init(desc);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "../EngineIncludes.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
struct Buffers
|
||||
{
|
||||
static Buffer V2DSprites;
|
||||
|
||||
static Buffer CbufferVS;
|
||||
|
||||
static Buffer CBufferGs;
|
||||
|
||||
static Buffer CBufferPipelineCs;
|
||||
|
||||
static void Init();
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
#include "..\EngineIncludes.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
|
||||
namespace BufferDefinitions
|
||||
{
|
||||
struct LightStructureBuffer
|
||||
{
|
||||
::Oyster::Math::Float4x4 viewMatrix, projectionMatrix;
|
||||
::LinearAlgebra::Vector3<unsigned int> numDispatches;
|
||||
unsigned int reservedPadding;
|
||||
};
|
||||
|
||||
struct ScreenTileFrustrum
|
||||
{
|
||||
::Oyster::Math::Float rawElement[6 * 4];
|
||||
};
|
||||
|
||||
class PointLightDescription
|
||||
{
|
||||
public:
|
||||
struct{ ::Oyster::Math::Float3 center; ::Oyster::Math::Float radius; } pos;
|
||||
::Oyster::Math::Float3 color;
|
||||
::Oyster::Math::Float intensty;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
#include "Manager.h"
|
||||
|
||||
std::unordered_map< std::string, Oyster::Render::ModelInfo*> Oyster::Resources::Manager::loadedModels = std::unordered_map< std::string, Oyster::Render::ModelInfo*>();
|
||||
|
||||
Oyster::Render::Model* Oyster::Resources::Manager::LoadModel(std::string Filename, Matrix Scale)
|
||||
{
|
||||
////TODO: Add redundncy sheck, to ensure not recreating model
|
||||
|
||||
////Loop to find filename
|
||||
|
||||
////If found Return Model
|
||||
|
||||
////else Create Model
|
||||
|
||||
//Oyster::FileLoaders::ObjReader *reader = Oyster::FileLoaders::ObjReader::LoadFile(Filename, Scale);
|
||||
//Oyster::FileLoaders::ObjReader::Vertex** vertex = new Oyster::FileLoaders::ObjReader::Vertex*[1];
|
||||
//int vcount;
|
||||
//std::map<std::string,ID3D11ShaderResourceView *> textures;
|
||||
//reader->GetVertexData( vertex, vcount, textures );
|
||||
|
||||
//Oyster::Buffer::BUFFER_INIT_DESC desc;
|
||||
//desc.ElementSize=sizeof(Oyster::FileLoaders::ObjReader::Vertex);
|
||||
//desc.NumElements = vcount;
|
||||
//desc.InitData = *vertex;
|
||||
//desc.Type = Oyster::Buffer::VERTEX_BUFFER;
|
||||
//desc.Usage = Oyster::Buffer::BUFFER_DEFAULT;
|
||||
//
|
||||
//ID3D11ShaderResourceView *srv = textures["Diffuse"];
|
||||
|
||||
//Oyster::Render::ModelInfo* m = new Oyster::Render::ModelInfo();
|
||||
//
|
||||
//m->Vertices = *(Oyster::Engine::Init::Buffers::CreateBuffer(desc));
|
||||
//m->VertexCount = vcount;
|
||||
//m->Material.push_back(srv);
|
||||
//srv = textures["Specular"];
|
||||
//m->Material.push_back(srv);
|
||||
//srv = textures["Glow"];
|
||||
//m->Material.push_back(srv);
|
||||
//m->Indexed=false;
|
||||
//
|
||||
//Oyster::Render::Model* model = new Oyster::Render::Model();
|
||||
//model->info=m;
|
||||
//model->Visible = true;
|
||||
//model->World = &Oyster::Math::Float4x4(Oyster::Math::Float4x4::identity);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "../EngineIncludes.h"
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
struct Manager
|
||||
{
|
||||
//Expects to be deleted either trough manager or after a clean
|
||||
static Oyster::Render::Model* LoadModel(std::string Filename, Matrix Scale);
|
||||
static void Clean();
|
||||
|
||||
private:
|
||||
static std::unordered_map< std::string, Oyster::Render::ModelInfo*> loadedModels;
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,228 +0,0 @@
|
|||
#include "PipelineResources.h"
|
||||
|
||||
using namespace Oyster::Resources;
|
||||
|
||||
ID3D11UnorderedAccessView* PipeLineResourses::TempUav = 0;
|
||||
ID3D11ShaderResourceView* PipeLineResourses::TempSrv = 0;
|
||||
|
||||
ID3D11ShaderResourceView* PipeLineResourses::GeometryOut[5] = {0};
|
||||
ID3D11RenderTargetView* PipeLineResourses::GeometryTarget[5] = {0};
|
||||
|
||||
ID3D11ShaderResourceView* PipeLineResourses::ComputeResources[4] = {0};
|
||||
Oyster::Buffer* PipeLineResourses::Resources[2] = {0};
|
||||
|
||||
ID3D11ShaderResourceView* PipeLineResourses::LightOut[4] = {0};
|
||||
ID3D11UnorderedAccessView* PipeLineResourses::LightTarget[4] = {0};
|
||||
|
||||
ID3D11RenderTargetView* PipeLineResourses::RtvNulls[16] = {0};
|
||||
ID3D11ShaderResourceView* PipeLineResourses::SrvNulls[16] = {0};
|
||||
ID3D11UnorderedAccessView* PipeLineResourses::uavNULL[16] = {0};
|
||||
|
||||
//Oyster::Collision3D::Frustrum* PipeLineResourses::SubFrustrums = 0;
|
||||
int PipeLineResourses::FrustrumSize = 0;
|
||||
LinearAlgebra::Vector3<unsigned int> PipeLineResourses::FrustrumDimensions = LinearAlgebra::Vector3<unsigned int>();
|
||||
|
||||
Oyster::Resources::BufferDefinitions::LightStructureBuffer PipeLineResourses::LightData = Oyster::Resources::BufferDefinitions::LightStructureBuffer();
|
||||
|
||||
void PipeLineResourses::Init(int sizeX, int sizeY)
|
||||
{
|
||||
InitGeometry(sizeX, sizeY);
|
||||
|
||||
InitSSAOData();
|
||||
InitSubFrustrums(sizeX, sizeY);
|
||||
InitPointLights();
|
||||
InitLightData();
|
||||
|
||||
InitLighting(sizeX, sizeY);
|
||||
}
|
||||
|
||||
void PipeLineResourses::InitGeometry(int sizeX, int sizeY)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC Tdesc;
|
||||
Tdesc.Width = sizeX;
|
||||
Tdesc.Height = sizeY;
|
||||
Tdesc.MipLevels = Tdesc.ArraySize = 1;
|
||||
Tdesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
Tdesc.SampleDesc.Count = 1;
|
||||
Tdesc.SampleDesc.Quality=0;
|
||||
Tdesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
Tdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
|
||||
Tdesc.CPUAccessFlags = 0;
|
||||
Tdesc.MiscFlags = 0;
|
||||
|
||||
ID3D11Texture2D *pTexture;
|
||||
HRESULT hr;
|
||||
|
||||
//Geometry stage resourses
|
||||
for( int i = 0; i < 5; ++i )
|
||||
{
|
||||
hr = Oyster::Core::Device->CreateTexture2D( &Tdesc, NULL, &pTexture );
|
||||
hr = Oyster::Core::Device->CreateShaderResourceView(pTexture,0,&GeometryOut[i]);
|
||||
hr = Oyster::Core::Device->CreateRenderTargetView(pTexture,0,&GeometryTarget[i]);
|
||||
pTexture->Release();
|
||||
}
|
||||
}
|
||||
|
||||
void PipeLineResourses::InitSSAOData()
|
||||
{
|
||||
//create Half Spheres and Random Data
|
||||
|
||||
Oyster::Buffer::BUFFER_INIT_DESC desc;
|
||||
HRESULT hr;
|
||||
|
||||
int NrOfSamples = Oyster::Engine::States::GetNrOfSSAOSamples();
|
||||
int SampleSpread = Oyster::Engine::States::GetSSAOSampleSpread();
|
||||
|
||||
Oyster::Math::Vector3* kernel = new Oyster::Math::Vector3[ NrOfSamples ];
|
||||
Oyster::Math::Vector3* random = new Oyster::Math::Vector3[ SampleSpread ];
|
||||
|
||||
for(int i = 0; i < NrOfSamples; ++i)
|
||||
{
|
||||
kernel[i] = Oyster::Math::Vector3::null;
|
||||
while( kernel[i] == Oyster::Math::Vector3::null )
|
||||
{
|
||||
kernel[i] = Oyster::Math::Vector3(
|
||||
(float)rand() / (RAND_MAX + 1) * (1 - -1) + -1,
|
||||
(float)rand() / (RAND_MAX + 1) * (1 - -1) + -1,
|
||||
(float)rand() / (RAND_MAX + 1) * (1 - 0) + 0);
|
||||
}
|
||||
kernel[i].Normalize();
|
||||
|
||||
float scale = float(i) / float(NrOfSamples);
|
||||
scale = (0.1f*(1 - scale * scale) + 1.0f *( scale * scale));
|
||||
kernel[i] *= scale;
|
||||
|
||||
if( i < SampleSpread)
|
||||
{
|
||||
random[i] = Oyster::Math::Vector3::null;
|
||||
while( random[i] == Oyster::Math::Vector3::null )
|
||||
{
|
||||
random[i] = Oyster::Math::Vector3(
|
||||
(float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1,
|
||||
(float)rand() / (RAND_MAX + 1) * (1 - -1)+ -1,
|
||||
0.0f);
|
||||
}
|
||||
random[i].Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
D3D11_TEXTURE1D_DESC T1desc;
|
||||
T1desc.Width = NrOfSamples;
|
||||
T1desc.MipLevels = T1desc.ArraySize = 1;
|
||||
T1desc.Format = DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
T1desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
T1desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
T1desc.CPUAccessFlags = 0;
|
||||
T1desc.MiscFlags = 0;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA sphere;
|
||||
sphere.pSysMem = kernel;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA rnd;
|
||||
rnd.pSysMem = random;
|
||||
|
||||
|
||||
ID3D11Texture1D *pTexture1[2];
|
||||
|
||||
hr = Oyster::Core::Device->CreateTexture1D( &T1desc, &sphere, &pTexture1[0] );
|
||||
hr = Oyster::Core::Device->CreateShaderResourceView( pTexture1[0], 0, &ComputeResources[3] );
|
||||
pTexture1[0]->Release();
|
||||
delete[] kernel;
|
||||
|
||||
T1desc.Width = SampleSpread;
|
||||
hr = Oyster::Core::Device->CreateTexture1D( &T1desc, &rnd, &pTexture1[1] );
|
||||
hr = Oyster::Core::Device->CreateShaderResourceView( (pTexture1[1]), 0, &ComputeResources[2] );
|
||||
pTexture1[1]->Release();
|
||||
delete[] random;
|
||||
}
|
||||
|
||||
void PipeLineResourses::InitSubFrustrums(int sizeX, int sizeY)
|
||||
{
|
||||
FrustrumDimensions.x = (sizeX + 15U) / 16U;
|
||||
FrustrumDimensions.y = (sizeY + 15U) / 16U;
|
||||
FrustrumDimensions.z = 1;
|
||||
FrustrumSize = FrustrumDimensions.x * FrustrumDimensions.y * FrustrumDimensions.z;
|
||||
//if(SubFrustrums!=0)
|
||||
//delete[] SubFrustrums;
|
||||
//SubFrustrums = new Collision3D::Frustrum[ FrustrumSize ];
|
||||
|
||||
Oyster::Buffer::BUFFER_INIT_DESC desc;
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||
|
||||
//buffer description for SubFrustrums
|
||||
desc.Usage = Oyster::Buffer::BUFFER_CPU_WRITE_DISCARD;
|
||||
desc.Type = Oyster::Buffer::STRUCTURED_BUFFER;
|
||||
desc.ElementSize = sizeof( ::Oyster::Resources::BufferDefinitions::ScreenTileFrustrum);
|
||||
desc.NumElements = FrustrumSize;
|
||||
desc.InitData = NULL;
|
||||
|
||||
//create matching srv
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = FrustrumSize;
|
||||
|
||||
PipeLineResourses::Resources[0] = Oyster::Engine::Init::Buffers::CreateBuffer(desc);
|
||||
|
||||
HRESULT hr = Oyster::Core::Device->CreateShaderResourceView( *PipeLineResourses::Resources[0], &srvDesc, &Oyster::Resources::PipeLineResourses::ComputeResources[0] );
|
||||
}
|
||||
|
||||
void PipeLineResourses::InitPointLights()
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||
Oyster::Buffer::BUFFER_INIT_DESC desc;
|
||||
HRESULT hr;
|
||||
|
||||
//buffer description for pointlight
|
||||
desc.Usage = Oyster::Buffer::BUFFER_CPU_WRITE_DISCARD;
|
||||
desc.Type = Oyster::Buffer::STRUCTURED_BUFFER;
|
||||
desc.ElementSize = sizeof(Oyster::Resources::BufferDefinitions::PointLightDescription);
|
||||
desc.NumElements = Oyster::Engine::States::GetMaxPointlights();
|
||||
desc.InitData = NULL;
|
||||
|
||||
PipeLineResourses::Resources[1] = Oyster::Engine::Init::Buffers::CreateBuffer(desc);
|
||||
|
||||
//create matching srv
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = Oyster::Engine::States::GetMaxPointlights();
|
||||
|
||||
hr = Oyster::Core::Device->CreateShaderResourceView( *PipeLineResourses::Resources[1], &srvDesc, &Oyster::Resources::PipeLineResourses::ComputeResources[1] );
|
||||
}
|
||||
|
||||
void PipeLineResourses::InitLightData()
|
||||
{
|
||||
LightData.numDispatches = FrustrumDimensions;
|
||||
}
|
||||
|
||||
void PipeLineResourses::InitLighting(int sizeX, int sizeY)
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC Tdesc;
|
||||
Tdesc.Width = sizeX;
|
||||
Tdesc.Height = sizeY;
|
||||
Tdesc.MipLevels = Tdesc.ArraySize = 1;
|
||||
Tdesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
Tdesc.SampleDesc.Count = 1;
|
||||
Tdesc.SampleDesc.Quality=0;
|
||||
Tdesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
Tdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
Tdesc.CPUAccessFlags = 0;
|
||||
Tdesc.MiscFlags = 0;
|
||||
|
||||
ID3D11Texture2D *pTexture;
|
||||
HRESULT hr;
|
||||
for(int i = 0; i < 4; ++i )
|
||||
{
|
||||
hr = Oyster::Core::Device->CreateTexture2D( &Tdesc, NULL, &pTexture );
|
||||
hr = Oyster::Core::Device->CreateShaderResourceView( pTexture, 0, &(LightOut[i]) );
|
||||
hr = Oyster::Core::Device->CreateUnorderedAccessView( pTexture, 0, &(LightTarget[i]) );
|
||||
pTexture->Release();
|
||||
}
|
||||
|
||||
hr = Oyster::Core::Device->CreateTexture2D( &Tdesc, NULL, &pTexture );
|
||||
hr = Oyster::Core::Device->CreateShaderResourceView( pTexture, 0, &TempSrv );
|
||||
hr = Oyster::Core::Device->CreateUnorderedAccessView( pTexture, 0, &TempUav );
|
||||
pTexture->Release();
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef PipeLineResources_H
|
||||
#define PipeLineResources_H
|
||||
|
||||
#include "..\EngineIncludes.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
struct PipeLineResourses
|
||||
{
|
||||
//0 = Diffuse
|
||||
//1 = Specular
|
||||
//2 = Glow
|
||||
//3 = Pos
|
||||
//4 = Normal
|
||||
static ID3D11ShaderResourceView* GeometryOut[5];
|
||||
static ID3D11RenderTargetView* GeometryTarget[5];
|
||||
|
||||
|
||||
//0 = TileBuffer
|
||||
//1 = PointList
|
||||
//2 = Random
|
||||
//3 = Sphere
|
||||
static ID3D11ShaderResourceView* ComputeResources[4];
|
||||
static Oyster::Buffer* Resources[2];
|
||||
|
||||
|
||||
//0 = Diffuse
|
||||
//1 = Specular
|
||||
//2 = Glow
|
||||
//3 = SSAO
|
||||
static ID3D11ShaderResourceView* LightOut[4];
|
||||
static ID3D11UnorderedAccessView* LightTarget[4];
|
||||
|
||||
//0 = BlurTempStorage
|
||||
static ID3D11UnorderedAccessView* TempUav;
|
||||
static ID3D11ShaderResourceView* TempSrv;
|
||||
|
||||
static ID3D11RenderTargetView* RtvNulls[16];
|
||||
static ID3D11ShaderResourceView* SrvNulls[16];
|
||||
static ID3D11UnorderedAccessView* uavNULL[16];
|
||||
|
||||
//static Oyster::Collision3D::Frustrum* SubFrustrums;
|
||||
static int FrustrumSize;
|
||||
static LinearAlgebra::Vector3<unsigned int> FrustrumDimensions;
|
||||
|
||||
static Oyster::Resources::BufferDefinitions::LightStructureBuffer LightData;
|
||||
|
||||
static void Init(int sizeX, int sizeY);
|
||||
|
||||
static void InitGeometry(int sizeX, int sizeY);
|
||||
|
||||
static void InitSSAOData();
|
||||
static void InitSubFrustrums(int sizeX, int sizeY);
|
||||
static void InitPointLights();
|
||||
static void InitLightData();
|
||||
|
||||
static void InitLighting(int sizeX, int sizeY);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,100 +0,0 @@
|
|||
#include "ShaderEffects.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
Core::ShaderManager::ShaderEffect ShaderEffects::BasicSprite = Core::ShaderManager::ShaderEffect();
|
||||
Core::ShaderManager::ShaderEffect ShaderEffects::Text2DEffect = Core::ShaderManager::ShaderEffect();
|
||||
Core::ShaderManager::ShaderEffect ShaderEffects::ModelEffect = Core::ShaderManager::ShaderEffect();
|
||||
|
||||
void ShaderEffects::Init()
|
||||
{
|
||||
BasicSprite.IAStage.Topology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
BasicSprite.Shaders.Vertex = Oyster::Core::ShaderManager::Get::Vertex(L"2D");
|
||||
BasicSprite.Shaders.Geometry = Oyster::Core::ShaderManager::Get::Geometry(L"2D");
|
||||
BasicSprite.Shaders.Pixel = Oyster::Core::ShaderManager::Get::Pixel(L"Texture0");
|
||||
|
||||
D3D11_BLEND_DESC blendDesc;
|
||||
blendDesc.AlphaToCoverageEnable=false;
|
||||
blendDesc.IndependentBlendEnable=false;
|
||||
blendDesc.RenderTarget[0].BlendEnable=true;
|
||||
|
||||
blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
|
||||
blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
|
||||
blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
|
||||
|
||||
blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
||||
blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
|
||||
blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_MAX;
|
||||
|
||||
blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
||||
|
||||
ID3D11BlendState* blender;
|
||||
|
||||
Oyster::Core::Device->CreateBlendState(&blendDesc,&blender);
|
||||
|
||||
BasicSprite.RenderStates.BlendState = blender;
|
||||
|
||||
ID3D11InputLayout* layout;
|
||||
|
||||
Oyster::Core::ShaderManager::CreateInputLayout(SpriteVertexDesc,1,Oyster::Core::ShaderManager::Get::Vertex(L"2D"),layout);
|
||||
|
||||
BasicSprite.IAStage.Layout = layout;
|
||||
|
||||
Text2DEffect.IAStage.Topology=D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
Text2DEffect.Shaders.Vertex = Oyster::Core::ShaderManager::Get::Vertex(L"Text");
|
||||
Text2DEffect.Shaders.Geometry = Oyster::Core::ShaderManager::Get::Geometry(L"Text");
|
||||
Text2DEffect.Shaders.Pixel = Oyster::Core::ShaderManager::Get::Pixel(L"Texture0");
|
||||
|
||||
Oyster::Core::ShaderManager::CreateInputLayout(Text2DDesc,3,Oyster::Core::ShaderManager::Get::Vertex(L"Text"),layout);
|
||||
|
||||
Text2DEffect.IAStage.Layout = layout;
|
||||
|
||||
blendDesc.AlphaToCoverageEnable = true;
|
||||
Oyster::Core::Device->CreateBlendState(&blendDesc,&blender);
|
||||
Text2DEffect.RenderStates.BlendState = blender;
|
||||
|
||||
ModelEffect.IAStage.Topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
Oyster::Core::ShaderManager::CreateInputLayout(ModelDesc,3,Oyster::Core::ShaderManager::Get::Vertex(L"OBJ"),layout);
|
||||
ModelEffect.IAStage.Layout = layout;
|
||||
|
||||
ModelEffect.Shaders.Vertex = Oyster::Core::ShaderManager::Get::Vertex(L"OBJ");
|
||||
ModelEffect.Shaders.Pixel = Oyster::Core::ShaderManager::Get::Pixel(L"OBJDEF");
|
||||
|
||||
Oyster::Buffer::BUFFER_INIT_DESC desc;
|
||||
|
||||
desc.ElementSize=sizeof(Oyster::Math::Float4x4);
|
||||
desc.NumElements = 1;
|
||||
desc.Usage = Oyster::Buffer::BUFFER_CPU_WRITE_DISCARD;
|
||||
desc.Type = Oyster::Buffer::CONSTANT_BUFFER_VS;
|
||||
desc.InitData = NULL;
|
||||
|
||||
ModelEffect.CBuffers.Vertex.push_back(Oyster::Engine::Init::Buffers::CreateBuffer(desc));
|
||||
ModelEffect.CBuffers.Vertex.push_back(Oyster::Engine::Init::Buffers::CreateBuffer(desc));
|
||||
|
||||
//use Oyster::Resources::Buffers::CbufferVS for per object data
|
||||
//perObject = Oyster::Engine::Init::Buffers::CreateBuffer(desc);
|
||||
|
||||
}
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC ShaderEffects::SpriteVertexDesc[1] =
|
||||
{
|
||||
{"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC ShaderEffects::Text2DDesc[3] =
|
||||
{
|
||||
{"Position",0, DXGI_FORMAT_R32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
{"Offset",0, DXGI_FORMAT_R32_SINT, 0, 4, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
{"CharOffset",0, DXGI_FORMAT_R32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC ShaderEffects::ModelDesc[3] =
|
||||
{
|
||||
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0},
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "../Engine.h"
|
||||
#include "Buffers.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Resources
|
||||
{
|
||||
struct ShaderEffects
|
||||
{
|
||||
static Oyster::Core::ShaderManager::ShaderEffect BasicSprite;
|
||||
static Oyster::Core::ShaderManager::ShaderEffect Text2DEffect;
|
||||
static Oyster::Core::ShaderManager::ShaderEffect ModelEffect;
|
||||
|
||||
static void Init();
|
||||
|
||||
static D3D11_INPUT_ELEMENT_DESC SpriteVertexDesc[1];
|
||||
static D3D11_INPUT_ELEMENT_DESC Text2DDesc[3];
|
||||
static D3D11_INPUT_ELEMENT_DESC ModelDesc[3];
|
||||
};
|
||||
}
|
||||
}
|
|
@ -206,19 +206,41 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\LightPass.hlsl">
|
||||
<FxCompile Include="Shader\Passes\2D\2DGeometry.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Geometry</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Geometry</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Geometry</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Geometry</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\Passes\2D\2DPixel.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\Passes\2D\2DVertex.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\Passes\Light\LightPass.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\PixelGatherData.hlsl">
|
||||
<FxCompile Include="Shader\Passes\Gather\GatherPixel.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\PostPass.hlsl">
|
||||
<FxCompile Include="Shader\Passes\Post\PostPass.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compute</ShaderType>
|
||||
|
@ -228,7 +250,7 @@
|
|||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\VertexGatherData.hlsl">
|
||||
<FxCompile Include="Shader\Passes\Gather\GatherVertex.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
|
@ -273,11 +295,12 @@
|
|||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Shader\HLSL\Deffered Shaders\Defines.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\GBufferHeader.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\LightCalc.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\PosManipulation.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\SSAO.hlsli" />
|
||||
<None Include="Shader\Passes\2D\Header.hlsli" />
|
||||
<None Include="Shader\Passes\Light\Defines.hlsli" />
|
||||
<None Include="Shader\Passes\Gather\Header.hlsli" />
|
||||
<None Include="Shader\Passes\Light\LightCalc.hlsli" />
|
||||
<None Include="Shader\Passes\Light\PosManipulation.hlsli" />
|
||||
<None Include="Shader\Passes\Light\SSAO.hlsli" />
|
||||
<None Include="Shader\HLSL\SimpleDebug\Debug.hlsl" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
<ClCompile Include="Render\Resources\Deffered.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Render\Resources\Debug.cpp">
|
||||
<ClCompile Include="Core\PipelineManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Core\PipelineManager.cpp">
|
||||
<ClCompile Include="FileLoader\DanLoader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -86,24 +86,27 @@
|
|||
<ClInclude Include="Render\Resources\Deffered.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Resources\Debug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\TextureDebug.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\LightPass.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\PixelGatherData.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\Deffered Shaders\VertexGatherData.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\Light\LightPass.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\Post\PostPass.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\Gather\GatherPixel.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\Gather\GatherVertex.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\2D\2DVertex.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\2D\2DPixel.hlsl" />
|
||||
<FxCompile Include="Shader\Passes\2D\2DGeometry.hlsl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Shader\HLSL\SimpleDebug\Debug.hlsl" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\Defines.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\GBufferHeader.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\LightCalc.hlsli" />
|
||||
<None Include="Shader\HLSL\Deffered Shaders\PosManipulation.hlsli" />
|
||||
<None Include="Shader\Passes\Light\Defines.hlsli" />
|
||||
<None Include="Shader\Passes\Light\LightCalc.hlsli" />
|
||||
<None Include="Shader\Passes\Light\PosManipulation.hlsli" />
|
||||
<None Include="Shader\Passes\Light\SSAO.hlsli" />
|
||||
<None Include="Shader\Passes\2D\Header.hlsli" />
|
||||
<None Include="Shader\Passes\Gather\Header.hlsli" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -158,7 +158,6 @@ namespace Oyster
|
|||
for(int b = 0; b < info->BoneCount; ++b)
|
||||
{
|
||||
am.AnimatedData[b] = (BoneAbsAnimated[b] * SkinTransform[b]);
|
||||
am.BindPoseData[b] = info->bones[b].Absolute;//Math3D::ExtractRotationMatrix(am.animatedData[b]);
|
||||
}
|
||||
|
||||
//retore to draw animated model
|
||||
|
|
|
@ -8,7 +8,7 @@ typedef Oyster::Graphics::Core::PipelineManager::Get GetShader;
|
|||
typedef Oyster::Graphics::Core::PipelineManager Shader;
|
||||
typedef Oyster::Graphics::Core::Buffer Buffer;
|
||||
|
||||
const std::wstring PathToHLSL = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\Deffered Shaders\\";
|
||||
const std::wstring PathToHLSL = L"..\\..\\Code\\OysterGraphics\\Shader\\Passes\\";
|
||||
const std::wstring PathToCSO = L"..\\Content\\Shaders\\";
|
||||
|
||||
const int KernelSize = 10;
|
||||
|
@ -32,10 +32,12 @@ namespace Oyster
|
|||
Shader::RenderPass Deffered::GeometryPass;
|
||||
Shader::RenderPass Deffered::LightPass;
|
||||
Shader::RenderPass Deffered::PostPass;
|
||||
Shader::RenderPass Deffered::GuiPass;
|
||||
|
||||
Buffer Deffered::ModelData = Buffer();
|
||||
Buffer Deffered::AnimationData = Buffer();
|
||||
Buffer Deffered::LightConstantsData = Buffer();
|
||||
Buffer Deffered::GuiData = Buffer();
|
||||
|
||||
Buffer Deffered::PointLightsData = Buffer();
|
||||
ID3D11ShaderResourceView* Deffered::PointLightView = NULL;
|
||||
|
@ -46,18 +48,31 @@ namespace Oyster
|
|||
|
||||
Core::Init::State Deffered::InitShaders()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
std::wstring path = PathToHLSL;
|
||||
#ifdef _DEBUG
|
||||
std::wstring path = PathToHLSL+L"Gather\\";
|
||||
std::wstring end = L".hlsl";
|
||||
#else
|
||||
std::wstring path = PathToCSO;
|
||||
std::wstring end = L".cso";
|
||||
#endif
|
||||
//Load Shaders
|
||||
Core::PipelineManager::Init(path + L"PixelGatherData" + end, ShaderType::Pixel, L"Geometry");
|
||||
Core::PipelineManager::Init(path + L"VertexGatherData" + end, ShaderType::Vertex, L"Geometry");
|
||||
Core::PipelineManager::Init(path + L"GatherPixel" + end, ShaderType::Pixel, L"Gather");
|
||||
Core::PipelineManager::Init(path + L"GatherVertex" + end, ShaderType::Vertex, L"Gather");
|
||||
#ifdef _DEBUG
|
||||
path = PathToHLSL+L"Light\\";
|
||||
#endif
|
||||
Core::PipelineManager::Init(path + L"LightPass" + end, ShaderType::Compute, L"LightPass");
|
||||
#ifdef _DEBUG
|
||||
path = PathToHLSL+L"Post\\";
|
||||
#endif
|
||||
Core::PipelineManager::Init(path + L"PostPass" + end, ShaderType::Compute, L"PostPass");
|
||||
#ifdef _DEBUG
|
||||
path = PathToHLSL+L"2D\\";
|
||||
#endif
|
||||
Core::PipelineManager::Init(path + L"2DVertex" + end,ShaderType::Vertex, L"2D");
|
||||
Core::PipelineManager::Init(path + L"2DGeometry" + end,ShaderType::Geometry, L"2D");
|
||||
Core::PipelineManager::Init(path + L"2DPixel" + end,ShaderType::Pixel, L"2D");
|
||||
|
||||
return Core::Init::State::Success;
|
||||
}
|
||||
|
||||
|
@ -79,6 +94,10 @@ namespace Oyster
|
|||
desc.ElementSize = sizeof(Definitions::AnimationData);
|
||||
AnimationData.Init(desc);
|
||||
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
|
||||
desc.NumElements = 1;
|
||||
desc.ElementSize = sizeof(Definitions::GuiData);
|
||||
|
||||
desc.ElementSize = sizeof(Definitions::LightConstants);
|
||||
desc.NumElements = 1;
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_CS;
|
||||
|
@ -240,8 +259,8 @@ namespace Oyster
|
|||
////Create ShaderEffects
|
||||
|
||||
////---------------- Geometry Pass Setup ----------------------------
|
||||
GeometryPass.Shaders.Pixel = GetShader::Pixel(L"Geometry");
|
||||
GeometryPass.Shaders.Vertex = GetShader::Vertex(L"Geometry");
|
||||
GeometryPass.Shaders.Pixel = GetShader::Pixel(L"Gather");
|
||||
GeometryPass.Shaders.Vertex = GetShader::Vertex(L"Gather");
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC indesc[] =
|
||||
{
|
||||
|
@ -254,7 +273,7 @@ namespace Oyster
|
|||
{ "BONEWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 72, D3D11_INPUT_PER_VERTEX_DATA, 0 }
|
||||
};
|
||||
|
||||
Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout);
|
||||
Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Gather"),GeometryPass.IAStage.Layout);
|
||||
GeometryPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
GeometryPass.CBuffers.Vertex.push_back(AnimationData);
|
||||
GeometryPass.CBuffers.Vertex.push_back(ModelData);
|
||||
|
@ -262,7 +281,7 @@ namespace Oyster
|
|||
GeometryPass.RenderStates.SampleCount = 1;
|
||||
GeometryPass.RenderStates.SampleState = ss;
|
||||
GeometryPass.RenderStates.DepthStencil = dsState;
|
||||
for(int i = 0; i<Deffered::GBufferSize;++i)
|
||||
for(int i = 0; i<GBufferSize;++i)
|
||||
{
|
||||
GeometryPass.RTV.push_back(GBufferRTV[i]);
|
||||
}
|
||||
|
@ -292,6 +311,23 @@ namespace Oyster
|
|||
}
|
||||
PostPass.UAV.Compute.push_back(Core::backBufferUAV);
|
||||
|
||||
////---------------- GUI Pass Setup ----------------------------
|
||||
GuiPass.Shaders.Vertex = GetShader::Vertex(L"2D");
|
||||
GuiPass.Shaders.Pixel = GetShader::Pixel(L"2D");
|
||||
GuiPass.Shaders.Geometry = GetShader::Geometry(L"2D");
|
||||
GuiPass.RTV.push_back(GBufferRTV[2]);
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC indesc2D[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
|
||||
Shader::CreateInputLayout(indesc2D,1,GetShader::Vertex(L"2D"),GuiPass.IAStage.Layout);
|
||||
GuiPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
|
||||
GuiPass.RenderStates.SampleCount = 1;
|
||||
GuiPass.RenderStates.SampleState = ss;
|
||||
|
||||
return Core::Init::State::Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,14 @@ namespace Oyster
|
|||
{
|
||||
public:
|
||||
|
||||
static const int GBufferSize = 2;
|
||||
static const int GBufferSize = 3;
|
||||
static const int LBufferSize = 3;
|
||||
static const int MaxLightSize = 100;
|
||||
|
||||
//! GBuffers
|
||||
//! 0 = Diffuse + Glow
|
||||
//! 1 = Normal + Spec
|
||||
//! 2 = GUI
|
||||
static ID3D11RenderTargetView* GBufferRTV[GBufferSize];
|
||||
static ID3D11ShaderResourceView* GBufferSRV[GBufferSize];
|
||||
|
||||
|
@ -32,6 +33,7 @@ namespace Oyster
|
|||
static ID3D11ShaderResourceView* LBufferSRV[LBufferSize];
|
||||
|
||||
static Core::PipelineManager::RenderPass GeometryPass;
|
||||
static Core::PipelineManager::RenderPass GuiPass;
|
||||
static Core::PipelineManager::RenderPass LightPass;
|
||||
static Core::PipelineManager::RenderPass PostPass;
|
||||
|
||||
|
@ -42,6 +44,9 @@ namespace Oyster
|
|||
static Core::Buffer LightConstantsData;
|
||||
|
||||
static Core::Buffer PointLightsData;
|
||||
|
||||
static Core::Buffer GuiData;
|
||||
|
||||
static ID3D11ShaderResourceView* PointLightView;
|
||||
|
||||
static ID3D11ShaderResourceView* SSAOKernel;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#include "Header.hlsli"
|
||||
|
||||
[maxvertexcount(4)]
|
||||
void main(point Vertex2DIn input[1],inout TriangleStream<Pixel2DIn> Quads)
|
||||
{
|
||||
Pixel2DIn output;
|
||||
output.Pos = mul(float4(-1,-1,0,1) ,Translation);
|
||||
output.Uv = float2(0,1);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(-1,1,0,1), Translation);
|
||||
output.Uv = float2(0,0);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(1,-1,0,1), Translation);
|
||||
output.Uv = float2(1,1);
|
||||
Quads.Append(output);
|
||||
|
||||
output.Pos = mul(float4(1,1,0,1), Translation);
|
||||
output.Uv = float2(1,0);
|
||||
Quads.Append(output);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#include "Header.hlsli"
|
||||
|
||||
float4 main(Pixel2DIn input) : SV_Target0
|
||||
{
|
||||
return Material.Sample(LinearSampler,input.Uv);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#include "Header.hlsli"
|
||||
|
||||
Vertex2DIn main(Vertex2DIn input)
|
||||
{
|
||||
return input;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
struct Vertex2DIn
|
||||
{
|
||||
float2 Pos : Position;
|
||||
};
|
||||
|
||||
cbuffer EveryObject2D : register(c0)
|
||||
{
|
||||
float4x4 Translation;
|
||||
};
|
||||
|
||||
struct Pixel2DIn
|
||||
{
|
||||
float4 Pos : SV_Position;
|
||||
float2 Uv : TEXCOORD;
|
||||
};
|
||||
|
||||
Texture2D Material : register(t0);
|
||||
SamplerState LinearSampler : register(s0);
|
|
@ -1,4 +1,4 @@
|
|||
#include "GBufferHeader.hlsli"
|
||||
#include "Header.hlsli"
|
||||
|
||||
PixelOut main(VertexOut input)
|
||||
{
|
|
@ -1,14 +1,9 @@
|
|||
#include "GBufferHeader.hlsli"
|
||||
#include "Header.hlsli"
|
||||
|
||||
VertexOut main( VertexIn input )
|
||||
{
|
||||
VertexOut output;
|
||||
|
||||
float3 offsetX = input.pos - BindPoseData[input.boneIndex.x][3].xyz;
|
||||
float3 offsetY = input.pos - BindPoseData[input.boneIndex.y][3].xyz;
|
||||
float3 offsetZ = input.pos - BindPoseData[input.boneIndex.z][3].xyz;
|
||||
float3 offsetW = input.pos - BindPoseData[input.boneIndex.w][3].xyz;
|
||||
|
||||
Matrix boneTrans = AnimatedData[input.boneIndex.x]*input.boneWeight.x +
|
||||
AnimatedData[input.boneIndex.y]*input.boneWeight.y +
|
||||
AnimatedData[input.boneIndex.z]*input.boneWeight.z +
|
|
@ -33,8 +33,6 @@ SamplerState S1 : register(s0);
|
|||
cbuffer Animation : register(b0)
|
||||
{
|
||||
float4x4 AnimatedData[100];
|
||||
float4x4 BindPoseData[100];
|
||||
float4x4 RotationData[100];
|
||||
int Animated;
|
||||
float3 Pad;
|
||||
}
|
|
@ -27,12 +27,13 @@ cbuffer LightConstants : register(b0)
|
|||
|
||||
Texture2D DiffuseGlow : register(t0);
|
||||
Texture2D NormalSpec : register(t1);
|
||||
Texture2D DepthTexture : register(t2);
|
||||
Texture2D GUI : register(t2);
|
||||
Texture2D DepthTexture : register(t3);
|
||||
|
||||
StructuredBuffer<PointLight> Points : register(t3);
|
||||
StructuredBuffer<PointLight> Points : register(t4);
|
||||
|
||||
Texture1D SSAOKernel : register(t4);
|
||||
Texture2D SSAORand : register(t5);
|
||||
Texture1D SSAOKernel : register(t5);
|
||||
Texture2D SSAORand : register(t6);
|
||||
|
||||
RWTexture2D<float4> Diffuse : register(u0);
|
||||
RWTexture2D<float4> Specular : register(u1);
|
Loading…
Reference in New Issue