载入中...
搜索中...
未找到
MeshMerge.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4#include "common/Result.h"
6#include "procgen/MeshBuild.h"
8
9#include <cstdint>
10#include <string>
11#include <vector>
12
13namespace eve::procgen {
14
22public:
24 enum class PivotMode : std::uint8_t { FirstSource = 0, WorldOrigin = 1 };
25
30 [[nodiscard]] Result<void> appendSource(const MeshBuild& mesh, float tx, float ty, float tz, float yawDegrees,
31 float sx, float sy, float sz, std::string defaultMaterialId = "default");
32 void clear() noexcept;
33 [[nodiscard]] int getSourceCount() const noexcept;
34
35 [[nodiscard]] Result<void> setEnableContactBlend(bool enabled) noexcept;
36 [[nodiscard]] bool getEnableContactBlend() const noexcept { return enableContactBlend_; }
37 [[nodiscard]] Result<void> setContactBlendParams(const MeshContactBlendParams& params);
38 [[nodiscard]] const MeshContactBlendParams& contactBlendParams() const noexcept { return blendParams_; }
43 [[nodiscard]] Result<void> setWeldTolerance(float tolerance) noexcept;
44 [[nodiscard]] float getWeldTolerance() const noexcept { return weldTolerance_; }
49 [[nodiscard]] Result<void> setSimplifyQuality(float quality) noexcept;
50 [[nodiscard]] float getSimplifyQuality() const noexcept { return simplifyQuality_; }
51 [[nodiscard]] Result<void> setPivotMode(PivotMode mode) noexcept;
52 [[nodiscard]] PivotMode getPivotMode() const noexcept { return pivotMode_; }
53 [[nodiscard]] Result<void> setMergeVertexColors(bool enabled) noexcept;
54 [[nodiscard]] bool getMergeVertexColors() const noexcept { return mergeVertexColors_; }
55
56private:
58 struct Source {
60 std::string defaultMaterialId;
61 };
62 std::vector<Source> sources_;
63 bool enableContactBlend_ = false;
64 MeshContactBlendParams blendParams_{};
65 float weldTolerance_ = 0.f;
66 float simplifyQuality_ = 0.f;
67 PivotMode pivotMode_ = PivotMode::FirstSource;
68 bool mergeVertexColors_ = true;
69 std::string falloffStorage_ = "smooth";
70};
71
77[[nodiscard]] EVENGINE_API_DOMAINS Result<MeshBuild> mergeStaticMeshes(const MeshMergePlan& plan);
78
79} // namespace eve::procgen
#define EVENGINE_API_DOMAINS
Definition Export.h:110
Mesh * mesh
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packe...
Definition MeshBuild.h:19
Authoring plan for commit-style static mesh merge.
Definition MeshMerge.h:21
bool getMergeVertexColors() const noexcept
Definition MeshMerge.h:54
float getWeldTolerance() const noexcept
Definition MeshMerge.h:44
PivotMode
Pivot placement for the merged mesh.
Definition MeshMerge.h:24
float getSimplifyQuality() const noexcept
Definition MeshMerge.h:50
PivotMode getPivotMode() const noexcept
Definition MeshMerge.h:52
const MeshContactBlendParams & contactBlendParams() const noexcept
Definition MeshMerge.h:38
std::vector< ParamSpec > params
Result< MeshBuild > mergeStaticMeshes(const MeshMergePlan &plan)
Merge planned static meshes into one owning MeshBuild.
bool enabled
Parameters for contact-band edge and material fusion.