载入中...
搜索中...
未找到
EditorSimulationPreview.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <cstdint>
8#include <memory>
9#include <string>
10#include <vector>
11
12namespace eve::editor {
13
16 std::string object;
17 double positionX = 0.0, positionY = 0.0, positionZ = 0.0;
18 double rotationX = 0.0, rotationY = 0.0, rotationZ = 0.0, rotationW = 1.0;
19};
20
23 std::uint64_t tick = 0;
24 double time = 0.0;
25 std::vector<SimulationObjectSample> objects;
26};
27
30 EditorStatus status = EditorStatus::Failed;
31 std::uint64_t sourceRevision = 0;
32 double fixedDelta = 0.0;
33 std::vector<SimulationPreviewFrame> frames;
34 std::vector<EditorDiagnostic> diagnostics;
35};
36
39public:
41 virtual ~IEditorSimulationBackend() = default;
43 virtual std::unique_ptr<IEditorSimulationBackend> cloneForPreview() const = 0;
45 virtual Result<void> step(std::uint64_t tick, double fixedDelta) = 0;
48};
49
52public:
54 Result<void> setFixedDelta(double seconds);
56 void setPaused(bool paused) { paused_ = paused; }
58 bool paused() const { return paused_; }
64 SimulationBakeResult bake(const IEditorSimulationBackend& source, std::uint64_t sourceRevision,
65 int steps, int maxSteps = 10000) const;
67 void rewind();
68
69private:
71 std::uint64_t tick) const;
72 bool paused_ = true;
73 double fixedDelta_ = 1.0 / 60.0;
74 std::uint64_t tick_ = 0;
75 std::unique_ptr<IEditorSimulationBackend> previewBackend_;
76};
77
78} // namespace eve::editor
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
int steps
SimulationTick tick
const UnitySourceAsset & source
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Cloneable backend boundary for physics/crowd/fluid editor simulation previews.
virtual Result< void > step(std::uint64_t tick, double fixedDelta)=0
Advance exactly one fixed deterministic step.
virtual std::unique_ptr< IEditorSimulationBackend > cloneForPreview() const =0
Clone complete simulation state so preview never mutates the live world.
virtual Result< std::vector< SimulationObjectSample > > capture() const =0
Capture stable object transforms after the current step.
virtual ~IEditorSimulationBackend()=default
Releases IEditorSimulationBackend resources.
Pause/single-step/bake controller shared by simulation editor modules.
void setPaused(bool paused)
Pause or resume interactive preview stepping.
bool paused() const
Return whether automatic preview advance is paused.
StatusCode
Stable outcome category for an operation.
Definition Status.h:27
Non-destructive baked preview trajectory and diagnostics.
std::vector< SimulationPreviewFrame > frames
std::vector< EditorDiagnostic > diagnostics
Stable transform sample captured from one simulation object.
One deterministic editor-preview simulation frame.
std::vector< SimulationObjectSample > objects