TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Render()

void NoiseLayer::Render ( int  index)

Definition at line 191 of file NoiseLayer.cpp.

192{
193 ImGui::SameLine();
194 ImGui::Text(name.data());
195 ImGui::InputTextWithHint(MAKE_IMGUI_ID("Name Input"), "Name", name.data(), name.capacity());
196 ImGui::NewLine();
197 ImGui::Checkbox(MAKE_IMGUI_LABEL("Enabled"), &enabled);
198 ImGui::Text("Offsets:");
199 ImGui::DragFloat3(MAKE_IMGUI_ID("Offsets"), offset, 0.1f);
200 ImGui::Text("Noise Type : ");
201 ImGui::SameLine();
202
203 if (ImGui::BeginCombo(MAKE_IMGUI_ID("Noise Type Selector"), noiseTypeStr))
204 {
205 for (int n = 0; n < 6; n++)
206 {
207 bool isSelected = (noiseTypeStr == noiseTypes[n]);
208
209 if (ImGui::Selectable(noiseTypes[n], isSelected))
210 {
211 noiseTypeStr = noiseTypes[n];
212 noiseType = n;
213 SetNoiseType(noiseGen, noiseType);
214
215 if (isSelected)
216 {
217 ImGui::SetItemDefaultFocus();
218 }
219 }
220 }
221
222 ImGui::EndCombo();
223 }
224
225 ImGui::Text("Fractal Type : ");
226 ImGui::SameLine();
227
228 if (ImGui::BeginCombo(MAKE_IMGUI_ID("Fractal Type Selector"), fractalTypeStr))
229 {
230 for (int n = 0; n < 4; n++)
231 {
232 bool isSelected = (fractalTypeStr == fractalTypes[n]);
233
234 if (ImGui::Selectable(fractalTypes[n], isSelected))
235 {
236 fractalTypeStr = fractalTypes[n];
237 fractalType = n;
238 SetFractalType(noiseGen, fractalType);
239
240 if (isSelected)
241 {
242 ImGui::SetItemDefaultFocus();
243 }
244 }
245 }
246
247 ImGui::EndCombo();
248 }
249
250 if (ImGui::DragInt(MAKE_IMGUI_LABEL("Seed"), &seed))
251 {
252 noiseGen->SetSeed(seed);
253 }
254
255 if (ImGui::DragFloat(MAKE_IMGUI_LABEL("Frequency"), &frequency, 0.001f))
256 {
257 noiseGen->SetFrequency(frequency);
258 }
259
260 ImGui::DragFloat(MAKE_IMGUI_LABEL("Strength"), &strength, 0.1f);
261
262 if (fractalType != 0)
263 {
264 if (ImGui::DragInt(MAKE_IMGUI_LABEL("Octaves"), &octaves, 0.05f))
265 {
266 noiseGen->SetFractalOctaves(octaves);
267 }
268
269 if (ImGui::DragFloat(MAKE_IMGUI_LABEL("Lacunarity"), &lacunarity, 0.1f))
270 {
271 noiseGen->SetFractalLacunarity(lacunarity);
272 }
273
274 if (ImGui::DragFloat(MAKE_IMGUI_LABEL("Gain"), &gain, 0.1f))
275 {
276 noiseGen->SetFractalGain(gain);
277 }
278
279 if (ImGui::DragFloat(MAKE_IMGUI_LABEL("Weighted Strength"), &weightedStrength, 0.01f))
280 {
281 noiseGen->SetFractalWeightedStrength(weightedStrength);
282 }
283
284 if (ImGui::DragFloat(MAKE_IMGUI_LABEL("Ping Pong Strength"), &pingPongStrength, 0.01f))
285 {
286 noiseGen->SetFractalPingPongStrength(pingPongStrength);
287 }
288 }
289
290 if (noiseType == 1)
291 {
292 if (ImGui::DragFloat(MAKE_IMGUI_LABEL("Cellur Jitter"), &cellularJitter, 0.01f))
293 {
294 noiseGen->SetCellularJitter(cellularJitter);
295 }
296
297 ImGui::Text("Cellular Distance Function : ");
298 ImGui::SameLine();
299
300 if (ImGui::BeginCombo(MAKE_IMGUI_ID("Cellular Distance Function"), distFuncStr))
301 {
302 for (int n = 0; n < 4; n++)
303 {
304 bool isSelected = (distFuncStr == distFuncs[n]);
305
306 if (ImGui::Selectable(distFuncs[n], isSelected))
307 {
308 distFuncStr = distFuncs[n];
309 distanceFunc = n;
310 SetFractalType(noiseGen, distanceFunc);
311
312 if (isSelected)
313 {
314 ImGui::SetItemDefaultFocus();
315 }
316 }
317 }
318
319 ImGui::EndCombo();
320 }
321 }
322}