Owning, typed generation parameters. 更多...
#include <Params.h>
Public 成员函数 | |
| void | setSeed (uint32_t seed) |
| Set the deterministic seed used by generation. | |
| uint32_t | getSeed () const |
| Return the deterministic generation seed. | |
| void | setSize (int width, int height) |
| Set the generation dimensions, clamping each non-positive value to one. | |
| int | getWidth () const |
| Return the generation width. | |
| int | getHeight () const |
| Return the generation height. | |
| void | setInt (const std::string &key, int value) |
| Store an Int64 parameter, preserving its numeric Value kind. | |
| void | setFloat (const std::string &key, float value) |
| Store a finite or non-finite floating parameter as Value::Double without text conversion. | |
| void | setBool (const std::string &key, bool value) |
| Stores a boolean generation parameter. | |
| void | setString (const std::string &key, const std::string &value) |
| Store an owning string parameter as Value::String. | |
| bool | has (const std::string &key) const |
| Return whether a parameter or one of the three dimensions exists. | |
| int | getInt (const std::string &key, int defaultValue) const |
| Read an integer parameter with explicit numeric conversion rules. | |
| float | getFloat (const std::string &key, float defaultValue) const |
| Read a floating parameter with explicit numeric conversion rules. | |
| bool | getBool (const std::string &key, bool defaultValue) const |
| Read a boolean parameter without parsing text. | |
| std::string | getString (const std::string &key, const std::string &defaultValue) const |
| Read only a Value::String parameter; numeric/bool values are not stringified. | |
| std::string | canonicalString () const |
| Return a deterministic serialization of all generation parameters. | |
详细描述
Owning, typed generation parameters.
Algorithm-specific values are stored in a common eve::Value::Object; the setter overload used by the caller is therefore preserved as the Value kind instead of being serialized to text and parsed again by a getter.
seed, width, and height have a dedicated generation-dimension domain. setSeed/setSize are the authoritative APIs for that domain and setInt retains the established convenience spelling for those three keys. A floating/string/bool value with one of those names is an algorithm-local parameter and is kept in the typed object domain; it does not change the dimensions. This is required by existing mesh recipes which use width or height as geometric floating-point parameters.
成员函数说明
◆ canonicalString()
| std::string eve::procgen::Params::canonicalString | ( | ) | const |
Return a deterministic serialization of all generation parameters.
- 返回
- Sorted, length-delimited, type-tagged parameter text suitable for a build key.
- 备注
- The result contains the dedicated dimensions and typed algorithm values. It does not include wall-clock, process address or unordered-container iteration order; a string
"1", Int641, Double1.0, and Booltruehave different encodings.
在文件 Params.cpp 第 209 行定义.
◆ getBool()
| bool eve::procgen::Params::getBool | ( | const std::string & | key, |
| bool | defaultValue | ||
| ) | const |
Read a boolean parameter without parsing text.
- 参数
-
key Parameter name. defaultValue Value returned when the parameter is absent, invalid, or not an exact Bool/0/1 numeric value.
- 返回
- The converted boolean value or
defaultValue.
在文件 Params.cpp 第 195 行定义.
引用了 defaultValue, key , 以及 value.
◆ getFloat()
| float eve::procgen::Params::getFloat | ( | const std::string & | key, |
| float | defaultValue | ||
| ) | const |
Read a floating parameter with explicit numeric conversion rules.
Double and representable Int64 values convert to float; Bool converts to zero or one. Non-finite/out-of-range values and unsupported kinds return the supplied default. Strings are never parsed.
在文件 Params.cpp 第 188 行定义.
引用了 defaultValue, key , 以及 value.
◆ getHeight()
| int eve::procgen::Params::getHeight | ( | ) | const |
Return the generation height.
在文件 Params.cpp 第 147 行定义.
◆ getInt()
| int eve::procgen::Params::getInt | ( | const std::string & | key, |
| int | defaultValue | ||
| ) | const |
Read an integer parameter with explicit numeric conversion rules.
Int64 values must fit int; finite integral Double values must also fit; Bool values convert to zero or one. Strings, fractional values, out-of-range values, missing keys, and unsupported kinds return the supplied default. Text is never parsed.
在文件 Params.cpp 第 176 行定义.
引用了 defaultValue, key , 以及 value.
◆ getSeed()
| uint32_t eve::procgen::Params::getSeed | ( | ) | const |
Return the deterministic generation seed.
在文件 Params.cpp 第 140 行定义.
◆ getString()
| std::string eve::procgen::Params::getString | ( | const std::string & | key, |
| const std::string & | defaultValue | ||
| ) | const |
Read only a Value::String parameter; numeric/bool values are not stringified.
在文件 Params.cpp 第 202 行定义.
引用了 defaultValue, key, text , 以及 value.
◆ getWidth()
| int eve::procgen::Params::getWidth | ( | ) | const |
Return the generation width.
在文件 Params.cpp 第 146 行定义.
◆ has()
| bool eve::procgen::Params::has | ( | const std::string & | key | ) | const |
Return whether a parameter or one of the three dimensions exists.
在文件 Params.cpp 第 171 行定义.
引用了 key.
◆ setBool()
| void eve::procgen::Params::setBool | ( | const std::string & | key, |
| bool | value | ||
| ) |
Stores a boolean generation parameter.
- 参数
-
key Parameter name. value Boolean value to store.
在文件 Params.cpp 第 167 行定义.
◆ setFloat()
| void eve::procgen::Params::setFloat | ( | const std::string & | key, |
| float | value | ||
| ) |
Store a finite or non-finite floating parameter as Value::Double without text conversion.
在文件 Params.cpp 第 165 行定义.
◆ setInt()
| void eve::procgen::Params::setInt | ( | const std::string & | key, |
| int | value | ||
| ) |
Store an Int64 parameter, preserving its numeric Value kind.
- 参数
-
key Algorithm parameter key; the three dimension keys route to the dedicated dimension domain. value Integer value.
在文件 Params.cpp 第 149 行定义.
被这些函数引用 eve::procgen_editing::TextureRecipePreviewRuntime::generate() , 以及 eve::procgen::generateRoadNetworkArtifact().
◆ setSeed()
| void eve::procgen::Params::setSeed | ( | uint32_t | seed | ) |
◆ setSize()
| void eve::procgen::Params::setSize | ( | int | width, |
| int | height | ||
| ) |
Set the generation dimensions, clamping each non-positive value to one.
- 参数
-
width Number of generated columns. height Number of generated rows.
在文件 Params.cpp 第 142 行定义.
◆ setString()
| void eve::procgen::Params::setString | ( | const std::string & | key, |
| const std::string & | value | ||
| ) |
该类的文档由以下文件生成:
- src/modules/procgen/Params.h
- src/modules/procgen/Params.cpp