载入中...
搜索中...
未找到
PcgMeshLod.cpp
浏览该文件的文档.
25Result<void> PcgMeshCombinePlan::appendSource(const MeshBuild& mesh, const PcgMeshTransform& transform,
29 DiagnosticCode::InvalidArgument, "Pcg mesh combine source, material identity or source budget is invalid",
38 DiagnosticCode::InvalidArgument, "Pcg mesh combine source streams are invalid", "procgen.pcgMeshLod"));
41 DiagnosticCode::InvalidArgument, "Pcg mesh combine transform is non-finite", "procgen.pcgMeshLod"));
50int PcgMeshCombinePlan::getSourceCount() const noexcept { return static_cast<int>(sources_.size()); }
113 if(anyColors){auto set=candidate.setVertexColors(std::move(colors));if(!set.ok())return Result<int>::failure(set.status());}
142Result<void> PcgMeshLodProfile::setLevelRendererState(int index, int skinQuality, int shadowCastingMode,
146 const bool validSkinQuality = skinQuality == 0 || skinQuality == 1 || skinQuality == 2 || skinQuality == 4;
147 const bool validLightProbe = lightProbeUsage == 0 || lightProbeUsage == 1 || lightProbeUsage == 2 ||
224 if (level < 0 || level >= static_cast<int>(levels_.size()) || !std::isfinite(diameter) || diameter <= 0.F ||
227 const float threshold = levels_[static_cast<std::size_t>(level)].screenRelativeTransitionHeight;
237 DiagnosticCode::InvalidArgument, "Pcg mesh LOD requires a non-empty mesh and one through four levels",
264 DiagnosticCode::InvalidArgument, "Every Pcg combined mesh LOD level must enable mesh combination",
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
void addVertex(float px, float py, float pz, float nx, float ny, float nz, float u, float v)
Adds vertex.
Definition MeshBuild.cpp:33
void setMeta(const std::string &key, const std::string &value)
Sets the meta.
Definition MeshBuild.cpp:244
int setActiveGroup(const std::string &name)
Select/create the named group assigned to subsequently added triangles.
Definition MeshBuild.cpp:53
eve::Result< void > setVertexColors(std::vector< float > colors)
Atomically replace the optional packed RGBA stream; empty removes it.
Definition MeshBuild.cpp:214
Owned ordered input plan for Pcg static MeshCombiner.
Definition PcgMeshLod.h:64
Result< void > appendSource(const MeshBuild &mesh, const PcgMeshTransform &transform, const std::string &defaultMaterialId)
Copy one readable mesh and root-relative affine transform into the plan.
Definition PcgMeshLod.cpp:25
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
int getLevelRendererState(int index, int field) const noexcept
Return one renderer state field (0..6), or -1 for invalid input.
Definition PcgMeshLod.cpp:166
const PcgMeshLodLevel * levelAt(int index) const noexcept
Return an immutable level, or null for an invalid index. @ownership The profile retains ownership....
Definition PcgMeshLod.cpp:194
float getCrossFadeAnimationDuration() const noexcept
Return time-driven transition duration in seconds.
Definition PcgMeshLod.h:117
Result< void > setLevelRendererState(int index, int skinQuality, int shadowCastingMode, bool receiveShadows, int motionVectorMode, bool skinnedMotionVectors, int lightProbeUsage, int reflectionProbeUsage)
Replace one level's renderer policy after validating every Pcg enum value.
Definition PcgMeshLod.cpp:142
Result< void > appendLevel(float transitionHeight, float fadeWidth, float quality, bool combineMeshes=false, bool combineSubMeshes=false)
Append one level after validating its scalar ranges.
Definition PcgMeshLod.cpp:119
Result< void > setFadePolicy(int fadeMode, bool animateCrossFading, float animationDuration=0.5F)
Configure Unity LODFadeMode (0 None, 1 SpeedTree, 2 CrossFade) and optional time animation.
Definition PcgMeshLod.cpp:182
Owned generic mesh LOD output generated with Pcg's independent-per-level policy.
Definition PcgMeshLod.h:144
float getQuality(int index) const noexcept
Return one level's quality, or -1 for an invalid index.
Definition PcgMeshLod.cpp:206
int selectLevel(float relativeHeight) const noexcept
Select a level from projected relative height; -1 means culled and -2 invalid input.
Definition PcgMeshLod.cpp:217
const PcgMeshLodRendererState * rendererStateAt(int index) const noexcept
Borrow one generated level's immutable renderer state, or null.
Definition PcgMeshLod.cpp:213
float getTransitionHeight(int index) const noexcept
Return one level's transition height, or -1 for an invalid index.
Definition PcgMeshLod.cpp:198
const MeshBuild * meshAt(int index) const noexcept
Borrow a generated mesh, or null for an invalid index. @ownership The set retains ownership....
Definition PcgMeshLod.cpp:210
float getSwitchDistance(int level, float worldDiameter, float verticalFovDegrees) const noexcept
Convert one level threshold to camera distance, or -1 for invalid input.
Definition PcgMeshLod.cpp:223
float getFadeWidth(int index) const noexcept
Return one level's fade width, or -1 for an invalid index.
Definition PcgMeshLod.cpp:202
Row-major affine matrix used by Pcg's root-relative static mesh combination.
Definition PcgMeshLod.h:43
float getElement(int row, int column) const noexcept
Return one element, or zero for an invalid coordinate.
Definition PcgMeshLod.cpp:20
Result< void > setElement(int row, int column, float value)
Set one finite row/column element in the 4x4 matrix.
Definition PcgMeshLod.cpp:13
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
Result< int > combinePcgStaticMeshesInto(MeshBuild &output, const PcgMeshCombinePlan &plan)
Combine static meshes with Pcg material deduplication and root-relative transforms.
Definition PcgMeshLod.cpp:52
Result< void > buildPcgCombinedMeshLodsInto(PcgMeshLodSet &output, const PcgMeshCombinePlan &plan, const PcgMeshLodProfile &profile)
Combine an ordered static-renderer plan and generate every combined LOD atomically.
Definition PcgMeshLod.cpp:255
Result< void > buildPcgMeshLodsInto(PcgMeshLodSet &output, const MeshBuild &source, const PcgMeshLodProfile &profile)
Generate a complete generic Pcg LOD chain and publish it atomically.
Definition PcgMeshLod.cpp:232
@ InvalidArgument
One UnityMeshSimplifierPcg LOD level translated to native mesh settings.
Definition PcgMeshLod.h:80
float screenRelativeTransitionHeight
Definition PcgMeshLod.h:81
Pcg/Unity renderer policies retained per generated mesh LOD.
Definition PcgMeshLod.h:32