Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
GenericDrawCommand.inl
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#ifndef DVD_GENERIC_DRAW_COMMAND_INL_
33#define DVD_GENERIC_DRAW_COMMAND_INL_
34
35namespace Divide {
36
37 inline bool isEnabledOption(const GenericDrawCommand& cmd, const CmdRenderOptions option) noexcept {
38 return cmd._renderOptions & to_base(option);
39 }
40
41 inline void enableOption(GenericDrawCommand& cmd, const CmdRenderOptions option) noexcept {
42 cmd._renderOptions |= to_base(option);
43 }
44
45 inline void disableOption(GenericDrawCommand& cmd, const CmdRenderOptions option) noexcept {
46 cmd._renderOptions &= ~to_base(option);
47 }
48
49 inline void toggleOption(GenericDrawCommand& cmd, const CmdRenderOptions option) noexcept {
50 setOption(cmd, option, !isEnabledOption(cmd, option));
51 }
52
53 inline void setOption(GenericDrawCommand& cmd, const CmdRenderOptions option, const bool state) noexcept {
54 if (state) {
55 enableOption(cmd, option);
56 } else {
57 disableOption(cmd, option);
58 }
59 }
60
61 inline void enableOptions(GenericDrawCommand& cmd, const BaseType<CmdRenderOptions> optionsMask) noexcept {
62 cmd._renderOptions |= to_base(optionsMask);
63 }
64
65 inline void disableOptions(GenericDrawCommand& cmd, const BaseType<CmdRenderOptions> optionsMask) noexcept {
66 cmd._renderOptions &= ~to_base(optionsMask);
67 }
68
69 inline void setOptions(GenericDrawCommand& cmd, const BaseType<CmdRenderOptions> optionsMask, const bool state) noexcept {
70 if (state) {
71 enableOptions(cmd, optionsMask);
72 } else {
73 disableOptions(cmd, optionsMask);
74 }
75 }
76
77 inline void resetOptions(GenericDrawCommand& cmd) noexcept {
78 cmd._renderOptions = to_base(CmdRenderOptions::RENDER_GEOMETRY);
79 }
80}; //namespace Divide
81
82#endif //DVD_GENERIC_DRAW_COMMAND_INL_
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
bool isEnabledOption(const GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void disableOptions(GenericDrawCommand &cmd, BaseType< CmdRenderOptions > optionsMask) noexcept
void disableOption(GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void toggleOption(GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void enableOption(GenericDrawCommand &cmd, CmdRenderOptions option) noexcept
void setOptions(GenericDrawCommand &cmd, BaseType< CmdRenderOptions > optionsMask, bool state) noexcept
void resetOptions(GenericDrawCommand &cmd) noexcept
std::underlying_type_t< Type > BaseType
void enableOptions(GenericDrawCommand &cmd, BaseType< CmdRenderOptions > optionsMask) noexcept
void setOption(GenericDrawCommand &cmd, CmdRenderOptions option, bool state) noexcept
constexpr auto to_base(const Type value) -> Type