Merge branch 'Graphics' of https://github.com/dean11/Danbias into Graphics
Conflicts: Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli Code/Tester/MainTest.cpp
This commit is contained in:
commit
61b8baed1b
|
@ -215,3 +215,8 @@ UINT32 Core::Buffer::GetVertexSize()
|
||||||
{
|
{
|
||||||
return this->mElementSize;
|
return this->mElementSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ID3D11Buffer* Core::Buffer::GetBufferPointer()
|
||||||
|
{
|
||||||
|
return this->mBuffer;
|
||||||
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
#include "Dx11Includes.h"
|
#include "Dx11Includes.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "OysterMath.h"
|
#include "OysterMath.h"
|
||||||
#include <vld.h>
|
//#include <vld.h>
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
{
|
{
|
||||||
|
|
|
@ -356,8 +356,8 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
ID3D11Texture2D* tex;
|
ID3D11Texture2D* tex;
|
||||||
D3D11_TEXTURE2D_DESC texDesc;
|
D3D11_TEXTURE2D_DESC texDesc;
|
||||||
texDesc.Width = Core::resolution.x;
|
texDesc.Width = (UINT)Core::resolution.x;
|
||||||
texDesc.Height = Core::resolution.y;
|
texDesc.Height = (UINT)Core::resolution.y;
|
||||||
texDesc.MipLevels = 1;
|
texDesc.MipLevels = 1;
|
||||||
texDesc.ArraySize = 1;
|
texDesc.ArraySize = 1;
|
||||||
texDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
texDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VSMap[name] = VS.size();
|
VSMap[name] = (int)VS.size();
|
||||||
VS.push_back((ID3D11VertexShader*)data);
|
VS.push_back((ID3D11VertexShader*)data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HSMap[name] = HS.size();
|
HSMap[name] = (int)HS.size();
|
||||||
HS.push_back((ID3D11HullShader*)data);
|
HS.push_back((ID3D11HullShader*)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DSMap[name] = DS.size();
|
DSMap[name] = (int)DS.size();
|
||||||
DS.push_back((ID3D11DomainShader*)data);
|
DS.push_back((ID3D11DomainShader*)data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GSMap[name] = GS.size();
|
GSMap[name] = (int)GS.size();
|
||||||
GS.push_back((ID3D11GeometryShader*)data);
|
GS.push_back((ID3D11GeometryShader*)data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PSMap[name] = PS.size();
|
PSMap[name] = (int)PS.size();
|
||||||
PS.push_back((ID3D11PixelShader*)data);
|
PS.push_back((ID3D11PixelShader*)data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ namespace Oyster
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CSMap[name] = CS.size();
|
CSMap[name] = (int)CS.size();
|
||||||
CS.push_back((ID3D11ComputeShader*)data);
|
CS.push_back((ID3D11ComputeShader*)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,19 +347,19 @@ namespace Oyster
|
||||||
Core::deviceContext->IASetPrimitiveTopology(se.IAStage.Topology);
|
Core::deviceContext->IASetPrimitiveTopology(se.IAStage.Topology);
|
||||||
if(se.CBuffers.Vertex.size())
|
if(se.CBuffers.Vertex.size())
|
||||||
{
|
{
|
||||||
deviceContext->VSSetConstantBuffers(0,se.CBuffers.Vertex.size(),&se.CBuffers.Vertex[0]);
|
deviceContext->VSSetConstantBuffers(0,(int)se.CBuffers.Vertex.size(),&se.CBuffers.Vertex[0]);
|
||||||
}
|
}
|
||||||
if(se.CBuffers.Pixel.size())
|
if(se.CBuffers.Pixel.size())
|
||||||
{
|
{
|
||||||
deviceContext->PSSetConstantBuffers(0,se.CBuffers.Pixel.size(),&se.CBuffers.Pixel[0]);
|
deviceContext->PSSetConstantBuffers(0,(int)se.CBuffers.Pixel.size(),&se.CBuffers.Pixel[0]);
|
||||||
}
|
}
|
||||||
if(se.CBuffers.Geometry.size())
|
if(se.CBuffers.Geometry.size())
|
||||||
{
|
{
|
||||||
deviceContext->GSSetConstantBuffers(0,se.CBuffers.Geometry.size(),&se.CBuffers.Geometry[0]);
|
deviceContext->GSSetConstantBuffers(0,(int)se.CBuffers.Geometry.size(),&se.CBuffers.Geometry[0]);
|
||||||
}
|
}
|
||||||
if(se.CBuffers.Compute.size())
|
if(se.CBuffers.Compute.size())
|
||||||
{
|
{
|
||||||
deviceContext->CSSetConstantBuffers(0,se.CBuffers.Compute.size(),&se.CBuffers.Compute[0]);
|
deviceContext->CSSetConstantBuffers(0,(int)se.CBuffers.Compute.size(),&se.CBuffers.Compute[0]);
|
||||||
}
|
}
|
||||||
Core::deviceContext->RSSetState(se.RenderStates.Rasterizer);
|
Core::deviceContext->RSSetState(se.RenderStates.Rasterizer);
|
||||||
Core::deviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
|
Core::deviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
|
||||||
|
@ -369,43 +369,43 @@ namespace Oyster
|
||||||
|
|
||||||
if(se.SRV.Vertex.size())
|
if(se.SRV.Vertex.size())
|
||||||
{
|
{
|
||||||
Core::deviceContext->VSSetShaderResources(0,se.SRV.Vertex.size(),&se.SRV.Vertex[0]);
|
Core::deviceContext->VSSetShaderResources(0,(int)se.SRV.Vertex.size(),&se.SRV.Vertex[0]);
|
||||||
}
|
}
|
||||||
if(se.SRV.Geometry.size())
|
if(se.SRV.Geometry.size())
|
||||||
{
|
{
|
||||||
Core::deviceContext->GSSetShaderResources(0,se.SRV.Geometry.size(),&se.SRV.Geometry[0]);
|
Core::deviceContext->GSSetShaderResources(0,(int)se.SRV.Geometry.size(),&se.SRV.Geometry[0]);
|
||||||
}
|
}
|
||||||
if(se.SRV.Pixel.size())
|
if(se.SRV.Pixel.size())
|
||||||
{
|
{
|
||||||
Core::deviceContext->PSSetShaderResources(0,se.SRV.Pixel.size(),&se.SRV.Pixel[0]);
|
Core::deviceContext->PSSetShaderResources(0,(int)se.SRV.Pixel.size(),&se.SRV.Pixel[0]);
|
||||||
}
|
}
|
||||||
if(se.SRV.Compute.size())
|
if(se.SRV.Compute.size())
|
||||||
{
|
{
|
||||||
Core::deviceContext->CSSetShaderResources(0,se.SRV.Compute.size(),&se.SRV.Compute[0]);
|
Core::deviceContext->CSSetShaderResources(0,(int)se.SRV.Compute.size(),&se.SRV.Compute[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(se.RTV.size())
|
if(se.RTV.size())
|
||||||
{
|
{
|
||||||
if(se.UAV.Pixel.size())
|
if(se.UAV.Pixel.size())
|
||||||
{
|
{
|
||||||
deviceContext->OMSetRenderTargetsAndUnorderedAccessViews(se.RTV.size(),&se.RTV[0],se.depth,se.RTV.size(),se.UAV.Pixel.size(),&se.UAV.Pixel[0],0);
|
deviceContext->OMSetRenderTargetsAndUnorderedAccessViews((int)se.RTV.size(),&se.RTV[0],se.depth,(int)se.RTV.size(),(int)se.UAV.Pixel.size(),&se.UAV.Pixel[0],0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deviceContext->OMSetRenderTargets(se.RTV.size(),&se.RTV[0],se.depth);
|
deviceContext->OMSetRenderTargets((int)se.RTV.size(),&se.RTV[0],se.depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(se.UAV.Pixel.size())
|
if(se.UAV.Pixel.size())
|
||||||
{
|
{
|
||||||
deviceContext->OMSetRenderTargetsAndUnorderedAccessViews(0,NULL,se.depth,0,se.UAV.Pixel.size(),&se.UAV.Pixel[0],0);
|
deviceContext->OMSetRenderTargetsAndUnorderedAccessViews(0,NULL,se.depth,0,(int)se.UAV.Pixel.size(),&se.UAV.Pixel[0],0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(se.UAV.Compute.size())
|
if(se.UAV.Compute.size())
|
||||||
{
|
{
|
||||||
deviceContext->CSSetUnorderedAccessViews(0,se.UAV.Compute.size(),&se.UAV.Compute[0],0);
|
deviceContext->CSSetUnorderedAccessViews(0,(int)se.UAV.Compute.size(),&se.UAV.Compute[0],0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../FileLoader/ObjReader.h"
|
#include "../FileLoader/ObjReader.h"
|
||||||
#include "../../Misc/Resource/OysterResource.h"
|
#include "../../Misc/Resource/OysterResource.h"
|
||||||
#include "../FileLoader/GeneralLoader.h"
|
#include "../FileLoader/GeneralLoader.h"
|
||||||
|
#include "../Model/ModelInfo.h"
|
||||||
#include <vld.h>
|
#include <vld.h>
|
||||||
|
|
||||||
namespace Oyster
|
namespace Oyster
|
||||||
|
@ -47,7 +48,7 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
if(Lights.size())
|
if(Lights.size())
|
||||||
{
|
{
|
||||||
Render::Rendering::Basic::NewFrame(View, Projection, &Lights[0], Lights.size());
|
Render::Rendering::Basic::NewFrame(View, Projection, &Lights[0], (int)Lights.size());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -75,6 +76,7 @@ namespace Oyster
|
||||||
return API::Sucsess;
|
return API::Sucsess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//returns null for invalid filenames
|
||||||
Model::Model* API::CreateModel(std::wstring filename)
|
Model::Model* API::CreateModel(std::wstring filename)
|
||||||
{
|
{
|
||||||
Model::Model* m = new Model::Model();
|
Model::Model* m = new Model::Model();
|
||||||
|
@ -83,11 +85,19 @@ namespace Oyster
|
||||||
|
|
||||||
m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadDAN);
|
m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadDAN);
|
||||||
|
|
||||||
|
Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
|
||||||
|
if(mi->Vertices->GetBufferPointer() == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void API::DeleteModel(Model::Model* model)
|
void API::DeleteModel(Model::Model* model)
|
||||||
{
|
{
|
||||||
|
if(model==NULL)
|
||||||
|
return;
|
||||||
Model::ModelInfo* info = (Model::ModelInfo*)model->info;
|
Model::ModelInfo* info = (Model::ModelInfo*)model->info;
|
||||||
delete model;
|
delete model;
|
||||||
Oyster::Resource::OysterResource::ReleaseResource((Oyster::Resource::OHRESOURCE)info);
|
Oyster::Resource::OysterResource::ReleaseResource((Oyster::Resource::OHRESOURCE)info);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "..\Model\Model.h"
|
#include "..\Model\Model.h"
|
||||||
#include "OysterMath.h"
|
#include "OysterMath.h"
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <vld.h>
|
//#include <vld.h>
|
||||||
|
|
||||||
#ifdef GFX_DLL_EXPORT
|
#ifdef GFX_DLL_EXPORT
|
||||||
#define GFX_DLL_USAGE __declspec(dllexport)
|
#define GFX_DLL_USAGE __declspec(dllexport)
|
||||||
|
|
|
@ -230,7 +230,6 @@ std::map<std::string, ID3D11ShaderResourceView *> ObjReader::GetMaterials(std::w
|
||||||
input.open(fileName.c_str());
|
input.open(fileName.c_str());
|
||||||
|
|
||||||
std::map<std::string, ID3D11ShaderResourceView *> materials;
|
std::map<std::string, ID3D11ShaderResourceView *> materials;
|
||||||
ID3D11ShaderResourceView *srv;
|
|
||||||
string texture;
|
string texture;
|
||||||
string s;
|
string s;
|
||||||
string path;
|
string path;
|
||||||
|
|
|
@ -50,6 +50,8 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
for(int i = 0; i < count; ++i)
|
for(int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
if(&models[i] == NULL)
|
||||||
|
continue;
|
||||||
if(models[i].Visible)
|
if(models[i].Visible)
|
||||||
{
|
{
|
||||||
Definitions::PerModel pm;
|
Definitions::PerModel pm;
|
||||||
|
@ -65,7 +67,7 @@ namespace Oyster
|
||||||
|
|
||||||
if(info->Material.size())
|
if(info->Material.size())
|
||||||
{
|
{
|
||||||
Core::deviceContext->PSSetShaderResources(0,info->Material.size(),&(info->Material[0]));
|
Core::deviceContext->PSSetShaderResources(0,(UINT)info->Material.size(),&(info->Material[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,11 +88,11 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
Core::PipelineManager::SetRenderPass(Resources::Deffered::LightPass);
|
Core::PipelineManager::SetRenderPass(Resources::Deffered::LightPass);
|
||||||
|
|
||||||
Core::deviceContext->Dispatch((Core::resolution.x + 15U) / 16U,(Core::resolution.y + 15U) / 16U,1);
|
Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1);
|
||||||
|
|
||||||
Core::PipelineManager::SetRenderPass(Resources::Deffered::PostPass);
|
Core::PipelineManager::SetRenderPass(Resources::Deffered::PostPass);
|
||||||
|
|
||||||
Core::deviceContext->Dispatch((Core::resolution.x + 15U) / 16U,(Core::resolution.y + 15U) / 16U,1);
|
Core::deviceContext->Dispatch((UINT)((Core::resolution.x + 15U) / 16U), (UINT)((Core::resolution.y + 15U) / 16U), 1);
|
||||||
|
|
||||||
Core::swapChain->Present(0,0);
|
Core::swapChain->Present(0,0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace Oyster
|
||||||
Buffer* b = &PointLightsData;
|
Buffer* b = &PointLightsData;
|
||||||
|
|
||||||
Core::Init::CreateLinkedShaderResourceFromStructuredBuffer(&b,&PointLightView,NULL);
|
Core::Init::CreateLinkedShaderResourceFromStructuredBuffer(&b,&PointLightView,NULL);
|
||||||
srand(time(0));
|
srand((unsigned int)time(0));
|
||||||
//SSAO
|
//SSAO
|
||||||
Math::Vector3 kernel[KernelSize];
|
Math::Vector3 kernel[KernelSize];
|
||||||
Math::Vector3 random[SampleSpread];
|
Math::Vector3 random[SampleSpread];
|
||||||
|
|
|
@ -4,7 +4,7 @@ VertexOut main( VertexIn input )
|
||||||
{
|
{
|
||||||
VertexOut output;
|
VertexOut output;
|
||||||
output.pos = mul(WVP, float4(input.pos,1));
|
output.pos = mul(WVP, float4(input.pos,1));
|
||||||
output.normal = mul(WV, float4(input.normal,0));
|
output.normal = mul(WV, float4(input.normal,0)).xyz;
|
||||||
output.UV = input.UV;
|
output.UV = input.UV;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
|
@ -44,18 +44,6 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
|
||||||
{
|
{
|
||||||
|
|
||||||
BOOL b = SetDllDirectoryW(L"..\\DLL");
|
BOOL b = SetDllDirectoryW(L"..\\DLL");
|
||||||
typedef struct tagLOADPARMS32
|
|
||||||
{
|
|
||||||
LPSTR lpEnvAddress; // address of environment strings
|
|
||||||
LPSTR lpCmdLine; // address of command line
|
|
||||||
LPSTR lpCmdShow; // how to show new program
|
|
||||||
DWORD dwReserved; // must be zero
|
|
||||||
} LOADPARMS32;
|
|
||||||
LOADPARMS32 params;
|
|
||||||
params.dwReserved=NULL;
|
|
||||||
params.lpCmdLine="";
|
|
||||||
params.lpCmdShow="";
|
|
||||||
params.lpEnvAddress="";
|
|
||||||
|
|
||||||
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -201,7 +189,7 @@ HRESULT Update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
angle += Oyster::Math::pi/8 * deltaTime;
|
angle += Oyster::Math::pi/8 * deltaTime;
|
||||||
//m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle);
|
m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle);
|
||||||
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-angle,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null);
|
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-angle,Oyster::Math::Float3(0,-4,0),Oyster::Math::Float3::null);
|
||||||
m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-0,Oyster::Math::Float3(3,4,-1*angle),Oyster::Math::Float3::null);
|
m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0)*-0,Oyster::Math::Float3(3,4,-1*angle),Oyster::Math::Float3::null);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -136,6 +136,7 @@
|
||||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<PreventDllBinding>true</PreventDllBinding>
|
<PreventDllBinding>true</PreventDllBinding>
|
||||||
|
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
|
Loading…
Reference in New Issue