Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
RenderStateBlock.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_RENDER_STATE_BLOCK_H_
34#define DVD_RENDER_STATE_BLOCK_H_
35
37
38namespace Divide {
39
40namespace TypeUtil {
41 [[nodiscard]] const char* ComparisonFunctionToString(ComparisonFunction func) noexcept;
42 [[nodiscard]] const char* StencilOperationToString(StencilOperation op) noexcept;
43 [[nodiscard]] const char* FillModeToString(FillMode mode) noexcept;
44 [[nodiscard]] const char* CullModeToString(CullMode mode) noexcept;
45
46 [[nodiscard]] ComparisonFunction StringToComparisonFunction(const char* name) noexcept;
47 [[nodiscard]] StencilOperation StringToStencilOperation(const char* name) noexcept;
48 [[nodiscard]] FillMode StringToFillMode(const char* name) noexcept;
49 [[nodiscard]] CullMode StringToCullMode(const char* name) noexcept;
50};
51
53{
55 F32 _zBias{0.f};
59 U32 _stencilMask{0xFFFFFFFF};
61
67
70
71 bool _frontFaceCCW{true};
75 bool _stencilEnabled{false};
78
79 bool operator==(const RenderStateBlock&) const = default;
80};
81
82
83size_t GetHash( const RenderStateBlock& block );
84void SaveToXML( const RenderStateBlock& block, const std::string& entryName, boost::property_tree::ptree& pt );
85void LoadFromXML( const std::string& entryName, const boost::property_tree::ptree& pt, RenderStateBlock& blockInOut );
86
87}; // namespace Divide
88#endif //DVD_RENDER_STATE_BLOCK_H_
FillMode StringToFillMode(const char *name) noexcept
const char * StencilOperationToString(StencilOperation op) noexcept
const char * CullModeToString(CullMode mode) noexcept
const char * ComparisonFunctionToString(ComparisonFunction func) noexcept
const char * FillModeToString(FillMode mode) noexcept
CullMode StringToCullMode(const char *name) noexcept
ComparisonFunction StringToComparisonFunction(const char *name) noexcept
StencilOperation StringToStencilOperation(const char *name) noexcept
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
static const P32 P32_FLAGS_TRUE
StencilOperation
Valid front and back stencil test actions.
@ KEEP
Keeps the current value.
size_t GetHash(const PropertyDescriptor< T > &descriptor) noexcept
Definition: Resource.inl:40
void SaveToXML(const TerrainDescriptor &descriptor, boost::property_tree::ptree &pt)
bool LoadFromXML(TerrainDescriptor &descriptor, const boost::property_tree::ptree &pt, std::string_view name)
FillMode
Defines all available fill modes for primitives.
@ SOLID
The interior of the polygon is filled.
CullMode
Specifies whether front- or back-facing facets are candidates for culling.
@ BACK
Cull Back facing polygons (aka CW)
uint32_t U32
StencilOperation _stencilZFailOp
StencilOperation _stencilFailOp
ComparisonFunction _stencilFunc
StencilOperation _stencilPassOp
ComparisonFunction _zFunc
bool operator==(const RenderStateBlock &) const =default