Skip to content

Commit 14fc6b1

Browse files
committed
Lighting working for non PBR code, and PBR code seems to be relatively working as well.
Introduce memorypool and stop doing lazy loading of objects which exhausts system of memory. Move loading into separate thread.
1 parent a62e4a9 commit 14fc6b1

16 files changed

+1330
-363
lines changed

attachments/simple_engine/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ set(SOURCES
9797
renderer_compute.cpp
9898
renderer_utils.cpp
9999
renderer_resources.cpp
100+
memory_pool.cpp
100101
resource_manager.cpp
101102
entity.cpp
102103
component.cpp

attachments/simple_engine/main.cpp

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -36,57 +36,6 @@ void SetupScene(Engine* engine) {
3636
// Set the camera as the active camera
3737
engine->SetActiveCamera(camera);
3838

39-
// Create a cube entity
40-
Entity* cubeEntity = engine->CreateEntity("Cube");
41-
if (!cubeEntity) {
42-
throw std::runtime_error("Failed to create cube entity");
43-
}
44-
45-
// Add a transform component to the cube
46-
auto* cubeTransform = cubeEntity->AddComponent<TransformComponent>();
47-
cubeTransform->SetPosition(glm::vec3(0.0f, 0.0f, 0.0f));
48-
cubeTransform->SetRotation(glm::vec3(0.0f, 0.0f, 0.0f));
49-
cubeTransform->SetScale(glm::vec3(1.0f, 1.0f, 1.0f));
50-
51-
// Add a mesh component to the cube
52-
auto* cubeMesh = cubeEntity->AddComponent<MeshComponent>();
53-
cubeMesh->CreateCube(1.0f, glm::vec3(1.0f, 0.0f, 0.0f));
54-
55-
// Make the camera look at the red cube
56-
camera->LookAt(cubeTransform->GetPosition());
57-
58-
// Create a second cube entity
59-
Entity* cube2Entity = engine->CreateEntity("Cube2");
60-
if (!cube2Entity) {
61-
throw std::runtime_error("Failed to create second cube entity");
62-
}
63-
64-
// Add a transform component to the second cube
65-
auto* cube2Transform = cube2Entity->AddComponent<TransformComponent>();
66-
cube2Transform->SetPosition(glm::vec3(2.0f, 0.0f, 0.0f));
67-
cube2Transform->SetRotation(glm::vec3(0.0f, 0.0f, 0.0f));
68-
cube2Transform->SetScale(glm::vec3(0.5f, 0.5f, 0.5f));
69-
70-
// Add a mesh component to the second cube
71-
auto* cube2Mesh = cube2Entity->AddComponent<MeshComponent>();
72-
cube2Mesh->CreateCube(1.0f, glm::vec3(0.0f, 1.0f, 0.0f));
73-
74-
// Create a third cube entity
75-
Entity* cube3Entity = engine->CreateEntity("Cube3");
76-
if (!cube3Entity) {
77-
throw std::runtime_error("Failed to create third cube entity");
78-
}
79-
80-
// Add a transform component to the third cube
81-
auto* cube3Transform = cube3Entity->AddComponent<TransformComponent>();
82-
cube3Transform->SetPosition(glm::vec3(-2.0f, 0.0f, 0.0f));
83-
cube3Transform->SetRotation(glm::vec3(0.0f, 0.0f, 0.0f));
84-
cube3Transform->SetScale(glm::vec3(0.5f, 0.5f, 0.5f));
85-
86-
// Add a mesh component to the third cube
87-
auto* cube3Mesh = cube3Entity->AddComponent<MeshComponent>();
88-
cube3Mesh->CreateCube(1.0f, glm::vec3(0.0f, 0.0f, 1.0f));
89-
9039
// Start loading Bistro.glb model in background thread
9140
if (ModelLoader* modelLoader = engine->GetModelLoader()) {
9241
std::cout << "Starting threaded loading of Bistro model..." << std::endl;
@@ -123,11 +72,9 @@ void android_main(android_app* app) {
12372
#else
12473
/**
12574
* @brief Desktop entry point.
126-
* @param argc The number of command-line arguments.
127-
* @param argv The command-line arguments.
12875
* @return The exit code.
12976
*/
130-
int main(int argc, char* argv[]) {
77+
int main(int, char*[]) {
13178
try {
13279
// Create the engine
13380
Engine engine;

0 commit comments

Comments
 (0)