From 013546f07676c4b2054dc31a43b4e85a91a2654a Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Mon, 17 Feb 2014 12:02:18 +0100 Subject: [PATCH 01/14] minor edit --- Code/Game/GameClient/GameClientState/GameState.cpp | 4 ++++ Code/Game/GameClient/GameClientState/SharedStateContent.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 349eaaeb..1691a470 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -16,6 +16,10 @@ struct GameState::MyData GameClientState::ClientState nextState; NetworkClient *nwClient; InputClass *input; + + ::std::map> *staticObjects; + ::std::map> *dynamicObjects; + } privData; GameState::GameState() diff --git a/Code/Game/GameClient/GameClientState/SharedStateContent.h b/Code/Game/GameClient/GameClientState/SharedStateContent.h index 567be2fa..2fabb1ac 100644 --- a/Code/Game/GameClient/GameClientState/SharedStateContent.h +++ b/Code/Game/GameClient/GameClientState/SharedStateContent.h @@ -19,7 +19,8 @@ namespace DanBias { namespace Client struct SharedStateContent { public: - ::std::map> scene; + ::std::map> staticObjects; + ::std::map> dynamicObjects; ::Oyster::Network::NetworkClient *network; InputClass* input; }; From 51a856958527e490f1afb47ce33e3de16cd85cbc Mon Sep 17 00:00:00 2001 From: lanariel Date: Mon, 17 Feb 2014 13:05:35 +0100 Subject: [PATCH 02/14] Color is now Float4 with RGBA --- .../GameClientState/Buttons/ButtonEllipse.h | 8 ++++---- .../GameClientState/Buttons/ButtonRectangle.h | 8 ++++---- .../GameClientState/Buttons/EventButtonGUI.h | 14 +++++++------- .../GameClient/GameClientState/Buttons/TextField.h | 4 ++-- .../GameClient/GameClientState/LanMenuState.cpp | 6 +++--- .../GameClient/GameClientState/LobbyAdminState.cpp | 2 +- .../Game/GameClient/GameClientState/LobbyState.cpp | 2 +- Code/Game/GameClient/GameClientState/MainState.cpp | 6 +++--- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 4 ++-- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 4 ++-- Code/OysterGraphics/Render/GuiRenderer.cpp | 8 ++++---- Code/OysterGraphics/Render/GuiRenderer.h | 4 ++-- Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl | 2 +- Code/OysterGraphics/Shader/Passes/2D/Header.hlsli | 2 +- 14 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/Buttons/ButtonEllipse.h b/Code/Game/GameClient/GameClientState/Buttons/ButtonEllipse.h index 694683e7..7d9a9a5d 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/ButtonEllipse.h +++ b/Code/Game/GameClient/GameClientState/Buttons/ButtonEllipse.h @@ -21,19 +21,19 @@ namespace DanBias ButtonEllipse() : EventButtonGUI(), radius(0) {} - ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize) {} - ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize) {} - ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize) {} - ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize) {} diff --git a/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h b/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h index 6afb77c1..f4dd69e1 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h +++ b/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h @@ -21,19 +21,19 @@ namespace DanBias ButtonRectangle() : EventButtonGUI(), width(0), height(0) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize) {} diff --git a/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h b/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h index c770cb9c..ee22fe26 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h +++ b/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h @@ -33,30 +33,30 @@ namespace DanBias { public: EventButtonGUI() - : EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(0, 0, 0) + : EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(1, 1, 1, 1) {} - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) : EventButton(func, owner, userData), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); @@ -79,7 +79,7 @@ namespace DanBias if(EventButton::Enabled()) { // let the using dev decide what is rendered - Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f)); + Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float4(1.0f, 1.0f, 1.0f, 1.0f)); //Render att xPos and yPos //With width and height @@ -127,7 +127,7 @@ namespace DanBias Oyster::Graphics::API::Texture texture; std::wstring buttonText; - Oyster::Math::Float3 textColor; + Oyster::Math::Float4 textColor; }; } } diff --git a/Code/Game/GameClient/GameClientState/Buttons/TextField.h b/Code/Game/GameClient/GameClientState/Buttons/TextField.h index af9c4346..c1fa79ac 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/TextField.h +++ b/Code/Game/GameClient/GameClientState/Buttons/TextField.h @@ -20,7 +20,7 @@ namespace DanBias { namespace Client { public: TextField(); - TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height ); + TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height ); virtual ~TextField(); virtual void RenderText(); @@ -62,7 +62,7 @@ namespace DanBias { namespace Client } template - TextField::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize ) + TextField::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize ) : ButtonRectangle( backgroundTexture, L"", textColor, owner, pos, size, resize ) { this->fontHeight = 0.025f; diff --git a/Code/Game/GameClient/GameClientState/LanMenuState.cpp b/Code/Game/GameClient/GameClientState/LanMenuState.cpp index 6a836a36..ba8aee42 100644 --- a/Code/Game/GameClient/GameClientState/LanMenuState.cpp +++ b/Code/Game/GameClient/GameClientState/LanMenuState.cpp @@ -56,7 +56,7 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient) this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); // create guiElements - this->privData->connectIP = new TextField( L"earth_md.png", Float3(1.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None ); + this->privData->connectIP = new TextField( L"earth_md.png", Float4(1.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None ); this->privData->connectIP->ReserveLines( 1 ); this->privData->connectIP->AppendText( L"127.0.0.1" ); this->privData->connectIP->SetFontHeight( 0.08f ); @@ -66,10 +66,10 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient) this->privData->guiElements.AddButton( this->privData->connectIP ); ButtonRectangle *guiElements; - guiElements = new ButtonRectangle( L"earth_md.png", L"Connect", Float3(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); + guiElements = new ButtonRectangle( L"earth_md.png", L"Connect", Float4(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); this->privData->guiElements.AddButton( guiElements ); - guiElements = new ButtonRectangle( L"earth_md.png", L"Exit", Float3(1.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); + guiElements = new ButtonRectangle( L"earth_md.png", L"Exit", Float4(1.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); this->privData->guiElements.AddButton( guiElements ); // bind guiElements collection to the singleton eventhandler diff --git a/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp b/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp index c157226e..b2349c2b 100644 --- a/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp +++ b/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp @@ -48,7 +48,7 @@ bool LobbyAdminState::Init(NetworkClient* nwClient) // create buttons ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", L"Ready", Float3(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"earth_md.png", L"Ready", Float4(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler diff --git a/Code/Game/GameClient/GameClientState/LobbyState.cpp b/Code/Game/GameClient/GameClientState/LobbyState.cpp index 47a3cebb..cbfc7eed 100644 --- a/Code/Game/GameClient/GameClientState/LobbyState.cpp +++ b/Code/Game/GameClient/GameClientState/LobbyState.cpp @@ -48,7 +48,7 @@ bool LobbyState::Init(NetworkClient* nwClient) // create buttons ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", L"Ready", Float3(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"earth_md.png", L"Ready", Float4(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler diff --git a/Code/Game/GameClient/GameClientState/MainState.cpp b/Code/Game/GameClient/GameClientState/MainState.cpp index 81794252..ef4b844a 100644 --- a/Code/Game/GameClient/GameClientState/MainState.cpp +++ b/Code/Game/GameClient/GameClientState/MainState.cpp @@ -52,13 +52,13 @@ bool MainState::Init( NetworkClient* nwClient ) // create buttons ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", L"Create", Float3(1.0f), OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"earth_md.png", L"Create", Float4(1.0f), OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); - button = new ButtonRectangle( L"skysphere_md.png", L"Join", Float3(1.0f), OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"skysphere_md.png", L"Join", Float4(1.0f), OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); - button = new ButtonRectangle( L"plane_texture_md.png", L"Quit", Float3(1.0f), OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"plane_texture_md.png", L"Quit", Float4(1.0f), OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index f3bd12fd..f4ce303f 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -161,7 +161,7 @@ namespace Oyster Render::Gui::Begin2DRender(); } - void API::RenderGuiElement(API::Texture tex, Math::Float3 pos, Math::Float2 size, Math::Float3 color) + void API::RenderGuiElement(API::Texture tex, Math::Float3 pos, Math::Float2 size, Math::Float4 color) { Render::Gui::Render((ID3D11ShaderResourceView*)tex,pos,size,color); } @@ -196,7 +196,7 @@ namespace Oyster Render::Gui::Begin2DTextRender(); } - void API::RenderText(std::wstring text, Math::Float3 Pos, Math::Float2 Size, float FontSize, Math::Float3 color) + void API::RenderText(std::wstring text, Math::Float3 Pos, Math::Float2 Size, float FontSize, Math::Float4 color) { Render::Gui::RenderText(text, Pos, Size, FontSize, color); } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index e2cea318..eea53939 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -57,13 +57,13 @@ namespace Oyster static void StartGuiRender(); //! @brief Renders a single GUI element using the texture provided and the Pos in the center, %based system - static void RenderGuiElement(Texture, Math::Float3 Pos, Math::Float2 Size, Math::Float3 Color = Math::Float3(1,1,1)); + static void RenderGuiElement(Texture, Math::Float3 Pos, Math::Float2 Size, Math::Float4 Color = Math::Float4(1,1,1,1)); //! @brief Configures Renderer to process 2D Text, data will be passed in to EndFrame() static void StartTextRender(); //! @brief Renders a single GUI string using the texture provided and the Pos in the center, %based system - static void RenderText(std::wstring, Math::Float3 Pos, Math::Float2 Size, float FontSize, Math::Float3 Color = Math::Float3(1,1,1)); + static void RenderText(std::wstring, Math::Float3 Pos, Math::Float2 Size, float FontSize, Math::Float4 Color = Math::Float4(1,1,1,1)); //! @brief Performs light calculations, post effects and presents the scene static void EndFrame(); diff --git a/Code/OysterGraphics/Render/GuiRenderer.cpp b/Code/OysterGraphics/Render/GuiRenderer.cpp index 8eda0bf5..b17fdfef 100644 --- a/Code/OysterGraphics/Render/GuiRenderer.cpp +++ b/Code/OysterGraphics/Render/GuiRenderer.cpp @@ -16,7 +16,7 @@ namespace Oyster Core::PipelineManager::SetRenderPass(Render::Resources::Gui::Pass); } - void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float3 pos, Math::Float2 size, Math::Float3 color) + void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float3 pos, Math::Float2 size, Math::Float4 color) { Core::deviceContext->PSSetShaderResources(0,1,&tex); @@ -37,7 +37,7 @@ namespace Oyster Render::Resources::Gui::Data.Unmap(); data = Render::Resources::Color.Map(); - memcpy(data,&color,sizeof(Math::Float3)); + memcpy(data,&color,sizeof(Math::Float4)); Render::Resources::Color.Unmap(); @@ -50,7 +50,7 @@ namespace Oyster Core::PipelineManager::SetRenderPass(Resources::Gui::Text::Pass); } - void Gui::RenderText(std::wstring text, Math::Float3 pos, Math::Float2 size, float FontSize, Math::Float3 color) + void Gui::RenderText(std::wstring text, Math::Float3 pos, Math::Float2 size, float FontSize, Math::Float4 color) { //size.x = size.x / (text.length() * TEXT_SPACING /2); @@ -81,7 +81,7 @@ namespace Oyster Definitions::Text2D tmpInst; data = Render::Resources::Color.Map(); - memcpy(data,&color,sizeof(Math::Float3)); + memcpy(data,&color,sizeof(Math::Float4)); Render::Resources::Color.Unmap(); void* dest = Resources::Gui::Text::Vertex.Map(); diff --git a/Code/OysterGraphics/Render/GuiRenderer.h b/Code/OysterGraphics/Render/GuiRenderer.h index 3e4a8de0..64d6fdd3 100644 --- a/Code/OysterGraphics/Render/GuiRenderer.h +++ b/Code/OysterGraphics/Render/GuiRenderer.h @@ -12,9 +12,9 @@ namespace Oyster { public: static void Begin2DRender(); - static void Render(ID3D11ShaderResourceView* tex, Math::Float3 pos, Math::Float2 size, Math::Float3 tint = Math::Float3(1,1,1)); + static void Render(ID3D11ShaderResourceView* tex, Math::Float3 pos, Math::Float2 size, Math::Float4 tint = Math::Float4(1,1,1,1)); static void Begin2DTextRender(); - static void RenderText(std::wstring text, Math::Float3 pos, Math::Float2 size, float FontSize, Math::Float3 tint = Math::Float3(1,1,1)); + static void RenderText(std::wstring text, Math::Float3 pos, Math::Float2 size, float FontSize, Math::Float4 tint = Math::Float4(1,1,1,1)); }; } } diff --git a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl index c28fd642..0c8d3c68 100644 --- a/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl +++ b/Code/OysterGraphics/Shader/Passes/2D/2DPixel.hlsl @@ -2,5 +2,5 @@ float4 main(Pixel2DIn input) : SV_Target0 { - return Material.Sample(LinearSampler,input.Uv) * float4(Color,1); + return Material.Sample(LinearSampler,input.Uv) * Color; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli b/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli index 4b507644..f84483f5 100644 --- a/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli +++ b/Code/OysterGraphics/Shader/Passes/2D/Header.hlsli @@ -10,7 +10,7 @@ cbuffer EveryObject2D : register(b0) cbuffer ColorData : register(b0) { - float3 Color; + float4 Color; }; struct Pixel2DIn From b93e20e9423a59682f8e70aac18feb45a9b6e14f Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Mon, 17 Feb 2014 14:33:11 +0100 Subject: [PATCH 03/14] Bunch of implementations --- .../GameClient/GameClientState/GameState.cpp | 413 ++++++------------ .../GameClient/GameClientState/GameState.h | 29 +- .../GameClientState/LanMenuState.cpp | 4 +- .../GameClientState/NetLoadState.cpp | 89 +++- .../GameClientState/SharedStateContent.h | 6 +- 5 files changed, 234 insertions(+), 307 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 1691a470..29cfec03 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -5,10 +5,16 @@ #include "Camera_FPS.h" #include +#include "C_obj/C_Player.h" +#include "C_obj/C_DynamicObj.h" +#include "C_obj/C_StaticObj.h" + using namespace ::DanBias::Client; using namespace ::Oyster; using namespace ::Oyster::Network; using namespace ::Oyster::Math3D; +using namespace ::GameLogic; +using namespace ::Utility::DynamicMemory; struct GameState::MyData { @@ -17,17 +23,26 @@ struct GameState::MyData NetworkClient *nwClient; InputClass *input; - ::std::map> *staticObjects; - ::std::map> *dynamicObjects; + ::std::map> *staticObjects; + ::std::map> *dynamicObjects; + + bool key_forward; + bool key_backward; + bool key_strafeRight; + bool key_strafeLeft; + bool key_Shoot; + bool key_Jump; + + C_Player player; + Camera_FPS camera; + + int myId; } privData; GameState::GameState() { - key_forward = false; - key_backward = false; - key_strafeRight = false; - key_strafeLeft = false; + this->privData = nullptr; } GameState::~GameState() @@ -38,202 +53,69 @@ GameState::~GameState() bool GameState::Init( SharedStateContent &shared ) { - // load models - privData = new MyData(); + // we may assume that shared.network is properly connected + // and there is content in shared.dynamicObjects and shared.staticObjects + + this->privData = new MyData(); + + this->privData->key_forward = false; + this->privData->key_backward = false; + this->privData->key_strafeRight = false; + this->privData->key_strafeLeft = false; this->privData->nextState = GameClientState::ClientState_Same; this->privData->nwClient = shared.network; this->privData->input = shared.input; - - LoadGame(); + this->privData->staticObjects = &shared.staticObjects; + this->privData->dynamicObjects = &shared.dynamicObjects; //tell server ready - this->privData->nwClient->Send( GameLogic::Protocol_General_Status(GameLogic::Protocol_General_Status::States_ready) ); + this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); return true; } -GameState::gameStateState GameState::LoadGame() +void GameState::InitiatePlayer( int id, std::wstring modelName, Float4x4 world ) { - - return gameStateState_playing; -} - -bool GameState::LoadModels(std::string mapFile) -{ - GameLogic::LevelLoader levelLoader; - std::vector> objects; - objects = levelLoader.LoadLevel(mapFile); - - int objCount = objects.size(); - int modelId = 0; - ModelInitData modelData; - for (int i = 0; i < objCount; i++) - { - GameLogic::ObjectTypeHeader* obj = objects.at(i); - - switch (obj->typeID) - { - case GameLogic::ObjectType::ObjectType_LevelMetaData: - - break; - case GameLogic::ObjectType::ObjectType_Static: - { - GameLogic::ObjectHeader* staticObjData = ((GameLogic::ObjectHeader*)obj); - - modelData.modelPath.assign(staticObjData->ModelFile.begin(), staticObjData->ModelFile.end()); - modelData.visible = true; - //modelData.position = ; - //modelData.rotation = Quaternion(Float3(2,2,-2), 1); - //modelData.scale = Float3(2,2,2); - modelData.id = modelId++; - - this->staticObjects.Push(new C_StaticObj()); - this->staticObjects[this->staticObjects.Size() -1 ]->Init(modelData); - } - break; - case GameLogic::ObjectType::ObjectType_Dynamic: - { - GameLogic::ObjectHeader* dynamicObjData = ((GameLogic::ObjectHeader*)obj); - //modelData.position = ; - //modelData.rotation = Quaternion(Float3(2,2,-2), 1); - //modelData.scale = Float3(2,2,2); - modelData.modelPath.assign(dynamicObjData->ModelFile.begin(), dynamicObjData->ModelFile.end()); - modelData.visible = true; - modelData.id = modelId++; - - this->dynamicObjects.Push(new C_DynamicObj()); - this->dynamicObjects[this->dynamicObjects.Size() -1 ]->Init(modelData); - } - break; - case GameLogic::ObjectType::ObjectType_Light: - { - GameLogic::BasicLight* lightData = ((GameLogic::BasicLight*)obj); - - switch( lightData->lightType ) - { - case GameLogic::LightType_PointLight: - { - //Oyster::Graphics::Definitions::Pointlight plight; - //plight.Pos = ((GameLogic::PointLight*)lightData)->position; - //plight.Color = lightData->diffuseColor; - //plight.Radius = 100; - //plight.Bright = 0.9f; - //Oyster::Graphics::API::AddLight(plight); - } - break; - default: break; - } - } - break; - default: - break; - } - } - myId += modelId++; - // add player model - //modelData.position = ; - //modelData.rotation = Quaternion(Float3(2,2,-2), 1); - //modelData.scale = Float3(2,2,2); - - - modelData.visible = true; - modelData.modelPath = L"char_still_sizeref.dan"; - modelData.id = myId; - // load models - this->dynamicObjects.Push(new C_DynamicObj()); - this->dynamicObjects[this->dynamicObjects.Size() -1 ]->Init(modelData); - - /*C_Player* obj = new C_Player(); - privData->object.push_back(obj); - privData->object[privData->object.size() -1 ]->Init(modelData); - */ - return true; - -} - -bool GameState::InitCamera(Float3 startPos) -{ - camera.SetHeadOffset( Float3(0.0f, 1.0f, 1.0f) ); - camera.SetPerspectiveProjection( pi / 4.0f, 1024.0f/768.0f, 1.0f, 1000.0f ); - camera.UpdateOrientation(); - Oyster::Graphics::API::SetProjection(camera.GetProjectionMatrix()); - - return true; -} - -void GameState::InitiatePlayer(int id, std::wstring modelName, Float4x4 world) -{ - myId = id; + this->privData->myId = id; ModelInitData modelData; - C_Object* obj; modelData.visible = true; - //modelData.world = world; modelData.position = Float3(world[12], world[13], world[14]); modelData.rotation = Quaternion(Float3(0,0,0), 1); modelData.scale = Float3(1,1,1); modelData.modelPath = modelName; - modelData.id = myId; - - obj = new C_Player(); - this->dynamicObjects.Push(obj); - this->dynamicObjects[this->dynamicObjects.Size() -1 ]->Init(modelData); + modelData.id = this->privData->myId; + this->privData->player.Init( modelData ); - Float3 pos = Float3(world[12], world[13], world[14]); - - camera.SetPosition( pos ); - camera.UpdateOrientation(); + this->privData->camera.SetPosition( this->privData->player.getPos() ); + this->privData->camera.UpdateOrientation(); } GameClientState::ClientState GameState::Update( float deltaTime ) { - //switch (privData->state) - //{ - //case gameStateState_loading: //Will this ever happen in this scope?? - // { - // // load map - // // wait for all players - // LoadGame(); - // GameLogic::Protocol_General_Status gameStatus; - // gameStatus.status = GameLogic::Protocol_General_Status::States_ready; - // privData->nwClient->Send(gameStatus); - // privData->state = gameStateState_playing; - // } - // break; - //case gameStateState_playing: - // // read server data - // // update objects - // { - // readKeyInput(KeyInput); - // camera.UpdateOrientation(); - // } - // break; - //case gameStateState_end: - // return ClientState_Lobby; - // break; - //default: - // break; - //} - // - //// send key input to server. - //return ClientState_Same; - return this->privData->nextState; } bool GameState::Render() { - Oyster::Graphics::API::SetView( camera.GetViewMatrix() ); + Oyster::Graphics::API::SetView( this->privData->camera.GetViewMatrix() ); Oyster::Graphics::API::NewFrame(); - for (unsigned int i = 0; i < staticObjects.Size(); i++) + + // for debugging to be replaced with render weapon + this->privData->player.Render(); + + auto staticObject = this->privData->staticObjects->begin(); + for( ; staticObject != this->privData->staticObjects->end(); ++staticObject ) { - staticObjects[i]->Render(); + staticObject->second->Render(); } - for (unsigned int i = 0; i < dynamicObjects.Size(); i++) + + auto dynamicObject = this->privData->dynamicObjects->begin(); + for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject ) { - dynamicObjects[i]->Render(); + dynamicObject->second->Render(); } Oyster::Graphics::API::EndFrame(); @@ -242,8 +124,25 @@ bool GameState::Render() bool GameState::Release() { + if( privData ) + { + auto staticObject = this->privData->staticObjects->begin(); + for( ; staticObject != this->privData->staticObjects->end(); ++staticObject ) + { + staticObject->second = nullptr; + } - privData = NULL; + auto dynamicObject = this->privData->dynamicObjects->begin(); + for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject ) + { + dynamicObject->second = nullptr; + } + + this->privData->staticObjects->clear(); + this->privData->dynamicObjects->clear(); + + privData = NULL; + } return true; } @@ -252,138 +151,119 @@ void GameState::ChangeState( ClientState next ) this->privData->nextState = next; } -void GameState::readKeyInput(InputClass* KeyInput) +void GameState::ReadKeyInput() { - if(KeyInput->IsKeyPressed(DIK_W)) + if( this->privData->input->IsKeyPressed(DIK_W) ) { - if(!key_forward) + if(!this->privData->key_forward) { - privData->nwClient->Send(GameLogic::Protocol_PlayerMovementForward()); - key_forward = true; + this->privData->nwClient->Send( Protocol_PlayerMovementForward() ); + this->privData->key_forward = true; } } else - key_forward = false; + this->privData->key_forward = false; - if(KeyInput->IsKeyPressed(DIK_S)) + if( this->privData->input->IsKeyPressed(DIK_S) ) { - if(!key_backward) + if( !this->privData->key_backward ) { - privData->nwClient->Send(GameLogic::Protocol_PlayerMovementBackward()); - key_backward = true; + this->privData->nwClient->Send( Protocol_PlayerMovementBackward() ); + this->privData->key_backward = true; } } else - key_backward = false; + this->privData->key_backward = false; - if(KeyInput->IsKeyPressed(DIK_A)) + if( this->privData->input->IsKeyPressed(DIK_A) ) { - if(!key_strafeLeft) + if( !this->privData->key_strafeLeft ) { - privData->nwClient->Send(GameLogic::Protocol_PlayerMovementLeft()); - key_strafeLeft = true; + this->privData->nwClient->Send( Protocol_PlayerMovementLeft() ); + this->privData->key_strafeLeft = true; } } else - key_strafeLeft = false; + this->privData->key_strafeLeft = false; - if(KeyInput->IsKeyPressed(DIK_D)) + if( this->privData->input->IsKeyPressed(DIK_D) ) { - if(!key_strafeRight) + if( !this->privData->key_strafeRight ) { - privData->nwClient->Send(GameLogic::Protocol_PlayerMovementRight()); - key_strafeRight = true; + this->privData->nwClient->Send( Protocol_PlayerMovementRight() ); + this->privData->key_strafeRight = true; } } else - key_strafeRight = false; + this->privData->key_strafeRight = false; //send delta mouse movement - //if (KeyInput->IsMousePressed()) { - camera.YawRight( -KeyInput->GetYaw() ); - camera.PitchUp( KeyInput->GetPitch() ); - camera.UpdateOrientation(); + this->privData->camera.YawRight( -this->privData->input->GetYaw() ); + this->privData->camera.PitchUp( this->privData->input->GetPitch() ); + this->privData->camera.UpdateOrientation(); - GameLogic::Protocol_PlayerLook playerLookDir; - Float4 look = camera.GetLook(); - - privData->nwClient->Send( playerLookDir ); + privData->nwClient->Send( Protocol_PlayerLook(this->privData->camera.GetLook(), this->privData->camera.GetRight()) ); } // shoot - if(KeyInput->IsKeyPressed(DIK_Z)) + if( this->privData->input->IsKeyPressed(DIK_Z) ) { - if(!key_Shoot) + if( !this->privData->key_Shoot ) { - GameLogic::Protocol_PlayerShot playerShot; + Protocol_PlayerShot playerShot; playerShot.primaryPressed = true; playerShot.secondaryPressed = false; playerShot.utilityPressed = false; - privData->nwClient->Send(playerShot); - key_Shoot = true; + this->privData->nwClient->Send( playerShot ); + this->privData->key_Shoot = true; } } else - key_Shoot = false; - if(KeyInput->IsKeyPressed(DIK_X)) + this->privData->key_Shoot = false; + if( this->privData->input->IsKeyPressed(DIK_X) ) { - if(!key_Shoot) + if( !this->privData->key_Shoot ) { - GameLogic::Protocol_PlayerShot playerShot; + Protocol_PlayerShot playerShot; playerShot.primaryPressed = false; playerShot.secondaryPressed = true; playerShot.utilityPressed = false; - privData->nwClient->Send(playerShot); - key_Shoot = true; + this->privData->nwClient->Send( playerShot ); + this->privData->key_Shoot = true; } } else - key_Shoot = false; - if(KeyInput->IsKeyPressed(DIK_C)) + this->privData->key_Shoot = false; + if( this->privData->input->IsKeyPressed(DIK_C) ) { - if(!key_Shoot) + if( !this->privData->key_Shoot ) { - GameLogic::Protocol_PlayerShot playerShot; + Protocol_PlayerShot playerShot; playerShot.primaryPressed = false; playerShot.secondaryPressed = false; playerShot.utilityPressed = true; - privData->nwClient->Send(playerShot); - key_Shoot = true; + this->privData->nwClient->Send( playerShot ); + this->privData->key_Shoot = true; } } else - key_Shoot = false; + this->privData->key_Shoot = false; // jump - if(KeyInput->IsKeyPressed(DIK_SPACE)) + if( this->privData->input->IsKeyPressed(DIK_SPACE) ) { - if(!key_Jump) + if(!this->privData->key_Jump) { - privData->nwClient->Send(GameLogic::Protocol_PlayerJump()); - key_Jump = true; + this->privData->nwClient->Send( Protocol_PlayerJump() ); + this->privData->key_Jump = true; } } else - key_Jump = false; + this->privData->key_Jump = false; - // send event data - // - //if(KeyInput->IsKeyPressed(DIK_L)) - // privData->state = GameState::gameStateState_end; -} - -using namespace ::Oyster::Network; -using namespace ::Utility::DynamicMemory; - -// returns -1 if none found -int FindObject( const DynamicArray> &collection, int id ) -{ - int num = collection.Size(); - for( int i = 0; i < num; ++i ) if( id == collection[i]->GetId() ) - return i; - return -1; + // TODO: implement sub-menu } void GameState::DataRecieved( NetEvent e ) @@ -400,76 +280,67 @@ void GameState::DataRecieved( NetEventmyId == decoded.object_ID ) - camera.SetPosition( decoded.position ); + if( this->privData->myId == decoded.object_ID ) + this->privData->camera.SetPosition( decoded.position ); - int i = FindObject( this->dynamicObjects, decoded.object_ID ); - if( i > -1 ) - this->dynamicObjects[i]->setPos( decoded.position ); + (*this->privData->dynamicObjects)[decoded.object_ID]->setPos( decoded.position ); } break; case protocol_Gameplay_ObjectScale: { - GameLogic::Protocol_ObjectScale decoded(data); - int i = FindObject( this->dynamicObjects, decoded.object_ID ); - if( i > -1 ) - this->dynamicObjects[i]->setScale( decoded.scale ); + Protocol_ObjectScale decoded(data); + (*this->privData->dynamicObjects)[decoded.object_ID]->setScale( decoded.scale ); } break; case protocol_Gameplay_ObjectRotation: { - GameLogic::Protocol_ObjectRotation decoded(data); + Protocol_ObjectRotation decoded(data); Quaternion rotation = Quaternion( Float3(decoded.rotationQ), decoded.rotationQ[3] ); // if is this player. Remember to change camera - if( this->myId == decoded.object_ID ) - camera.SetAngular( AngularAxis(rotation) ); + if( this->privData->myId == decoded.object_ID ) + this->privData->camera.SetAngular( AngularAxis(rotation) ); - int i = FindObject( this->dynamicObjects, decoded.object_ID ); - if( i > -1 ) - this->dynamicObjects[i]->setRot( rotation ); + (*this->privData->dynamicObjects)[decoded.object_ID]->setRot( rotation ); } break; case protocol_Gameplay_ObjectPositionRotation: { - GameLogic::Protocol_ObjectPositionRotation decoded(data); + Protocol_ObjectPositionRotation decoded(data); Float3 position = decoded.position; Quaternion rotation = Quaternion( Float3(decoded.rotationQ), decoded.rotationQ[3] ); // if is this player. Remember to change camera - if( this->myId == decoded.object_ID ) + if( this->privData->myId == decoded.object_ID ) { - camera.SetPosition( position ); - camera.SetAngular( AngularAxis(rotation) ); + this->privData->camera.SetPosition( position ); + this->privData->camera.SetAngular( AngularAxis(rotation) ); } - int i = FindObject( this->dynamicObjects, decoded.object_ID ); - if( i > -1 ) - { - this->dynamicObjects[i]->setPos( position ); - this->dynamicObjects[i]->setRot( rotation ); - } + C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID]; + object->setPos( position ); + object->setRot( rotation ); } break; case protocol_Gameplay_ObjectEnabled: break; /** @todo TODO: implement */ case protocol_Gameplay_ObjectDisabled: { - GameLogic::Protocol_ObjectDisable decoded(data); + Protocol_ObjectDisable decoded(data); - int i = FindObject( this->dynamicObjects, decoded.objectID ); - if( i > -1 ) + auto object = this->privData->dynamicObjects->find( decoded.objectID ); + if( object != this->privData->dynamicObjects->end() ) { - this->dynamicObjects[i].Release(); - this->dynamicObjects.Pop(i); + object->second = nullptr; + this->privData->dynamicObjects->erase( object ); } } break; case protocol_Gameplay_ObjectCreate: { - GameLogic::Protocol_ObjectCreate decoded(data); + Protocol_ObjectCreate decoded(data); C_DynamicObj* object = new C_DynamicObj(); ModelInitData modelData; @@ -484,7 +355,7 @@ void GameState::DataRecieved( NetEventInit(modelData); - dynamicObjects.Push(object); + (*this->privData->dynamicObjects)[decoded.object_ID] = object; } break; diff --git a/Code/Game/GameClient/GameClientState/GameState.h b/Code/Game/GameClient/GameClientState/GameState.h index 5a3b3c1a..29ea2f1e 100644 --- a/Code/Game/GameClient/GameClientState/GameState.h +++ b/Code/Game/GameClient/GameClientState/GameState.h @@ -4,13 +4,6 @@ #include "OysterMath.h" #include -#include "Camera_FPS.h" -#include "LevelLoader/LevelLoader.h" -#include "C_obj/C_Player.h" -#include "C_obj/C_DynamicObj.h" -#include "C_obj/C_StaticObj.h" -#include "DynamicArray.h" - namespace DanBias { namespace Client { class GameState : public GameClientState @@ -27,12 +20,8 @@ namespace DanBias { namespace Client ~GameState(void); bool Init( SharedStateContent &shared ); GameClientState::ClientState Update( float deltaTime ) override; - - bool LoadModels(std::string mapFile); - bool InitCamera(Oyster::Math::Float3 startPos) ; - void InitiatePlayer(int id, std::wstring modelName, Oyster::Math::Float4x4 world); - gameStateState LoadGame(); - void readKeyInput(InputClass* KeyInput); + void InitiatePlayer( int id, std::wstring modelName, Oyster::Math::Float4x4 world ); + void ReadKeyInput(); bool Render()override; bool Release()override; @@ -43,20 +32,6 @@ namespace DanBias { namespace Client private: struct MyData; ::Utility::DynamicMemory::UniquePointer privData; - - bool key_forward; - bool key_backward; - bool key_strafeRight; - bool key_strafeLeft; - bool key_Shoot; - bool key_Jump; - Camera_FPS camera; - - int myId; - - Utility::DynamicMemory::DynamicArray> staticObjects; - Utility::DynamicMemory::DynamicArray> dynamicObjects; - //Utility::DynamicMemory::DynamicArray> playObjects; }; } } #endif \ No newline at end of file diff --git a/Code/Game/GameClient/GameClientState/LanMenuState.cpp b/Code/Game/GameClient/GameClientState/LanMenuState.cpp index 3051c097..0615f209 100644 --- a/Code/Game/GameClient/GameClientState/LanMenuState.cpp +++ b/Code/Game/GameClient/GameClientState/LanMenuState.cpp @@ -123,8 +123,8 @@ void LanMenuState::ChangeState( ClientState next ) { case GameClientState::ClientState_Lobby: // attempt to connect to lobby - //if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) ) - // return; // TODO: temporary commented out + if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) ) + return; break; default: break; } diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index 3463182e..8274472d 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -1,13 +1,18 @@ #include "NetLoadState.h" #include "NetworkClient.h" #include "OysterMath.h" -#include "../Game/GameProtocols/Protocols.h" +#include "Protocols.h" +#include "LevelLoader\LevelLoader.h" +#include "Utilities.h" +#include "C_obj\C_StaticObj.h" +#include "C_obj\C_DynamicObj.h" using namespace ::DanBias::Client; using namespace ::Oyster; using namespace ::Oyster::Math; using namespace ::Oyster::Network; using namespace ::GameLogic; +using namespace ::Utility::String; struct NetLoadState::MyData { @@ -16,9 +21,17 @@ struct NetLoadState::MyData GameClientState::ClientState nextState; NetworkClient *nwClient; Graphics::API::Texture background; + ::std::map> *staticObjects; + ::std::map> *dynamicObjects; + bool loading; }; +inline Quaternion ArrayToQuaternion( float source[4] ) +{ + return Quaternion( Float3(source[0], source[1], source[2]), source[3] ); +} + NetLoadState::NetLoadState(void) {} NetLoadState::~NetLoadState(void) @@ -31,9 +44,12 @@ bool NetLoadState::Init( SharedStateContent &shared ) { this->privData = new MyData(); - this->privData->nextState = GameClientState::ClientState_Same; - this->privData->nwClient = shared.network; - this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); + this->privData->nextState = GameClientState::ClientState_Same; + this->privData->nwClient = shared.network; + this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); + this->privData->dynamicObjects = &shared.dynamicObjects; + this->privData->staticObjects = &shared.staticObjects; + this->privData->loading = false; // we may assume that nwClient is properly connected to the server @@ -82,6 +98,7 @@ void NetLoadState::DataRecieved( NetEventprivData->loading ) { this->LoadGame( Protocol_LobbyCreateGame(e.args.data.protocol).modelName ); + this->ChangeState( ClientState_Game ); } } @@ -89,7 +106,69 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) { this->privData->loading = true; - // TODO: ask Sam about level loader + LevelLoader loader; + auto objects = loader.LoadLevel( fileName ); + auto object = objects.begin(); + ObjectHeader *oh; + + int objectID = 100; // first 100 is reserved for players. This is how the server does it. + + for( ; object != objects.end(); ++object ) + { + ++objectID; + oh = (ObjectHeader*)&*object; + switch( oh->typeID ) + { + case ObjectType::ObjectType_Static: + { + ModelInitData desc; + desc.id = objectID; + StringToWstring( oh->ModelFile, desc.modelPath ); + desc.position = oh->position; + desc.rotation = ArrayToQuaternion( oh->rotation ); + desc.scale = oh->scale; + desc.visible = true; + + C_StaticObj *staticObject = new C_StaticObj(); + if( staticObject->Init( desc ) ) + { + (*this->privData->staticObjects)[objectID] = staticObject; + } + else + { + delete staticObject; + } + } + break; + case ObjectType::ObjectType_Dynamic: + { + ModelInitData desc; + desc.id = objectID; + StringToWstring( oh->ModelFile, desc.modelPath ); + desc.position = oh->position; + desc.rotation = ArrayToQuaternion( oh->rotation ); + desc.scale = oh->scale; + desc.visible = true; + + C_DynamicObj *dynamicObject = new C_DynamicObj(); + if( dynamicObject->Init( desc ) ) + { + (*this->privData->dynamicObjects)[objectID] = dynamicObject; + } + else + { + delete dynamicObject; + } + } + break; + case ObjectType::ObjectType_Light: + { + /* TODO: implement light into the leveformat */ + } + break; + default: break; + } + } this->privData->nextState = ClientState::ClientState_Game; } diff --git a/Code/Game/GameClient/GameClientState/SharedStateContent.h b/Code/Game/GameClient/GameClientState/SharedStateContent.h index 2fabb1ac..da9dc759 100644 --- a/Code/Game/GameClient/GameClientState/SharedStateContent.h +++ b/Code/Game/GameClient/GameClientState/SharedStateContent.h @@ -11,6 +11,8 @@ #include #include "Utilities.h" #include "C_Object.h" +#include "C_obj\C_StaticObj.h" +#include "C_obj\C_DynamicObj.h" #include "NetworkClient.h" #include "L_inputClass.h" @@ -19,8 +21,8 @@ namespace DanBias { namespace Client struct SharedStateContent { public: - ::std::map> staticObjects; - ::std::map> dynamicObjects; + ::std::map> staticObjects; + ::std::map> dynamicObjects; ::Oyster::Network::NetworkClient *network; InputClass* input; }; From 12623d1b167bed917d140030fb371946f2e828d3 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Mon, 17 Feb 2014 16:16:27 +0100 Subject: [PATCH 04/14] Bunch of implementations --- Code/Game/GameClient/DanBiasGame_Impl.cpp | 6 +-- Code/Game/GameClient/GameClient.vcxproj | 8 +-- .../GameClient/GameClientState/GameState.cpp | 50 ++++++++++++++----- .../GameClient/GameClientState/GameState.h | 3 +- .../GameClientState/NetLoadState.cpp | 13 +++-- 5 files changed, 54 insertions(+), 26 deletions(-) diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index 392e917f..81650049 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -99,9 +99,6 @@ namespace DanBias data.timer.reset(); Graphics::API::Update( dt ); - - if(data.networkClient.IsConnected()) - data.networkClient.Update(); data.capFrame += dt; if(data.capFrame > 0.03) @@ -118,6 +115,9 @@ namespace DanBias data.capFrame = 0; } + if(data.networkClient.IsConnected()) + data.networkClient.Update(); + } return DanBiasClientReturn_Success; } diff --git a/Code/Game/GameClient/GameClient.vcxproj b/Code/Game/GameClient/GameClient.vcxproj index a87f61e4..3daafff3 100644 --- a/Code/Game/GameClient/GameClient.vcxproj +++ b/Code/Game/GameClient/GameClient.vcxproj @@ -112,7 +112,7 @@ Windows true %(AdditionalDependencies) - NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;GameClient_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -129,7 +129,7 @@ Windows true %(AdditionalDependencies) - NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + NetworkAPI_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;GameClient_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -150,7 +150,7 @@ true true %(AdditionalDependencies) - NetworkAPI_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;%(DelayLoadDLLs) + NetworkAPI_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;GameClient_$(PlatformShortName).dll;%(DelayLoadDLLs) @@ -171,7 +171,7 @@ true true %(AdditionalDependencies) - NetworkAPI_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;%(DelayLoadDLLs) + NetworkAPI_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;GameClient_$(PlatformShortName).dll;%(DelayLoadDLLs) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 29cfec03..38ded541 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -8,6 +8,7 @@ #include "C_obj/C_Player.h" #include "C_obj/C_DynamicObj.h" #include "C_obj/C_StaticObj.h" +#include "Utilities.h" using namespace ::DanBias::Client; using namespace ::Oyster; @@ -15,6 +16,7 @@ using namespace ::Oyster::Network; using namespace ::Oyster::Math3D; using namespace ::GameLogic; using namespace ::Utility::DynamicMemory; +using namespace ::Utility::String; struct GameState::MyData { @@ -40,6 +42,11 @@ struct GameState::MyData } privData; +inline Quaternion ArrayToQuaternion( const float source[4] ) +{ + return Quaternion( Float3(source[0], source[1], source[2]), source[3] ); +} + GameState::GameState() { this->privData = nullptr; @@ -75,21 +82,33 @@ bool GameState::Init( SharedStateContent &shared ) return true; } -void GameState::InitiatePlayer( int id, std::wstring modelName, Float4x4 world ) +void GameState::InitiatePlayer( int id, const std::string &modelName, const float position[3], const float rotation[4], const float scale[3], bool isMyPlayer ) { - this->privData->myId = id; - ModelInitData modelData; - modelData.visible = true; - modelData.position = Float3(world[12], world[13], world[14]); - modelData.rotation = Quaternion(Float3(0,0,0), 1); - modelData.scale = Float3(1,1,1); - modelData.modelPath = modelName; - modelData.id = this->privData->myId; - this->privData->player.Init( modelData ); + modelData.visible = true; + modelData.position = position; + modelData.rotation = ArrayToQuaternion( rotation ); + modelData.scale = scale; + StringToWstring( modelName, modelData.modelPath ); + modelData.id = id; - this->privData->camera.SetPosition( this->privData->player.getPos() ); - this->privData->camera.UpdateOrientation(); + if( isMyPlayer ) + { + if( this->privData->player.Init(modelData) ) + { + this->privData->myId = id; + this->privData->camera.SetPosition( this->privData->player.getPos() ); + this->privData->camera.UpdateOrientation(); + } + } + else + { + C_DynamicObj *p = new C_DynamicObj(); + if( p->Init(modelData) ) + { + (*this->privData->dynamicObjects)[id] = p; + } + } } GameClientState::ClientState GameState::Update( float deltaTime ) @@ -359,7 +378,12 @@ void GameState::DataRecieved( NetEventInitiatePlayer( decoded.object_ID, decoded.meshName, decoded.position, decoded.rotation, decoded.scale, decoded.owner ); + } + break; case protocol_Gameplay_ObjectJoinTeam: break; /** @todo TODO: implement */ case protocol_Gameplay_ObjectLeaveTeam: break; /** @todo TODO: implement */ case protocol_Gameplay_ObjectWeaponCooldown: break; /** @todo TODO: implement */ diff --git a/Code/Game/GameClient/GameClientState/GameState.h b/Code/Game/GameClient/GameClientState/GameState.h index 29ea2f1e..e3ced125 100644 --- a/Code/Game/GameClient/GameClientState/GameState.h +++ b/Code/Game/GameClient/GameClientState/GameState.h @@ -20,9 +20,8 @@ namespace DanBias { namespace Client ~GameState(void); bool Init( SharedStateContent &shared ); GameClientState::ClientState Update( float deltaTime ) override; - void InitiatePlayer( int id, std::wstring modelName, Oyster::Math::Float4x4 world ); + void InitiatePlayer( int id, const std::string &modelName, const float position[3], const float rotation[4], const float scale[3] ); void ReadKeyInput(); - bool Render()override; bool Release()override; void ChangeState( ClientState next ); diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index 8274472d..f50db40c 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -27,7 +27,7 @@ struct NetLoadState::MyData bool loading; }; -inline Quaternion ArrayToQuaternion( float source[4] ) +inline Quaternion ArrayToQuaternion( const float source[4] ) { return Quaternion( Float3(source[0], source[1], source[2]), source[3] ); } @@ -99,6 +99,7 @@ void NetLoadState::DataRecieved( NetEventLoadGame( Protocol_LobbyCreateGame(e.args.data.protocol).modelName ); this->ChangeState( ClientState_Game ); + this->privData->loading = false; } } @@ -109,18 +110,20 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) LevelLoader loader; auto objects = loader.LoadLevel( fileName ); auto object = objects.begin(); - ObjectHeader *oh; + ObjectTypeHeader *oth; int objectID = 100; // first 100 is reserved for players. This is how the server does it. for( ; object != objects.end(); ++object ) { ++objectID; - oh = (ObjectHeader*)&*object; - switch( oh->typeID ) + oth = (ObjectTypeHeader*)(*object._Ptr); + switch( oth->typeID ) { case ObjectType::ObjectType_Static: { + ObjectHeader *oh = (ObjectHeader*)oth; + ModelInitData desc; desc.id = objectID; StringToWstring( oh->ModelFile, desc.modelPath ); @@ -142,6 +145,8 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) break; case ObjectType::ObjectType_Dynamic: { + ObjectHeader *oh = (ObjectHeader*)oth; + ModelInitData desc; desc.id = objectID; StringToWstring( oh->ModelFile, desc.modelPath ); From 112f45463aad359580033a9152ce935dab8e34c9 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Mon, 17 Feb 2014 16:18:21 +0100 Subject: [PATCH 05/14] Oops .. Forgot to save this one for the previous commit --- Code/Game/GameClient/GameClientState/GameState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.h b/Code/Game/GameClient/GameClientState/GameState.h index e3ced125..035ad566 100644 --- a/Code/Game/GameClient/GameClientState/GameState.h +++ b/Code/Game/GameClient/GameClientState/GameState.h @@ -20,7 +20,7 @@ namespace DanBias { namespace Client ~GameState(void); bool Init( SharedStateContent &shared ); GameClientState::ClientState Update( float deltaTime ) override; - void InitiatePlayer( int id, const std::string &modelName, const float position[3], const float rotation[4], const float scale[3] ); + void InitiatePlayer( int id, const std::string &modelName, const float position[3], const float rotation[4], const float scale[3], bool isMyPlayer ); void ReadKeyInput(); bool Render()override; bool Release()override; From 6f368b45657c305085172a6e779e73f323a0f3d0 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 08:53:52 +0100 Subject: [PATCH 06/14] compilation error dealt with --- Code/Game/GameClient/GameClientState/GameState.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 38ded541..2ae8ae21 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -381,7 +381,7 @@ void GameState::DataRecieved( NetEventInitiatePlayer( decoded.object_ID, decoded.meshName, decoded.position, decoded.rotation, decoded.scale, decoded.owner ); + this->InitiatePlayer( decoded.object_ID, decoded.meshName, decoded.position, decoded.rotationQ, decoded.scale, decoded.owner ); } break; case protocol_Gameplay_ObjectJoinTeam: break; /** @todo TODO: implement */ From 197067687e6f4cc7a9e3be7e44644732f58390df Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 18 Feb 2014 09:32:10 +0100 Subject: [PATCH 07/14] Added Gui Transparancy, Get Options provides Resolution.xy --- .../GameClientState/Buttons/ButtonRectangle.h | 40 +++++++---- .../GameClientState/Buttons/EventButtonGUI.h | 68 +++++++++++-------- .../GameClientState/Buttons/TextField.h | 6 +- .../GameClientState/LanMenuState.cpp | 8 +-- .../GameClientState/LobbyAdminState.cpp | 2 +- .../GameClient/GameClientState/LobbyState.cpp | 2 +- .../GameClient/GameClientState/MainState.cpp | 19 ++++-- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 15 ++++ Code/OysterGraphics/DllInterfaces/GFXAPI.h | 17 +++++ .../OysterGraphics/Render/DefaultRenderer.cpp | 3 +- Code/OysterGraphics/Render/GuiRenderer.cpp | 6 +- Code/OysterGraphics/Render/Resources.cpp | 37 ++++++++++ Code/OysterGraphics/Render/Resources.h | 1 + .../Shader/Passes/2D/2DGeometry.hlsl | 8 +-- .../Shader/Passes/2D/Text/2DTextGeometry.hlsl | 8 +-- 15 files changed, 174 insertions(+), 66 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h b/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h index f4dd69e1..7f3db825 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h +++ b/Code/Game/GameClient/GameClientState/Buttons/ButtonRectangle.h @@ -21,21 +21,37 @@ namespace DanBias ButtonRectangle() : EventButtonGUI(), width(0), height(0) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + Owner owner, Oyster::Math::Float3 pos, + Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButtonGUI(textureName, buttonText, + textColor, backColor, hoverColor, pressedColor, + owner, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + EventFunc func, Oyster::Math::Float3 pos, + Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButtonGUI(textureName, buttonText, + textColor, backColor, hoverColor, pressedColor, + func, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + EventFunc func, Owner owner, Oyster::Math::Float3 pos, + Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButtonGUI(textureName, buttonText, + textColor, backColor, hoverColor, pressedColor, + func, owner, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, + Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButtonGUI(textureName, buttonText, + textColor, backColor, hoverColor, pressedColor, + func, owner, userData, pos, size, resize) {} virtual ~ButtonRectangle() {} diff --git a/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h b/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h index c6b54a7e..3ae09043 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h +++ b/Code/Game/GameClient/GameClientState/Buttons/EventButtonGUI.h @@ -30,32 +30,40 @@ namespace DanBias class EventButtonGUI : public Oyster::Event::EventButton { public: - EventButtonGUI() - : EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(1, 1, 1, 1) - {} - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), + textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + EventFunc func, Oyster::Math::Float3 pos, + Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), + textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, - Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + EventFunc func, Owner owner, Oyster::Math::Float3 pos, + Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), + textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) - : EventButton(func, owner, userData), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, + Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor, + EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None) + : EventButton(func, owner, userData), pos(pos), size(size), texture(NULL), buttonText(buttonText), + textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor) { CreateTexture(textureName); if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); @@ -77,23 +85,23 @@ namespace DanBias if(EventButton::Enabled()) { // let the using dev decide what is rendered - Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float4(1.0f, 1.0f, 1.0f, 1.0f)); + //Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float4(1.0f, 1.0f, 1.0f, 1.0f)); //Render att xPos and yPos //With width and height - //if(EventButton::GetState() == ButtonState_None) - //{ - // Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f)); - //} - //else if(EventButton::GetState() == ButtonState_Hover) - //{ - // Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(0.0f, 1.0f, 0.0f)); - //} - //else - //{ - // Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 0.0f, 0.0f)); - //} + if(EventButton::GetState() == ButtonState_None) + { + Oyster::Graphics::API::RenderGuiElement(texture, pos, size, backColor); + } + else if(EventButton::GetState() == ButtonState_Hover) + { + Oyster::Graphics::API::RenderGuiElement(texture, pos, size, hoverColor); + } + else + { + Oyster::Graphics::API::RenderGuiElement(texture, pos, size, pressedColor); + } } } @@ -102,7 +110,7 @@ namespace DanBias { if(buttonText.size() > 0) { - Oyster::Graphics::API::RenderText(buttonText, pos - Float3(size.x * 0.5f, size.y * 0.25f, 0.0f), size*2.0f, size.y * 0.5f, textColor); + Oyster::Graphics::API::RenderText(buttonText, pos - Float3(size.x * 0.5f, size.y * 0.25f, -0.001f), size, size.y * 0.5f, textColor); } } @@ -126,6 +134,10 @@ namespace DanBias std::wstring buttonText; Oyster::Math::Float4 textColor; + + Oyster::Math::Float4 backColor; + Oyster::Math::Float4 hoverColor; + Oyster::Math::Float4 pressedColor; }; } } diff --git a/Code/Game/GameClient/GameClientState/Buttons/TextField.h b/Code/Game/GameClient/GameClientState/Buttons/TextField.h index c1fa79ac..18e5d23b 100644 --- a/Code/Game/GameClient/GameClientState/Buttons/TextField.h +++ b/Code/Game/GameClient/GameClientState/Buttons/TextField.h @@ -20,7 +20,7 @@ namespace DanBias { namespace Client { public: TextField(); - TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height ); + TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, ::Oyster::Math::Float4 backColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height ); virtual ~TextField(); virtual void RenderText(); @@ -62,8 +62,8 @@ namespace DanBias { namespace Client } template - TextField::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize ) - : ButtonRectangle( backgroundTexture, L"", textColor, owner, pos, size, resize ) + TextField::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float4 textColor, ::Oyster::Math::Float4 backColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize ) + : ButtonRectangle( backgroundTexture, L"", textColor, backColor, backColor, backColor, owner, pos, size, resize ) { this->fontHeight = 0.025f; this->lineSpacing = 0.001f; diff --git a/Code/Game/GameClient/GameClientState/LanMenuState.cpp b/Code/Game/GameClient/GameClientState/LanMenuState.cpp index 3051c097..cb07aa55 100644 --- a/Code/Game/GameClient/GameClientState/LanMenuState.cpp +++ b/Code/Game/GameClient/GameClientState/LanMenuState.cpp @@ -55,10 +55,10 @@ bool LanMenuState::Init( SharedStateContent &shared ) this->privData->nwClient = shared.network; this->privData->input = shared.input; - this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); + this->privData->background = Graphics::API::CreateTexture( L"color_white.png" ); // create guiElements - this->privData->connectIP = new TextField( L"earth_md.png", Float4(1.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None ); + this->privData->connectIP = new TextField( L"color_white.png", Float4(1.0f), Float4(0.0f), this, Float3(0.5f, 0.3f, 0.5f), Float2(0.8f, 0.09f), ResizeAspectRatio_None ); this->privData->connectIP->ReserveLines( 1 ); this->privData->connectIP->AppendText( L"127.0.0.1" ); this->privData->connectIP->SetFontHeight( 0.08f ); @@ -68,10 +68,10 @@ bool LanMenuState::Init( SharedStateContent &shared ) this->privData->guiElements.AddButton( this->privData->connectIP ); ButtonRectangle *guiElements; - guiElements = new ButtonRectangle( L"earth_md.png", L"Connect", Float4(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); + guiElements = new ButtonRectangle( L"color_white.png", L"Connect", Float4(1.0f),Float4(0.0f),Float4(0.0f),Float4(0.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); this->privData->guiElements.AddButton( guiElements ); - guiElements = new ButtonRectangle( L"earth_md.png", L"Exit", Float4(1.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); + guiElements = new ButtonRectangle( L"color_white.png", L"Exit", Float4(1.0f),Float4(0.0f),Float4(0.0f),Float4(0.0f), OnButtonInteract_Exit, this, Float3(0.5f, 0.5f, 0.5f), Float2(0.3f, 0.05f), ResizeAspectRatio_None ); this->privData->guiElements.AddButton( guiElements ); // bind guiElements collection to the singleton eventhandler diff --git a/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp b/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp index b05e90dc..070d8b48 100644 --- a/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp +++ b/Code/Game/GameClient/GameClientState/LobbyAdminState.cpp @@ -50,7 +50,7 @@ bool LobbyAdminState::Init( SharedStateContent &shared ) // create buttons ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", L"Ready", Float4(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"earth_md.png", L"Ready", Float4(1.0f),Float4(0.0f),Float4(0.0f),Float4(0.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler diff --git a/Code/Game/GameClient/GameClientState/LobbyState.cpp b/Code/Game/GameClient/GameClientState/LobbyState.cpp index 23b27e3f..a6d03527 100644 --- a/Code/Game/GameClient/GameClientState/LobbyState.cpp +++ b/Code/Game/GameClient/GameClientState/LobbyState.cpp @@ -50,7 +50,7 @@ bool LobbyState::Init( SharedStateContent &shared ) // create buttons ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", L"Ready", Float4(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"earth_md.png", L"Ready", Float4(1.0f), Float4(0.0f), Float4(0.0f), Float4(0.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler diff --git a/Code/Game/GameClient/GameClientState/MainState.cpp b/Code/Game/GameClient/GameClientState/MainState.cpp index d71b050e..f34b9ad6 100644 --- a/Code/Game/GameClient/GameClientState/MainState.cpp +++ b/Code/Game/GameClient/GameClientState/MainState.cpp @@ -49,18 +49,22 @@ bool MainState::Init( SharedStateContent &shared ) this->privData->nwClient = shared.network; this->privData->input = shared.input; - this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); + this->privData->background = Graphics::API::CreateTexture( L"color_white.png" ); // create buttons ButtonRectangle *button; + Float4 TextCol = Float4(1.0f,0.0f,1.0f,1.0f); + Float4 BackCol = Float4(1.0f,1.0f,1.0f,0.5f); + Float4 HoverCol = Float4(0.0f,1.0f,0.0f,1.0f); + Float4 PressCol = Float4(0.0f,0.0f,1.0f,1.0f); - button = new ButtonRectangle( L"earth_md.png", L"Create", Float4(1.0f), OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"color_white.png", L"Create",TextCol, BackCol, HoverCol, PressCol, OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f)); this->privData->guiElements.AddButton( button ); - button = new ButtonRectangle( L"skysphere_md.png", L"Join", Float4(1.0f), OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"color_white.png", L"Join", TextCol, BackCol, HoverCol, PressCol, OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f)); this->privData->guiElements.AddButton( button ); - button = new ButtonRectangle( L"plane_texture_md.png", L"Quit", Float4(1.0f), OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + button = new ButtonRectangle( L"color_white.png", L"Quit", TextCol, BackCol, HoverCol, PressCol, OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f)); this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler @@ -73,6 +77,11 @@ GameClientState::ClientState MainState::Update( float deltaTime ) { MouseInput mouseState; { + bool test = this->privData->input->IsMousePressed(); + if(test) + { + int i = 0; + }; this->privData->input->GetMousePos( mouseState.x, mouseState.y ); mouseState.mouseButtonPressed = this->privData->input->IsMousePressed(); } @@ -87,7 +96,7 @@ bool MainState::Render() Graphics::API::NewFrame(); Graphics::API::StartGuiRender(); - Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); + Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 0.9f), Float2(1.0f), Float4(63.0f/255.0f,73.0f/255.0f,127.0f/255.0f,0.6f) ); this->privData->guiElements.RenderTexture(); Graphics::API::StartTextRender(); diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index f4ce303f..75bc3c70 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -19,6 +19,10 @@ namespace Oyster Math::Float4x4 Projection; std::vector Lights; float deltaTime; +#ifdef _DEBUG + Model::Model* cube; + Model::Model* sphere; +#endif } API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion) @@ -33,6 +37,12 @@ namespace Oyster Render::Resources::Init(); Render::Preparations::Basic::SetViewPort(); +#ifdef _DEBUG + //fix load model + cube = CreateModel(L"debug_cube.dan"); + sphere = CreateModel(L"debug_sphere.dan"); + +#endif return API::Sucsess; } @@ -145,6 +155,10 @@ namespace Oyster Render::Resources::InitShaders(); return State::Sucsess; } + + void API::StartRenderWireFrame() + { + } #endif API::Option API::GetOption() @@ -153,6 +167,7 @@ namespace Oyster o.BytesUsed = Core::UsedMem; o.modelPath = Core::modelPath; o.texturePath = Core::texturePath; + o.Resolution = Core::resolution; return o; } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index eea53939..e123e59a 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -27,6 +27,12 @@ namespace Oyster struct Option { std::wstring modelPath, texturePath; + //between 0-1 + float AmbientValue; + + Math::Float2 Resolution; + + //Bytes on the GPU int BytesUsed; }; typedef void* Texture; @@ -34,6 +40,17 @@ namespace Oyster static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); #ifdef _DEBUG static State ReloadShaders(); + + //should be called after rendered normal models, before GUI or Text rendering + static void StartRenderWireFrame(); + + //Render a unit cube with the presented WorldMatrix + static void RenderDebugCube(Math::Matrix world); + + //Render a unit Sphere with the presented WorldMatrix + static void RenderDebugSphere(Math::Matrix world); + + static void StartRenderFullModel(); #endif //! @todo Memory Leaks diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index c0c2990e..7e8d08cd 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -16,7 +16,8 @@ namespace Oyster void DefaultRenderer::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection, Definitions::Pointlight* Lights, int numLights) { - Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(1,0,0,1)); + Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,0,0)); + Preparations::Basic::ClearDepthStencil(Resources::Gui::depth); Preparations::Basic::ClearRTV(Resources::GBufferRTV,Resources::GBufferSize,Math::Float4(0,0,0,0)); Core::PipelineManager::SetRenderPass(Graphics::Render::Resources::Gather::Pass); Lights[1]; diff --git a/Code/OysterGraphics/Render/GuiRenderer.cpp b/Code/OysterGraphics/Render/GuiRenderer.cpp index b17fdfef..02e202e4 100644 --- a/Code/OysterGraphics/Render/GuiRenderer.cpp +++ b/Code/OysterGraphics/Render/GuiRenderer.cpp @@ -9,7 +9,7 @@ namespace Oyster namespace Render { const int TEXT_NR_LETTERS=95; - const float TEXT_SPACING=1.8f; + const float TEXT_SPACING=2.0f; void Gui::Begin2DRender() { @@ -20,8 +20,8 @@ namespace Oyster { Core::deviceContext->PSSetShaderResources(0,1,&tex); - pos *= 2; - pos -= 1; + pos.xy *= 2; + pos.xy -= 1; pos.y *= -1; Definitions::GuiData gd; diff --git a/Code/OysterGraphics/Render/Resources.cpp b/Code/OysterGraphics/Render/Resources.cpp index 0c5bf592..82ace315 100644 --- a/Code/OysterGraphics/Render/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -62,6 +62,7 @@ namespace Oyster ID3D11BlendState* Resources::RenderStates::bs = NULL; ID3D11ShaderResourceView* Resources::Gui::Text::Font = NULL; + ID3D11DepthStencilView* Resources::Gui::depth = NULL; #pragma endregion @@ -304,6 +305,7 @@ namespace Oyster ID3D11Texture1D *pTexture1; Core::device->CreateTexture1D( &T1desc, &sphere, &pTexture1 ); + Core::UsedMem += T1desc.Width * 16; Core::device->CreateShaderResourceView( pTexture1, 0, &Light::SSAOKernel ); pTexture1->Release(); @@ -323,8 +325,33 @@ namespace Oyster ID3D11Texture2D *pTexture2; Core::device->CreateTexture2D( &T2desc, &rnd, &pTexture2 ); + Core::UsedMem += T2desc.Height * T2desc.Width * 16; Core::device->CreateShaderResourceView( (pTexture2), 0, &Light::SSAORandom ); pTexture2->Release(); + + //create Depth Buffer + D3D11_TEXTURE2D_DESC dTDesc; + dTDesc.MipLevels=1; + dTDesc.ArraySize=1; + dTDesc.Format = DXGI_FORMAT_D32_FLOAT; + dTDesc.Usage = D3D11_USAGE_DEFAULT; + dTDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; + dTDesc.CPUAccessFlags=0; + dTDesc.MiscFlags=0; + dTDesc.Height = Core::resolution.y; + dTDesc.Width = Core::resolution.x; + dTDesc.SampleDesc.Count=1; + dTDesc.SampleDesc.Quality=0; + + ID3D11Texture2D* depthstencil; + Core::device->CreateTexture2D(&dTDesc,0,&depthstencil); + Core::UsedMem += dTDesc.Height * dTDesc.Width * 4; + Core::device->CreateDepthStencilView(depthstencil,NULL,&Gui::depth); + depthstencil->Release(); + + + D3D11_DEPTH_STENCIL_DESC dDesc; + return Core::Init::Success; } @@ -390,10 +417,13 @@ namespace Oyster Gui::Pass.Shaders.Vertex = GetShader::Vertex(L"2D"); Gui::Pass.Shaders.Pixel = GetShader::Pixel(L"2D"); Gui::Pass.Shaders.Geometry = GetShader::Geometry(L"2D"); + Gui::Pass.RTV.push_back(GBufferRTV[2]); Gui::Pass.CBuffers.Geometry.push_back(Gui::Data); Gui::Pass.CBuffers.Pixel.push_back(Color); + Gui::Pass.depth = Gui::depth; + D3D11_INPUT_ELEMENT_DESC indesc2D[] = { { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, @@ -405,6 +435,7 @@ namespace Oyster Gui::Pass.RenderStates.SampleCount = 1; Gui::Pass.RenderStates.SampleState = RenderStates::ss; Gui::Pass.RenderStates.BlendState = RenderStates::bs; + Gui::Pass.RenderStates.DepthStencil = RenderStates::dsState; ////---------------- Blur Pass Setup ---------------------------- Blur::HorPass.Shaders.Compute = GetShader::Compute(L"BlurHor"); @@ -442,9 +473,13 @@ namespace Oyster Gui::Text::Pass.CBuffers.Pixel.push_back(Color); Gui::Text::Pass.SRV.Pixel.push_back(Gui::Text::Font); Gui::Text::Pass.RTV.push_back(GBufferRTV[2]); + + Gui::Text::Pass.depth = Gui::depth; + Gui::Text::Pass.RenderStates.SampleCount = 1; Gui::Text::Pass.RenderStates.SampleState = RenderStates::ss; Gui::Text::Pass.RenderStates.BlendState = RenderStates::bs; + Gui::Text::Pass.RenderStates.DepthStencil = RenderStates::dsState; return Core::Init::Success; } @@ -510,6 +545,8 @@ namespace Oyster SAFE_RELEASE(Gui::Text::Pass.RenderStates.BlendState); SAFE_RELEASE(Gui::Text::Pass.IAStage.Layout); + + SAFE_RELEASE(Gui::depth); } } } diff --git a/Code/OysterGraphics/Render/Resources.h b/Code/OysterGraphics/Render/Resources.h index 6b4e140e..665ab8dc 100644 --- a/Code/OysterGraphics/Render/Resources.h +++ b/Code/OysterGraphics/Render/Resources.h @@ -64,6 +64,7 @@ namespace Oyster { static Core::PipelineManager::RenderPass Pass; static Core::Buffer Data; + static ID3D11DepthStencilView* depth; struct Text { static Core::PipelineManager::RenderPass Pass; diff --git a/Code/OysterGraphics/Shader/Passes/2D/2DGeometry.hlsl b/Code/OysterGraphics/Shader/Passes/2D/2DGeometry.hlsl index 86fea579..56b6294f 100644 --- a/Code/OysterGraphics/Shader/Passes/2D/2DGeometry.hlsl +++ b/Code/OysterGraphics/Shader/Passes/2D/2DGeometry.hlsl @@ -4,19 +4,19 @@ void main(point Vertex2DIn input[1],inout TriangleStream Quads) { Pixel2DIn output; - output.Pos = mul(float4(-1,-1,1,1) ,Translation); + output.Pos = mul(float4(-1,-1,0,1) ,Translation); output.Uv = float2(0,1); Quads.Append(output); - output.Pos = mul(float4(-1,1,1,1), Translation); + output.Pos = mul(float4(-1,1,0,1), Translation); output.Uv = float2(0,0); Quads.Append(output); - output.Pos = mul(float4(1,-1,1,1), Translation); + output.Pos = mul(float4(1,-1,0,1), Translation); output.Uv = float2(1,1); Quads.Append(output); - output.Pos = mul(float4(1,1,1,1), Translation); + output.Pos = mul(float4(1,1,0,1), Translation); output.Uv = float2(1,0); Quads.Append(output); } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/2D/Text/2DTextGeometry.hlsl b/Code/OysterGraphics/Shader/Passes/2D/Text/2DTextGeometry.hlsl index 4e0bed02..feefbed7 100644 --- a/Code/OysterGraphics/Shader/Passes/2D/Text/2DTextGeometry.hlsl +++ b/Code/OysterGraphics/Shader/Passes/2D/Text/2DTextGeometry.hlsl @@ -7,22 +7,22 @@ void main(point Text2DIn input[1],inout TriangleStream Quads) float endoff=startoff+input[0].coff; Pixel2DIn output; - output.Pos = mul(float4(-1,-1,1,1), Translation); + output.Pos = mul(float4(-1,-1,0,1), Translation); output.Pos.x += input[0].Pos; output.Uv = float2(startoff,1); Quads.Append(output); - output.Pos = mul(float4(-1,1,1,1), Translation); + output.Pos = mul(float4(-1,1,0,1), Translation); output.Pos.x += input[0].Pos; output.Uv = float2(startoff,0); Quads.Append(output); - output.Pos = mul(float4(1,-1,1,1), Translation); + output.Pos = mul(float4(1,-1,0,1), Translation); output.Pos.x += input[0].Pos; output.Uv = float2(endoff,1); Quads.Append(output); - output.Pos = mul(float4(1,1,1,1), Translation); + output.Pos = mul(float4(1,1,0,1), Translation); output.Pos.x += input[0].Pos; output.Uv = float2(endoff,0); Quads.Append(output); From 05cc76e9d6811f4d63013b1e13ae5337e836e098 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 18 Feb 2014 09:33:21 +0100 Subject: [PATCH 08/14] Added .user to gitIgnore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d5d239c2..57ccce7f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ Bin/DLL/ Bin/Executable/ Obj/ External/ +Code/Game/GameClient/GameClient.vcxproj.user From 80b203737a3755838435584721ed585da15478ee Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 18 Feb 2014 09:56:28 +0100 Subject: [PATCH 09/14] Debug WireFrame to verify --- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 34 +++++++++++++++++++ .../OysterGraphics/Render/DefaultRenderer.cpp | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 75bc3c70..ec0be45e 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -22,6 +22,8 @@ namespace Oyster #ifdef _DEBUG Model::Model* cube; Model::Model* sphere; + + ID3D11RasterizerState* wire; #endif } @@ -42,6 +44,19 @@ namespace Oyster cube = CreateModel(L"debug_cube.dan"); sphere = CreateModel(L"debug_sphere.dan"); + D3D11_RASTERIZER_DESC desc; + desc.CullMode = D3D11_CULL_BACK; + desc.FillMode = D3D11_FILL_WIREFRAME; + desc.FrontCounterClockwise = false; + desc.DepthBias = 0; + desc.DepthBiasClamp = 0; + desc.DepthClipEnable = true; + desc.SlopeScaledDepthBias = 0; + desc.ScissorEnable = false; + desc.MultisampleEnable = false; + desc.AntialiasedLineEnable = false; + + Core::device->CreateRasterizerState(&desc,&wire); #endif return API::Sucsess; } @@ -123,6 +138,11 @@ namespace Oyster void API::Clean() { +#ifdef _DEBUG + DeleteModel(cube); + DeleteModel(sphere); + SAFE_RELEASE(wire); +#endif DeleteTexture(Render::Resources::Gui::Text::Font); SAFE_DELETE(Core::viewPort); Core::loader.Clean(); @@ -137,6 +157,7 @@ namespace Oyster SAFE_RELEASE(Core::swapChain); SAFE_RELEASE(Core::deviceContext); SAFE_RELEASE(Core::device); + } void API::AddLight(Definitions::Pointlight light) @@ -158,6 +179,19 @@ namespace Oyster void API::StartRenderWireFrame() { + Core::deviceContext->RSSetState(wire); + } + + void API::RenderDebugCube(Math::Matrix world) + { + cube->WorldMatrix = world; + Render::DefaultRenderer::RenderScene(cube,1,View,Projection); + } + + void API::RenderDebugSphere(Math::Matrix world) + { + sphere->WorldMatrix = world; + Render::DefaultRenderer::RenderScene(sphere,1,View,Projection); } #endif diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 7e8d08cd..fbf11f08 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -58,7 +58,7 @@ namespace Oyster if(models[i].Visible) { Definitions::PerModel pm; - pm.WV = View * models[i].WorldMatrix; + pm.WV = View * models[i].WorldMatrix.GetInverse().GetTranspose(); pm.WVP = Projection * pm.WV; Model::ModelInfo* info = models[i].info; From 55e3aaaabca6b32cfe872b3f12f4251389290ec8 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 18 Feb 2014 10:19:59 +0100 Subject: [PATCH 10/14] Fixed proper start and some more option modifications --- Code/Game/GameClient/DanBiasGame_Impl.cpp | 6 ++++-- .../Definitions/GraphicalDefinition.h | 3 +-- Code/OysterGraphics/DllInterfaces/GFXAPI.cpp | 21 +++++++++++++++++-- Code/OysterGraphics/DllInterfaces/GFXAPI.h | 2 +- .../OysterGraphics/Render/DefaultRenderer.cpp | 8 ------- .../Shader/Passes/Post/PostPass.hlsl | 6 ++---- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index 81650049..e6f95f79 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -136,9 +136,11 @@ namespace DanBias Oyster::Graphics::API::Option p; p.modelPath = L"..\\Content\\Models\\"; p.texturePath = L"..\\Content\\Textures\\"; - Oyster::Graphics::API::SetOptions(p); + p.Resolution = Oyster::Math::Float2( 1024, 768); + //! @todo fix proper amb value + p.AmbientValue = 1.0f; - if(Oyster::Graphics::API::Init(data.window->GetHWND(), false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess) + if(Oyster::Graphics::API::Init(data.window->GetHWND(), false, false, p) != Oyster::Graphics::API::Sucsess) return E_FAIL; return S_OK; } diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index ffd2869a..fcfd865c 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -61,8 +61,7 @@ namespace Oyster struct PostData { - int x; - int y; + float Amb; }; struct Text2D diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index ec0be45e..bdfa0bde 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -27,9 +27,11 @@ namespace Oyster #endif } - API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion) + API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, API::Option o) { - Core::resolution = resulotion; + Core::resolution = o.Resolution; + Core::modelPath = o.modelPath; + Core::texturePath = o.texturePath; if(Core::Init::FullInit(Window, MSAA_Quality, Fullscreen) == Core::Init::Fail) { @@ -38,6 +40,13 @@ namespace Oyster Render::Resources::Gui::Text::Font = (ID3D11ShaderResourceView*)API::CreateTexture(L"font_generic.png"); Render::Resources::Init(); + Definitions::PostData pd; + pd.Amb = o.AmbientValue; + + void* data = Render::Resources::Post::Data.Map(); + memcpy(data,&pd,sizeof(Definitions::PostData)); + Render::Resources::Post::Data.Unmap(); + Render::Preparations::Basic::SetViewPort(); #ifdef _DEBUG //fix load model @@ -102,6 +111,14 @@ namespace Oyster { Core::modelPath = option.modelPath; Core::texturePath = option.texturePath; + + Definitions::PostData pd; + pd.Amb = option.AmbientValue; + + void* data = Render::Resources::Post::Data.Map(); + memcpy(data,&pd,sizeof(Definitions::PostData)); + Render::Resources::Post::Data.Unmap(); + return API::Sucsess; } diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.h b/Code/OysterGraphics/DllInterfaces/GFXAPI.h index e123e59a..71e12662 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.h +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.h @@ -37,7 +37,7 @@ namespace Oyster }; typedef void* Texture; - static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion); + static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Option options); #ifdef _DEBUG static State ReloadShaders(); diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index fbf11f08..097fcedb 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -39,14 +39,6 @@ namespace Oyster data = Resources::Light::PointLightsData.Map(); memcpy(data, Lights, sizeof(Definitions::Pointlight) * numLights); Resources::Light::PointLightsData.Unmap(); - - Definitions::PostData pd; - pd.x = (int)lc.Pixels.x; - pd.y = (int)lc.Pixels.y; - - data = Resources::Post::Data.Map(); - memcpy(data, &pd, sizeof(Definitions::PostData)); - Resources::Post::Data.Unmap(); } void DefaultRenderer::RenderScene(Model::Model* models, int count, Math::Matrix View, Math::Matrix Projection, float deltaTime) diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 0c6ad9ca..346913d8 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -8,11 +8,9 @@ SamplerState S1 : register(s0); cbuffer Size : register(b0) { - int2 Pixels; + float AmbFactor; } -#define AmbFactor 0.1f; - float4 SuperSample(float4 Glow, uint3 DTid) { // Line X @@ -36,7 +34,7 @@ void main( uint3 DTid : SV_DispatchThreadID ) Glow = SuperSample(Glow,DTid); float4 GUI; - uint2 index = DTid.xy/2 + uint2((uint)Pixels.x/(uint)2,0); + uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0); float3 PostLight = Amb.xyz * AmbFactor; PostLight = PostLight + Light.xyz + Glow; GUI = float4(Ambient[index]); From b2e98f12078f456bfc53ef96c668ba955d7889e2 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 10:28:46 +0100 Subject: [PATCH 11/14] Debug hack + actual fixings --- Code/Game/GameClient/DanBiasGame_Impl.cpp | 9 ++++-- Code/Game/GameClient/GameClient.vcxproj.user | 2 +- .../GameClient/GameClientState/Camera_FPS.cpp | 3 +- .../GameClient/GameClientState/GameState.cpp | 28 ++++++++++++++++--- .../GameClientState/NetLoadState.cpp | 5 +++- .../OysterGraphics.vcxproj.user | 2 +- 6 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Code/Game/GameClient/DanBiasGame_Impl.cpp b/Code/Game/GameClient/DanBiasGame_Impl.cpp index e6f95f79..b978597c 100644 --- a/Code/Game/GameClient/DanBiasGame_Impl.cpp +++ b/Code/Game/GameClient/DanBiasGame_Impl.cpp @@ -64,7 +64,12 @@ namespace DanBias { WindowShell::CreateConsoleWindow(); //if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC(L"Window", cPOINT(1600, 900), cPOINT()))) - if(! data.window->CreateWin(WindowShell::WINDOW_INIT_DESC())) + + WindowShell::WINDOW_INIT_DESC winDesc; + winDesc.windowSize.x = 1280; + winDesc.windowSize.y = 720; + + if(! data.window->CreateWin(winDesc) ) return DanBiasClientReturn_Error; if( FAILED( InitDirect3D() ) ) @@ -136,7 +141,7 @@ namespace DanBias Oyster::Graphics::API::Option p; p.modelPath = L"..\\Content\\Models\\"; p.texturePath = L"..\\Content\\Textures\\"; - p.Resolution = Oyster::Math::Float2( 1024, 768); + p.Resolution = Oyster::Math::Float2( 1280.0f, 720.0f ); //! @todo fix proper amb value p.AmbientValue = 1.0f; diff --git a/Code/Game/GameClient/GameClient.vcxproj.user b/Code/Game/GameClient/GameClient.vcxproj.user index 2e28d6f7..4b847ee6 100644 --- a/Code/Game/GameClient/GameClient.vcxproj.user +++ b/Code/Game/GameClient/GameClient.vcxproj.user @@ -1,7 +1,7 @@  - true + false $(OutDir) diff --git a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp index 8c87970b..56a026e3 100644 --- a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp +++ b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp @@ -112,7 +112,8 @@ void Camera_FPS::StrafeLeft( Float distance ) void Camera_FPS::PitchUp( Float radian ) { - this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); + //this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); + this->pitchUp = this->pitchUp + radian; // debug hack this->head.SetAngular( this->body.angularAxis + this->pitchUp * this->body.direction.v[0] ); } diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 2ae8ae21..f590f366 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -17,6 +17,7 @@ using namespace ::Oyster::Math3D; using namespace ::GameLogic; using namespace ::Utility::DynamicMemory; using namespace ::Utility::String; +using namespace ::Utility::Value; struct GameState::MyData { @@ -76,9 +77,24 @@ bool GameState::Init( SharedStateContent &shared ) this->privData->staticObjects = &shared.staticObjects; this->privData->dynamicObjects = &shared.dynamicObjects; - //tell server ready - this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); + Graphics::API::Option gfxOp = Graphics::API::GetOption(); + Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; + this->privData->camera.SetPerspectiveProjection( Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); + Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); + //tell server ready + //this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); + + // Debugg hack + this->InitiatePlayer( 0, "crate_generic.dan",Float3( 0,132, 10), Quaternion::identity, Float3(1), true ); + Graphics::Definitions::Pointlight light; + light.Pos = Float3( 0,132,0); + light.Color = Float3( 1.0f ); + light.Bright = 1.0f; + light.Radius = 1000.0f; + Graphics::API::AddLight( light ); + // end debug hack + return true; } @@ -98,6 +114,9 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa { this->privData->myId = id; this->privData->camera.SetPosition( this->privData->player.getPos() ); + Float3 offset = Float3( 0.0f ); + offset.y = this->privData->player.getScale().y + 0.5f; // debug hack +0.5f + this->privData->camera.SetHeadOffset( offset ); this->privData->camera.UpdateOrientation(); } } @@ -113,6 +132,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa GameClientState::ClientState GameState::Update( float deltaTime ) { + this->ReadKeyInput(); return this->privData->nextState; } @@ -219,8 +239,8 @@ void GameState::ReadKeyInput() //send delta mouse movement { - this->privData->camera.YawRight( -this->privData->input->GetYaw() ); - this->privData->camera.PitchUp( this->privData->input->GetPitch() ); + this->privData->camera.YawRight( this->privData->input->GetYaw() * 0.017f ); + this->privData->camera.PitchDown( this->privData->input->GetPitch() * 0.017f ); this->privData->camera.UpdateOrientation(); privData->nwClient->Send( Protocol_PlayerLook(this->privData->camera.GetLook(), this->privData->camera.GetRight()) ); diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index f50db40c..7443344e 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -54,8 +54,11 @@ bool NetLoadState::Init( SharedStateContent &shared ) // we may assume that nwClient is properly connected to the server // signals querry to server for loading instructions - this->privData->nwClient->Send( Protocol_QuerryGameType() ); + //this->privData->nwClient->Send( Protocol_QuerryGameType() ); + // debugg + this->LoadGame( "..//Content//Worlds//2ofAll_updated.bias"); + this->ChangeState( ClientState_Game ); return true; } diff --git a/Code/OysterGraphics/OysterGraphics.vcxproj.user b/Code/OysterGraphics/OysterGraphics.vcxproj.user index 9a0b0ae0..3f030911 100644 --- a/Code/OysterGraphics/OysterGraphics.vcxproj.user +++ b/Code/OysterGraphics/OysterGraphics.vcxproj.user @@ -1,6 +1,6 @@  - true + false \ No newline at end of file From fc19938f1b952e71b8494baee3195c1f485cb5c8 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 10:40:27 +0100 Subject: [PATCH 12/14] =?UTF-8?q?P=C3=A4r's=20fix=20i=20RenderScene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/OysterGraphics/Render/DefaultRenderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 097fcedb..22b71df7 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -50,8 +50,8 @@ namespace Oyster if(models[i].Visible) { Definitions::PerModel pm; - pm.WV = View * models[i].WorldMatrix.GetInverse().GetTranspose(); - pm.WVP = Projection * pm.WV; + pm.WV = View * models[i].WorldMatrix.GetTranspose().GetInverse(); + pm.WVP = Projection * View * models[i].WorldMatrix; Model::ModelInfo* info = models[i].info; From c8c0bb9bc4c9a7976732286dfd75dbbe25539e2f Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 11:06:11 +0100 Subject: [PATCH 13/14] Clamp fixed --- Code/Misc/Utilities/Utilities.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Code/Misc/Utilities/Utilities.h b/Code/Misc/Utilities/Utilities.h index c259a845..b97d62d7 100644 --- a/Code/Misc/Utilities/Utilities.h +++ b/Code/Misc/Utilities/Utilities.h @@ -337,7 +337,11 @@ namespace Utility template inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max ) - { return value < min ? Max( value, max ) : min; } + { + if( value < min ) return min; + if( value > max ) return max; + return value; + } template inline ValueType Average( const ValueType &valueA, const ValueType &valueB ) From 0bd5d68da44d3b68ae3493b9dd1b129d46f3f6a8 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 11:12:47 +0100 Subject: [PATCH 14/14] Removed some debug lines --- Code/Game/GameClient/GameClientState/Camera_FPS.cpp | 3 +-- Code/Game/GameClient/GameClientState/GameState.cpp | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp index 56a026e3..8c87970b 100644 --- a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp +++ b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp @@ -112,8 +112,7 @@ void Camera_FPS::StrafeLeft( Float distance ) void Camera_FPS::PitchUp( Float radian ) { - //this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); - this->pitchUp = this->pitchUp + radian; // debug hack + this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); this->head.SetAngular( this->body.angularAxis + this->pitchUp * this->body.direction.v[0] ); } diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index f590f366..4a364ec7 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -87,12 +87,6 @@ bool GameState::Init( SharedStateContent &shared ) // Debugg hack this->InitiatePlayer( 0, "crate_generic.dan",Float3( 0,132, 10), Quaternion::identity, Float3(1), true ); - Graphics::Definitions::Pointlight light; - light.Pos = Float3( 0,132,0); - light.Color = Float3( 1.0f ); - light.Bright = 1.0f; - light.Radius = 1000.0f; - Graphics::API::AddLight( light ); // end debug hack return true;