载入中...
搜索中...
未找到
AssemblyFractureSettings.cpp
浏览该文件的文档.
2#include <cmath>
4namespace {
5Result<void> check(int id, const FractureComponentPolicy& p) {
6 if (id < 0 || id > 4095 || p.fragments < 1 || p.fragments > 64 || !std::isfinite(p.cohesion) || p.cohesion <= 0 ||
7 !std::isfinite(p.connectionStrength) || p.connectionStrength <= 0)
10 "policy requires valid id, 1..64 fragments and finite positive cohesion/connection strength",
11 "fracturePolicy"));
12 return Result<void>::success();
13}
14} // namespace
16 auto valid = recipe.validate();
17 if (!valid) return valid;
18 if (!std::isfinite(contactTolerance) || contactTolerance < 0 || contactTolerance > .25f)
20 DiagnosticCode::InvalidArgument, "contact tolerance must be in [0,0.25] metres", "contactTolerance"));
21 for (const auto& [id, policy] : groups) {
22 auto r = check(id, policy);
23 if (!r) return r;
24 }
25 for (const auto& [id, policy] : components) {
26 auto r = check(id, policy);
27 if (!r) return r;
28 }
29 return Result<void>::success();
30}
32 auto r = check(id, policy);
33 if (!r) return r;
34 groups[id] = policy;
35 return Result<void>::success();
36}
38 auto r = check(id, policy);
39 if (!r) return r;
40 components[id] = policy;
41 return Result<void>::success();
42}
43} // namespace eve::physics::destruction_cook
glm::vec4 p[6]
double r
std::string id
bool valid
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
eve::Result< void > validate() const
Validate.
Result< void > setGroupPolicy(int clusterId, FractureComponentPolicy policy)
Set an authored cluster policy; invalid input leaves settings unchanged.
Result< void > validate() const
Validate recipe, tolerances and all policies before offline cooking.
Result< void > setComponentPolicy(int component, FractureComponentPolicy policy)
Override one source component; invalid input leaves settings unchanged.
Independent controls for mesh granularity, internal cohesion and parent-joint strength.