@@ -137,6 +137,7 @@ void CommandHandler::sendCommand(CUICommand& cui_command) {
137
137
void CommandHandler::executeCommand (CUICommand& cui_command) {
138
138
std::string file_path, time_for_move, source_position, sink_height;
139
139
int simulation_timesteps;
140
+ Vector3 camera_position = Vector3 (0 , 5 , -5 );
140
141
141
142
switch (cui_command.getCommand ()) {
142
143
case CUICommand::LOAD_MESH:
@@ -203,7 +204,11 @@ void CommandHandler::executeCommand(CUICommand& cui_command) {
203
204
}
204
205
break ;
205
206
case CUICommand::RENDER:
206
- render (loaded_mesh, loaded_shutter, 0 );
207
+ if (cui_command.hasParameter (" -v" )) {
208
+ camera_position = parseToVector3 (cui_command.getParameter (0 ).getValue ());
209
+ }
210
+
211
+ render (loaded_mesh, loaded_shutter, 0 , camera_position);
207
212
MPI_Barrier (MPI_COMM_WORLD);
208
213
209
214
// console feedback
@@ -326,27 +331,27 @@ void CommandHandler::simulate(int simulation_timesteps) {
326
331
if (mpi_rank == 1 ) {
327
332
std::vector<SphParticle> particles;
328
333
329
- for (int i = 0 ; i < 20 ; i++) {
330
- for (int j = 0 ; j < 20 ; j++) {
331
- for (int k = 0 ; k < 20 ; k++) {
332
- particles.push_back (SphParticle (Vector3 (3.0 + i, 3.0 + j, 3.0 + k)));
334
+ /* for (int i = 0; i < 1 ; i++) {
335
+ for (int j = 1 ; j < 2 ; j++) {
336
+ for (int k = 0; k < 1 ; k++) {
337
+ particles.push_back(SphParticle(Vector3(i, j, k)));
333
338
}
334
339
}
335
- }
340
+ }*/
336
341
337
342
sph_manager.add_particles (particles);
338
343
}
339
344
sph_manager.simulate (simulation_timesteps);
340
345
}
341
346
342
- void CommandHandler::render (Terrain loaded_mesh, Terrain loaded_shutter, int shutter_time) {
347
+ void CommandHandler::render (Terrain loaded_mesh, Terrain loaded_shutter, int shutter_time, Vector3 cameraPosition ) {
343
348
if (mpi_rank == 0 ) {
344
349
cout << " Rendering in progress..." << endl;
345
350
}
346
351
VisualizationManager::importTerrain (loaded_mesh, false );
347
352
VisualizationManager::importTerrain (loaded_shutter, true );
348
353
349
- VisualizationManager::init (Vector3 ( 10 , 5 , - 20 ), 200 , 200 , 10 *5 );
354
+ VisualizationManager::init (cameraPosition, 800 , 600 , 10 *5 );
350
355
// VisualizationManager::renderFrames("sph.ptcl");
351
356
VisualizationManager::renderFramesDistributed (" sph.ptcl" , mpi_rank);
352
357
@@ -360,6 +365,11 @@ void CommandHandler::render(Terrain loaded_mesh, Terrain loaded_shutter, int shu
360
365
void CommandHandler::addSource (std::string source_position_string) {
361
366
Vector3 source_position = parseToVector3 (source_position_string);
362
367
// sph_manager.setSource(source_position);
368
+ if (mpi_rank == 1 ) {
369
+ std::vector<SphParticle> particles;
370
+ particles.push_back (SphParticle (source_position));
371
+ sph_manager.add_particles (particles);
372
+ }
363
373
std::cout << " New source: " << source_position << std::endl;
364
374
}
365
375
0 commit comments