From bdb6cfcd5317f37fe1cf583aa69ac768d3046abf Mon Sep 17 00:00:00 2001 From: Danilo Date: Thu, 14 Nov 2024 11:13:14 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=B5es=20em=20DepthStencilState?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/xna/enumerations.hpp | 29 ++----------------- includes/xna/graphics/depthstencilstate.hpp | 31 +++++++++++++++------ includes/xna/graphics/samplerstate.hpp | 1 + includes/xna/graphics/shared.hpp | 19 +++++++++++++ 4 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 includes/xna/graphics/shared.hpp diff --git a/includes/xna/enumerations.hpp b/includes/xna/enumerations.hpp index 8ede1a2..139d511 100644 --- a/includes/xna/enumerations.hpp +++ b/includes/xna/enumerations.hpp @@ -54,20 +54,7 @@ namespace xna { DepthBuffer, Stencil, Target, - }; - - enum class ComparisonFunction { - Never, - Less, - Equal, - LessEquals, - Greater, - NotEqual, - GreaterEqual, - Always - }; - - using CompareFunction = ComparisonFunction; + }; enum class CullMode { None, @@ -183,19 +170,7 @@ namespace xna { Texture, BackToFront, FrontToBack, - }; - - enum class StencilOperation - { - Keep, - Zero, - Replace, - IncrementSaturation, - DecrementSaturation, - Invert, - Increment, - Decrement, - }; + }; enum class SurfaceFormat { Color = 0, diff --git a/includes/xna/graphics/depthstencilstate.hpp b/includes/xna/graphics/depthstencilstate.hpp index ce2a1d2..bdf2fac 100644 --- a/includes/xna/graphics/depthstencilstate.hpp +++ b/includes/xna/graphics/depthstencilstate.hpp @@ -1,11 +1,24 @@ #ifndef XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP #define XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP -#include "../default.hpp" #include "gresource.hpp" #include "../platform.hpp" +#include "shared.hpp" +#include +#include namespace xna { + enum class StencilOperation + { + Keep, + Zero, + Replace, + IncrementSaturation, + DecrementSaturation, + Invert, + Increment, + Decrement, + }; struct DepthStencilStateImplementation; @@ -13,7 +26,7 @@ namespace xna { class DepthStencilState : public GraphicsResource, public PlatformImplementation { public: DepthStencilState(); - DepthStencilState(sptr const& device); + DepthStencilState(std::shared_ptr const& device); //Gets or sets the stencil operation to perform if the stencil test passes and the depth-buffer test fails for a counterclockwise triangle. //The default is StencilOperation.Keep. @@ -65,14 +78,14 @@ namespace xna { CompareFunction StencilFunction() const; //Gets or sets the mask applied to the reference value and each stencil buffer entry to determine the significant bits for the stencil test. //The default mask is Int32.MaxValue. - void StencilMask(Int value); + void StencilMask(int32_t value); //Gets or sets the mask applied to the reference value and each stencil buffer entry to determine the significant bits for the stencil test. //The default mask is Int32.MaxValue. - Int StencilMask() const; + int32_t StencilMask() const; //Gets or sets the write mask applied to values written into the stencil buffer. The default mask is Int32.MaxValue. - void StencilWriteMask(Int value); + void StencilWriteMask(int32_t value); //Gets or sets the write mask applied to values written into the stencil buffer. The default mask is Int32.MaxValue. - Int StencilWriteMask() const; + int32_t StencilWriteMask() const; //Gets or sets the stencil operation to perform if the stencil test passes. The default is StencilOperation.Keep. void StencilPass(StencilOperation value); //Gets or sets the stencil operation to perform if the stencil test passes. The default is StencilOperation.Keep. @@ -83,11 +96,11 @@ namespace xna { StencilOperation StencilDepthBufferFail() const; //A built-in state object with settings for not using a depth stencil buffer. - static uptr None(); + static std::unique_ptr None(); //A built-in state object with default settings for using a depth stencil buffer. - static uptr Default(); + static std::unique_ptr Default(); //A built-in state object with settings for enabling a read-only depth stencil buffer. - static uptr DepthRead(); + static std::unique_ptr DepthRead(); bool Initialize(); bool Apply(); diff --git a/includes/xna/graphics/samplerstate.hpp b/includes/xna/graphics/samplerstate.hpp index 2f07d1e..105b24a 100644 --- a/includes/xna/graphics/samplerstate.hpp +++ b/includes/xna/graphics/samplerstate.hpp @@ -2,6 +2,7 @@ #define XNA_GRAPHICS_SAMPLERSTATE_HPP #include "../default.hpp" +#include "shared.hpp" #include "gresource.hpp" namespace xna { diff --git a/includes/xna/graphics/shared.hpp b/includes/xna/graphics/shared.hpp new file mode 100644 index 0000000..075e76f --- /dev/null +++ b/includes/xna/graphics/shared.hpp @@ -0,0 +1,19 @@ +#ifndef XNA_GRAPHICS_SHARED_HPP +#define XNA_GRAPHICS_SHARED_HPP + +namespace xna { + enum class ComparisonFunction { + Never, + Less, + Equal, + LessEquals, + Greater, + NotEqual, + GreaterEqual, + Always + }; + + using CompareFunction = ComparisonFunction; +} + +#endif \ No newline at end of file