载入中...
搜索中...
未找到
Box3DShape.cpp
浏览该文件的文档.
15 material.tangentVelocity = {value.tangentVelocity.x, value.tangentVelocity.y, value.tangentVelocity.z};
22 value.rollingResistance, {value.tangentVelocity.x, value.tangentVelocity.y, value.tangentVelocity.z},
35 return R::failure(eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, error.what(), name));
87 def.baseMaterial = isValid() ? b3Shape_GetSurfaceMaterial(shape_) : nativeMaterial(initialMaterial_);
102 const b3Transform transform{{g.localX, g.localY, g.localZ}, {{g.localQx, g.localQy, g.localQz}, g.localQw}};
169 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, error.what(), "physics.shape3d.rebuild"));
204 return eve::Result<SurfaceMaterial3D>::success(materialValue(b3Shape_GetSurfaceMaterial(shape_)));
215 return eve::Result<ShapeFilter3D>::success(ShapeFilter3D{b3Shape_GetFilter(shape_).categoryBits,
222 b3Shape_SetFilter(shape_, b3Filter{value.categoryBits, value.maskBits, value.groupIndex}, updatePairs);
248 if (kind_ != ShapeKind3D::TriangleMesh || slot < 0 || slot >= b3Shape_GetMeshMaterialCount(shape_))
250 return eve::Result<SurfaceMaterial3D>::success(materialValue(b3Shape_GetMeshSurfaceMaterial(shape_, slot)));
255 if (kind_ != ShapeKind3D::TriangleMesh || slot < 0 || slot >= b3Shape_GetMeshMaterialCount(shape_))
272 xf.p = b3Vec3{static_cast<float>(wt.p.x), static_cast<float>(wt.p.y), static_cast<float>(wt.p.z)};
313 std::unique_ptr<b3HeightFieldData, decltype(&b3DestroyHeightField)> height_{nullptr, b3DestroyHeightField};
317eve::Result<std::unique_ptr<IShapeBackend3D>> makeShape(b3BodyId body, const ShapeGeometry3D& geometry, float density,
322 eve::DiagnosticCode::InvalidArgument, "Shape material values must be finite and non-negative"));
325 if (!result.ok()) return eve::Result<std::unique_ptr<IShapeBackend3D>>::failure(result.status());
EVEngine assertion entry point, backed by zeroerr.
#define EV_ASSERT(cond,...)
Assert an internal engine invariant (state that must always hold).
Definition Assert.h:37
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
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
constexpr HexDirection next(HexDirection d) noexcept
The next direction clockwise (NW wraps to NE).
Definition HexMetrics.h:76
Definition Body3D.h:17
eve::Result< std::unique_ptr< IShapeBackend3D > > makeShape(b3BodyId body, const ShapeGeometry3D &geometry, float density, float friction, float restitution)
Internal native shape factory; transfers native/cooked ownership on success. @cost Cooks the supplied...
Definition Box3DShape.cpp:317
b3MeshData * createCheckedMesh(const std::vector< float > &vertices, const std::vector< int32_t > &indices, bool weldVertices, float weldTolerance, bool identifyEdges, bool useMedianSplit, b3Transform transform, const std::vector< uint8_t > *materialIndices, const char *operation)
Validates and cooks native geometry; throws on invalid input. @ownership Transfers native allocation ...
Definition Box3DShapeCook.cpp:22
b3HeightFieldData * createCheckedHeightField(int countX, int countZ, float cellSizeX, float cellSizeZ, const std::vector< float > &heights, float globalMin, float globalMax, bool clockwiseWinding, const char *operation)
Validates and cooks native geometry; throws on invalid input. @ownership Transfers native allocation ...
Definition Box3DShapeCook.cpp:66
b3HullData * createCheckedHull(const std::vector< float > &vertices, int maxVertices, const char *operation)
Validates and cooks native geometry; throws on invalid input. @ownership Transfers native allocation ...
Definition Box3DShapeCook.cpp:5
Result< ForceVector > checked(ForceVector value)
Definition ForceMath.h:21
@ ConvexHull
@ Capsule
@ TriangleMesh
@ HeightField
@ InvalidArgument
@ Failed
@ StaleHandle
Owning, backend-independent shape source; metres, local quaternion XYZW.
Definition ShapeBackend3D.h:13
static b3ShapeId shapeId(const Shape3D &shape)
Borrows a Box3D shape identifier for a synchronous native operation.
Definition Box3DShape.cpp:328