| 1284 | } |
| 1285 | |
| 1286 | void 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()) |
nothing calls this directly
no test coverage detected