-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathRectBasePerlin.hpp
205 lines (175 loc) · 8.74 KB
/
RectBasePerlin.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*#######################################################################################
Copyright (c) 2017-2019 Kasugaccho
Copyright (c) 2018-2019 As Project
https://github.com/Kasugaccho/DungeonTemplateLibrary
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#######################################################################################*/
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_RANGE_RECT_BASE_WITH_PERLIN_HPP
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_RANGE_RECT_BASE_WITH_PERLIN_HPP
#include <DTL/Base/Struct.hpp>
#include <DTL/Macros/constexpr.hpp>
#include <DTL/Macros/nodiscard.hpp>
#include <DTL/Type/SizeT.hpp>
#include <DTL/Range/BasicRect.hpp>
/*#######################################################################################
[概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
[Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
#######################################################################################*/
namespace dtl {
inline namespace range { //"dtl::range"名前空間に属する
//四角形クラス
template<typename Derived_, typename Matrix_Var_>
class RectBasePerlin : public ::dtl::range::BasicRect<Derived_> {
private:
///// エイリアス (Alias) /////
using Index_Size = ::dtl::type::size;
using RectBase_t = ::dtl::range::BasicRect<Derived_>;
protected:
///// メンバ変数 (Member Variable) /////
double frequency{};
Index_Size octaves{};
Matrix_Var_ min_height{};
Matrix_Var_ max_height{};
public:
///// メンバ変数の値を取得 (Get Value) /////
DTL_VERSIONING_CPP17_NODISCARD
constexpr double getValue() const noexcept {
return this->frequency;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr double getFrequency() const noexcept {
return this->frequency;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getOctaves() const noexcept {
return this->octaves;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getMinHeight() const noexcept {
return this->min_height;
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getMaxHeight() const noexcept {
return this->max_height;
}
///// 消去 (Clear) /////
/*#######################################################################################
[概要] 塗り値を初期値に戻す(描画値を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing value to the initial value (deletes the drawing value).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearValue() noexcept {
this->frequency = 0.0;
this->octaves = 0;
const Matrix_Var_ clear_max_height{};
this->max_height = clear_max_height;
const Matrix_Var_ clear_min_height{};
this->min_height = clear_min_height;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearFrequency() noexcept {
this->frequency = 0.0;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearOctaves() noexcept {
this->octaves = 0;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearMinHeight() noexcept {
const Matrix_Var_ clear_min_height{};
this->min_height = clear_min_height;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clearMaxHeight() noexcept {
const Matrix_Var_ clear_max_height{};
this->max_height = clear_max_height;
return static_cast<Derived_&>(*this);
}
/*#######################################################################################
[概要] 全ての値を初期値に戻す。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Reset all values to their initial values.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& clear() noexcept {
this->clearRange();
this->clearValue();
return static_cast<Derived_&>(*this);
}
///// 代入 /////
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setValue(const double frequency_) noexcept {
this->frequency = frequency_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setFrequency(const double frequency_) noexcept {
this->frequency = frequency_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setOctaves(const Index_Size octaves_) noexcept {
this->octaves = octaves_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setMinHeight(const Matrix_Var_& min_height_) noexcept {
this->min_height = min_height_;
return static_cast<Derived_&>(*this);
}
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setMaxHeight(const Matrix_Var_& max_height_) noexcept {
this->max_height = max_height_;
return static_cast<Derived_&>(*this);
}
///// コンストラクタ (Constructor) /////
RectBasePerlin() = default;
constexpr explicit RectBasePerlin(const ::dtl::base::MatrixRange& matrix_range_) noexcept
:RectBase_t(matrix_range_) {}
constexpr RectBasePerlin(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_) {}
constexpr explicit RectBasePerlin(const double frequency_) noexcept
:frequency(frequency_) {}
constexpr RectBasePerlin(const double frequency_, const Index_Size octaves_) noexcept
:frequency(frequency_), octaves(octaves_) {}
constexpr RectBasePerlin(const double frequency_, const Index_Size octaves_, const Matrix_Var_& max_height_) noexcept
:frequency(frequency_), octaves(octaves_), max_height(max_height_) {}
constexpr RectBasePerlin(const double frequency_, const Index_Size octaves_, const Matrix_Var_& max_height_, const Matrix_Var_& min_height_) noexcept
:frequency(frequency_), octaves(octaves_), min_height(min_height_), max_height(max_height_) {}
constexpr RectBasePerlin(const ::dtl::base::MatrixRange& matrix_range_, const double frequency_) noexcept
:RectBase_t(matrix_range_),
frequency(frequency_) {}
constexpr RectBasePerlin(const ::dtl::base::MatrixRange& matrix_range_, const double frequency_, const Index_Size octaves_) noexcept
:RectBase_t(matrix_range_),
frequency(frequency_), octaves(octaves_) {}
constexpr RectBasePerlin(const ::dtl::base::MatrixRange& matrix_range_, const double frequency_, const Index_Size octaves_, const Matrix_Var_& max_height_) noexcept
:RectBase_t(matrix_range_),
frequency(frequency_), octaves(octaves_), max_height(max_height_) {}
constexpr RectBasePerlin(const ::dtl::base::MatrixRange& matrix_range_, const double frequency_, const Index_Size octaves_, const Matrix_Var_& max_height_, const Matrix_Var_& min_height_) noexcept
:RectBase_t(matrix_range_),
frequency(frequency_), octaves(octaves_), min_height(min_height_), max_height(max_height_) {}
constexpr RectBasePerlin(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const double frequency_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
frequency(frequency_) {}
constexpr RectBasePerlin(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const double frequency_, const Index_Size octaves_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
frequency(frequency_), octaves(octaves_) {}
constexpr RectBasePerlin(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const double frequency_, const Index_Size octaves_, const Matrix_Var_& max_height_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
frequency(frequency_), octaves(octaves_), max_height(max_height_) {}
constexpr RectBasePerlin(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const double frequency_, const Index_Size octaves_, const Matrix_Var_& max_height_, const Matrix_Var_& min_height_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
frequency(frequency_), octaves(octaves_), min_height(min_height_), max_height(max_height_) {}
};
}
}
#endif //Included Dungeon Template Library