Compare commits

...

3 Commits

Author SHA1 Message Date
1989ff4cc2 Update README 2021-01-18 19:11:17 +01:00
08646911ba Add benchmark code in main (commented out) 2021-01-18 19:11:17 +01:00
a3233d90c7 Hotfix for memory leak
The Vector class is still leaky, but it's not a noticeable problem with this fix. Proper fixing requries more debugging
2021-01-18 19:11:07 +01:00
3 changed files with 28 additions and 1 deletions

View File

@ -4,7 +4,18 @@
C++ ECS OpenGL game demo. C++ ECS OpenGL game demo.
Building requires OpenGL 3.2+, GLFW, GLM and GLAD. ## Movement
- Moving and panning: WASD and mouse
- Switching between free-look and path-mode: P
- Adding a path point: R
- Changing speed in path-mode: W/S
- Toggle anti-aliasing: Q
## Building
Building requires OpenGL 3.2+, GLFW, GLM and GLAD. CMake is used for compiling.
## Credits
Some code adapted from Joey de Vries' (https://twitter.com/JoeyDeVriez) tutorials at https://learnopengl.com/About licensed under https://creativecommons.org/licenses/by-nc/4.0/. Some code adapted from Joey de Vries' (https://twitter.com/JoeyDeVriez) tutorials at https://learnopengl.com/About licensed under https://creativecommons.org/licenses/by-nc/4.0/.

View File

@ -127,6 +127,8 @@ class KDTree {
nearest = current_distance; nearest = current_distance;
nearest_triangle = triangle; nearest_triangle = triangle;
result = current_result; result = current_result;
} else {
delete[] current_result.c;
} }
} }
} }

View File

@ -205,6 +205,20 @@ int main(int argc, char **argv) {
ring->assign<Material>(0.1, 0.9); ring->assign<Material>(0.1, 0.9);
ring->get<Transform>()->set_origin(glm::vec3(-5.0f, 2.0f, 0.0f)); ring->get<Transform>()->set_origin(glm::vec3(-5.0f, 2.0f, 0.0f));
/* for (int i = 0; i < 20; i++) {
Entity *ring = world->create();
ring->assign<Transform>();
ring->assign<ObjMesh>(ObjMesh("Resources/ring.obj", ObjMesh::Settings()));
ring->assign<Texture>("Resources/Metal007_2K_Color.jpg", Texture::Settings(true),
false); ring->get<Texture>()->addNormalmap("Resources/Metal007_2K_Normal.jpg",
Texture::Settings(true));
ring->assign<Material>(0.1, 0.9);
ring->get<Transform>()->set_origin(
glm::vec3(((float)(rand() - RAND_MAX / 2) / (float)RAND_MAX) * 50.0,
((float)(rand() - RAND_MAX / 2) / (float)RAND_MAX) * 50.0,
((float)(rand() - RAND_MAX / 2) / (float)RAND_MAX) * 50.0));
} */
Entity *sun = world->create(); Entity *sun = world->create();
sun->assign<DirectionalLight>(glm::normalize(glm::vec3(1.0, 1.0, 1.0))); sun->assign<DirectionalLight>(glm::normalize(glm::vec3(1.0, 1.0, 1.0)));