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
2 changed files with 16 additions and 2 deletions

View File

@ -127,11 +127,11 @@ 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; delete[] current_result.c;
} }
}
}
// Is the ray origin within the left or right child node bounding box? // Is the ray origin within the left or right child node bounding box?
Node *near = Node *near =

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