载入中...
搜索中...
未找到
JoltShape.cpp
浏览该文件的文档.
16eve::Result<JPH::RefConst<JPH::Shape>> cook(const ShapeGeometry3D& g, float density, JPH::uint64 userData) {
20 return rejected<JPH::RefConst<JPH::Shape>>("Invalid shape parameters", eve::DiagnosticCode::InvalidArgument);
23 settings = std::make_unique<JPH::BoxShapeSettings>(JPH::Vec3(g.a, g.b, g.c), std::min({0.05f, g.a, g.b, g.c}));
29 if (g.hullVertices.size() < 12 || g.hullVertices.size() % 3 || g.hullVertices.size() / 3 > 100000 ||
31 return rejected<JPH::RefConst<JPH::Shape>>("Invalid hull", eve::DiagnosticCode::InvalidArgument);
35 return rejected<JPH::RefConst<JPH::Shape>>("Invalid hull", eve::DiagnosticCode::InvalidArgument);
74 return rejected<JPH::RefConst<JPH::Shape>>(result.GetError().c_str(), eve::DiagnosticCode::InvalidArgument);
77eve::Result<void> replaceShapes(BodyState& body, const std::vector<std::shared_ptr<ShapeState>>& shapes) {
80 if (shape->native->MustBeStatic() && body.api().GetMotionType(body.id) != JPH::EMotionType::Static)
81 return rejected<void>("Concave shapes require a static body", eve::DiagnosticCode::InvalidArgument);
95 if (result.HasError()) return rejected<void>(result.GetError().c_str(), eve::DiagnosticCode::InvalidArgument);
132 result.ignore("Destructor cannot report shape removal failure; parent retains native resources");
136eve::Result<void> ShapeBackend::rebuild(const ShapeGeometry3D& geometry, ShapeBehavior3D behavior,
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
3D shape (box/sphere/capsule) attached to a Body3D with material settings. Created via Body3D::new*Sh...
Definition Shape3D.h:34
void invalidate() noexcept override
Detaches native identity before parent teardown; retains cooked data until destruction.
Definition JoltShape.cpp:119
eve::Result< SurfaceMaterial3D > material() const override
material; synchronous owning-value operation under the class lifetime contract.
Definition JoltShapeOperations.cpp:78
void bindOwner(Shape3D &owner) noexcept override
Binds the owning facade for internal collision attribution; no callbacks. @ownership Borrows its excl...
Definition JoltShape.cpp:118
void destroy() noexcept override
Idempotent native resource release after dependent records have been detached.
Definition JoltShape.cpp:123
eve::Result< void > rebuild(const ShapeGeometry3D &geometry, ShapeBehavior3D behavior, std::span< const SurfaceMaterial3D > materials) override
Atomically replaces cooked geometry, preserving material, density and filter. @cost One geometry cook...
Definition JoltShape.cpp:136
Result< ForceVector > checked(ForceVector value)
Definition ForceMath.h:21
Definition JoltBody.cpp:7
eve::Result< T > rejected(const char *operation, eve::DiagnosticCode code=eve::DiagnosticCode::Unsupported)
Definition JoltInternal.h:21
void notifyJointShapeChanged(State &state, JPH::BodyID id, JPH::Vec3Arg delta)
Recomputes constraint COM offsets after a successful native shape replacement.
Definition JoltJoint.cpp:112
eve::Result< void > replaceShapes(BodyState &, const std::vector< std::shared_ptr< ShapeState > > &)
Definition JoltShape.cpp:77
eve::Result< JPH::RefConst< JPH::Shape > > cookMesh(const ShapeGeometry3D &, JPH::uint64 userData)
Definition JoltMesh.cpp:10
eve::Result< JPH::RefConst< JPH::Shape > > cook(const ShapeGeometry3D &, float density, JPH::uint64 userData)
Definition JoltShape.cpp:16
eve::Result< void > validateMaterial(SurfaceMaterial3D)
Definition JoltShapeOperations.cpp:83
@ ConvexHull
@ Capsule
@ TriangleMesh
@ HeightField
@ InvalidArgument
@ StaleHandle
Shape behavior reapplied atomically when geometry changes.
Definition ShapeBackend3D.h:46
Owning, backend-independent shape source; metres, local quaternion XYZW.
Definition ShapeBackend3D.h:13