TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ GenerateForCustomBase()

void MeshGeneratorManager::GenerateForCustomBase ( )

Definition at line 285 of file MeshGeneratorManager.cpp.

286{
287 Model *customModel = appState->models.customBase;
288 Model *customModelCopy = appState->models.customBaseCopy;
289 float scale = appState->globals.scale;
290 appState->stats.vertexCount = customModel->mesh->vertexCount;
291
292 for (int i = 0; i < customModel->mesh->vertexCount; i++)
293 {
294 Vert tmp = customModelCopy->mesh->vert[i];
295 float elev = 0.0f;
296 NodeInputParam inp;
297 inp.x = tmp.position.x;
298 inp.y = 0.0f;
299 inp.z = tmp.position.z;
300 inp.minX = 0.0f;
301 inp.minY = 0.0f;
302 inp.minZ = 0.0f;
303 inp.maxX = scale;
304 inp.maxY = scale;
305 inp.maxZ = scale;
306 inp.texX = tmp.texCoord.x;
307 inp.texY = tmp.texCoord.y;
308
309 for (int j = 0; j < cpuNoiseLayers.size(); j++)
310 {
311 if(cpuNoiseLayers[j]->enabled)
312 {
313 elev += cpuNoiseLayers[j]->EvaluateAt(inp.x, inp.y, inp.z);
314 }
315 }
316
317 for(int j = 0 ; j<cpuNodeEditors.size(); j++)
318 {
319 if(cpuNodeEditors[j]->enabled)
320 {
321 elev += cpuNodeEditors[j]->EvaluateAt(inp);
322 }
323 }
324
325 tmp.position *= scale;
326 tmp.position += elev * tmp.normal;
327 customModel->mesh->vert[i].extras1.x += elev;
328 customModel->mesh->vert[i].position += tmp.position;
329 }
330}
Definition: Model.h:9
Definition: Mesh.h:13