From aa52541cd92307ba47686d70b64fca286455ec68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C4=B1dvan?= Date: Sun, 20 Jun 2021 16:48:03 +0300 Subject: [PATCH] c++ stuff fixed --- Citrus/Blur.cpp | 4 ++-- Citrus/Graphics.cpp | 1 - Citrus/Graphics.h | 10 +++++----- Citrus/Model.cpp | 8 ++++++++ Citrus/Model.h | 1 + Citrus/UI.h | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Citrus/Blur.cpp b/Citrus/Blur.cpp index a00f670..e1226cb 100644 --- a/Citrus/Blur.cpp +++ b/Citrus/Blur.cpp @@ -32,8 +32,8 @@ void Blur::Draw() pVS.Bind(pContext.Get()); pPS.Bind(pContext.Get()); //bind c buffer - pBlurCBuffer->data.screenWidth = width; - pBlurCBuffer->data.screenHeight = height; + pBlurCBuffer->data.screenWidth = static_cast(width); + pBlurCBuffer->data.screenHeight = static_cast(height); pBlurCBuffer->MapData(); pBlurCBuffer->VSBind(pContext.Get(), 1u, 1u); } diff --git a/Citrus/Graphics.cpp b/Citrus/Graphics.cpp index 0622e5e..ec6f04f 100644 --- a/Citrus/Graphics.cpp +++ b/Citrus/Graphics.cpp @@ -212,7 +212,6 @@ bool Graphics::InitScene() pPointLight.Init(pDevice.Get(), pContext.Get()); pObject.Init(pDevice.Get(), pContext.Get(), "Models\\sponza\\sponza.obj", width, height, true); pSkyBox.Init(pDevice.Get(), pContext.Get()); - pObject.GetMesh()->SetScale(0.1f, 0.1f, 0.1f); return true; } diff --git a/Citrus/Graphics.h b/Citrus/Graphics.h index 177fd9f..9c90ccf 100644 --- a/Citrus/Graphics.h +++ b/Citrus/Graphics.h @@ -7,11 +7,11 @@ class Graphics { public: Graphics() {} + Graphics(const Graphics&) {} + ~Graphics() {} bool InitializeGraphics(HWND hwnd, const int width, const int height); bool InitDxBase(HWND hwnd); bool InitScene(); - Graphics(Graphics&) = delete; - ~Graphics() {} public: void BeginFrame() const noexcept; void EndFrame() const noexcept; @@ -22,9 +22,9 @@ class Graphics GameObject pObject; CPUInfo pCPU; PointLight pPointLight; -protected: - Microsoft::WRL::ComPtr pDevice = nullptr; - Microsoft::WRL::ComPtr pContext = nullptr; +public: + Microsoft::WRL::ComPtr pDevice; + Microsoft::WRL::ComPtr pContext; Microsoft::WRL::ComPtr pChain = nullptr; Microsoft::WRL::ComPtr pRtv = nullptr; Microsoft::WRL::ComPtr pDSV = nullptr; diff --git a/Citrus/Model.cpp b/Citrus/Model.cpp index 8a5ce70..0a0cfad 100644 --- a/Citrus/Model.cpp +++ b/Citrus/Model.cpp @@ -58,6 +58,14 @@ XMFLOAT3 Model::AdjustPos(float x, float y, float z) return pos; } +XMFLOAT3 Model::AdjustRot(float roll, float pitch, float yaw) +{ + rot.x += roll; + rot.y += pitch; + rot.z += yaw; + return rot; +} + XMFLOAT3 Model::SetRot(const float x, const float y, const float z) { rot.x = x; diff --git a/Citrus/Model.h b/Citrus/Model.h index 8cdb042..52b227a 100644 --- a/Citrus/Model.h +++ b/Citrus/Model.h @@ -25,6 +25,7 @@ class Model void Render(const Camera3D cam); XMFLOAT3 SetPos(const float x, const float y, const float z); XMFLOAT3 AdjustPos(float x, float y, float z); + XMFLOAT3 AdjustRot(float roll, float pitch, float yaw); XMFLOAT3 SetRot(const float x, const float y, const float z); XMFLOAT3 SetScale(const float x, const float y, const float z); XMFLOAT3 GetPos() const; diff --git a/Citrus/UI.h b/Citrus/UI.h index b1271a1..0f65bed 100644 --- a/Citrus/UI.h +++ b/Citrus/UI.h @@ -1,7 +1,7 @@ #pragma once #include "Model.h" #include -using namespace DirectX; + class UI { public: