载入中...
搜索中...
未找到
HouseGenRuntime.cpp
浏览该文件的文档.
24 if (!registered.ok()) return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.housegen.runtime-component"), "House runtime rejected an authored component");
29 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.housegen.runtime-category"), "House kit is missing required category: "+std::string(required));
33 if (!generated.ok()) return eve::editing::failed<void>(EditorStatus::Failed, RuleId("editor.housegen.generate"), "House generator rejected the candidate kit or request");
39 if (expectedRevision!=revision_) return eve::editing::failed<EditorGizmoSnapshot>(EditorStatus::Conflict, RuleId("editor.housegen.stale"), "House preview generation is stale");
40 if (!layout_||!library_) return eve::editing::failed<EditorGizmoSnapshot>(EditorStatus::NotFound, RuleId("editor.housegen.preview"), "House preview has no generated layout");
41 EditorGizmoSnapshot snapshot;snapshot.status=EditorStatus::Applied;snapshot.target="housegen-preview";snapshot.targetRevision=revision_;
42 if (layout_->instances.size()>200000) return eve::editing::failed<EditorGizmoSnapshot>(EditorStatus::Rejected, RuleId("editor.housegen.preview-budget"), "House layout exceeds 200000 preview instances");
43 for (std::size_t index=0;index<layout_->instances.size();++index){const auto& instance=layout_->instances[index];const auto component=library_->find(instance.componentId);if(!component)continue;const auto& c=component->get();const bool quarter=((instance.rotationDeg/90)&1)!=0;EditorGizmoPrimitive p;p.id="component:"+std::to_string(index);p.kind="box";p.position={(instance.x+(quarter?c.depth:c.width)*.5)*layout_->moduleSize,(instance.z*c.height+.5*c.height)*layout_->floorHeight,(instance.y+(quarter?c.width:c.depth)*.5)*layout_->moduleSize};p.size={(quarter?c.depth:c.width)*layout_->moduleSize,c.height*layout_->floorHeight,(quarter?c.width:c.depth)*layout_->moduleSize};if(c.category=="door")p.color={.2,1,.4,.8};else if(c.category=="roof")p.color={1,.5,.2,.65};else if(c.category=="foundation")p.color={.5,.5,.5,.6};else p.color={.2,.7,1,.5};snapshot.primitives.push_back(std::move(p));}
44 for(std::size_t index=0;index<layout_->rooms.size();++index){const auto& room=layout_->rooms[index];EditorGizmoPrimitive p;p.id="room:"+std::to_string(index);p.kind="area";p.position={(room.x+room.width*.5)*layout_->moduleSize,.02,(room.y+room.depth*.5)*layout_->moduleSize};p.size={room.width*layout_->moduleSize,.01,room.depth*layout_->moduleSize};p.color={.8,.2,1,.25};snapshot.primitives.push_back(std::move(p));}
eve::Result< void > registerComponent(const HouseComponent &component)
注册单个组件(id 重复会报错)。
Definition HouseComponentLibrary.cpp:100
布局生成器:把 HouseRequest 解析为 HouseLayout(组件库驱动)。
Definition HouseGenerator.h:15
eve::Result< void > generate(const HouseRequest &request, HouseLayout &out) const
生成布局;失败时不修改输出布局并返回结构化诊断。
Definition HouseGenerator.cpp:329
Revisioned component-kit and deterministic generation-request asset.
Definition HouseGenTarget.h:63
const std::vector< HouseKitComponentValue > & components() const
Components.
Definition HouseGenTarget.h:99
std::vector< EditorDiagnostic > validate() const
Validate kit fields, generator-required categories and request budgets.
Definition HouseGenTarget.cpp:447
Result< void > publish(const HouseGenDocumentTarget &document)
Generate entirely in temporary state before replacing the active preview.
Definition HouseGenRuntime.cpp:15
HouseGenPreviewRuntime()
House gen preview runtime.
Result< EditorGizmoSnapshot > gizmo(Revision expectedRevision) const
Build grid cells, component bounds and room overlays for the active generation.
Definition HouseGenRuntime.cpp:38
const housegen::HouseLayout * layout() const
Access the published layout.
Definition HouseGenTarget.h:134
~HouseGenPreviewRuntime()
House gen preview runtime.
const housegen::HouseComponentLibrary * library() const
Access the published component library.
Definition HouseGenTarget.h:137
Definition HouseGenRuntime.cpp:10
Renderer-neutral wire primitive for authoring viewport overlays.
Definition EditingGizmo.h:12
Immutable revision-tagged overlay snapshot consumed by any viewport renderer.
Definition EditingGizmo.h:27
std::vector< GizmoPrimitive > primitives
Definition EditingGizmo.h:31