From 483236801fc140cb4fae290a4c6f3097f7a184a9 Mon Sep 17 00:00:00 2001 From: lanariel Date: Thu, 16 Jan 2014 09:30:01 +0100 Subject: [PATCH 1/4] Fixed compile warnings and crash on non existing models --- Code/OysterGraphics/Core/Buffer.cpp | 5 +++ Code/OysterGraphics/Core/Core.h | 2 +- Code/OysterGraphics/Core/Init.cpp | 4 +-- Code/OysterGraphics/Core/PipelineManager.cpp | 36 +++++++++---------- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 12 ++++++- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 2 +- Code/OysterGraphics/FileLoader/ObjReader.cpp | 1 - .../Render/Rendering/BasicRender.cpp | 8 +++-- .../Render/Resources/Deffered.cpp | 2 +- .../HLSL/Deffered Shaders/GBufferHeader.hlsli | 1 - .../HLSL/Deffered Shaders/LightCalc.hlsli | 4 +-- .../HLSL/Deffered Shaders/LightPass.hlsl | 6 ++-- .../Shader/HLSL/Deffered Shaders/SSAO.hlsli | 2 +- .../Deffered Shaders/VertexGatherData.hlsl | 2 +- Code/Tester/MainTest.cpp | 20 +++-------- Code/Tester/Tester.vcxproj | 1 + 16 files changed, 57 insertions(+), 51 deletions(-) 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 4d612513..b38984dc 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::LoadOBJ); + 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 9950ce76..06e53e69 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 77bcad09..b1189f39 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/GBufferHeader.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli index 2f5a4a01..74f8cc33 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli @@ -12,7 +12,6 @@ struct VertexIn struct VertexOut { float4 pos : SV_POSITION; - float4 ViewPos : POSITION; float2 UV : TEXCOORD; float3 normal : NORMAL; //float3 tangent : TANGENT; diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli index bd449209..8a1ff05a 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightCalc.hlsli @@ -21,8 +21,8 @@ DiffSpec LightCalc(PointLight pl, float3 pos, int2 texCoord) output.Specular * 0; if(d > pl.Radius) { - output.Diffuse = float4(0,0,0,1); - output.Specular = float4(0,0,0,1); + output.Diffuse = float3(0,0,0); + output.Specular = float3(0,0,0); } return output; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl index 98b2887e..0aec75da 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl @@ -12,13 +12,13 @@ [numthreads(16, 16, 1)] void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) { - float2 UV = DTid / Pixels; + float2 UV = DTid.xy / Pixels; UV.x = UV.x * 2 - 1; UV.y = 1 - 2 * UV.y; float3 ViewPos = ToVpos(DTid.xy, UV); DiffSpec Shaded; - Shaded.Diffuse = float4(0,0,0,0); - Shaded.Specular = float4(0,0,0,0); + Shaded.Diffuse = float3(0,0,0); + Shaded.Specular = float3(0,0,0); for(int i = 0; i < Lights; ++i) { diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli index 32f84f90..b7e2a9f1 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/SSAO.hlsli @@ -24,7 +24,7 @@ float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) float4 ProjOffset = sampled; ProjOffset = mul(Proj, ProjOffset); float4 offset = ProjOffset; - float2 UV = offset; + float2 UV = offset.xy; offset /= offset.w; offset.xyz = offset.xyz * 0.5f + 0.5f; //extra invert y axis, DX11 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 e3284c0b..af6917c8 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; @@ -171,10 +159,12 @@ HRESULT InitDirect3D() return E_FAIL; } - m = Oyster::Graphics::API::CreateModel(L"orca_dummy"); - m2 = Oyster::Graphics::API::CreateModel(L"worldDummy"); + m = Oyster::Graphics::API::CreateModel(L"crate2"); + if(m==NULL) + m = Oyster::Graphics::API::CreateModel(L"crate"); + m2 = Oyster::Graphics::API::CreateModel(L"crate"); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); - m3 = Oyster::Graphics::API::CreateModel(L"worldDummy"); + m3 = Oyster::Graphics::API::CreateModel(L"crate"); m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); 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; From c48f640cdf14385dd8eac14e74b509c604c0efa7 Mon Sep 17 00:00:00 2001 From: bladdidoo Date: Fri, 17 Jan 2014 08:51:12 +0100 Subject: [PATCH 2/4] Loading .Dan geometry and material --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 2 +- Code/OysterGraphics/FileLoader/DanLoader.cpp | 307 ++++++++++ .../OysterGraphics/FileLoader/GeneralLoader.h | 3 + Code/OysterGraphics/Model/ModelInfo.h | 2 +- Code/OysterGraphics/OysterGraphics.vcxproj | 569 +++++++++--------- .../Render/Rendering/BasicRender.cpp | 2 +- .../Render/Resources/Deffered.cpp | 11 +- .../HLSL/Deffered Shaders/GBufferHeader.hlsli | 10 +- Code/Tester/MainTest.cpp | 8 +- 9 files changed, 614 insertions(+), 300 deletions(-) create mode 100644 Code/OysterGraphics/FileLoader/DanLoader.cpp diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 4d612513..ac25ab4a 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -81,7 +81,7 @@ namespace Oyster m->WorldMatrix = Oyster::Math::Float4x4::identity; m->Visible = true; - m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadOBJ); + m->info = Oyster::Resource::OysterResource::LoadResource(filename.c_str(),Oyster::Graphics::Loading::LoadDAN); return m; } diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp new file mode 100644 index 00000000..73f0c8c8 --- /dev/null +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -0,0 +1,307 @@ +#include "GeneralLoader.h" +#include "../Definitions/GraphicalDefinition.h" +#include "../Model/ModelInfo.h" +#include "../Core/Core.h" +#include +#include + +#define DANFILEVERSIONMAJOR 1 +#define DANFILEVERSIONMINOR 1 + +#define FILEHEADERSIZE 8 +#define VERTEXHEADERSIZE 4 +#define VERTEXSIZE 88 + + + +/// +enum HeaderType +{ + VERTEXHEADER = 0, ///< + INDEXHEADER = 1, ///< + MATERIALHEADER = 2, ///< + SKELETONHEADER = 3, ///< + ANIMATIONHEADER = 4 ///< +}; + +/// +struct FileHeader +{ + unsigned int versionMajor; ///< + unsigned int versionMinor; ///< + + /// + FileHeader(char* data) + { + char* memPos = data; // + + memcpy(&versionMajor, memPos, sizeof(unsigned int)); + memPos += 4; + memcpy(&versionMinor, memPos, sizeof(unsigned int)); + } +}; + +/// +struct VertexHeader +{ + unsigned int numVertices; + + /// + VertexHeader(char* data) + { + memcpy(&numVertices, data, sizeof(unsigned int)); + } +}; + +/// +typedef Oyster::Graphics::Definitions::FinalVertex Vertex; + +/// +struct IndexHeader +{ + unsigned int numIndices; + + /// + IndexHeader(char* data) + { + memcpy(&numIndices, data, sizeof(unsigned int)); + } +}; + +/// +struct MaterialHeader +{ + unsigned int diffuseMapPathLength; + char* diffuseMapPath; + + unsigned int normalMapPathLength; + char* normalMapPath; + /* + /// + MaterialHeader(char* data) + { + char* memPos = data; // + + memcpy(&diffuseMapPathLength, memPos, sizeof(unsigned int)); + memPos += 4; + + diffuseMapPath = new char[diffuseMapPathLength]; + memcpy(diffuseMapPath, memPos, diffuseMapPathLength); + memPos += diffuseMapPathLength; + + memcpy(&normalMapPathLength, memPos, sizeof(unsigned int)); + memPos += 4; + + normalMapPath = new char[normalMapPathLength]; + memcpy(normalMapPath, memPos, normalMapPathLength); + memPos += normalMapPathLength; + } + */ +}; + +/// +struct SkeletonHeader +{ + // do this... +}; + +/// +struct AnimationHeader +{ + // do this... +}; + +struct Frame +{ + // do this... +}; + +/// +void Oyster::Graphics::Loading::UnloadDAN(void* data) +{ + Model::ModelInfo* info = (Model::ModelInfo*) data; + SAFE_DELETE(info->Vertices); + if(info->Indexed) + { + SAFE_DELETE(info->Indecies); + } + for(int i =0;iMaterial.size();++i) + { + Oyster::Resource::OysterResource::ReleaseResource(info->Material[i]); + } + delete info; +} + +static wchar_t* charToWChar(const char* text) +{ + // Convert to a wchar_t* + size_t origsize = strlen(text) + 1; + size_t convertedChars = 0; + wchar_t* wcstring = new wchar_t[origsize]; + mbstowcs_s(&convertedChars, wcstring, origsize, text, _TRUNCATE); + return wcstring; +} + +/// +void Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[], Oyster::Resource::CustomData& out) +{ + // + Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo(); + modelInfo->Indexed = false; + // Open file in binary mode + std::ifstream danFile; + danFile.open(filename, std::ios::binary); + if (!danFile.is_open()) + return; + + // Read file header + char* buffer = new char[sizeof(FileHeader)]; + danFile.read(buffer, sizeof(FileHeader)); + FileHeader fileHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + // If problem with compatability then close file and return from method + if (fileHeader.versionMajor != DANFILEVERSIONMAJOR) + { + danFile.close(); + return; + } + + // Read the .dan-file + while (!danFile.eof()) + { + // read header type + unsigned int headerType; + buffer = new char[4]; + danFile.read(buffer, 4); + memcpy(&headerType, buffer, 4); + //delete[] buffer; // ( note: may crash here.) + + // handle header type + switch ((HeaderType)headerType) + { + // vertex header + case HeaderType::VERTEXHEADER: + { + // Fetch vertex header, number of vertices + buffer = new char[4]; + danFile.read(buffer, 4); + VertexHeader vertexHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + // Fetch all vertices + Vertex* vertices = new Vertex[vertexHeader.numVertices]; + unsigned int bufferSize = VERTEXSIZE * vertexHeader.numVertices; + buffer = new char[bufferSize]; + danFile.read(buffer, bufferSize); + memcpy(vertices, buffer, bufferSize); + delete[] buffer; // ( note: may crash here.) + + // Do the deed + Oyster::Graphics::Core::Buffer* vertexBuffer = new Oyster::Graphics::Core::Buffer(); + Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC bufferInitDesc; + bufferInitDesc.ElementSize = sizeof(Vertex); + bufferInitDesc.InitData = vertices; + bufferInitDesc.NumElements = vertexHeader.numVertices; + bufferInitDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::VERTEX_BUFFER; + bufferInitDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_DEFAULT; + vertexBuffer->Init(bufferInitDesc); + modelInfo->VertexCount = vertexHeader.numVertices; + modelInfo->Vertices = vertexBuffer; + + delete[] vertices; // ( note: may crash here.) + + break; + } + case HeaderType::INDEXHEADER: + { + // Fetch vertex header, number of vertices + buffer = new char[4]; + danFile.read(buffer, 4); + IndexHeader indexHeader(buffer); + delete[] buffer; // ( note: may crash here.) + + // Fetch all indices + unsigned int* indices = new unsigned int[indexHeader.numIndices]; + unsigned int bufferSize = sizeof(unsigned int) * indexHeader.numIndices; + buffer = new char[bufferSize]; + danFile.read(buffer, bufferSize); + memcpy(indices, buffer, bufferSize); + delete[] buffer; // ( note: may crash here.) + + // Do the deed + Oyster::Graphics::Core::Buffer* indexBuffer = new Oyster::Graphics::Core::Buffer(); + Oyster::Graphics::Core::Buffer::BUFFER_INIT_DESC bufferInitDesc; + bufferInitDesc.ElementSize = sizeof(unsigned int); + bufferInitDesc.InitData = indices; + bufferInitDesc.NumElements = indexHeader.numIndices; + bufferInitDesc.Type = Oyster::Graphics::Core::Buffer::BUFFER_TYPE::INDEX_BUFFER; + bufferInitDesc.Usage = Oyster::Graphics::Core::Buffer::BUFFER_USAGE::BUFFER_DEFAULT; + indexBuffer->Init(bufferInitDesc); + modelInfo->IndexCount = indexHeader.numIndices; + modelInfo->Indecies = indexBuffer; + modelInfo->Indexed = true; + + delete[] indices; // ( note: may crash here.) + + break; + } + // material header + case HeaderType::MATERIALHEADER: + { + // Fetch material header, 2 texture path strings + MaterialHeader materialHeader; + buffer = new char[4]; + danFile.read(buffer, 4); + memcpy(&materialHeader.diffuseMapPathLength, buffer, 4); + delete[] buffer; // ( note: may crash here.) + + buffer = new char[materialHeader.diffuseMapPathLength]; + danFile.read(buffer, materialHeader.diffuseMapPathLength); + materialHeader.diffuseMapPath = new char[materialHeader.diffuseMapPathLength+1]; + memcpy(materialHeader.diffuseMapPath, buffer, materialHeader.diffuseMapPathLength); + materialHeader.diffuseMapPath[materialHeader.diffuseMapPathLength] = 0; + delete[] buffer; // ( note: may crash here.) + + buffer = new char[4]; + danFile.read(buffer, 4); + memcpy(&materialHeader.normalMapPathLength, buffer, 4); + delete[] buffer; // ( note: may crash here.) + + buffer = new char[materialHeader.normalMapPathLength]; + danFile.read(buffer, materialHeader.normalMapPathLength); + materialHeader.normalMapPath = new char[materialHeader.normalMapPathLength + 1]; + memcpy(materialHeader.normalMapPath, buffer, materialHeader.normalMapPathLength); + materialHeader.normalMapPath[materialHeader.normalMapPathLength] = 0; + delete[] buffer; // ( note: may crash here.) + + // + ID3D11ShaderResourceView* diffuseMap = (ID3D11ShaderResourceView*)Oyster::Resource::OysterResource::LoadResource(charToWChar(materialHeader.diffuseMapPath), Oyster::Graphics::Loading::LoadTexture); + ID3D11ShaderResourceView* normalMap = (ID3D11ShaderResourceView*)Oyster::Resource::OysterResource::LoadResource(charToWChar(materialHeader.normalMapPath), Oyster::Graphics::Loading::LoadTexture); + modelInfo->Material.push_back(diffuseMap); + modelInfo->Material.push_back(normalMap); + + break; + } + // skeleton header + case HeaderType::SKELETONHEADER: + { + // not implemented... + break; + } + // animation header + case HeaderType::ANIMATIONHEADER: + { + // not implemented... + break; + } + } + } + + // close file + danFile.close(); + + // Set modelinfo as output data + out.loadedData = modelInfo; + out.resourceUnloadFnc = Oyster::Graphics::Loading::UnloadDAN; +} \ No newline at end of file diff --git a/Code/OysterGraphics/FileLoader/GeneralLoader.h b/Code/OysterGraphics/FileLoader/GeneralLoader.h index 4eab570b..cd6806e1 100644 --- a/Code/OysterGraphics/FileLoader/GeneralLoader.h +++ b/Code/OysterGraphics/FileLoader/GeneralLoader.h @@ -29,6 +29,9 @@ namespace Oyster void UnloadOBJ(void* loadedData); void LoadOBJ(const wchar_t filename[], Oyster::Resource::CustomData& out); + + void UnloadDAN(void* loadedData); + void LoadDAN(const wchar_t filename[], Oyster::Resource::CustomData& out); } } } \ No newline at end of file diff --git a/Code/OysterGraphics/Model/ModelInfo.h b/Code/OysterGraphics/Model/ModelInfo.h index 6c1d0cfe..9dcef562 100644 --- a/Code/OysterGraphics/Model/ModelInfo.h +++ b/Code/OysterGraphics/Model/ModelInfo.h @@ -16,7 +16,7 @@ namespace Oyster std::vector Material; Core::Buffer *Vertices,*Indecies; bool Indexed; - int VertexCount; + int VertexCount, IndexCount; }; } } diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index d2196e4e..e9b8ff72 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -1,285 +1,286 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0EC83E64-230E-48EF-B08C-6AC9651B4F82} - OysterGraphics - - - - DynamicLibrary - true - v110 - MultiByte - - - DynamicLibrary - true - v110 - MultiByte - - - DynamicLibrary - false - v110 - true - MultiByte - - - DynamicLibrary - false - v110 - true - MultiByte - - - - - - - - - - - - - - - - - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName)D - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) - - - $(SolutionDir)..\Bin\DLL\ - $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(ProjectName)_$(PlatformShortName) - C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) - C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) - - - - Level3 - Disabled - true - $(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - - - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - 5.0 - - - - - Level3 - Disabled - true - ..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - 5.0 - - - - - Level3 - Disabled - true - true - true - ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - true - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - true - 5.0 - - - - - Level3 - Disabled - true - true - true - ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) - GFX_DLL_EXPORT;%(PreprocessorDefinitions) - - - true - true - true - - - $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso - true - 5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} - - - {f10cbc03-9809-4cba-95d8-327c287b18ee} - - - - - Compute - Compute - Compute - Compute - - - Pixel - Pixel - Pixel - Pixel - - - Compute - 5.0 - Compute - 5.0 - Compute - 5.0 - Compute - 5.0 - - - Vertex - Vertex - Vertex - Vertex - - - Vertex - Vertex - Vertex - Vertex - - - - - 5.0 - - - Pixel - Pixel - Pixel - Pixel - true - 5.0 - main - - - Vertex - Vertex - Vertex - Vertex - true - 5.0 - main - - - - - Pixel - Pixel - Pixel - Pixel - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0EC83E64-230E-48EF-B08C-6AC9651B4F82} + OysterGraphics + + + + DynamicLibrary + true + v110 + MultiByte + + + DynamicLibrary + true + v110 + MultiByte + + + DynamicLibrary + false + v110 + true + MultiByte + + + DynamicLibrary + false + v110 + true + MultiByte + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName)D + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName) + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName)D + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + $(SolutionDir)..\Bin\DLL\ + $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ + $(ProjectName)_$(PlatformShortName) + C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) + C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath) + + + + Level3 + Disabled + true + $(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + + + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + 5.0 + + + + + Level3 + Disabled + true + ..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + 5.0 + + + + + Level3 + Disabled + true + true + true + ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + true + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + true + 5.0 + + + + + Level3 + Disabled + true + true + true + ..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) + GFX_DLL_EXPORT;%(PreprocessorDefinitions) + + + true + true + true + + + $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + true + 5.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} + + + {f10cbc03-9809-4cba-95d8-327c287b18ee} + + + + + Compute + Compute + Compute + Compute + + + Pixel + Pixel + Pixel + Pixel + + + Compute + 5.0 + Compute + 5.0 + Compute + 5.0 + Compute + 5.0 + + + Vertex + Vertex + Vertex + Vertex + + + Vertex + Vertex + Vertex + Vertex + + + + + 5.0 + + + Pixel + Pixel + Pixel + Pixel + true + 5.0 + main + + + Vertex + Vertex + Vertex + Vertex + true + 5.0 + main + + + + + Pixel + Pixel + Pixel + Pixel + + + + + + + + + + + + + \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 9950ce76..33391eb0 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -73,7 +73,7 @@ namespace Oyster if(info->Indexed) { info->Indecies->Apply(); - Oyster::Graphics::Core::deviceContext->DrawIndexed(info->VertexCount,0,0); + Oyster::Graphics::Core::deviceContext->DrawIndexed(info->IndexCount,0,0); } else { diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index 77bcad09..349d99a9 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -92,7 +92,7 @@ namespace Oyster D3D11_RASTERIZER_DESC rdesc; rdesc.CullMode = D3D11_CULL_BACK; rdesc.FillMode = D3D11_FILL_SOLID; - rdesc.FrontCounterClockwise = true; + rdesc.FrontCounterClockwise = false; rdesc.DepthBias = 0; rdesc.DepthBiasClamp = 0; rdesc.DepthClipEnable = true; @@ -230,11 +230,14 @@ namespace Oyster { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 } - + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BITANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 44, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BONEINDEX", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 56, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "BONEWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 72, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; - Shader::CreateInputLayout(indesc,3,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout); + Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Geometry"),GeometryPass.IAStage.Layout); GeometryPass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; GeometryPass.CBuffers.Vertex.push_back(VPData); GeometryPass.CBuffers.Vertex.push_back(ModelData); diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli index 2f5a4a01..18cac11d 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/GBufferHeader.hlsli @@ -3,16 +3,16 @@ struct VertexIn float3 pos : POSITION; float2 UV : TEXCOORD; float3 normal : NORMAL; - //float3 tangent : TANGENT; - //float3 biTangent : BITANGENT; - //float4 boneIndex : BONEINDEX; - //float4 boneWeight : BONEWEIGHT; + float3 tangent : TANGENT; + float3 biTangent : BITANGENT; + float4 boneIndex : BONEINDEX; + float4 boneWeight : BONEWEIGHT; }; struct VertexOut { float4 pos : SV_POSITION; - float4 ViewPos : POSITION; + //float4 ViewPos : POSITION; float2 UV : TEXCOORD; float3 normal : NORMAL; //float3 tangent : TANGENT; diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index e3284c0b..2e5fbe0a 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -171,10 +171,10 @@ HRESULT InitDirect3D() return E_FAIL; } - m = Oyster::Graphics::API::CreateModel(L"orca_dummy"); - m2 = Oyster::Graphics::API::CreateModel(L"worldDummy"); + m = Oyster::Graphics::API::CreateModel(L"cube_tri.dan"); + m2 = Oyster::Graphics::API::CreateModel(L"cube_tri.dan"); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); - m3 = Oyster::Graphics::API::CreateModel(L"worldDummy"); + m3 = Oyster::Graphics::API::CreateModel(L"cube_tri.dan"); m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); @@ -201,7 +201,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; From faa6efba578cb5fbf4ee6dbb9155f2ae793ce044 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 17 Jan 2014 09:04:13 +0100 Subject: [PATCH 3/4] added .cso to git ignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c574ca5e..f3fd569c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,9 +25,10 @@ *.ilk *.exp *.dll +*.cso -Bin/Content/Sound/ +Bin/Content/ Bin/Executable/ Obj/ External/ From ab0b9a925a4326271727ef9db36a2fb87a4eaf18 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 17 Jan 2014 09:05:18 +0100 Subject: [PATCH 4/4] /Graphics Fixed stable pipeline with no warnings --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 1 + Code/Tester/MainTest.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index b38984dc..cca2786c 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -88,6 +88,7 @@ namespace Oyster Model::ModelInfo* mi = (Model::ModelInfo*)m->info; if(mi->Vertices->GetBufferPointer() == NULL) { + delete m; return NULL; } diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index af6917c8..f9ceec99 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -161,10 +161,10 @@ HRESULT InitDirect3D() m = Oyster::Graphics::API::CreateModel(L"crate2"); if(m==NULL) - m = Oyster::Graphics::API::CreateModel(L"crate"); - m2 = Oyster::Graphics::API::CreateModel(L"crate"); + m = Oyster::Graphics::API::CreateModel(L"christmastree"); + m2 = Oyster::Graphics::API::CreateModel(L"christmastree"); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null); - m3 = Oyster::Graphics::API::CreateModel(L"crate"); + m3 = Oyster::Graphics::API::CreateModel(L"christmastree"); m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null);