MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / createEmitters

Method createEmitters

Simulator/SimulatorBase.cpp:1286–1390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284}
1285
1286void SimulatorBase::createEmitters()
1287{
1288 Simulation *sim = Simulation::getCurrent();
1289 Utilities::SceneLoader::Scene& scene = SceneConfiguration::getCurrent()->getScene();
1290
1291 //////////////////////////////////////////////////////////////////////////
1292 // emitters
1293 //////////////////////////////////////////////////////////////////////////
1294 for (unsigned int i = 0; i < scene.emitters.size(); i++)
1295 {
1296 EmitterParameterObject *ed = scene.emitters[i];
1297
1298 FluidModel *model = nullptr;
1299 unsigned int j;
1300 for (j = 0; j < sim->numberOfFluidModels(); j++)
1301 {
1302 model = sim->getFluidModel(j);
1303 if (model->getId() == ed->id)
1304 break;
1305 }
1306
1307 if (j < sim->numberOfFluidModels())
1308 {
1309 if (sim->is2DSimulation())
1310 {
1311 // in 2D convert all emitters to box emitters
1312 // and set width to 1
1313 if (ed->type == 1)
1314 ed->height = ed->width;
1315 ed->width = 1;
1316 ed->type = 0;
1317 }
1318 Matrix3r rot = AngleAxisr(ed->angle, ed->axis).toRotationMatrix();
1319 model->getEmitterSystem()->addEmitter(
1320 ed->width, ed->height,
1321 ed->x, rot,
1322 ed->velocity,
1323 ed->type);
1324
1325 // Generate boundary geometry around emitters
1326 Emitter *emitter = model->getEmitterSystem()->getEmitters().back();
1327 BoundaryParameterObject *emitterBoundary = new BoundaryParameterObject();
1328 emitterBoundary->dynamic = false;
1329 emitterBoundary->isWall = false;
1330 emitterBoundary->color = { 0.2f, 0.2f, 0.2f, 1.0f };
1331 emitterBoundary->axis = ed->axis;
1332 emitterBoundary->angle = ed->angle;
1333 const Real supportRadius = sim->getSupportRadius();
1334 const Vector3r & emitDir = rot.col(0);
1335 emitterBoundary->scale = Emitter::getSize(static_cast<Real>(ed->width), static_cast<Real>(ed->height), ed->type);
1336 const Vector3r pos = ed->x;
1337 emitterBoundary->translation = pos;
1338 emitterBoundary->samplesFile = "";
1339 emitterBoundary->mapInvert = false;
1340 emitterBoundary->mapResolution = Eigen::Matrix<unsigned int, 3, 1, Eigen::DontAlign>(20, 20, 20);
1341 emitterBoundary->mapThickness = 0.0;
1342
1343 if (sim->is2DSimulation())

Callers

nothing calls this directly

Calls 15

getExePathFunction · 0.85
numberOfFluidModelsMethod · 0.80
getFluidModelMethod · 0.80
is2DSimulationMethod · 0.80
addEmitterMethod · 0.80
getEmitterSystemMethod · 0.80
getSupportRadiusMethod · 0.80
enableReuseParticlesMethod · 0.80
setEmitStartTimeMethod · 0.80
setEmitEndTimeMethod · 0.80
addFluidInfoMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected