TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ OnRender()

void NoiseCellularNode::OnRender ( )
virtual

Implements NodeEditorNode.

Definition at line 158 of file NoiseCellularNode.cpp.

159{
160 DrawHeader("Cellular Noise");
161 ImGui::Dummy(ImVec2(150, 10));
162 ImGui::SameLine();
163 ImGui::Text("Out");
164 outputPins[0]->Render();
165 inputPins[0]->Render();
166 ImGui::Text("Seed");
167
168 if (!inputPins[0]->IsLinked())
169 {
170 ImGui::Dummy(ImVec2(30, 10));
171 ImGui::SameLine();
172 ImGui::PushItemWidth(100);
173 ImGui::DragInt(MAKE_IMGUI_ID(inputPins[0]->id), &seed, 1);
174 ImGui::PopItemWidth();
175 }
176
177 else
178 {
179 ImGui::NewLine();
180 }
181
182 inputPins[1]->Render();
183 ImGui::Text("Octaves");
184
185 if (!inputPins[1]->IsLinked())
186 {
187 ImGui::Dummy(ImVec2(30, 10));
188 ImGui::SameLine();
189 ImGui::PushItemWidth(100);
190 ImGui::DragInt(MAKE_IMGUI_ID(inputPins[1]->id), &octaves, 1);
191 ImGui::PopItemWidth();
192 }
193
194 else
195 {
196 ImGui::NewLine();
197 }
198
199 inputPins[2]->Render();
200 ImGui::Text("Frequency");
201
202 if (!inputPins[2]->IsLinked())
203 {
204 ImGui::Dummy(ImVec2(30, 10));
205 ImGui::SameLine();
206 ImGui::PushItemWidth(100);
207 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[2]->id), &frequency, 0.001f);
208 ImGui::PopItemWidth();
209 }
210
211 else
212 {
213 ImGui::NewLine();
214 }
215
216 inputPins[3]->Render();
217 ImGui::Text("Lacunarity");
218
219 if (!inputPins[3]->IsLinked())
220 {
221 ImGui::Dummy(ImVec2(30, 10));
222 ImGui::SameLine();
223 ImGui::PushItemWidth(100);
224 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[3]->id), &lacunarity, 0.01f);
225 ImGui::PopItemWidth();
226 }
227
228 else
229 {
230 ImGui::NewLine();
231 }
232
233 inputPins[4]->Render();
234 ImGui::Text("Gain");
235
236 if (!inputPins[4]->IsLinked())
237 {
238 ImGui::Dummy(ImVec2(30, 10));
239 ImGui::SameLine();
240 ImGui::PushItemWidth(100);
241 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[4]->id), &gain, 0.01f);
242 ImGui::PopItemWidth();
243 }
244
245 else
246 {
247 ImGui::NewLine();
248 }
249
250 inputPins[5]->Render();
251 ImGui::Text("Weighted Strength");
252
253 if (!inputPins[5]->IsLinked())
254 {
255 ImGui::Dummy(ImVec2(30, 10));
256 ImGui::SameLine();
257 ImGui::PushItemWidth(100);
258 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[5]->id), &weightedStrength, 0.01f, 0, 1);
259 ImGui::PopItemWidth();
260 }
261
262 else
263 {
264 ImGui::NewLine();
265 }
266
267 inputPins[6]->Render();
268 ImGui::Text("Ping Pong Strength");
269
270 if (!inputPins[6]->IsLinked())
271 {
272 ImGui::Dummy(ImVec2(30, 10));
273 ImGui::SameLine();
274 ImGui::PushItemWidth(100);
275 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[6]->id), &pingPongStrength, 0.01f);
276 ImGui::PopItemWidth();
277 }
278
279 else
280 {
281 ImGui::NewLine();
282 }
283
284 inputPins[8]->Render();
285 ImGui::Text("Cellular Jitter");
286
287 if (!inputPins[8]->IsLinked())
288 {
289 ImGui::Dummy(ImVec2(30, 10));
290 ImGui::SameLine();
291 ImGui::PushItemWidth(100);
292 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[8]->id), &cellularJitter, 0.01f);
293 ImGui::PopItemWidth();
294 }
295
296 else
297 {
298 ImGui::NewLine();
299 }
300
301 inputPins[7]->Render();
302 ImGui::Text("Strength");
303
304 if (!inputPins[7]->IsLinked())
305 {
306 ImGui::Dummy(ImVec2(30, 10));
307 ImGui::SameLine();
308 ImGui::PushItemWidth(100);
309 ImGui::DragFloat(MAKE_IMGUI_ID(inputPins[7]->id), &strength, 0.01f);
310 ImGui::PopItemWidth();
311 }
312
313 else
314 {
315 ImGui::NewLine();
316 }
317
318 ImGui::NewLine();
319 ImGui::Text("Current Fractal Type : ");
320 ImGui::SameLine();
321 ImGui::Text(fractalTypes[fractalType]);
322
323 if (ImGui::Button(MAKE_IMGUI_LABEL(id, "Change Fractal Type")))
324 {
325 fractalType++;
326
327 if (fractalType == 4)
328 {
329 fractalType = 0;
330 }
331 }
332
333 ImGui::NewLine();
334 ImGui::Text("Current Distance Function : ");
335 ImGui::SameLine();
336 ImGui::Text(distFuncs[distanceFunc]);
337
338 if (ImGui::Button(MAKE_IMGUI_LABEL(id, "Change Distance Function")))
339 {
340 distanceFunc++;
341
342 if (distanceFunc == 4)
343 {
344 distanceFunc = 0;
345 }
346 }
347}