载入中...
搜索中...
未找到
ShapeBackend3D.h
浏览该文件的文档.
1#pragma once
2#include <cstdint>
3#include <memory>
4#include <span>
5#include <vector>
6#include "common/Result.h"
8namespace eve::physics {
9class Shape3D;
15 float a = 0.f, b = 0.f, c = 0.f;
16 std::vector<float> hullVertices;
18 std::vector<float> meshVertices;
19 std::vector<int32_t> meshIndices;
20 bool meshWeldVertices = true;
21 float meshWeldTolerance = 0.001f;
22 bool meshIdentifyEdges = true;
23 bool meshUseMedianSplit = false;
24 std::vector<uint8_t> meshMaterialIndices;
25 std::vector<float> heightValues;
27 float heightCellSizeX = 1.f, heightCellSizeZ = 1.f;
28 float heightGlobalMin = 0.f, heightGlobalMax = 0.f;
29 bool heightClockwise = false;
30 float localX = 0.f, localY = 0.f, localZ = 0.f;
31 float localQx = 0.f, localQy = 0.f, localQz = 0.f, localQw = 1.f;
32};
35 float friction = 0.2f, restitution = 0.f, rollingResistance = 0.f;
37 uint64_t userMaterialId = 0;
38 std::uint32_t customColor = 0;
39};
42 uint64_t categoryBits = 1, maskBits = UINT64_MAX;
43 int groupIndex = 0;
44};
47 bool sensor = false, hitEvents = false, preSolveEvents = false, customFiltering = false;
48 float explosionScale = 1.f;
49};
52 double x = 0, y = 0, z = 0;
53 float nx = 0, ny = 1, nz = 0;
54};
55
63public:
66 float offset) const = 0;
67 virtual ~IShapeBackend3D() = default;
69 virtual bool isValid() const noexcept = 0;
71 virtual void destroy() noexcept = 0;
73 virtual void invalidate() noexcept = 0;
78 virtual void bindOwner(Shape3D& owner) noexcept = 0;
83 [[nodiscard]] virtual eve::Result<void> rebuild(const ShapeGeometry3D& geometry, ShapeBehavior3D behavior,
84 std::span<const SurfaceMaterial3D> materials) = 0;
86 [[nodiscard]] virtual eve::Result<float> density() const = 0;
88 [[nodiscard]] virtual eve::Result<void> setDensity(float value, bool updateMass) = 0;
90 [[nodiscard]] virtual eve::Result<float> friction() const = 0;
92 [[nodiscard]] virtual eve::Result<void> setFriction(float value) = 0;
94 [[nodiscard]] virtual eve::Result<float> restitution() const = 0;
96 [[nodiscard]] virtual eve::Result<void> setRestitution(float value) = 0;
98 [[nodiscard]] virtual eve::Result<SurfaceMaterial3D> material() const = 0;
100 [[nodiscard]] virtual eve::Result<void> setMaterial(SurfaceMaterial3D value) = 0;
102 [[nodiscard]] virtual eve::Result<ShapeFilter3D> filter() const = 0;
104 [[nodiscard]] virtual eve::Result<void> setFilter(ShapeFilter3D value, bool updatePairs) = 0;
106 [[nodiscard]] virtual eve::Result<bool> isSensor() const = 0;
108 [[nodiscard]] virtual eve::Result<void> enableHitEvents(bool enabled) = 0;
110 [[nodiscard]] virtual eve::Result<void> enablePreSolveEvents(bool enabled) = 0;
112 [[nodiscard]] virtual eve::Result<int> meshMaterialCount() const = 0;
114 [[nodiscard]] virtual eve::Result<SurfaceMaterial3D> meshMaterial(int slot) const = 0;
116 [[nodiscard]] virtual eve::Result<void> setMeshMaterial(SurfaceMaterial3D value, int slot) = 0;
118 [[nodiscard]] virtual eve::Result<bool> testPoint(float x, float y, float z) const = 0;
119};
120} // namespace eve::physics
double z
double y
double x
size_t offset
Texture * normal
std::shared_ptr< OceanGpuSpectrum > owner
Object::Ptr value
std::string slot
Move-only, checked operation results for the common layer.
std::string geometry
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Sole owner of native shape and cooked resources; facade owns portable source geometry....
virtual eve::Result< void > setMaterial(SurfaceMaterial3D value)=0
setMaterial; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< ShapeFilter3D > filter() const =0
filter; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< void > enablePreSolveEvents(bool enabled)=0
enablePreSolveEvents; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< float > density() const =0
density; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< void > setMeshMaterial(SurfaceMaterial3D value, int slot)=0
setMeshMaterial; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< bool > isSensor() const =0
isSensor; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< void > enableHitEvents(bool enabled)=0
enableHitEvents; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< SurfaceMaterial3D > meshMaterial(int slot) const =0
meshMaterial; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< void > setFriction(float value)=0
setFriction; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< float > restitution() const =0
restitution; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< float > friction() const =0
friction; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< SurfaceMaterial3D > material() const =0
material; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< void > rebuild(const ShapeGeometry3D &geometry, ShapeBehavior3D behavior, std::span< const SurfaceMaterial3D > materials)=0
Atomically replaces cooked geometry, preserving material, density and filter. @cost One geometry cook...
virtual eve::Result< ShapePlane3D > oneWayPlane(const ShapeGeometry3D &geometry, PhysicsVector3D normal, float offset) const =0
Computes an owning world-space plane using the current body pose; no callbacks.
virtual eve::Result< void > setRestitution(float value)=0
setRestitution; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< bool > testPoint(float x, float y, float z) const =0
testPoint; synchronous owning-value operation under the class lifetime contract.
virtual void invalidate() noexcept=0
Detaches native identity before parent teardown; retains cooked data until destruction.
virtual void bindOwner(Shape3D &owner) noexcept=0
Binds the owning facade for internal collision attribution; no callbacks. @ownership Borrows its excl...
virtual eve::Result< void > setFilter(ShapeFilter3D value, bool updatePairs)=0
setFilter; synchronous owning-value operation under the class lifetime contract.
virtual eve::Result< int > meshMaterialCount() const =0
meshMaterialCount; synchronous owning-value operation under the class lifetime contract.
virtual ~IShapeBackend3D()=default
virtual bool isValid() const noexcept=0
Native shape liveness.
virtual eve::Result< void > setDensity(float value, bool updateMass)=0
setDensity; synchronous owning-value operation under the class lifetime contract.
virtual void destroy() noexcept=0
Idempotent native resource release after dependent records have been detached.
3D shape (box/sphere/capsule) attached to a Body3D with material settings. Created via Body3D::new*Sh...
Definition Shape3D.h:34
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
ShapeKind3D
Geometry kinds supported by the rigid shape contract.
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
bool enabled
Allocation-free owning three-dimensional physics value.
Definition RigidTypes3D.h:4
Shape behavior reapplied atomically when geometry changes.
Collision filter; negative groups never collide, positive groups always collide.
Owning, backend-independent shape source; metres, local quaternion XYZW.
std::vector< int32_t > meshIndices
std::vector< float > heightValues
std::vector< uint8_t > meshMaterialIndices
std::vector< float > meshVertices
std::vector< float > hullVertices
Owning world-space plane; double-precision point and unit normal.
Owning surface values; userMaterialId contains the engine material ID and combine policy encoding.
std::uint32_t customColor
Optional solver debug color, retained through topology rebuilds.