载入中...
搜索中...
未找到
GpuAgentsDocument.cpp
浏览该文件的文档.
14 return eve::editing::ruleDiagnostic(eve::DiagnosticCode::InvalidArgument, RuleId(rule), severity,
60 diagnostic("editor.gpuagents.capacity", DiagnosticSeverity::Error, "maxAgents must be in (0, 100000]"));
63 out.push_back(diagnostic("editor.gpuagents.fixedDt", DiagnosticSeverity::Error, "fixedDt must be in (0, 0.2]"));
145 return eve::editing::failed<GpuAgentsSettings>(EditorStatus::Rejected, RuleId("editor.gpuagents.fields"),
151 return eve::editing::failed<GpuAgentsSettings>(EditorStatus::Rejected, RuleId("editor.gpuagents.invalid"),
157editing::PropertyDescriptor descriptor(const char* path, editing::PropertyType type, EditorValue defaultValue,
187 descriptor("agentRadius", editing::PropertyType::Float, d.agentRadius, "effect", 0.001, 100, true),
188 descriptor("obstaclePredictTime", editing::PropertyType::Float, d.obstaclePredictTime, "effect", 0, 5, true),
190 descriptor("separationRadius", editing::PropertyType::Float, d.separationRadius, "boids", 0.01, 100, true),
191 descriptor("cohesionRadius", editing::PropertyType::Float, d.cohesionRadius, "boids", 0.01, 100, true),
192 descriptor("alignmentRadius", editing::PropertyType::Float, d.alignmentRadius, "boids", 0.01, 100, true),
193 descriptor("separationWeight", editing::PropertyType::Float, d.separationWeight, "boids", 0, 20, true),
194 descriptor("cohesionWeight", editing::PropertyType::Float, d.cohesionWeight, "boids", 0, 20, true),
195 descriptor("alignmentWeight", editing::PropertyType::Float, d.alignmentWeight, "boids", 0, 20, true),
198 descriptor("depositStrength", editing::PropertyType::Float, d.depositStrength, "life", 0, 10, true),
199 descriptor("trailDecayRate", editing::PropertyType::Float, d.trailDecayRate, "life", 0, 10, true),
202 descriptor("fieldResolution", editing::PropertyType::Int, d.fieldResolution, "life", 2, 1024, true),
204 descriptor("origin", editing::PropertyType::Vec3, EditorValue::Array{d.originX, d.originY, d.originZ}, "life"),
205 descriptor("minSurfaceNormalZ", editing::PropertyType::Float, d.minSurfaceNormalZ, "life", 0, 1, true),
207 descriptor("surfaceDataSampler", editing::PropertyType::String, d.surfaceDataSampler, "material"),
266 return c == CapabilityId("eve.editor.target.gpuagents-effect-properties") ? static_cast<IPropertyProvider*>(this)
274eve::Result<eve::Revision> GpuAgentsDocumentTarget::currentRevision(const SelectionSnapshot& s) const {
277 eve::DiagnosticCode::InvalidArgument, "GPU Agents selection mismatch", "editor.gpuagents.selection"));
282PropertySchema GpuAgentsDocumentTarget::schema(const SelectionSnapshot&) const { return gpuAgentsEffectSchema(); }
284PropertyReadResult GpuAgentsDocumentTarget::read(const SelectionSnapshot& s, const PropertyPath& p) const {
287 return v ? PropertyReadResult{editing::PropertyReadState::Value, *v, {}} : PropertyReadResult{};
290Result<DomainOperation> GpuAgentsDocumentTarget::makeSet(const SelectionSnapshot& s, const PropertyPath& p,
295 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.gpuagents.set"),
318 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.gpuagents.reset"),
336std::vector<EditorDiagnostic> GpuAgentsDocumentTarget::validate() const { return validateSettings(settings_); }
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
void bumpRevision()
Advance the revision without touching the dirty region.
Definition EditableTarget.h:179
Revision revisionValue() const noexcept
Return the revision as the shared protocol revision type.
Definition EditableTarget.h:169
UI-independent property access for an immutable selection snapshot.
Definition EditingProperty.h:139
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
Definition EditingValue.h:19
Binds an EffectProfile to a GpuAgentSimulation and optional renderer.
Definition EffectBackend.h:19
Result< void > configure(const EffectProfile &profile, std::string displayName={})
Configure from a profile and initialize empty capacity.
Definition EffectBackend.cpp:7
World-level registry for GPU agent simulations and environment semantics.
Definition GpuAgentWorld.h:27
Reversible document for GPU Agents effect authoring.
Definition GpuAgentsDocument.h:86
std::vector< EditorDiagnostic > validate() const
Structured validation diagnostics.
Definition GpuAgentsDocument.cpp:336
Result< DomainOperation > makeReset(const SelectionSnapshot &selection, const PropertyPath &path) const override
Make reset.
Definition GpuAgentsDocument.cpp:314
Result< DomainOperation > makeSet(const SelectionSnapshot &selection, const PropertyPath &path, const EditorValue &value, PropertySetMode mode) const override
Make set.
Definition GpuAgentsDocument.cpp:290
eve::Result< eve::Revision > currentRevision(const SelectionSnapshot &selection) const override
Current revision.
Definition GpuAgentsDocument.cpp:274
PropertySchema schema(const SelectionSnapshot &selection) const override
Schema.
Definition GpuAgentsDocument.cpp:282
GpuAgentsDocumentTarget(std::string id)
Gpu agents document target.
Definition GpuAgentsDocument.cpp:255
Result< void > loadSnapshot(const EditorValue &snapshot)
Atomically load and validate a persisted snapshot.
Definition GpuAgentsDocument.cpp:340
PropertyReadResult read(const SelectionSnapshot &selection, const PropertyPath &path) const override
Reads .
Definition GpuAgentsDocument.cpp:284
void * queryCapability(const CapabilityId &capability) override
Query an optional target capability. @ownership Borrowed; owned by this target. @lifetime Valid until...
Definition GpuAgentsDocument.cpp:265
EditorValue snapshotValue() const
Capture schema-version-one settings.
Definition GpuAgentsDocument.cpp:338
Result< void > applyDomainOperation(const DomainOperation &operation) override
Applies domain operation.
Definition GpuAgentsDocument.cpp:324
Result< void > apply(const GpuAgentsDocumentTarget &target, gpuagents::EffectBackend *backend, gpuagents::GpuAgentWorld *world) const
Configure backend from document and optionally re-init the world surface domain.
Definition GpuAgentsDocument.cpp:348
@ Runtime
Result< T > applied(T value, std::vector< Diagnostic > diagnostics={})
Construct an Applied result with an owning payload and optional diagnostics.
Definition EditingResult.h:43
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build a common diagnostic carrying an open editing rule identity.
Definition EditingResult.h:25
PropertySchema gpuAgentsEffectSchema()
Build the UI-independent PropertySchema for gpuagents:effect-document v1.
Definition GpuAgentsDocument.cpp:176
editing::CapabilityId CapabilityId
Definition GpuAgentsDocument.h:19
gpuagents::EffectProfile toEffectProfile(const GpuAgentsSettings &settings)
Convert authoring settings into a runtime EffectProfile.
Definition GpuAgentsDocument.cpp:212
editing::PropertyPath PropertyPath
Definition GpuAgentsDocument.h:29
@ InvalidArgument
Definition Container.h:602
PropertyDescriptorLookup find(const PropertyPath &path) const
Finds find.
Definition EditingProperty.cpp:9
Stable discovery metadata exposed by every editable target.
Definition EditableTarget.h:39
Type-erased profile bundle owned by an EffectBackend.
Definition EffectProfile.h:130
static EffectProfile makePetal(int maxAgents=512)
Factory for a default petal profile.
Definition EffectProfile.h:188
const EffectProfileBase & base() const
Returns the shared base slice for the active kind.
Definition EffectProfile.h:138
static EffectProfile makeBird(int maxAgents=256)
Factory for a default bird profile.
Definition EffectProfile.h:179
static EffectProfile makeFish(int maxAgents=256)
Factory for a default fish profile.
Definition EffectProfile.h:160
static EffectProfile makeLife(int maxAgents=128, int resolution=64)
Factory for a default life-network profile.
Definition EffectProfile.h:169
float depositStrength
Definition EffectProfile.h:61
float minSurfaceNormalZ
Definition EffectProfile.h:66
Authoring values for one GPU Agents effect document.
Definition GpuAgentsDocument.h:40