diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index b6c1b521..d7d30968 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -8,6 +8,7 @@ #include "../../Misc/Resource/ResourceManager.h" #include "../FileLoader/GeneralLoader.h" #include "../Model/ModelInfo.h" +#include "../Render/Rendering/GuiRender.h" #include namespace Oyster @@ -154,5 +155,15 @@ namespace Oyster o.texturePath = Core::texturePath; return o; } + + void API::StartGuiRender() + { + Render::Rendering::Gui::BeginRender(); + } + + void API::RenderGuiElement(API::Texture tex, Math::Float2 pos, Math::Float2 size) + { + Render::Rendering::Gui::Render((ID3D11Texture2D*)tex,pos,size); + } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index 555e8a0c..64a774d6 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -29,6 +29,7 @@ namespace Oyster std::wstring modelPath, texturePath; int BytesUsed; }; + typedef void* Texture; static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); #ifdef _DEBUG @@ -51,6 +52,13 @@ namespace Oyster static void RenderScene(Oyster::Graphics::Model::Model models[], int count); //! @brief Renders a single model static void RenderModel(Oyster::Graphics::Model::Model& model); + + //! @brief Configures Renderer to process 2D graphics, data will be passed in to EndFrame() + static void StartGuiRender(); + + //! @brief Renders a single GUI element using the texture provided and the Pos in the upper right corner, %based system + static void RenderGuiElement(Texture, Math::Float2 Pos, Math::Float2 Size); + //! @brief Performs light calculations, post effects and presents the scene static void EndFrame(); @@ -59,6 +67,8 @@ namespace Oyster //! @brief deletes a model and relases the models resources static void DeleteModel(Oyster::Graphics::Model::Model* model); + static Texture CreateTexture(std::wstring filename); + //! @brief adds a light to the scene static void AddLight(Definitions::Pointlight light); //! @brief removes all lights from the scene diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj b/Code/OysterGraphics/OysterGraphics.vcxproj index f0bcb60b..5d92df15 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj +++ b/Code/OysterGraphics/OysterGraphics.vcxproj @@ -182,6 +182,7 @@ + @@ -193,6 +194,7 @@ + diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.filters b/Code/OysterGraphics/OysterGraphics.vcxproj.filters index d53ddc07..67e2ce46 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.filters +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.filters @@ -51,6 +51,9 @@ Source Files + + Source Files + @@ -86,6 +89,9 @@ Header Files + + Header Files + diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.cpp b/Code/OysterGraphics/Render/Rendering/GuiRender.cpp new file mode 100644 index 00000000..923f7123 --- /dev/null +++ b/Code/OysterGraphics/Render/Rendering/GuiRender.cpp @@ -0,0 +1,44 @@ +#include "GuiRender.h" + +namespace Oyster +{ + namespace Graphics + { + namespace Render + { + namespace Rendering + { + void Gui::BeginRender() + { + } + + void Gui::Render(ID3D11Texture2D* tex,Math::Float2 pos, Math::Float2 size) + { + //Oyster::Core::DeviceContext->PSSetShaderResources(0,1,&srv); + + //Pos.x -= instance.sizeX/2; + //Pos.x += size.x/2; + + //Pos.y -= instance.sizeY/2; + //Pos.y += size.y/2; + + //Matrix m; + //m = Math::Matrix::identity; + //float width = (1.0f/(instance.sizeX/2.0f)); + //float height = (1.0f/(instance.sizeY/2.0f)); + //m.m41=Pos.x * width; + //m.m42=-Pos.y * height; + //m.m43=Pos.z; + //m.m11=width*size.x/2; + //m.m22=height*size.y/2; + + //void* dest = Resources::Buffers::CBufferGs.Map(); + //memcpy(dest,&m.GetTranspose(),64); + //Resources::Buffers::CBufferGs.Unmap(); + + //Oyster::Core::DeviceContext->Draw(1,0); + } + } + } + } +} \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Rendering/GuiRender.h b/Code/OysterGraphics/Render/Rendering/GuiRender.h new file mode 100644 index 00000000..1d343f32 --- /dev/null +++ b/Code/OysterGraphics/Render/Rendering/GuiRender.h @@ -0,0 +1,22 @@ +#pragma once + +#include "../../Core/Core.h" + +namespace Oyster +{ + namespace Graphics + { + namespace Render + { + namespace Rendering + { + class Gui + { + public: + static void BeginRender(); + static void Render(ID3D11Texture2D* tex, Math::Float2 pos, Math::Float2 size); + }; + } + } + } +} \ No newline at end of file diff --git a/Code/OysterGraphics/Render/Resources/Deffered.cpp b/Code/OysterGraphics/Render/Resources/Deffered.cpp index c922a826..e897e0fa 100644 --- a/Code/OysterGraphics/Render/Resources/Deffered.cpp +++ b/Code/OysterGraphics/Render/Resources/Deffered.cpp @@ -337,6 +337,7 @@ namespace Oyster Resources::Deffered::AnimationData.~Buffer(); Resources::Deffered::LightConstantsData.~Buffer(); Resources::Deffered::PointLightsData.~Buffer(); + GuiData.~Buffer(); SAFE_RELEASE(Resources::Deffered::PointLightView); SAFE_RELEASE(Deffered::SSAOKernel); SAFE_RELEASE(Deffered::SSAORandom); @@ -367,6 +368,8 @@ namespace Oyster } SAFE_DELETE_ARRAY(GeometryPass.RenderStates.SampleState); + + SAFE_RELEASE(GuiPass.IAStage.Layout); } } } diff --git a/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj b/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj deleted file mode 100644 index 53ffc005..00000000 --- a/Code/OysterGraphics/~AutoRecover.OysterGraphics.vcxproj +++ /dev/null @@ -1,287 +0,0 @@ - - - - - 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