载入中...
搜索中...
未找到
eve::housegen::HouseLayout类 参考

一次生成的房屋布局:实例 + 房间 + 元信息,可 JSON 序列化 / 实例化。 更多...

#include <HouseLayout.h>

Public 成员函数

void clear ()
 清空布局。
 
std::string toJson () const
 Serialize or restore the eve.house-layout version 1 JSON schema.
 
eve::Result< void > fromJson (std::string_view json)
 From json.
 
eve::Result< void > validate (const HouseComponentLibrary &library) const
 校验布局是否满足组件库规则。
 
eve::Result< void > writeFootprintGrid (procgen::Grid2D &out) const
 Export the generated footprint as the canonical procgen grid value.
 
eve::Result< void > writeComponentPoints (procgen::PointSet &out) const
 Export component placements as canonical attributed procgen points.
 
eve::Result< std::vector< ecs::EntityHandle > > instantiate (graphics::Graphics &gfx, model3d::Model3D &models, const HouseComponentLibrary &library) const
 把布局实例化为场景中的 Renderable3D ECS 实体。
 

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"
 
int footprintWidth = 0
 Canonical base-floor occupancy mask owned by this layout.
 
int footprintDepth = 0
 
std::vector< uint8_t > footprintMask
 
std::vector< HouseInstance > instances
 组件实例 / 房间 / 诊断信息。
 
std::vector< HouseRoom > rooms
 
std::vector< std::string > diagnostics
 

详细描述

一次生成的房屋布局:实例 + 房间 + 元信息,可 JSON 序列化 / 实例化。

在文件 HouseLayout.h 第 23 行定义.

成员函数说明

◆ clear()

void eve::housegen::HouseLayout::clear ( )

◆ fromJson()

◆ instantiate()

eve::Result< std::vector< ecs::EntityHandle > > eve::housegen::HouseLayout::instantiate ( graphics::Graphics &  gfx,
model3d::Model3D &  models,
const HouseComponentLibrary &  library 
) const

把布局实例化为场景中的 Renderable3D ECS 实体。

返回
Generation-checked ECS handles; the graphics ECS world owns the entities.
备注
Callers must resolve handles before use and must not retain resolved pointers across world mutation. Failure leaves no partially-created entities.

在文件 HouseLayout.cpp 第 437 行定义.

引用了 a, eve::Applied, b, c, color, entities, eve::Diagnostic::error(), eve::Failed, eve::housegen::HouseComponentLibrary::find(), g, handle, instances, material, mesh, metallic, model, eve::graphics::Graphics::newMeshFromAssimp(), node, eve::NotFound, parent, parts, r, roughness, scene, source, eve::Status::success(), valid , 以及 world.

◆ toJson()

std::string eve::housegen::HouseLayout::toJson ( ) const

Serialize or restore the eve.house-layout version 1 JSON schema.

备注
Unknown fields are ignored for forward-compatible readers; unsupported explicit schemas or versions are rejected transactionally without changing this layout.

在文件 HouseLayout.cpp 第 161 行定义.

引用了 cell, diagnostics, entranceSide, floorHeight, footprintDepth, footprintMask, footprintStyle, footprintWidth, instances, moduleSize, roofStyle, rooms, seed , 以及 v.

被这些函数引用 eve::housegen::exposeHouseGeneration().

◆ validate()

◆ writeComponentPoints()

eve::Result< void > eve::housegen::HouseLayout::writeComponentPoints ( procgen::PointSet &  out) const

Export component placements as canonical attributed procgen points.

返回
Success after atomically replacing out; conversion failure leaves it unchanged. @cost Linear in the number of generated component instances.

在文件 HouseLayout.cpp 第 393 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), floorHeight, footprintDepth, footprintMask, footprintWidth, instances, eve::InvalidArgument, moduleSize , 以及 rotation.

◆ writeFootprintGrid()

eve::Result< void > eve::housegen::HouseLayout::writeFootprintGrid ( procgen::Grid2D &  out) const

类成员变量说明

◆ diagnostics

std::vector<std::string> eve::housegen::HouseLayout::diagnostics

在文件 HouseLayout.h 第 40 行定义.

被这些函数引用 clear(), fromJson() , 以及 toJson().

◆ entranceSide

std::string eve::housegen::HouseLayout::entranceSide = "north"

在文件 HouseLayout.h 第 32 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson() , 以及 writeFootprintGrid().

◆ floorHeight

float eve::housegen::HouseLayout::floorHeight = 3.f

◆ footprintDepth

int eve::housegen::HouseLayout::footprintDepth = 0

◆ footprintMask

std::vector<uint8_t> eve::housegen::HouseLayout::footprintMask

◆ footprintStyle

std::string eve::housegen::HouseLayout::footprintStyle = "rectangle"

布局风格结果。

在文件 HouseLayout.h 第 30 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson() , 以及 writeFootprintGrid().

◆ footprintWidth

int eve::housegen::HouseLayout::footprintWidth = 0

Canonical base-floor occupancy mask owned by this layout.

在文件 HouseLayout.h 第 34 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson(), validate(), writeComponentPoints() , 以及 writeFootprintGrid().

◆ instances

std::vector<HouseInstance> eve::housegen::HouseLayout::instances

组件实例 / 房间 / 诊断信息。

在文件 HouseLayout.h 第 38 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson(), validate(), writeComponentPoints() , 以及 writeFootprintGrid().

◆ moduleSize

float eve::housegen::HouseLayout::moduleSize = 1.f

生成参数回显。

在文件 HouseLayout.h 第 27 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson(), validate(), writeComponentPoints() , 以及 writeFootprintGrid().

◆ roofStyle

std::string eve::housegen::HouseLayout::roofStyle = "gable"

在文件 HouseLayout.h 第 31 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson() , 以及 writeFootprintGrid().

◆ rooms

std::vector<HouseRoom> eve::housegen::HouseLayout::rooms

在文件 HouseLayout.h 第 39 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson() , 以及 validate().

◆ seed

uint32_t eve::housegen::HouseLayout::seed = 1

在文件 HouseLayout.h 第 25 行定义.

被这些函数引用 clear(), fromJson(), eve::housegen::HouseGenerator::generate(), toJson() , 以及 writeFootprintGrid().


该类的文档由以下文件生成: