载入中...
搜索中...
未找到
FractureRecipeSchema.cpp
浏览该文件的文档.
2
4
5#include <utility>
6
8namespace {
9
10editing::PropertyDescriptor property(const char* path, const char* label, const char* description, const char* category,
14 result.displayNameKey = label;
16 result.category = category;
17 result.type = type;
18 result.defaultValue = std::move(defaultValue);
19 return result;
20}
21
22void numeric(editing::PropertySchema& schema, const char* path, const char* label, const char* description,
24 double step, const char* units = "") {
25 auto descriptor = property(path, label, description, category, type, std::move(value));
26 descriptor.numeric.minimum = minimum;
27 descriptor.numeric.maximum = maximum;
28 descriptor.numeric.step = step;
29 descriptor.numeric.units = units;
30 schema.properties.push_back(std::move(descriptor));
31}
32
33} // namespace
34
36 const physics::FractureRecipe defaults;
38 schema.typeId = std::string(physics::FractureRecipe::SchemaId);
40
41 auto mode = property("mode", "Fracture mode", "UniformVoronoi, ClusteredVoronoi, Radial, or Planar", "Fracture",
42 editing::PropertyType::String, std::string("UniformVoronoi"));
43 mode.enumItems = {"UniformVoronoi", "ClusteredVoronoi", "Radial", "Planar"};
44 schema.properties.push_back(std::move(mode));
45
46 numeric(schema, "siteCountMin", "Site count min", "Minimum Voronoi site count", "Voronoi",
47 editing::PropertyType::Int, std::int64_t(defaults.siteCountMin), 1, 4096, 1);
48 numeric(schema, "siteCountMax", "Site count max", "Maximum Voronoi site count", "Voronoi",
49 editing::PropertyType::Int, std::int64_t(defaults.siteCountMax), 1, 4096, 1);
50 numeric(schema, "clusterCount", "Cluster count", "Island count for ClusteredVoronoi", "Voronoi",
51 editing::PropertyType::Int, std::int64_t(defaults.clusterCount), 1, 256, 1);
52 numeric(schema, "clusterRadius", "Cluster radius", "Site scatter radius around each island centre", "Voronoi",
53 editing::PropertyType::Float, defaults.clusterRadius, 0.0001, 1000, 0.01, "m");
54 numeric(schema, "radialSpokes", "Radial spokes", "Number of vertical cutting planes for Radial mode", "Radial",
55 editing::PropertyType::Int, std::int64_t(defaults.radialSpokes), 1, 64, 1);
56 numeric(schema, "radialPlanes", "Radial shells", "Number of horizontal shell cuts for Radial mode", "Radial",
57 editing::PropertyType::Int, std::int64_t(defaults.radialPlanes), 0, 32, 1);
58 numeric(schema, "seed", "Seed", "Deterministic cook seed mixed with the named RNG stream", "Random",
59 editing::PropertyType::Int, std::int64_t(defaults.seed), 0, 9223372036854775807.0, 1);
60 schema.properties.push_back(property("randomStreamName", "RNG stream", "Named deterministic stream (no wall clock)",
62 schema.properties.push_back(property("interiorMaterialLogicalId", "Interior material",
63 "Logical id for broken-face interior material", "Material",
65 numeric(schema, "defaultStrainThreshold", "Default strain threshold", "Break threshold for generated edges",
66 "Structure", editing::PropertyType::Float, defaults.defaultStrainThreshold, 0.0001, 100000, 0.1);
67 numeric(schema, "defaultDensity", "Default density", "Proxy bone density", "Material",
68 editing::PropertyType::Float, defaults.defaultDensity, 0.0001, 100000, 0.1, "kg/m3");
69 numeric(schema, "defaultFriction", "Default friction", "Proxy bone friction", "Material",
70 editing::PropertyType::Float, defaults.defaultFriction, 0, 1, 0.01);
71 numeric(schema, "defaultRestitution", "Default restitution", "Proxy bone restitution", "Material",
73 numeric(schema, "minimumThickness", "Minimum thickness", "Reject meshes thinner than this on any AABB axis",
74 "Validation", editing::PropertyType::Float, defaults.minimumThickness, 0.0001, 1000, 0.01, "m");
75 numeric(schema, "maximumBones", "Maximum bones", "Soft cap on cooked leaf bones", "Validation",
76 editing::PropertyType::Int, std::int64_t(defaults.maximumBones), 1, 4096, 1);
77 return schema;
78}
79
80} // namespace eve::physics_editing
double value
std::string descriptor
std::string label
float maximum[3]
float minimum[3]
std::string description
std::string path
Definition PlayHost.cpp:110
std::vector< UnitCandidate > units
float step
Definition TreeMesh.cpp:314
const char * category
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
const char * defaultValue
PropertyType
PropertyType public API.
editing::PropertySchema fractureRecipeSchema()
Return the UI-independent authoring schema for physics:fracture-recipe v1.
PropertyDescriptor public API.
EVENGINE_API_PLATFORM public API.
std::vector< PropertyDescriptor > properties
Versioned cook recipe for Chaos-style pre-fracture (schema v1).
static constexpr std::uint32_t SchemaVersion
int maximumBones
Soft cap on produced leaf bones.
float minimumThickness
Minimum AABB axis length in metres; thinner meshes are rejected.
static constexpr std::string_view SchemaId