@@ -73,9 +73,8 @@ void checkOpenGLErrors()
73
73
}
74
74
}
75
75
76
- void GLAPIENTRY DebugOutputCallback (GLenum /* source*/ , GLenum type, GLuint id, GLenum /* severity*/ ,
77
- GLsizei /* length*/ , const GLchar* message,
78
- const void * /* userParam*/ )
76
+ void GLAPIENTRY DebugOutputCallback (GLenum /* source*/ , GLenum type, GLuint id, GLenum /* severity*/ , GLsizei /* length*/ ,
77
+ const GLchar* message, const void * /* userParam*/ )
79
78
{
80
79
// errors only
81
80
if (type != GL_DEBUG_TYPE_ERROR)
@@ -215,11 +214,9 @@ void CEngine::prepare()
215
214
216
215
auto texManager = mResourceManager ->getTextureManager ();
217
216
218
- auto skyboxTexture = texManager->create <CTextureCubeMap>(" resources/skybox/purple-nebula.4096" ,
219
- ETextureType::FILE);
217
+ auto skyboxTexture = texManager->create <CTextureCubeMap>(" resources/skybox/purple-nebula.4096" , ETextureType::FILE);
220
218
221
- auto orange =
222
- texManager->create <CTexture2D>(" resources/textures/orange.png" , ETextureType::FILE);
219
+ auto orange = texManager->create <CTexture2D>(" resources/textures/orange.png" , ETextureType::FILE);
223
220
224
221
CRegistry::set (" camera" , m_camera.get ());
225
222
@@ -239,10 +236,12 @@ void CEngine::prepare()
239
236
mRotationUpdateSystem .reset (new CRotationUpdateSystem (mEntityManager ));
240
237
mParticleUpdateSystem .reset (new CParticleUpdateSystem (mEntityManager ));
241
238
239
+ m_camera->set_moving_speed (10 );
240
+
242
241
CAssetLoader modelLoader;
243
242
244
243
{
245
- auto position = glm::vec3 (10 .f , 10 .f , 10 .f );
244
+ auto position = glm::vec3 (50 .f , 0 .f , - 50 .f );
246
245
auto color = glm::vec3 (0 .5f , 0 .5f , 0 .5f );
247
246
248
247
auto light = std::make_shared<TBasicLight>(position, color);
@@ -299,21 +298,6 @@ void CEngine::prepare()
299
298
mEntityManager .addComponent <CCameraComponent>(e, m_camera);
300
299
}
301
300
302
- {
303
- auto e = mEntityManager .createEntity ();
304
- mEntityManager .addComponent <CEditableComponent>(e, " Model" );
305
- mEntityManager .addComponent <CPickingComponent>(e);
306
-
307
- auto & t = mEntityManager .addComponent <CTransform3DComponent>(e);
308
-
309
- t.mScale = glm::vec3 (1 );
310
- t.mPosition = glm::vec3 (10 .f , 0 .f , -20 .f );
311
- t.mOrientation = glm::quat (glm::vec3 (0 .f ));
312
-
313
- auto model = modelLoader.getModel (" resources/models/rock/rock.gltf" );
314
- mEntityManager .addComponent <CModelComponent>(e, model);
315
- }
316
-
317
301
{
318
302
auto e = mEntityManager .createEntity ();
319
303
auto & w = mEntityManager .addComponent <CWindowComponent>(e);
@@ -353,7 +337,7 @@ void CEngine::prepare()
353
337
354
338
system->setGravity (glm::vec3 (0 ));
355
339
system->setParticleTexture (orange);
356
- system->setMaxPatricles (1000 );
340
+ system->setMaxPatricles (10000 );
357
341
358
342
auto createEmitter = []() -> std::shared_ptr<CParticleEmitter> {
359
343
auto emitter = std::make_shared<CParticleEmitter>();
@@ -362,8 +346,8 @@ void CEngine::prepare()
362
346
emitter->setMaxDeviationAngle (3 .14f );
363
347
emitter->setDistanceRange (5 , 5.1 );
364
348
emitter->setEmitIntervalRange (0.0003 , 0.0004 );
365
- emitter->setLifetimeRange (0.3 , 0.4 );
366
- emitter->setSpeedRange (1.0 , 1.1 );
349
+ emitter->setLifetimeRange (0.3 , 5.0 );
350
+ emitter->setSpeedRange (0.3 , 0.5 );
367
351
368
352
return emitter;
369
353
};
@@ -372,6 +356,38 @@ void CEngine::prepare()
372
356
373
357
system->setEmitter (p.m_particle_emitter );
374
358
}
359
+
360
+
361
+ {
362
+ auto e = mEntityManager .createEntity ();
363
+ mEntityManager .addComponent <CEditableComponent>(e, " Model" );
364
+ mEntityManager .addComponent <CPickingComponent>(e);
365
+
366
+ auto & t = mEntityManager .addComponent <CTransform3DComponent>(e);
367
+
368
+ t.mScale = glm::vec3 (1 );
369
+ t.mPosition = glm::vec3 (1 .f , 1 .f , 1 .f );
370
+ t.mOrientation = glm::quat (glm::vec3 (0 .f ));
371
+
372
+ auto model =
373
+ modelLoader.getModel (" /mnt/sandbox/cxx-opengl/glTF-Sample-Models/2.0/SciFiHelmet/glTF/SciFiHelmet.gltf" );
374
+ mEntityManager .addComponent <CModelComponent>(e, model);
375
+ }
376
+
377
+ {
378
+ auto e = mEntityManager .createEntity ();
379
+ mEntityManager .addComponent <CEditableComponent>(e, " Model" );
380
+ mEntityManager .addComponent <CPickingComponent>(e);
381
+
382
+ auto & t = mEntityManager .addComponent <CTransform3DComponent>(e);
383
+
384
+ t.mScale = glm::vec3 (1 );
385
+ t.mPosition = glm::vec3 (10 .f , 1 .f , 1 .f );
386
+ t.mOrientation = glm::quat (glm::vec3 (0 .f ));
387
+
388
+ auto model = modelLoader.getModel (" trash/nanosuit_gltf/untitled.gltf" );
389
+ mEntityManager .addComponent <CModelComponent>(e, model);
390
+ }
375
391
}
376
392
377
393
void CEngine::loop ()
@@ -428,8 +444,7 @@ void CEngine::onUpdate(double delta)
428
444
{
429
445
430
446
// Updating procedural model if it was re-generated.
431
- for (auto [entity, components] :
432
- mEntityManager .getEntitySet <CModelComponent, CProceduralComponent>())
447
+ for (auto [entity, components] : mEntityManager .getEntitySet <CModelComponent, CProceduralComponent>())
433
448
{
434
449
auto & [m, g] = components;
435
450
auto model = g.get ();
0 commit comments