1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Correções em DepthStencilState

This commit is contained in:
Danilo 2024-11-14 11:13:14 -03:00
parent fd9709f530
commit bdb6cfcd53
4 changed files with 44 additions and 36 deletions

View File

@ -54,20 +54,7 @@ namespace xna {
DepthBuffer, DepthBuffer,
Stencil, Stencil,
Target, Target,
}; };
enum class ComparisonFunction {
Never,
Less,
Equal,
LessEquals,
Greater,
NotEqual,
GreaterEqual,
Always
};
using CompareFunction = ComparisonFunction;
enum class CullMode { enum class CullMode {
None, None,
@ -183,19 +170,7 @@ namespace xna {
Texture, Texture,
BackToFront, BackToFront,
FrontToBack, FrontToBack,
}; };
enum class StencilOperation
{
Keep,
Zero,
Replace,
IncrementSaturation,
DecrementSaturation,
Invert,
Increment,
Decrement,
};
enum class SurfaceFormat { enum class SurfaceFormat {
Color = 0, Color = 0,

View File

@ -1,11 +1,24 @@
#ifndef XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP #ifndef XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP
#define XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP #define XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP
#include "../default.hpp"
#include "gresource.hpp" #include "gresource.hpp"
#include "../platform.hpp" #include "../platform.hpp"
#include "shared.hpp"
#include <memory>
#include <cstdint>
namespace xna { namespace xna {
enum class StencilOperation
{
Keep,
Zero,
Replace,
IncrementSaturation,
DecrementSaturation,
Invert,
Increment,
Decrement,
};
struct DepthStencilStateImplementation; struct DepthStencilStateImplementation;
@ -13,7 +26,7 @@ namespace xna {
class DepthStencilState : public GraphicsResource, public PlatformImplementation<DepthStencilStateImplementation> { class DepthStencilState : public GraphicsResource, public PlatformImplementation<DepthStencilStateImplementation> {
public: public:
DepthStencilState(); DepthStencilState();
DepthStencilState(sptr<GraphicsDevice> const& device); DepthStencilState(std::shared_ptr<GraphicsDevice> 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. //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. //The default is StencilOperation.Keep.
@ -65,14 +78,14 @@ namespace xna {
CompareFunction StencilFunction() const; 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. //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. //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. //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. //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. //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. //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. //Gets or sets the stencil operation to perform if the stencil test passes. The default is StencilOperation.Keep.
void StencilPass(StencilOperation value); void StencilPass(StencilOperation value);
//Gets or sets the stencil operation to perform if the stencil test passes. The default is StencilOperation.Keep. //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; StencilOperation StencilDepthBufferFail() const;
//A built-in state object with settings for not using a depth stencil buffer. //A built-in state object with settings for not using a depth stencil buffer.
static uptr<DepthStencilState> None(); static std::unique_ptr<DepthStencilState> None();
//A built-in state object with default settings for using a depth stencil buffer. //A built-in state object with default settings for using a depth stencil buffer.
static uptr<DepthStencilState> Default(); static std::unique_ptr<DepthStencilState> Default();
//A built-in state object with settings for enabling a read-only depth stencil buffer. //A built-in state object with settings for enabling a read-only depth stencil buffer.
static uptr<DepthStencilState> DepthRead(); static std::unique_ptr<DepthStencilState> DepthRead();
bool Initialize(); bool Initialize();
bool Apply(); bool Apply();

View File

@ -2,6 +2,7 @@
#define XNA_GRAPHICS_SAMPLERSTATE_HPP #define XNA_GRAPHICS_SAMPLERSTATE_HPP
#include "../default.hpp" #include "../default.hpp"
#include "shared.hpp"
#include "gresource.hpp" #include "gresource.hpp"
namespace xna { namespace xna {

View File

@ -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