Line data Source code
1 : // Copyright (c) 2025 Milton McDonald
2 : // This source code is licensed under the MIT License. See LICENSE file in the
3 : // project root for details.
4 :
5 : #ifndef ENGINE_LIB_GL_CLEAR_FLAGS_H_
6 : #define ENGINE_LIB_GL_CLEAR_FLAGS_H_
7 :
8 : #include <bitset>
9 : #include <utility>
10 :
11 : #include "graphics-engine/i-gl-clear-flags.h"
12 :
13 : namespace graphics_engine::gl_clear_flags {
14 :
15 1 : class GLClearFlags : public IGLClearFlags {
16 : public:
17 2 : ~GLClearFlags() override = default;
18 : auto Set(gl_types::GLClearBit bit) -> GLClearFlags& override;
19 : auto Reset(gl_types::GLClearBit bit) -> GLClearFlags& override;
20 : [[nodiscard]] auto Test(gl_types::GLClearBit bit) const -> bool override;
21 :
22 : private:
23 : static constexpr int kExpectedNumClearBits = 3;
24 : static_assert(
25 : std::to_underlying(gl_types::GLClearBit::kNumBits) ==
26 : kExpectedNumClearBits,
27 : "Fix value of kExpectedNumClearBits to match GLClearBit definition!");
28 :
29 : std::bitset<kExpectedNumClearBits> flags_;
30 : };
31 :
32 : } // namespace graphics_engine::gl_clear_flags
33 :
34 : #endif // ENGINE_LIB_GL_CLEAR_FLAGS_H_
|