载入中...
搜索中...
未找到
Cabinet.cpp
浏览该文件的文档.
14 auto number = [&](const char* key, float fallback) { return p.getFloat(key, p.has(key) ? invalid : fallback); };
15 const float w = number("cabinetWidth", 1.8f), h = number("cabinetHeight", 2.0f), d = number("depth", 0.55f);
16 const float t = number("thickness", 0.025f), leg = p.getBool("legs", true) ? number("legHeight", 0.15f) : 0.f;
27 if (!std::isfinite(w) || !std::isfinite(h) || !std::isfinite(d) || !std::isfinite(t) || !std::isfinite(leg) ||
28 w > 100 || h > 100 || d > 100 || t < 0.002f || leg < 0 || columns < 1 || columns > 16 || levels < 1 ||
43 auto box = [&](float x, float y, float z, float sx, float sy, float sz, const std::string& group) {
47 if ((group.starts_with("drawer.") && !group.ends_with(".interior") && !group.ends_with(".hardware")) ||
55 for (float sign : {-1.f, 1.f}) box(sign * (w - t) / 2, (leg + bodyTop) / 2, 0, t, bodyTop - leg, d, "body");
58 box(-inner / 2 + c * (bay + t) - t / 2, (split + top) / 2, 0, t, top - split, d - 2 * t, "dividers");
59 for (int l = 1; l < levels; ++l) box(0, split + (top - split) * l / levels, 0, inner, t, d - 2 * t, "shelves");
65 prototype_detail::addCylinder(m, {x * (w / 2 - 2 * t), leg / 2, z * (d / 2 - 2 * t)}, t, 1.5f * t,
70 auto front = [&](float x, float y, float fw, float fh, const std::string& group, bool drawer, float handleSide) {
79 for (int i = -1; i <= 1; ++i) box(x + i * fw / 5, y, z + t, 0.4f * t, fh - 4 * t, t, group + ".trim");
87 front(-inner / 2 + (i + 0.5f) * doorW, (split + top) / 2, doorW - t * 0.25f, top - split - t * 0.5f,
94 for (float s : {-1.f, 1.f}) box(s * (inner / 2 - t), y, -t, t, drawerH - 2 * t, d - 4 * t, group + ".interior");
134 ParamDescriptor::choice("style", "Style", "modern", {"european", "chinese", "minimal", "modern"})};
const eve::script::BindingContractRegistry & registry
Definition ProjectIndexAutomatic.cpp:24
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:20
void addCylinder(MeshBuild &mesh, Vec3 center, float radiusBottom, float radiusTop, float height, int sides, const char *group)
Adds cylinder.
Definition PrototypeKit.cpp:458
void addBox(MeshBuild &mesh, Vec3 center, Vec3 size, const char *group)
Adds box.
Definition PrototypeKit.cpp:399
Definition EvpackPointGraphLoader.h:12
void registerCabinetRecipe(MeshRecipeRegistry ®istry)
Register mesh.cabinet and its editor schema during single-threaded initialization.
Definition Cabinet.cpp:119
eve::Result< MeshBuild > generateCabinet(const Params &p)
Build a deterministic, Y-up cabinet with its base at Y=0 and front toward +Z.
Definition Cabinet.cpp:12
@ InvalidArgument
static ParamDescriptor boolean(std::string key, std::string label, bool defaultValue)
Construct a Boolean descriptor stored as zero or one in Params.
Definition ParamSchema.cpp:47
static ParamDescriptor choice(std::string key, std::string label, std::string defaultValue, std::vector< std::string > choices)
Construct a finite-choice string descriptor.
Definition ParamSchema.cpp:65
static ParamDescriptor floating(std::string key, std::string label, float defaultValue, float minimum, float maximum, float step)
Construct a bounded floating-point descriptor.
Definition ParamSchema.cpp:33
static ParamDescriptor integer(std::string key, std::string label, int defaultValue, int minimum, int maximum, int step=1)
Construct a bounded integer descriptor.
Definition ParamSchema.cpp:19
Complete metadata and parameter schema shared by every procgen recipe family.
Definition ParamSchema.h:52