载入中...
搜索中...
未找到
JoltWorld.cpp
浏览该文件的文档.
23 eve::Result<void> step(const SimulationStep& step, const SimulationSettings& settings) override {
46 auto error = state.system.Update(static_cast<float>(step.delta.seconds()), settings.subStepCount,
52 return rejected<void>("Solver capacity exceeded; simulation stopped", eve::DiagnosticCode::Failed);
66 native->GetAngularVelocity().Length() * native->GetShape()->GetLocalBounds().GetExtent().Length();
67 body->quietSeconds = speed > body->sleepThreshold ? 0.f : body->quietSeconds + float(step.delta.seconds());
78 SimulationDeterminism determinism() const noexcept override { return SimulationDeterminism::ToleranceBounded; }
104 {std::make_unique<StepDriver>(*this), SimulationBackendKind::Cpu, SimulationBackendKind::Cpu, false});
112uint64_t WorldBackend::shapeKey(const Shape3D& shape) const { return static_cast<uint64_t>(shape.getId()); }
113eve::Result<std::unique_ptr<IBodyBackend3D>> WorldBackend::createBody(std::string_view type, float x, float y,
115 if (!isValid()) return rejected<std::unique_ptr<IBodyBackend3D>>("World expired", eve::DiagnosticCode::StaleHandle);
133 return rejected<std::unique_ptr<IBodyBackend3D>>("Body capacity exhausted", eve::DiagnosticCode::Failed);
140 return eve::Result<std::unique_ptr<IBodyBackend3D>>::success(std::make_unique<BodyBackend>(body));
145 World3D::EventShape a{pair.bodyA, pair.shapeA, pair.tagA}, b{pair.bodyB, pair.shapeB, pair.tagB};
173 std::sort(owner->hits_.begin() + hitStart, owner->hits_.end(), [](const auto& a, const auto& b) {
180 JPH::Vec3 f(facade.getConstraintForceX(), facade.getConstraintForceY(), facade.getConstraintForceZ());
181 JPH::Vec3 t(facade.getConstraintTorqueX(), facade.getConstraintTorqueY(), facade.getConstraintTorqueZ());
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Complete rigid-world execution boundary, bound once to an owning World3D facade. @ownership Owns exac...
Definition WorldBackend3D.h:24
3D shape (box/sphere/capsule) attached to a Body3D with material settings. Created via Body3D::new*Sh...
Definition Shape3D.h:34
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:47
Shape3D * findShape(PhysicsShapeHandle handle) const
Resolves a live shape handle; returns null when stale or foreign.
Definition World3D.cpp:447
void destroy() noexcept override
Idempotent native teardown after all facades have been invalidated.
Definition JoltWorld.cpp:91
WorldBackend(World3D &, float, float, float, bool)
Definition JoltWorld.cpp:87
eve::Result< std::unique_ptr< IBodyBackend3D > > createBody(std::string_view type, float x, float y, float z) override
Creates an owning body backend without publishing an engine wrapper. @cost One native body allocation...
Definition JoltWorld.cpp:113
eve::Result< SimulationBackendSelection > selectSimulation() override
Builds the separate CPU/accelerator step driver; driver borrows this world's stable state.
Definition JoltWorld.cpp:102
eve::Result< void > collectEvents() override
Collects solver events into the owner's queues without publishing callbacks.
Definition JoltWorld.cpp:142
eve::Result< void > swapTopology(IWorldBackend3D &prepared) override
Swaps prepared native topology while retaining stable step-driver contexts.
Definition JoltWorld.cpp:106
uint64_t shapeKey(const Shape3D &shape) const override
Opaque native lookup key scoped to this world, used only by internal event history.
Definition JoltWorld.cpp:112
constexpr HexDirection next(HexDirection d) noexcept
The next direction clockwise (NW wraps to NE).
Definition HexMetrics.h:76
Definition JoltBody.cpp:7
void initializeRuntime()
Initializes the process-owned allocator and type factory before constructing any native members.
Definition JoltState.cpp:84
eve::Result< std::unique_ptr< IWorldBackend3D > > makeWorld(World3D &owner, float x, float y, float z, bool sleep)
Creates the native Jolt provider; world owns it and calls it only on the simulation thread....
Definition JoltWorld.cpp:98
SimulationBackendKind
Kind of implementation that owns a simulation step.
Definition SimulationBackend.h:32
SimulationDeterminism
Determinism guarantee made by a simulation backend.
Definition SimulationBackend.h:64
@ ToleranceBounded
Results are equivalent within a documented numeric tolerance.
eve::SimulationStep SimulationStep
Compatibility alias for the common injected simulation step.
Definition SimulationBackend.h:111
@ InvalidArgument
@ Failed
@ StaleHandle
Definition Container.h:602
Stable snapshot describing one side of a 3D collision event.
Definition World3D.h:50
Definition JoltInternal.h:58