2024-04-10 09:51:03 -03:00
|
|
|
#ifndef XNA_GRAPHICS_RASTERIZER_HPP
|
|
|
|
#define XNA_GRAPHICS_RASTERIZER_HPP
|
|
|
|
|
2024-05-22 10:56:16 -03:00
|
|
|
#include "gresource.hpp"
|
2024-04-10 09:51:03 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-11-15 20:14:51 -03:00
|
|
|
|
|
|
|
//Defines winding orders that may be used to identify back faces for culling.
|
|
|
|
enum class CullMode {
|
|
|
|
//Do not cull back faces.
|
|
|
|
None,
|
|
|
|
//Cull back faces with clockwise vertices.
|
|
|
|
CullClockwiseFace,
|
|
|
|
//Cull back faces with counterclockwise vertices.
|
|
|
|
CullCounterClockwiseFace,
|
|
|
|
};
|
|
|
|
|
|
|
|
//Describes options for filling the vertices and lines that define a primitive.
|
|
|
|
enum class FillMode
|
|
|
|
{
|
|
|
|
//Draw lines connecting the vertices that define a primitive face.
|
|
|
|
WireFrame,
|
|
|
|
//Draw solid faces for each primitive.
|
|
|
|
Solid,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RasterizerStateImplementation;
|
|
|
|
|
2024-06-24 11:09:31 -03:00
|
|
|
//Contains rasterizer state, which determines how to convert vector data (shapes) into raster data (pixels).
|
2024-11-16 14:21:06 -03:00
|
|
|
class RasterizerState : public GraphicsResource {
|
2024-04-10 09:51:03 -03:00
|
|
|
public:
|
2024-05-22 10:56:16 -03:00
|
|
|
RasterizerState();
|
2024-11-15 20:14:51 -03:00
|
|
|
RasterizerState(std::shared_ptr<GraphicsDevice> const& device);
|
2024-06-24 11:09:31 -03:00
|
|
|
|
|
|
|
//Specifies the conditions for culling or removing triangles. The default value is CullMode.CounterClockwise.
|
2024-05-22 10:56:16 -03:00
|
|
|
xna::CullMode CullMode() const;
|
2024-06-24 11:09:31 -03:00
|
|
|
//Specifies the conditions for culling or removing triangles. The default value is CullMode.CounterClockwise.
|
2024-05-22 10:56:16 -03:00
|
|
|
void CullMode(xna::CullMode value);
|
2024-06-24 11:09:31 -03:00
|
|
|
//The fill mode, which defines how a triangle is filled during rendering. The default is FillMode.Solid.
|
2024-05-22 10:56:16 -03:00
|
|
|
xna::FillMode FillMode() const;
|
2024-06-24 11:09:31 -03:00
|
|
|
//The fill mode, which defines how a triangle is filled during rendering. The default is FillMode.Solid.
|
2024-05-22 10:56:16 -03:00
|
|
|
void FillMode(xna::FillMode value);
|
|
|
|
|
2024-06-24 11:09:31 -03:00
|
|
|
//Enables or disables multisample antialiasing. The default is true.
|
|
|
|
bool MultiSampleAntiAlias() const;
|
|
|
|
//Enables or disables multisample antialiasing. The default is true.
|
|
|
|
void MultiSampleAntiAlias(bool value);
|
|
|
|
|
|
|
|
//Sets or retrieves the depth bias for polygons, which is the amount of bias to apply to the depth of a primitive
|
|
|
|
//to alleviate depth testing problems for primitives of similar depth. The default value is 0.
|
|
|
|
float DepthBias() const;
|
|
|
|
//Sets or retrieves the depth bias for polygons, which is the amount of bias to apply to the depth of a primitive
|
|
|
|
//to alleviate depth testing problems for primitives of similar depth. The default value is 0.
|
|
|
|
void DepthBias(float value);
|
|
|
|
|
|
|
|
//Gets or sets a bias value that takes into account the slope of a polygon. This bias value is applied to coplanar primitives
|
|
|
|
// to reduce aliasing and other rendering artifacts caused by z-fighting. The default is 0.
|
|
|
|
float SlopeScaleDepthBias() const;
|
|
|
|
//Gets or sets a bias value that takes into account the slope of a polygon. This bias value is applied to coplanar primitives
|
|
|
|
// to reduce aliasing and other rendering artifacts caused by z-fighting. The default is 0.
|
|
|
|
void SlopeScaleDepthBias(float value);
|
|
|
|
|
|
|
|
//Enables or disables scissor testing. The default is false.
|
|
|
|
bool ScissorTestEnable() const;
|
|
|
|
//Enables or disables scissor testing. The default is false.
|
|
|
|
void ScissorTestEnable(bool value);
|
|
|
|
|
|
|
|
//A built-in state object with settings for not culling any primitives.
|
2024-11-15 20:14:51 -03:00
|
|
|
static std::unique_ptr<RasterizerState> CullNone();
|
2024-06-24 11:09:31 -03:00
|
|
|
//A built-in state object with settings for culling primitives with clockwise winding order.
|
2024-11-15 20:14:51 -03:00
|
|
|
static std::unique_ptr<RasterizerState> CullClockwise();
|
2024-06-24 11:09:31 -03:00
|
|
|
//A built-in state object with settings for culling primitives with counter-clockwise winding order.
|
2024-11-15 20:14:51 -03:00
|
|
|
static std::unique_ptr<RasterizerState> CullCounterClockwise();
|
2024-05-22 10:56:16 -03:00
|
|
|
|
2024-06-24 11:09:31 -03:00
|
|
|
bool Initialize();
|
2024-11-15 20:14:51 -03:00
|
|
|
bool Apply();
|
2024-11-16 14:21:06 -03:00
|
|
|
|
|
|
|
std::unique_ptr<RasterizerStateImplementation> Implementation;
|
2024-11-15 20:14:51 -03:00
|
|
|
};
|
2024-04-10 09:51:03 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|