From f29af8b8bd3cd2b8e92d957234cffe94e93e3b88 Mon Sep 17 00:00:00 2001 From: lanariel Date: Wed, 4 Dec 2013 09:36:43 +0100 Subject: [PATCH] Release Now Stable --- Code/GameLogic/Object.cpp | 2 +- Code/Network/NetworkDependencies/WinsockFunctions.cpp | 2 +- Code/OysterGraphics/Core/Init.cpp | 3 ++- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 7 ++++++- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 5 ++--- Code/OysterGraphics/FileLoader/ShaderLoader.cpp | 9 +++++---- Code/OysterGraphics/OysterGraphics.vcxproj | 10 ++++++++-- Code/OysterGraphics/Render/Rendering/BasicRender.cpp | 3 ++- Code/OysterGraphics/Render/Resources/Resources.cpp | 9 ++++++++- Code/Tester/MainTest.cpp | 7 ++++++- Code/Tester/Tester.vcxproj | 9 +++++---- 11 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Code/GameLogic/Object.cpp b/Code/GameLogic/Object.cpp index 965af90e..33679058 100644 --- a/Code/GameLogic/Object.cpp +++ b/Code/GameLogic/Object.cpp @@ -16,7 +16,7 @@ Object::Object(void) { model = new Model(); - model = Oyster::Graphics::API::CreateModel(L"bth.obj"); + model = Oyster::Graphics::API::CreateModel(L"orca"); API::SimpleBodyDescription sbDesc; //sbDesc.centerPosition = diff --git a/Code/Network/NetworkDependencies/WinsockFunctions.cpp b/Code/Network/NetworkDependencies/WinsockFunctions.cpp index ea3c3b00..3e2e32f3 100644 --- a/Code/Network/NetworkDependencies/WinsockFunctions.cpp +++ b/Code/Network/NetworkDependencies/WinsockFunctions.cpp @@ -17,7 +17,7 @@ std::wstring GetErrorMessage(int errorCode) LPWSTR lpMessage; std::wstring retVal(L"Succesful"); - DWORD bufLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , + DWORD bufLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , NULL, errorCode , MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) , diff --git a/Code/OysterGraphics/Core/Init.cpp b/Code/OysterGraphics/Core/Init.cpp index c69b80b4..548615d2 100644 --- a/Code/OysterGraphics/Core/Init.cpp +++ b/Code/OysterGraphics/Core/Init.cpp @@ -32,7 +32,8 @@ namespace Oyster log << "DirectX running in debug mode.\n"; createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif - + + createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; D3D_FEATURE_LEVEL featureLevelsToTry[] = { diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index b5de4fda..86df58a2 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -63,7 +63,12 @@ namespace Oyster { Model::ModelInfo* info = (Model::ModelInfo*)model->info; delete model; - info->Vertices->~Buffer(); + SAFE_DELETE(info->Vertices); + if(info->Indexed) + { + SAFE_DELETE(info->Indecies); + } + delete info; } void API::Clean() diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index e55a435f..f7665ba6 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -4,13 +4,12 @@ #include "OysterMath.h" #include -#if defined GFX_DLL_EXPORT +#ifdef GFX_DLL_EXPORT #define GFX_DLL_USAGE __declspec(dllexport) #else - #define GFX_DLL_USAGE __declspec(dllimport) + #define GFX_DLL_USAGE #endif - namespace Oyster { namespace Graphics diff --git a/Code/OysterGraphics/FileLoader/ShaderLoader.cpp b/Code/OysterGraphics/FileLoader/ShaderLoader.cpp index 5a7ba9e3..05420abf 100644 --- a/Code/OysterGraphics/FileLoader/ShaderLoader.cpp +++ b/Code/OysterGraphics/FileLoader/ShaderLoader.cpp @@ -165,14 +165,16 @@ namespace Oyster data.data = new char[data.size]; memcpy(data.data,Shader->GetBufferPointer(),data.size); #else + std::ifstream stream; + stream.open(filename, std::ifstream::in | std::ifstream::binary); if(stream.good()) { stream.seekg(0, std::ios::end); - sd.size = size_t(stream.tellg()); - sd.data = new char[sd.size]; + data.size = size_t(stream.tellg()); + data.data = new char[data.size]; stream.seekg(0, std::ios::beg); - stream.read(&sd.data[0], sd.size); + stream.read(&data.data[0], data.size); stream.close(); } else @@ -180,7 +182,6 @@ namespace Oyster memset(&out,0,sizeof(out)); return; } - #endif out.loadedData = Core::ShaderManager::CreateShader(data, Core::ShaderManager::ShaderType(type)); } diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index c5592230..29acd43e 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -109,6 +109,7 @@ $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + 5.0 @@ -124,12 +125,13 @@ $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + 5.0 Level3 - MaxSpeed + Disabled true true true @@ -143,12 +145,14 @@ $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + true + 5.0 Level3 - MaxSpeed + Disabled true true true @@ -162,6 +166,8 @@ $(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso + true + 5.0 diff --git a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp index 50e7f9f1..9626c954 100644 --- a/Code/OysterGraphics/Render/Rendering/BasicRender.cpp +++ b/Code/OysterGraphics/Render/Rendering/BasicRender.cpp @@ -60,7 +60,8 @@ namespace Oyster } void Basic::EndFrame() { - Core::swapChain->Present(0,0); + IDXGISwapChain* chain = Core::swapChain; + chain->Present(0,0); } } } diff --git a/Code/OysterGraphics/Render/Resources/Resources.cpp b/Code/OysterGraphics/Render/Resources/Resources.cpp index 2bda54e1..66fa4cc9 100644 --- a/Code/OysterGraphics/Render/Resources/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources/Resources.cpp @@ -3,7 +3,8 @@ // /Bin/Executable/Tester -> // /Code/OysterGraphics/Shader/HLSL -const std::wstring PathFromExeToHlsl = L"..\\..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\"; +const std::wstring PathFromExeToCso = L"..\\Content\\Shaders\\"; +const std::wstring PathFromExeToHlsl = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\"; const std::wstring VertexTransformDebug = L"TransformDebugVertex"; const std::wstring VertexDebug = L"DebugVertex"; const std::wstring PixelRed = L"DebugPixel"; @@ -42,6 +43,12 @@ namespace Oyster #else /** Load Vertex Shader with Precompiled */ + Core::ShaderManager::Init(PathFromExeToCso + L"DebugCameraVertex.cso",ShaderType::Vertex, VertexTransformDebug); + Core::ShaderManager::Init(PathFromExeToCso + L"DebugVertex.cso",ShaderType::Vertex, VertexDebug); + + /** Load Pixel Shader with Precompiled */ + Core::ShaderManager::Init(PathFromExeToCso + L"DebugPixel.cso",ShaderType::Pixel, PixelRed); + Core::ShaderManager::Init(PathFromExeToCso + L"TextureDebug.cso",ShaderType::Pixel, PixelTexture); #endif #pragma endregion diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index cbf563c6..61d5e45b 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -18,6 +18,7 @@ HINSTANCE g_hInst = NULL; HWND g_hWnd = NULL; Oyster::Graphics::Model::Model* m = NULL; +Oyster::Graphics::Model::Model* m2 = NULL; Oyster::Math::Float4x4 V; Oyster::Math::Float4x4 P; @@ -186,7 +187,9 @@ HRESULT InitDirect3D() #pragma endregion #pragma region Obj - m = Oyster::Graphics::API::CreateModel(L"orca"); + 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); #pragma endregion @@ -203,6 +206,7 @@ HRESULT Update(float deltaTime) { angle += Oyster::Math::pi/30000; m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle); + m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,0,1)*-angle,Oyster::Math::Float3(0,4,0),Oyster::Math::Float3::null); return S_OK; } @@ -211,6 +215,7 @@ HRESULT Render(float deltaTime) Oyster::Graphics::API::NewFrame(V,P); Oyster::Graphics::API::RenderScene(m,1); + Oyster::Graphics::API::RenderScene(m2,1); Oyster::Graphics::API::EndFrame(); diff --git a/Code/Tester/Tester.vcxproj b/Code/Tester/Tester.vcxproj index 27fc7682..36184b93 100644 --- a/Code/Tester/Tester.vcxproj +++ b/Code/Tester/Tester.vcxproj @@ -85,7 +85,7 @@ false $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ - $(SolutionDir)..\Bin\Executable\$(ProjectName)\ + $(SolutionDir)..\Bin\Executable\ $(ProjectName)_$(PlatformShortName) C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath) C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath) @@ -143,9 +143,9 @@ Level3 - MaxSpeed + Disabled true - true + false WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true ..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories) @@ -158,6 +158,7 @@ OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies) $(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories) true + OysterGraphics_x86.dll; @@ -165,7 +166,7 @@ Level3 - MaxSpeed + Disabled true true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)