Skip to content

Commit ba4a4b6

Browse files
committed
Changes:
- Fixed space body generation; - Added one-color texture generator.
1 parent e611d4c commit ba4a4b6

24 files changed

+388
-238
lines changed

resources/models/rock/rock.bin

-6.28 KB
Binary file not shown.

resources/models/rock/rock.gltf

Lines changed: 0 additions & 139 deletions
This file was deleted.

resources/models/rock/rock.png

-629 KB
Binary file not shown.

sources/app/CEngine.cpp

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ void checkOpenGLErrors()
7373
}
7474
}
7575

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*/)
7978
{
8079
// errors only
8180
if (type != GL_DEBUG_TYPE_ERROR)
@@ -215,11 +214,9 @@ void CEngine::prepare()
215214

216215
auto texManager = mResourceManager->getTextureManager();
217216

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);
220218

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);
223220

224221
CRegistry::set("camera", m_camera.get());
225222

@@ -239,10 +236,12 @@ void CEngine::prepare()
239236
mRotationUpdateSystem.reset(new CRotationUpdateSystem(mEntityManager));
240237
mParticleUpdateSystem.reset(new CParticleUpdateSystem(mEntityManager));
241238

239+
m_camera->set_moving_speed(10);
240+
242241
CAssetLoader modelLoader;
243242

244243
{
245-
auto position = glm::vec3(10.f, 10.f, 10.f);
244+
auto position = glm::vec3(50.f, 0.f, -50.f);
246245
auto color = glm::vec3(0.5f, 0.5f, 0.5f);
247246

248247
auto light = std::make_shared<TBasicLight>(position, color);
@@ -299,21 +298,6 @@ void CEngine::prepare()
299298
mEntityManager.addComponent<CCameraComponent>(e, m_camera);
300299
}
301300

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-
317301
{
318302
auto e = mEntityManager.createEntity();
319303
auto& w = mEntityManager.addComponent<CWindowComponent>(e);
@@ -353,7 +337,7 @@ void CEngine::prepare()
353337

354338
system->setGravity(glm::vec3(0));
355339
system->setParticleTexture(orange);
356-
system->setMaxPatricles(1000);
340+
system->setMaxPatricles(10000);
357341

358342
auto createEmitter = []() -> std::shared_ptr<CParticleEmitter> {
359343
auto emitter = std::make_shared<CParticleEmitter>();
@@ -362,8 +346,8 @@ void CEngine::prepare()
362346
emitter->setMaxDeviationAngle(3.14f);
363347
emitter->setDistanceRange(5, 5.1);
364348
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);
367351

368352
return emitter;
369353
};
@@ -372,6 +356,38 @@ void CEngine::prepare()
372356

373357
system->setEmitter(p.m_particle_emitter);
374358
}
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+
}
375391
}
376392

377393
void CEngine::loop()
@@ -428,8 +444,7 @@ void CEngine::onUpdate(double delta)
428444
{
429445

430446
// 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>())
433448
{
434449
auto& [m, g] = components;
435450
auto model = g.get();

sources/app/auxiliary/opengl.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ namespace gl
1010

1111
using TTexParametriList = std::vector<std::tuple<GLenum, GLenum, GLint>>;
1212

13-
inline void vertex_attrib_pointer(GLuint index, GLint size, GLenum type, GLboolean normalized,
14-
GLsizei stride, const void* pointer)
13+
inline void vertex_attrib_pointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
1514
{
1615
glEnableVertexAttribArray(index);
1716
glVertexAttribPointer(index, size, type, normalized, stride, pointer);

0 commit comments

Comments
 (0)