载入中...
搜索中...
未找到
CaveGenerationConfigure.cpp
浏览该文件的文档.
2
4
6 std::string error;
7 style = params.getString("style", "mixed");
8 genesis = params.getString("genesis", "epigene");
9 resolution = params.getInt("resolution", 40);
10 nx = params.getInt("nx", resolution);
11 ny = params.getInt("ny", std::max(12, resolution * 3 / 5));
12 nz = params.getInt("nz", resolution);
13 chamberCount = params.getInt("chambers", 7);
14 branchCount = params.getInt("branches", 4);
15 tunnelRadius = params.getFloat("tunnelRadius", 0.16f);
16 chamberScale = params.getFloat("chamberScale", 1.f);
17 chamberHierarchy = params.getFloat("chamberHierarchy", 0.f);
18 passageVariation = params.getFloat("passageVariation", 0.f);
19 chamberIrregularity = params.getFloat("chamberIrregularity", 0.f);
20 roughness = params.getFloat("roughness", 0.12f);
21 multiscaleRoughness = params.getFloat("multiscaleRoughness", 0.f);
22 roughnessFlowCoupling = params.getFloat("roughnessFlowCoupling", 0.f);
23 erosion = params.getFloat("erosion", 0.55f);
24 bedding = params.getFloat("bedding", 0.6f);
25 fractureDissolution = params.getFloat("fractureDissolution", 0.55f);
26 fractureApertureVariability = params.getFloat("fractureApertureVariability", 0.f);
27 fractureStressControl = params.getFloat("fractureStressControl", 0.f);
28 fractureFlowFeedback = params.getFloat("fractureFlowFeedback", 0.f);
29 vadoseIncision = params.getFloat("vadoseIncision", 0.35f);
30 waterTableCorrosion = params.getFloat("waterTableCorrosion", 0.f);
31 waterTableLevel = params.getFloat("waterTableLevel", 0.18f);
32 waterTableStages = params.getInt("waterTableStages", 1);
33 waterTableDrop = params.getFloat("waterTableDrop", 0.18f);
34 waterTableFluctuation = params.getFloat("waterTableFluctuation", 0.35f);
35 scallopErosion = params.getFloat("scallopErosion", 0.45f);
36 scallopScale = params.getFloat("scallopScale", 0.12f);
37 scallopHydraulicScaling = params.getFloat("scallopHydraulicScaling", 0.f);
38 scallopMaturity = params.getFloat("scallopMaturity", 0.f);
39 scallopScaleVariability = params.getFloat("scallopScaleVariability", 0.f);
40 scallopFlowSeparation = params.getFloat("scallopFlowSeparation", 0.f);
41 scallopFlowHistory = params.getFloat("scallopFlowHistory", 0.f);
42 bendUndercut = params.getFloat("bendUndercut", 0.f);
43 fragmentDetachment = params.getFloat("fragmentDetachment", 0.f);
44 curvatureDissolution = params.getFloat("curvatureDissolution", 0.f);
45 reactiveSurfaceCoupling = params.getFloat("reactiveSurfaceCoupling", 0.f);
46 surfaceSlopeReactivity = params.getFloat("surfaceSlopeReactivity", 0.f);
47 reactivePatchiness = params.getFloat("reactivePatchiness", 0.f);
48 hydraulicErosion = params.getFloat("hydraulicErosion", 0.f);
49 mixingCorrosion = params.getFloat("mixingCorrosion", 0.f);
50 lithologicHeterogeneity = params.getFloat("lithologicHeterogeneity", 0.f);
51 floodAbrasion = params.getFloat("floodAbrasion", 0.f);
52 sedimentLoad = params.getFloat("sedimentLoad", 0.55f);
53 floodPlucking = params.getFloat("floodPlucking", 0.f);
54 pluckingBlockScale = params.getFloat("pluckingBlockScale", 0.1f);
55 constrictionScour = params.getFloat("constrictionScour", 0.f);
56 knickpointErosion = params.getFloat("knickpointErosion", 0.f);
57 streamBedKarren = params.getFloat("streamBedKarren", 0.f);
58 eddyPotholes = params.getFloat("eddyPotholes", 0.f);
59 potholeGravelSize = params.getFloat("potholeGravelSize", 0.5f);
60 breakdownScour = params.getFloat("breakdownScour", 0.f);
61 hydraulicGradient = params.getFloat("hydraulicGradient", 0.35f);
62 recharge = params.getFloat("recharge", 0.65f);
63 flowFocusing = params.getFloat("flowFocusing", 0.7f);
64 damkohler = params.getFloat("damkohler", 0.002f);
65 transportG = params.getFloat("transportG", 1.f);
66 microstructure = params.getFloat("microstructure", 0.f);
67 microporosityAccess = params.getFloat("microporosityAccess", 0.55f);
68 permeabilityContrast = params.getFloat("permeabilityContrast", 0.65f);
69 fractureCount = params.getInt("fractureCount", 5);
70 cupolaCount = params.getInt("cupolas", 6);
71 feederCount = params.getInt("feeders", 4);
72 dripstoneCount = params.getInt("dripstones", 12);
73 dripstoneScale = params.getFloat("dripstoneScale", 0.7f);
74 stalagmiteShape = params.getString("stalagmiteShape", "mixed");
75 normalSmoothing = params.getFloat("normalSmoothing", 0.78f);
76 surfaceNormalMode = params.getString("surfaceNormalMode", "faceAverage");
77 wetnessRefinement = params.getInt("wetnessRefinement", 0);
78 boundaryClosure = params.getFloat("boundaryClosure", 0.f);
79 condensationCorrosion = params.getFloat("condensationCorrosion", 0.f);
80 biogenicCorrosion = params.getFloat("biogenicCorrosion", 0.f);
81 mineralArmoring = params.getFloat("mineralArmoring", 0.f);
82 condensationFaceting = params.getFloat("condensationFaceting", 0.f);
83 differentialVeinErosion = params.getFloat("differentialVeinErosion", 0.f);
84 breakdown = params.getFloat("breakdown", 0.f);
85 breakdownEvents = params.getInt("breakdownEvents", 4);
86 sedimentDeposition = params.getFloat("sedimentDeposition", 0.f);
87 paragenesis = params.getFloat("paragenesis", 0.f);
88 sedimentBars = params.getInt("sedimentBars", 4);
89 flowstoneCount = params.getInt("flowstones", 7);
90 curtainCount = params.getInt("curtains", 5);
91 flowstoneScale = params.getFloat("flowstoneScale", 0.75f);
92 surfaceRefinement = params.getInt("surfaceRefinement", 0);
93 isosurfaceSampling = params.getInt("isosurfaceSampling", 1);
94 refinementThreshold = params.getFloat("refinementThreshold", 0.0015f);
95 width = params.getFloat("width", 30.f);
96 height = params.getFloat("height", 12.f);
97 depth = params.getFloat("depth", 24.f);
98 if (!validStyle(style)) {
99 error = "mesh.cave: unknown style '" + style + "' (use cavern|tunnels|vertical|labyrinth|mixed)";
101 }
102 if (!validGenesis(genesis)) {
103 error = "mesh.cave: unknown genesis '" + genesis + "' (use epigene|hypogene|mixed)";
105 }
106 if (stalagmiteShape != "conical" && stalagmiteShape != "columnar" && stalagmiteShape != "flatTop" &&
107 stalagmiteShape != "mixed") {
108 error = "mesh.cave: unknown stalagmiteShape '" + stalagmiteShape + "' (use conical|columnar|flatTop|mixed)";
110 }
111 if (surfaceNormalMode != "faceAverage" && surfaceNormalMode != "densityGradient") {
112 error = "mesh.cave: unknown surfaceNormalMode '" + surfaceNormalMode + "' (use faceAverage|densityGradient)";
114 }
115 if (nx < 8 || ny < 8 || nz < 8 || nx > 128 || ny > 128 || nz > 128) {
116 error = "mesh.cave: each resolution axis must be in [8, 128]";
118 }
119 if (chamberCount < 1 || chamberCount > 64 || branchCount < 0 || branchCount > 32) {
120 error = "mesh.cave: chambers must be in [1, 64] and branches in [0, 32]";
122 }
123 if (!(tunnelRadius >= 0.04f && tunnelRadius <= 0.4f) || chamberScale < 0.35f || chamberScale > 2.5f ||
124 chamberHierarchy < 0.f || chamberHierarchy > 1.f || passageVariation < 0.f || passageVariation > 1.f ||
125 chamberIrregularity < 0.f || chamberIrregularity > 1.f || roughness < 0.f || roughness > 0.45f ||
126 multiscaleRoughness < 0.f || multiscaleRoughness > 1.f || roughnessFlowCoupling < 0.f ||
127 roughnessFlowCoupling > 1.f || erosion < 0.f || erosion > 1.f || bedding < 0.f || bedding > 1.f ||
128 fractureDissolution < 0.f || fractureDissolution > 1.f || fractureApertureVariability < 0.f ||
129 fractureApertureVariability > 1.f || fractureStressControl < 0.f || fractureStressControl > 1.f ||
130 fractureFlowFeedback < 0.f || fractureFlowFeedback > 1.f || vadoseIncision < 0.f || vadoseIncision > 1.f ||
131 waterTableCorrosion < 0.f || waterTableCorrosion > 1.f || waterTableLevel < -0.8f || waterTableLevel > 0.8f ||
132 waterTableStages < 1 || waterTableStages > 4 || waterTableDrop < 0.05f || waterTableDrop > 0.5f ||
133 waterTableFluctuation < 0.f || waterTableFluctuation > 1.f || scallopErosion < 0.f || scallopErosion > 1.f ||
134 scallopScale < 0.04f || scallopScale > 0.32f || scallopHydraulicScaling < 0.f ||
135 scallopHydraulicScaling > 1.f || scallopMaturity < 0.f || scallopMaturity > 1.f ||
136 scallopScaleVariability < 0.f || scallopScaleVariability > 1.f || scallopFlowSeparation < 0.f ||
137 scallopFlowSeparation > 1.f || scallopFlowHistory < 0.f || scallopFlowHistory > 1.f || bendUndercut < 0.f ||
138 bendUndercut > 1.f || fragmentDetachment < 0.f || fragmentDetachment > 1.f || curvatureDissolution < 0.f ||
139 curvatureDissolution > 1.f || reactiveSurfaceCoupling < 0.f || reactiveSurfaceCoupling > 1.f ||
140 surfaceSlopeReactivity < 0.f || surfaceSlopeReactivity > 1.f || reactivePatchiness < 0.f ||
141 reactivePatchiness > 1.f || hydraulicErosion < 0.f || hydraulicErosion > 1.f || mixingCorrosion < 0.f ||
142 mixingCorrosion > 1.f || lithologicHeterogeneity < 0.f || lithologicHeterogeneity > 1.f ||
143 floodAbrasion < 0.f || floodAbrasion > 1.f || sedimentLoad < 0.f || sedimentLoad > 1.f || floodPlucking < 0.f ||
144 floodPlucking > 1.f || pluckingBlockScale < 0.04f || pluckingBlockScale > 0.2f || constrictionScour < 0.f ||
145 constrictionScour > 1.f || knickpointErosion < 0.f || knickpointErosion > 1.f || streamBedKarren < 0.f ||
146 streamBedKarren > 1.f || eddyPotholes < 0.f || eddyPotholes > 1.f || potholeGravelSize < 0.f ||
147 potholeGravelSize > 1.f || breakdownScour < 0.f || breakdownScour > 1.f || hydraulicGradient < 0.01f ||
148 hydraulicGradient > 2.f || recharge < 0.f || recharge > 1.f || flowFocusing < 0.f || flowFocusing > 1.f ||
149 damkohler < 0.00005f || damkohler > 0.05f || transportG < 0.1f || transportG > 5.f || cupolaCount < 0 ||
150 cupolaCount > 32 || microstructure < 0.f || microstructure > 1.f || microporosityAccess < 0.f ||
151 microporosityAccess > 1.f || permeabilityContrast < 0.f || permeabilityContrast > 1.f || feederCount < 0 ||
152 feederCount > 24 || fractureCount < 0 || fractureCount > 24 || dripstoneCount < 0 || dripstoneCount > 64 ||
153 dripstoneScale < 0.25f || dripstoneScale > 1.5f || normalSmoothing < 0.f || normalSmoothing > 1.f ||
154 flowstoneCount < 0 || flowstoneCount > 32 || curtainCount < 0 || curtainCount > 32 || flowstoneScale < 0.25f ||
155 flowstoneScale > 1.5f || surfaceRefinement < 0 || surfaceRefinement > 2 || isosurfaceSampling < 1 ||
156 isosurfaceSampling > 2 || wetnessRefinement < 0 || wetnessRefinement > 1 || boundaryClosure < 0.f ||
157 boundaryClosure > 1.f || condensationCorrosion < 0.f || condensationCorrosion > 1.f ||
158 biogenicCorrosion < 0.f || biogenicCorrosion > 1.f || mineralArmoring < 0.f || mineralArmoring > 1.f ||
159 condensationFaceting < 0.f || condensationFaceting > 1.f || differentialVeinErosion < 0.f ||
160 differentialVeinErosion > 1.f || breakdown < 0.f || breakdown > 1.f || breakdownEvents < 0 ||
161 breakdownEvents > 16 || refinementThreshold < 0.0001f || refinementThreshold > 0.02f ||
162 sedimentDeposition < 0.f || sedimentDeposition > 1.f || paragenesis < 0.f || paragenesis > 1.f ||
163 sedimentBars < 0 || sedimentBars > 16 || width <= 0.f || height <= 0.f || depth <= 0.f) {
164 error = "mesh.cave: invalid radius, chamber scale, roughness, or world dimensions";
166 }
167
168
169 return Result<void>::success();
170}
171
172} // namespace eve::procgen::cave_detail
std::string error
Definition Package.cpp:174
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
float getFloat(const std::string &key, float defaultValue) const
Read a floating parameter with explicit numeric conversion rules.
Definition Params.cpp:188
std::string getString(const std::string &key, const std::string &defaultValue) const
Read only a Value::String parameter; numeric/bool values are not stringified.
Definition Params.cpp:202
int getInt(const std::string &key, int defaultValue) const
Read an integer parameter with explicit numeric conversion rules.
Definition Params.cpp:176
bool validStyle(const std::string &style)
bool validGenesis(const std::string &genesis)