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

111 lines
5.7 KiB
C++
Raw Permalink Normal View History

2024-04-15 09:48:16 -03:00
#ifndef XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP
#define XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP
2024-11-14 13:44:23 -03:00
#include "gresource.hpp"
2024-11-14 11:13:14 -03:00
#include "shared.hpp"
#include <cstdint>
2024-11-14 13:44:23 -03:00
#include <memory>
2024-04-15 09:48:16 -03:00
namespace xna {
2024-11-14 11:13:14 -03:00
enum class StencilOperation
{
Keep,
Zero,
Replace,
IncrementSaturation,
DecrementSaturation,
Invert,
Increment,
Decrement,
};
struct DepthStencilStateImplementation;
2024-06-23 23:14:06 -03:00
//Contains depth-stencil state for the device.
2024-11-16 14:21:06 -03:00
class DepthStencilState : public GraphicsResource {
2024-04-15 09:48:16 -03:00
public:
2024-05-20 10:29:20 -03:00
DepthStencilState();
2024-11-14 11:13:14 -03:00
DepthStencilState(std::shared_ptr<GraphicsDevice> const& device);
2024-04-15 09:48:16 -03:00
2024-06-23 23:14:06 -03:00
//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.
void CounterClockwiseStencilDepthBufferFail(StencilOperation value);
//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.
StencilOperation CounterClockwiseStencilDepthBufferFail() const;
//Gets or sets the stencil operation to perform if the stencil test fails for a counterclockwise triangle.
//The default is StencilOperation.Keep.
void CounterClockwiseStencilFail(StencilOperation value);
//Gets or sets the stencil operation to perform if the stencil test fails for a counterclockwise triangle.
//The default is StencilOperation.Keep.
StencilOperation CounterClockwiseStencilFail() const;
//Gets or sets the comparison function to use for counterclockwise stencil tests. The default is CompareFunction.Always.
void CounterClockwiseStencilFunction(CompareFunction value);
//Gets or sets the comparison function to use for counterclockwise stencil tests. The default is CompareFunction.Always.
CompareFunction CounterClockwiseStencilFunction() const;
//Gets or sets the stencil operation to perform if the stencil and depth-tests pass for a counterclockwise triangle.
//The default is StencilOperation.Keep.
void CounterClockwiseStencilPass(StencilOperation value);
//Gets or sets the stencil operation to perform if the stencil and depth-tests pass for a counterclockwise triangle.
//The default is StencilOperation.Keep.
StencilOperation CounterClockwiseStencilPass() const;
//Enables or disables depth buffering. The default is true.
void DepthBufferEnable(bool value);
//Enables or disables depth buffering. The default is true.
bool DepthBufferEnable() const;
//Enables or disables writing to the depth buffer. The default is true.
void DepthBufferWriteEnable(bool value);
//Enables or disables writing to the depth buffer. The default is true.
bool DepthBufferWriteEnable() const;
//Gets or sets the comparison function for the depth-buffer test. The default is CompareFunction.LessEqual
void DepthBufferFunction(CompareFunction value);
//Gets or sets the comparison function for the depth-buffer test. The default is CompareFunction.LessEqual
CompareFunction DepthBufferFunction() const;
//Gets or sets stencil enabling. The default is false.
void StencilEnable(bool value);
//Gets or sets stencil enabling. The default is false.
bool StencilEnable() const;
//Gets or sets the stencil operation to perform if the stencil test fails. The default is StencilOperation.Keep.
void StencilFail(StencilOperation value);
//Gets or sets the stencil operation to perform if the stencil test fails. The default is StencilOperation.Keep.
StencilOperation StencilFail() const;
//Gets or sets the comparison function for the stencil test.The default is CompareFunction.Always.
void StencilFunction(CompareFunction value);
//Gets or sets the comparison function for the stencil test. The default is CompareFunction.Always.
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.
2024-11-14 11:13:14 -03:00
void StencilMask(int32_t value);
2024-06-23 23:14:06 -03:00
//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.
2024-11-14 11:13:14 -03:00
int32_t StencilMask() const;
2024-06-23 23:14:06 -03:00
//Gets or sets the write mask applied to values written into the stencil buffer. The default mask is Int32.MaxValue.
2024-11-14 11:13:14 -03:00
void StencilWriteMask(int32_t value);
2024-06-23 23:14:06 -03:00
//Gets or sets the write mask applied to values written into the stencil buffer. The default mask is Int32.MaxValue.
2024-11-14 11:13:14 -03:00
int32_t StencilWriteMask() const;
2024-06-23 23:14:06 -03:00
//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.
StencilOperation StencilPass() const;
//Gets or sets the stencil operation to perform if the stencil test passes and the depth-test fails. The default is StencilOperation.Keep.
void StencilDepthBufferFail(StencilOperation value);
//Gets or sets the stencil operation to perform if the stencil test passes and the depth-test fails. The default is StencilOperation.Keep.
StencilOperation StencilDepthBufferFail() const;
2024-05-20 10:29:20 -03:00
2024-06-23 23:14:06 -03:00
//A built-in state object with settings for not using a depth stencil buffer.
2024-11-14 11:13:14 -03:00
static std::unique_ptr<DepthStencilState> None();
2024-06-23 23:14:06 -03:00
//A built-in state object with default settings for using a depth stencil buffer.
2024-11-14 11:13:14 -03:00
static std::unique_ptr<DepthStencilState> Default();
2024-06-23 23:14:06 -03:00
//A built-in state object with settings for enabling a read-only depth stencil buffer.
2024-11-14 11:13:14 -03:00
static std::unique_ptr<DepthStencilState> DepthRead();
2024-05-20 10:29:20 -03:00
2024-06-23 23:14:06 -03:00
bool Initialize();
bool Apply();
2024-11-16 14:21:06 -03:00
std::unique_ptr<DepthStencilStateImplementation> Implementation;
2024-04-15 09:48:16 -03:00
};
}
#endif