@@ -111,6 +111,12 @@ void Engine::run() {
111
111
consoleThread = std::thread (&Engine::console, this );
112
112
consoleThread.detach ();
113
113
114
+ // == TEMPORARY FIX ==
115
+ // For some reason compiling this program with /MD instead of /MDd leads to only these values being false. I know it makes no sense, but this at leas fixes it...
116
+ G::VoxLightSettings->intermediate_cones = true ;
117
+ G::VoxLightSettings->front_cone = true ;
118
+ G::VoxLightSettings->side_cones = false ;
119
+
114
120
// >> Render Loop <<
115
121
116
122
while (!window->shouldClose ())
@@ -270,6 +276,7 @@ void Engine::console() {
270
276
else if (input[0 ] == " specular_dist_factor" || input[0 ] == " sdf" ) { G::VoxLightSettings->specular_dist_factor = strtof (input[1 ].c_str (), 0 ); }
271
277
272
278
else if (input[0 ] == " diffuse_offset" || input[0 ] == " do" ) { G::VoxLightSettings->diffuse_offset = strtof (input[1 ].c_str (), 0 ); }
279
+ else if (input[0 ] == " diffuse_origin_offset" || input[0 ] == " doo" ) { G::VoxLightSettings->diffuse_origin_offset = strtof (input[1 ].c_str (), 0 ); }
273
280
else if (input[0 ] == " occlusion_offset" || input[0 ] == " oo" ) { G::VoxLightSettings->occlusion_offset = strtof (input[1 ].c_str (), 0 ); }
274
281
else if (input[0 ] == " specular_offset" || input[0 ] == " so" ) { G::VoxLightSettings->specular_offset = strtof (input[1 ].c_str (), 0 ); }
275
282
@@ -285,6 +292,22 @@ void Engine::console() {
285
292
286
293
else if (input[0 ] == " load" ) { loadSceneOnNextFrame = true ; scene_load_dir = SCENE_DIR + input[1 ] + " .txt" ; }
287
294
else if (input[0 ] == " vox_freq" ) { voxelize_freq = strtof (input[1 ].c_str (), 0 ); }
295
+ else if (input[0 ] == " toggle" ) {
296
+ for (int i = 0 ; i < mainScene->objs .size (); i++) {
297
+ if (mainScene->objs [i]->name == input[1 ]) toggle (&mainScene->objs [i]->active , mainScene->objs [i]->name );
298
+ }
299
+ }
300
+ else print (this , " Unknwon Command" );
301
+ }
302
+ else if (input.size () == 3 ) {
303
+ if (input[0 ] == " scale" ) {
304
+ for (int i = 0 ; i < mainScene->objs .size (); i++) {
305
+ if (mainScene->objs [i]->name == input[1 ]) {
306
+ float scalar = strtof (input[2 ].c_str (), 0 );
307
+ mainScene->objs [i]->scale ( glm::vec3 (scalar) );
308
+ }
309
+ }
310
+ }
288
311
else print (this , " Unknwon Command" );
289
312
}
290
313
// eg. setmat Sphere1 shininess 0.1
@@ -299,38 +322,58 @@ void Engine::console() {
299
322
}
300
323
}
301
324
}
325
+ else if (input[0 ] == " translate" ) {
326
+ for (int i = 0 ; i < mainScene->objs .size (); i++) {
327
+ if (mainScene->objs [i]->name == input[1 ]) {
328
+ if (input[2 ] == " x" ) { mainScene->objs [i]->translate ( strtof (input[3 ].c_str (), 0 ), 0 , 0 ); }
329
+ else if (input[2 ] == " y" ) { mainScene->objs [i]->translate (0 , strtof (input[3 ].c_str (), 0 ), 0 ); }
330
+ else if (input[2 ] == " z" ) { mainScene->objs [i]->translate (0 , 0 , strtof (input[3 ].c_str (), 0 )); }
331
+ else print (this , " Invalid Axis" );
332
+ }
333
+ }
334
+ }
335
+ else if (input[0 ] == " rotate" ) {
336
+ for (int i = 0 ; i < mainScene->objs .size (); i++) {
337
+ if (mainScene->objs [i]->name == input[1 ]) {
338
+ if (input[2 ] == " x" ) { mainScene->objs [i]->rotate (glm::vec3 (strtof (input[3 ].c_str (), 0 ), 0 , 0 )); }
339
+ else if (input[2 ] == " y" ) { mainScene->objs [i]->rotate (glm::vec3 (0 , strtof (input[3 ].c_str (), 0 ), 0 )); }
340
+ else if (input[2 ] == " z" ) { mainScene->objs [i]->rotate (glm::vec3 (0 , 0 , strtof (input[3 ].c_str (), 0 ))); }
341
+ else print (this , " Invalid Axis" );
342
+ }
343
+ }
344
+ }
302
345
else print (this , " Unknwon Command" );
303
346
}
304
347
else if (input.size () == 1 ) {
305
- if (input[0 ] == " objs" ) objs = !objs;
306
- else if (input[0 ] == " voxs" ) voxs = !voxs;
348
+ if (input[0 ] == " objs" ) { toggle (& objs, " Draw Objects " ); }
349
+ else if (input[0 ] == " voxs" ) { toggle (& voxs, " Draw Voxels " ); }
307
350
else if (input[0 ] == " vox" ) voxelizeOnNextFrame = true ;
308
- else if (input[0 ] == " voxsW" ) voxsWireframe = !voxsWireframe;
309
- else if (input[0 ] == " objsW" ) objsWireframe = !objsWireframe;
310
- else if (input[0 ] == " sfMode" ) sfMode = !sfMode;
351
+ else if (input[0 ] == " voxsW" ) { toggle (& voxsWireframe, " Wireframe Voxels " ); }
352
+ else if (input[0 ] == " objsW" ) { toggle (& objsWireframe, " Wireframe Objects " ); }
353
+ else if (input[0 ] == " sfMode" ) { toggle (& sfMode, " Single Frame Mode " ); }
311
354
else if (input[0 ] == " sf" && sfMode) singleFrame = true ;
312
- else if (input[0 ] == " iLight" ) iLight = ! iLight;
313
- else if (input[0 ] == " overlayW" ) overlayWireframe = !overlayWireframe;
355
+ else if (input[0 ] == " iLight" ) { toggle (& iLight, " VXCT " ); }
356
+ else if (input[0 ] == " overlayW" ) { toggle (& overlayWireframe, " Wireframe Overlay " ); }
314
357
else if (input[0 ] == " pos1" ) G::SceneCamera->setPosition (1 );
315
358
else if (input[0 ] == " pos2" ) G::SceneCamera->setPosition (2 );
316
359
else if (input[0 ] == " ray" ) rayOnNextFrame = true ;
317
- else if (input[0 ] == " loclod" ) LocLod = !LocLod;
360
+ else if (input[0 ] == " loclod" ) { toggle (& LocLod, " Localized LOD Mode " ); }
318
361
else if (input[0 ] == " avgf" ) frametimecounter->printAvg ();
319
362
else if (input[0 ] == " clearf" ) frametimecounter->clear ();
320
- else if (input[0 ] == " dynamic" ) { dynamic_scene = !dynamic_scene; print ( this , dynamic_scene? " Dynamic revoxelization: ON " : " Dynamic revoxelization: OFF " ); }
363
+ else if (input[0 ] == " dynamic" ) { toggle (&dynamic_scene, " Dynamic Revoxelization " ); }
321
364
322
- else if (input[0 ] == " phong" ) G::VoxLightSettings->phong = !G::VoxLightSettings-> phong ;
323
- else if (input[0 ] == " phong_ambient" ) G::VoxLightSettings->phong_ambient = !G::VoxLightSettings-> phong_ambient ;
324
- else if (input[0 ] == " phong_diffuse" ) G::VoxLightSettings->phong_diffuse = !G::VoxLightSettings-> phong_diffuse ;
325
- else if (input[0 ] == " phong_specular" ) G::VoxLightSettings->phong_specular = !G::VoxLightSettings-> phong_specular ;
365
+ else if (input[0 ] == " phong" ) toggle (& G::VoxLightSettings->phong , " VXCT Phong " ) ;
366
+ else if (input[0 ] == " phong_ambient" ) toggle (& G::VoxLightSettings->phong_ambient , " VXCT Phong Ambient " ) ;
367
+ else if (input[0 ] == " phong_diffuse" ) toggle (& G::VoxLightSettings->phong_diffuse , " VXCT Phong Diffuse " ) ;
368
+ else if (input[0 ] == " phong_specular" ) toggle (& G::VoxLightSettings->phong_specular , " VXCT Phong Specular " ) ;
326
369
327
- else if (input[0 ] == " front_cone" ) G::VoxLightSettings->front_cone = !G::VoxLightSettings-> front_cone ;
328
- else if (input[0 ] == " side_cones" ) G::VoxLightSettings->side_cones = !G::VoxLightSettings-> side_cones ;
329
- else if (input[0 ] == " intermediate_cones" ) G::VoxLightSettings->intermediate_cones = !G::VoxLightSettings-> intermediate_cones ;
370
+ else if (input[0 ] == " front_cone" ) toggle (& G::VoxLightSettings->front_cone , " VXCT Front Cone " ) ;
371
+ else if (input[0 ] == " side_cones" ) toggle (& G::VoxLightSettings->side_cones , " VXCT Side Cones " ) ;
372
+ else if (input[0 ] == " intermediate_cones" ) toggle (& G::VoxLightSettings->intermediate_cones , " VXCT Intermediate Cones " ) ;
330
373
331
- else if (input[0 ] == " vox_diffuse" || input[0 ] == " vdiff" ) G::VoxLightSettings->vox_diffuse = !G::VoxLightSettings-> vox_diffuse ;
332
- else if (input[0 ] == " vox_specular" || input[0 ] == " vspec" ) G::VoxLightSettings->vox_specular = !G::VoxLightSettings-> vox_specular ;
333
- else if (input[0 ] == " vox_shadows" || input[0 ] == " vshad" ) G::VoxLightSettings->vox_shadows = !G::VoxLightSettings-> vox_shadows ;
374
+ else if (input[0 ] == " vox_diffuse" || input[0 ] == " vdiff" ) toggle (& G::VoxLightSettings->vox_diffuse , " VXCT Diffuse Component " ) ;
375
+ else if (input[0 ] == " vox_specular" || input[0 ] == " vspec" ) toggle (& G::VoxLightSettings->vox_specular , " VXCT Specular Component " ) ;
376
+ else if (input[0 ] == " vox_shadows" || input[0 ] == " vshad" ) toggle (& G::VoxLightSettings->vox_shadows , " VXCT Occlusion Component " ) ;
334
377
335
378
else if (input[0 ] == " phong_only" ) { G::VoxLightSettings->vox_diffuse = G::VoxLightSettings->vox_shadows = G::VoxLightSettings->vox_specular = false ; G::VoxLightSettings->phong = true ; }
336
379
else if (input[0 ] == " shadows_only" ) { G::VoxLightSettings->vox_diffuse = G::VoxLightSettings->phong = G::VoxLightSettings->vox_specular = false ; G::VoxLightSettings->vox_shadows = true ; }
@@ -342,6 +385,8 @@ void Engine::console() {
342
385
else if (input[0 ] == " occlusion_offset" || input[0 ] == " oo" ) { print (this , " Occlusion Offset : " + std::to_string (G::VoxLightSettings->occlusion_offset )); }
343
386
else if (input[0 ] == " specular_offset" || input[0 ] == " so" ) { print (this , " Specular Offset : " + std::to_string (G::VoxLightSettings->specular_offset )); }
344
387
388
+ else if (input[0 ] == " exit" || input[0 ] == " quit" || input[0 ] == " q" ) window->exit ();
389
+
345
390
else print (this , " Unknwon Command" );
346
391
}
347
392
@@ -350,3 +395,8 @@ void Engine::console() {
350
395
settingMutex.unlock ();
351
396
}
352
397
}
398
+
399
+ void Engine::toggle (bool * var, std::string name) {
400
+ (*var) = !(*var);
401
+ print (this , name + ((*var) ? " : ON" : " : OFF" ));
402
+ }
0 commit comments