载入中...
搜索中...
未找到
PcgMeshLod.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "common/Result.h"
7
8#include <vector>
9#include <array>
10#include <string>
11
12namespace eve::procgen {
13
14class PcgMeshCombinePlan;
15
28[[nodiscard]] EVENGINE_API_DOMAINS Result<int> combinePcgStaticMeshesInto(MeshBuild& output,
29 const PcgMeshCombinePlan& plan);
30
33 int skinQuality = 0; // Auto, Bone1, Bone2, Bone4
34 int shadowCastingMode = 1; // Off, On, TwoSided, ShadowsOnly
35 bool receiveShadows = true;
36 int motionVectorMode = 1; // Camera, Object, ForceNoMotion
38 int lightProbeUsage = 1; // Off, BlendProbes, UseProxyVolume, CustomProvided
39 int reflectionProbeUsage = 1; // Off, BlendProbes, Simple
40};
41
44public:
46 PcgMeshTransform() noexcept;
48 [[nodiscard]] Result<void> setElement(int row, int column, float value);
50 [[nodiscard]] float getElement(int row, int column) const noexcept;
51private:
52 friend class PcgMeshCombinePlan;
54 std::array<float, 16> matrix_{};
55};
56
65public:
67 [[nodiscard]] Result<void> appendSource(const MeshBuild& mesh, const PcgMeshTransform& transform,
68 const std::string& defaultMaterialId);
70 void clear() noexcept;
72 [[nodiscard]] int getSourceCount() const noexcept;
73private:
74 struct Source { MeshBuild mesh; PcgMeshTransform transform; std::string defaultMaterialId; };
76 std::vector<Source> sources_;
77};
78
89
98public:
100 [[nodiscard]] Result<void> appendLevel(float transitionHeight, float fadeWidth, float quality,
101 bool combineMeshes = false, bool combineSubMeshes = false);
103 [[nodiscard]] Result<void> setLevelRendererState(int index, int skinQuality, int shadowCastingMode,
104 bool receiveShadows, int motionVectorMode,
105 bool skinnedMotionVectors, int lightProbeUsage,
106 int reflectionProbeUsage);
108 [[nodiscard]] int getLevelRendererState(int index, int field) const noexcept;
110 [[nodiscard]] Result<void> setFadePolicy(int fadeMode, bool animateCrossFading,
111 float animationDuration = 0.5F);
113 [[nodiscard]] int getFadeMode() const noexcept { return fadeMode_; }
115 [[nodiscard]] bool getAnimateCrossFading() const noexcept { return animateCrossFading_; }
117 [[nodiscard]] float getCrossFadeAnimationDuration() const noexcept { return crossFadeAnimationDuration_; }
119 void clear() noexcept { levels_.clear(); }
121 [[nodiscard]] int getLevelCount() const noexcept { return static_cast<int>(levels_.size()); }
125 [[nodiscard]] const PcgMeshLodLevel* levelAt(int index) const noexcept;
129 [[nodiscard]] const std::vector<PcgMeshLodLevel>& levels() const noexcept { return levels_; }
130private:
131 std::vector<PcgMeshLodLevel> levels_;
132 int fadeMode_ = 0;
133 bool animateCrossFading_ = false;
134 float crossFadeAnimationDuration_ = 0.5F;
135};
136
145public:
147 [[nodiscard]] int getLevelCount() const noexcept { return static_cast<int>(meshes_.size()); }
149 [[nodiscard]] float getTransitionHeight(int index) const noexcept;
151 [[nodiscard]] float getFadeWidth(int index) const noexcept;
153 [[nodiscard]] float getQuality(int index) const noexcept;
155 [[nodiscard]] int selectLevel(float relativeHeight) const noexcept;
157 [[nodiscard]] float getSwitchDistance(int level, float worldDiameter, float verticalFovDegrees) const noexcept;
161 [[nodiscard]] const MeshBuild* meshAt(int index) const noexcept;
163 [[nodiscard]] const PcgMeshLodRendererState* rendererStateAt(int index) const noexcept;
165 [[nodiscard]] int getFadeMode() const noexcept { return fadeMode_; }
167 [[nodiscard]] bool getAnimateCrossFading() const noexcept { return animateCrossFading_; }
169 [[nodiscard]] float getCrossFadeAnimationDuration() const noexcept { return crossFadeAnimationDuration_; }
170private:
172 const PcgMeshLodProfile&);
173 std::vector<PcgMeshLodLevel> levels_;
174 std::vector<MeshBuild> meshes_;
175 int fadeMode_ = 0;
176 bool animateCrossFading_ = false;
177 float crossFadeAnimationDuration_ = 0.5F;
178};
179
188[[nodiscard]] EVENGINE_API_DOMAINS Result<void> buildPcgMeshLodsInto(PcgMeshLodSet& output, const MeshBuild& source,
189 const PcgMeshLodProfile& profile);
190
200 const PcgMeshCombinePlan& plan,
201 const PcgMeshLodProfile& profile);
202
203} // namespace eve::procgen
double value
std::string output
int column
#define EVENGINE_API_DOMAINS
Definition Export.h:110
int level
Mesh * mesh
int lightProbeUsage
Move-only, checked operation results for the common layer.
uint32_t index
const UnitySourceAsset & source
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
Owned ordered input plan for Pcg static MeshCombiner.
Definition PcgMeshLod.h:64
Mutable value profile for at most four native renderer LOD levels.
Definition PcgMeshLod.h:97
const std::vector< PcgMeshLodLevel > & levels() const noexcept
Borrow all levels for synchronous native compilation. @ownership The profile retains ownership....
Definition PcgMeshLod.h:129
bool getAnimateCrossFading() const noexcept
Return whether transitions advance from injected dt.
Definition PcgMeshLod.h:115
float getCrossFadeAnimationDuration() const noexcept
Return time-driven transition duration in seconds.
Definition PcgMeshLod.h:117
void clear() noexcept
Remove all level records.
Definition PcgMeshLod.h:119
int getFadeMode() const noexcept
Return configured Unity LODFadeMode.
Definition PcgMeshLod.h:113
int getLevelCount() const noexcept
Return the number of configured levels.
Definition PcgMeshLod.h:121
Owned generic mesh LOD output generated with Pcg's independent-per-level policy.
Definition PcgMeshLod.h:144
bool getAnimateCrossFading() const noexcept
Return whether transitions use injected time.
Definition PcgMeshLod.h:167
int getFadeMode() const noexcept
Return Unity LODFadeMode copied from the build profile.
Definition PcgMeshLod.h:165
float getCrossFadeAnimationDuration() const noexcept
Return injected-time transition duration.
Definition PcgMeshLod.h:169
int getLevelCount() const noexcept
Return the number of complete generated levels.
Definition PcgMeshLod.h:147
Row-major affine matrix used by Pcg's root-relative static mesh combination.
Definition PcgMeshLod.h:43
Result< int > combinePcgStaticMeshesInto(MeshBuild &output, const PcgMeshCombinePlan &plan)
Combine static meshes with Pcg material deduplication and root-relative transforms.
Result< void > buildPcgCombinedMeshLodsInto(PcgMeshLodSet &output, const PcgMeshCombinePlan &plan, const PcgMeshLodProfile &profile)
Combine an ordered static-renderer plan and generate every combined LOD atomically.
Result< void > buildPcgMeshLodsInto(PcgMeshLodSet &output, const MeshBuild &source, const PcgMeshLodProfile &profile)
Generate a complete generic Pcg LOD chain and publish it atomically.
GTS mesh simplification controls supported by MeshBuild streams.
One UnityMeshSimplifierPcg LOD level translated to native mesh settings.
Definition PcgMeshLod.h:80
GtsMeshSimplificationOptions simplification
Definition PcgMeshLod.h:86
PcgMeshLodRendererState renderer
Definition PcgMeshLod.h:87
Pcg/Unity renderer policies retained per generated mesh LOD.
Definition PcgMeshLod.h:32