一次生成的房屋布局:实例 + 房间 + 元信息,可 JSON 序列化 / 实例化。 更多...
#include <HouseLayout.h>
Public 成员函数 | |
| void | clear () |
| 清空布局。 | |
| std::string | toJson () const |
| 序列化为 JSON / 从 JSON 恢复。 | |
| bool | fromJson (const std::string &json, std::string *error=nullptr) |
| bool | validate (const HouseComponentLibrary &library, std::string *error=nullptr) const |
| 校验布局是否满足组件库规则。 | |
| std::vector< graphics::Renderable3D * > | instantiate (graphics::Graphics *gfx, model3d::Model3D *models, const HouseComponentLibrary &library, std::string *error=nullptr) const |
| 把布局实例化为场景中的 Renderable3D(调用方持有)。 | |
Public 属性 | |
| uint32_t | seed = 1 |
| float | moduleSize = 1.f |
| 生成参数回显。 | |
| float | floorHeight = 3.f |
| std::string | footprintStyle = "rectangle" |
| 布局风格结果。 | |
| std::string | roofStyle = "gable" |
| std::string | entranceSide = "north" |
| std::vector< HouseInstance > | instances |
| 组件实例 / 房间 / 诊断信息。 | |
| std::vector< HouseRoom > | rooms |
| std::vector< std::string > | diagnostics |
详细描述
一次生成的房屋布局:实例 + 房间 + 元信息,可 JSON 序列化 / 实例化。
在文件 HouseLayout.h 第 16 行定义.
成员函数说明
◆ clear()
| void eve::housegen::HouseLayout::clear | ( | ) |
清空布局。
在文件 HouseLayout.cpp 第 114 行定义.
引用了 diagnostics, entranceSide, floorHeight, footprintStyle, instances, moduleSize, roofStyle, rooms , 以及 seed.
◆ fromJson()
| bool eve::housegen::HouseLayout::fromJson | ( | const std::string & | json, |
| std::string * | error = nullptr |
||
| ) |
在文件 HouseLayout.cpp 第 130 行定义.
引用了 diagnostics, entranceSide, error, floorHeight, footprintStyle, instances, moduleSize, eve::json::Document::parse(), roofStyle, rooms, eve::json::Document::root(), seed, v , 以及 eve::json::Document::valid().
◆ instantiate()
| std::vector< graphics::Renderable3D * > eve::housegen::HouseLayout::instantiate | ( | graphics::Graphics * | gfx, |
| model3d::Model3D * | models, | ||
| const HouseComponentLibrary & | library, | ||
| std::string * | error = nullptr |
||
| ) | const |
把布局实例化为场景中的 Renderable3D(调用方持有)。
在文件 HouseLayout.cpp 第 221 行定义.
引用了 a, b, c, color, data, error, eve::housegen::HouseComponentLibrary::find(), floorHeight, eve::model3d::ModelData::getScene(), instances, material, mesh, metallic, model, moduleSize, eve::graphics::Graphics::newMeshFromAssimp(), parent , 以及 roughness.
◆ toJson()
| std::string eve::housegen::HouseLayout::toJson | ( | ) | const |
序列化为 JSON / 从 JSON 恢复。
在文件 HouseLayout.cpp 第 116 行定义.
引用了 diagnostics, entranceSide, floorHeight, footprintStyle, instances, moduleSize, roofStyle, rooms, seed , 以及 v.
◆ validate()
| bool eve::housegen::HouseLayout::validate | ( | const HouseComponentLibrary & | library, |
| std::string * | error = nullptr |
||
| ) | const |
校验布局是否满足组件库规则。
在文件 HouseLayout.cpp 第 174 行定义.
引用了 c, d, eve::housegen::HouseComponent::depth, error, eve::housegen::HouseComponentLibrary::find(), instances, w, x, y , 以及 z.
类成员变量说明
◆ diagnostics
| std::vector<std::string> eve::housegen::HouseLayout::diagnostics |
在文件 HouseLayout.h 第 29 行定义.
被这些函数引用 clear(), fromJson() , 以及 toJson().
◆ entranceSide
| std::string eve::housegen::HouseLayout::entranceSide = "north" |
在文件 HouseLayout.h 第 25 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate() , 以及 toJson().
◆ floorHeight
| float eve::housegen::HouseLayout::floorHeight = 3.f |
在文件 HouseLayout.h 第 21 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), instantiate() , 以及 toJson().
◆ footprintStyle
| std::string eve::housegen::HouseLayout::footprintStyle = "rectangle" |
布局风格结果。
在文件 HouseLayout.h 第 23 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate() , 以及 toJson().
◆ instances
| std::vector<HouseInstance> eve::housegen::HouseLayout::instances |
组件实例 / 房间 / 诊断信息。
在文件 HouseLayout.h 第 27 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), instantiate(), toJson() , 以及 validate().
◆ moduleSize
| float eve::housegen::HouseLayout::moduleSize = 1.f |
生成参数回显。
在文件 HouseLayout.h 第 20 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), instantiate() , 以及 toJson().
◆ roofStyle
| std::string eve::housegen::HouseLayout::roofStyle = "gable" |
在文件 HouseLayout.h 第 24 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate() , 以及 toJson().
◆ rooms
| std::vector<HouseRoom> eve::housegen::HouseLayout::rooms |
在文件 HouseLayout.h 第 28 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate() , 以及 toJson().
◆ seed
| uint32_t eve::housegen::HouseLayout::seed = 1 |
在文件 HouseLayout.h 第 18 行定义.
被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate() , 以及 toJson().
该类的文档由以下文件生成:
- src/modules/housegen/HouseLayout.h
- src/modules/housegen/HouseLayout.cpp