diff --git a/Code/OysterGraphics/Core/Buffer.cpp b/Code/OysterGraphics/Core/Buffer.cpp index e84d91d3..d6994554 100644 --- a/Code/OysterGraphics/Core/Buffer.cpp +++ b/Code/OysterGraphics/Core/Buffer.cpp @@ -214,4 +214,9 @@ UINT32 Core::Buffer::GetElementCount() UINT32 Core::Buffer::GetVertexSize() { return this->mElementSize; +} + +ID3D11Buffer* Core::Buffer::GetBufferPointer() +{ + return this->mBuffer; } \ No newline at end of file diff --git a/Code/OysterGraphics/Core/Core.h b/Code/OysterGraphics/Core/Core.h index 126323eb..3e8ffdd6 100644 --- a/Code/OysterGraphics/Core/Core.h +++ b/Code/OysterGraphics/Core/Core.h @@ -7,7 +7,7 @@ #include "Dx11Includes.h" #include #include "OysterMath.h" -#include +//#include namespace Oyster { diff --git a/Code/OysterGraphics/Core/Init.cpp b/Code/OysterGraphics/Core/Init.cpp index db63d847..05a91a59 100644 --- a/Code/OysterGraphics/Core/Init.cpp +++ b/Code/OysterGraphics/Core/Init.cpp @@ -356,8 +356,8 @@ namespace Oyster { ID3D11Texture2D* tex; D3D11_TEXTURE2D_DESC texDesc; - texDesc.Width = Core::resolution.x; - texDesc.Height = Core::resolution.y; + texDesc.Width = (UINT)Core::resolution.x; + texDesc.Height = (UINT)Core::resolution.y; texDesc.MipLevels = 1; texDesc.ArraySize = 1; texDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; diff --git a/Code/OysterGraphics/Core/PipelineManager.cpp b/Code/OysterGraphics/Core/PipelineManager.cpp index ae9e4088..c77873b5 100644 --- a/Code/OysterGraphics/Core/PipelineManager.cpp +++ b/Code/OysterGraphics/Core/PipelineManager.cpp @@ -58,7 +58,7 @@ namespace Oyster } else { - VSMap[name] = VS.size(); + VSMap[name] = (int)VS.size(); VS.push_back((ID3D11VertexShader*)data); } } @@ -76,7 +76,7 @@ namespace Oyster } else { - HSMap[name] = HS.size(); + HSMap[name] = (int)HS.size(); HS.push_back((ID3D11HullShader*)data); } @@ -95,7 +95,7 @@ namespace Oyster } else { - DSMap[name] = DS.size(); + DSMap[name] = (int)DS.size(); DS.push_back((ID3D11DomainShader*)data); } } @@ -113,7 +113,7 @@ namespace Oyster } else { - GSMap[name] = GS.size(); + GSMap[name] = (int)GS.size(); GS.push_back((ID3D11GeometryShader*)data); } } @@ -131,7 +131,7 @@ namespace Oyster } else { - PSMap[name] = PS.size(); + PSMap[name] = (int)PS.size(); PS.push_back((ID3D11PixelShader*)data); } } @@ -149,7 +149,7 @@ namespace Oyster } else { - CSMap[name] = CS.size(); + CSMap[name] = (int)CS.size(); CS.push_back((ID3D11ComputeShader*)data); } @@ -347,19 +347,19 @@ namespace Oyster Core::deviceContext->IASetPrimitiveTopology(se.IAStage.Topology); 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()) { - 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()) { - 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()) { - 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->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState); @@ -369,43 +369,43 @@ namespace Oyster 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()) { - 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()) { - 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()) { - 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.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 { - deviceContext->OMSetRenderTargets(se.RTV.size(),&se.RTV[0],se.depth); + deviceContext->OMSetRenderTargets((int)se.RTV.size(),&se.RTV[0],se.depth); } } else { 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()) { - 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); } } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index ac25ab4a..f78ffadb 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -6,6 +6,7 @@ #include "../FileLoader/ObjReader.h" #include "../../Misc/Resource/OysterResource.h" #include "../FileLoader/GeneralLoader.h" +#include "../Model/ModelInfo.h" #include namespace Oyster @@ -47,7 +48,7 @@ namespace Oyster { 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 { @@ -75,6 +76,7 @@ namespace Oyster return API::Sucsess; } + //returns null for invalid filenames Model::Model* API::CreateModel(std::wstring filename) { 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); + Model::ModelInfo* mi = (Model::ModelInfo*)m->info; + if(mi->Vertices->GetBufferPointer() == NULL) + { + return NULL; + } + return m; } void API::DeleteModel(Model::Model* model) { + if(model==NULL) + return; Model::ModelInfo* info = (Model::ModelInfo*)model->info; delete model; Oyster::Resource::OysterResource::ReleaseResource((Oyster::Resource::OHRESOURCE)info); diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 65bffe5a..950ef19f 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -4,7 +4,7 @@ #include "..\Model\Model.h" #include "OysterMath.h" #include -#include +//#include #ifdef GFX_DLL_EXPORT #define GFX_DLL_USAGE __declspec(dllexport) diff --git a/Code/OysterGraphics/FileLoader/ObjReader.cpp b/Code/OysterGraphics/FileLoader/ObjReader.cpp index ccc32fea..60e7824f 100644 --- a/Code/OysterGraphics/FileLoader/ObjReader.cpp +++ b/Code/OysterGraphics/FileLoader/ObjReader.cpp @@ -230,7 +230,6 @@ std::map ObjReader::GetMaterials(std::w input.open(fileName.c_str()); std::map materials; - ID3D11ShaderResourceView *srv; string texture; string s; string path; diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 33391eb0..0a5a275c 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -50,6 +50,8 @@ namespace Oyster { for(int i = 0; i < count; ++i) { + if(&models[i] == NULL) + continue; if(models[i].Visible) { Definitions::PerModel pm; @@ -65,7 +67,7 @@ namespace Oyster 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::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::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); } diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index 349d99a9..f606d57e 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -155,7 +155,7 @@ namespace Oyster Buffer* b = &PointLightsData; Core::Init::CreateLinkedShaderResourceFromStructuredBuffer(&b,&PointLightView,NULL); - srand(time(0)); + srand((unsigned int)time(0)); //SSAO Math::Vector3 kernel[KernelSize]; Math::Vector3 random[SampleSpread]; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl index e0cf21c3..8a361ccf 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl @@ -4,7 +4,7 @@ VertexOut main( VertexIn input ) { VertexOut output; 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; return output; } \ No newline at end of file diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index 2e5fbe0a..d25a9adc 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -44,18 +44,6 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL { 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 ) ) ) return 0; @@ -201,7 +189,7 @@ HRESULT Update(float 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); 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; diff --git a/Code/Tester/Tester.vcxproj b/Code/Tester/Tester.vcxproj index 80853c72..2f10fdc5 100644 --- a/Code/Tester/Tester.vcxproj +++ b/Code/Tester/Tester.vcxproj @@ -136,6 +136,7 @@ OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies) $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) true + OysterGraphics_$(PlatformShortName)D.dll;