载入中...
搜索中...
未找到
JoltMesh.cpp
浏览该文件的文档.
17 g.meshIndices.size() % 3 || g.meshVertices.size() / 3 > 1000000 || g.meshIndices.size() / 3 > 2000000 ||
20 return rejected<JPH::RefConst<JPH::Shape>>("Invalid mesh source", eve::DiagnosticCode::InvalidArgument);
23 return rejected<JPH::RefConst<JPH::Shape>>("Non-finite vertex", eve::DiagnosticCode::InvalidArgument);
24 settings.mTriangleVertices.emplace_back(g.meshVertices[i], g.meshVertices[i + 1], g.meshVertices[i + 2]);
28 if (g.meshIndices[i + j] < 0 || size_t(g.meshIndices[i + j]) >= settings.mTriangleVertices.size())
34 return rejected<JPH::RefConst<JPH::Shape>>("Degenerate triangle", eve::DiagnosticCode::InvalidArgument);
40 triangles.emplace_back(settings.mTriangleVertices[t.mIdx[0]], settings.mTriangleVertices[t.mIdx[1]],
44 JPH::Indexify(triangles, settings.mTriangleVertices, settings.mIndexedTriangles, g.meshWeldTolerance);
54 settings.mBuildQuality = g.meshUseMedianSplit ? JPH::MeshShapeSettings::EBuildQuality::FavorBuildSpeed
58 if (g.heightCountX < 2 || g.heightCountZ < 2 || count > 16000000 || g.heightValues.size() != count ||
59 !isFinite(g.heightCellSizeX, g.heightCellSizeZ, g.heightGlobalMin) || !std::isfinite(g.heightGlobalMax) ||
61 return rejected<JPH::RefConst<JPH::Shape>>("Invalid height field", eve::DiagnosticCode::InvalidArgument);
63 // Jolt HeightFieldShape requires a square grid; a native mesh preserves all accepted source grids.
75 const auto a = static_cast<JPH::uint32>(z * g.heightCountX + x), b = a + 1, c = a + g.heightCountX,
78 settings.mIndexedTriangles.emplace_back(a, g.heightClockwise ? b : c, g.heightClockwise ? c : b, 0,
80 settings.mIndexedTriangles.emplace_back(d, g.heightClockwise ? c : b, g.heightClockwise ? b : c, 0,
86 return rejected<JPH::RefConst<JPH::Shape>>(result.GetError().c_str(), eve::DiagnosticCode::InvalidArgument);
96SurfaceMaterial3D contactMaterial(const JPH::Body& body, const JPH::SubShapeID& id, const ShapeState& shape) {
Definition JoltBody.cpp:7
int triangleIndex(const JPH::Body &, const JPH::SubShapeID &)
Definition JoltMesh.cpp:89
eve::Result< T > rejected(const char *operation, eve::DiagnosticCode code=eve::DiagnosticCode::Unsupported)
Definition JoltInternal.h:21
eve::Result< JPH::RefConst< JPH::Shape > > cookMesh(const ShapeGeometry3D &, JPH::uint64 userData)
Definition JoltMesh.cpp:10
SurfaceMaterial3D contactMaterial(const JPH::Body &, const JPH::SubShapeID &, const ShapeState &)
Definition JoltMesh.cpp:96
@ TriangleMesh
@ InvalidArgument
Owning, backend-independent shape source; metres, local quaternion XYZW.
Definition ShapeBackend3D.h:13
Owning surface values; userMaterialId contains the engine material ID and combine policy encoding.
Definition ShapeBackend3D.h:34