载入中...
搜索中...
未找到
GtsMeshSimplifier.cpp
浏览该文件的文档.
24 return q[0] * x * x + 2 * q[1] * x * y + 2 * q[2] * x * z + q[3] * y * y + 2 * q[4] * y * z + q[5] * z * z +
30 m.normals().size() == size_t(m.getVertexCount()) * 3 && m.uvs().size() == size_t(m.getVertexCount()) * 2 &&
36 if (!valid(source) || !std::isfinite(quality) || quality < 0 || quality > 1 || o.maxIterationCount <= 0 ||
37 !std::isfinite(o.vertexLinkDistance) || o.vertexLinkDistance < 0 || !std::isfinite(o.aggressiveness) ||
45 V v{source.getPositionX(i), source.getPositionY(i), source.getPositionZ(i), source.getNormalX(i),
58 if (a < 0 || b < 0 || c < 0 || a >= int(vs.size()) || b >= int(vs.size()) || c >= int(vs.size()) || a == b ||
71 double ux = b.x - a.x, uy = b.y - a.y, uz = b.z - a.z, vx = c.x - a.x, vy = c.y - a.y, vz = c.z - a.z;
76 DiagnosticCode::InvalidArgument, "mesh contains a zero-area triangle", "procgen.gtsMeshSimplify"));
81 std::array<double, 10> q{nx * nx, nx * ny, nx * nz, ny * ny, ny * nz, nz * nz, nx * d, ny * d, nz * d, d * d};
132 if (!a.alive || !b.alive || (a.locked && b.locked) || a.border != b.border || a.seam != b.seam ||
147 if (o.preserveSurfaceCurvature) cost *= 2. - std::clamp(a.nx * b.nx + a.ny * b.ny + a.nz * b.nz, -1., 1.);
194 double oux = old1.x - old0.x, ouy = old1.y - old0.y, ouz = old1.z - old0.z, ovx = old2.x - old0.x,
197 double ux = q.x - p.x, uy = q.y - p.y, uz = q.z - p.z, vx = r.x - p.x, vy = r.y - p.y, vz = r.z - p.z,
252 if (!colors.empty()) next.setVertexColors(std::move(colors)).ignore("validated simplified color stream");
255 DiagnosticCode::InvalidArgument, "simplification removed the complete mesh", "procgen.gtsMeshSimplify"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:19
Definition EvpackPointGraphLoader.h:12
Result< int > simplifyGtsMesh(MeshBuild &output, const MeshBuild &source, float quality, const GtsMeshSimplificationOptions &o)
Simplify a mesh with deterministic quadric edge collapse.
Definition GtsMeshSimplifier.cpp:34
@ InvalidArgument
GTS mesh simplification controls supported by MeshBuild streams.
Definition GtsMeshSimplifier.h:6
int maxIterationCount
Definition GtsMeshSimplifier.h:10
bool preserveUvFoldoverEdges
Definition GtsMeshSimplifier.h:7
bool preserveSurfaceCurvature
Definition GtsMeshSimplifier.h:8
double aggressiveness
Definition GtsMeshSimplifier.h:9
bool preserveUvSeamEdges
Definition GtsMeshSimplifier.h:7
bool preserveBorderEdges
Definition GtsMeshSimplifier.h:7
bool enableSmartLink
Definition GtsMeshSimplifier.h:8
double vertexLinkDistance
Definition GtsMeshSimplifier.h:9