Commit 7ed1ccde authored by Aaron Grabowy's avatar Aaron Grabowy
Browse files

Updated from develop, many fixes after restructuring

parents 601bcf81 030b3608
Pipeline #13515 failed with stage
in 6 minutes and 14 seconds
......@@ -90,6 +90,7 @@ else()
set(SAMPLE_FLAGS
-Wall
-Werror
-march=native
)
set(TEST_FLAGS
${SAMPLE_FLAGS}
......@@ -180,6 +181,8 @@ if (TG_TESTS)
polymesh
ctracer
glm
-lgmp
-lgmpxx
${TEST_LINK_FLAGS}
)
......
ctracer @ f5c89c5a
Subproject commit 56d33f9b69854c7339e8ddd71fe81095ddd5cc41
Subproject commit f5c89c5aecf75079a2d1314ebeb9020f1f091bcb
glow @ 586b7ab6
Subproject commit 79f278f3a41b551daa20fe45a8a9cb5b5926ff0d
Subproject commit 586b7ab6bd43921de52605e99c21ce43d39a98dd
glow-extras @ 29ec9cf1
Subproject commit b2b528eb65352c877ef76665d67ce5d045e40a7d
Subproject commit 29ec9cf13518d8ed462ba88ced2bd667e5c955a5
polymesh @ 567b64bf
Subproject commit 62677179123a61649755b05e86a8ed68adee81e9
Subproject commit 567b64bf34667d95b834fbd01db24c2d18aff21d
typed-geometry @ bd41a428
Subproject commit a0e8302a24a969b41bf90636d5189680928369eb
Subproject commit bd41a428c7141d6631a0744ab37a624863a9f22d
......@@ -27,7 +27,7 @@ int main()
tg::sphere3 sphere;
tg::box3 box;
tg::cone3 cone;
tg::tube3 tube;
tg::cylinder_boundary_no_caps<3, float> tube;
data() {}
} d;
......@@ -104,7 +104,7 @@ int main()
break;
case 2:
p.type = prim::cone;
p.d.cone = tg::cone3(tg::disk3(uniform(rng, aabb), uniform(rng, 1.0f, 3.0f), tg::uniform<tg::dir3>(rng)), uniform(rng, 1.0f, 3.0f));
p.d.cone = tg::cone3({uniform(rng, aabb), uniform(rng, 1.0f, 3.0f), tg::uniform<tg::dir3>(rng)}, uniform(rng, 1.0f, 3.0f));
break;
case 3:
p.type = prim::tube;
......
......@@ -25,9 +25,9 @@ struct environment
environment()
{
for (auto i = 0; i < 100; ++i)
pts.push_back(uniform(rng, tg::ball3({0, 0, 0}, 1)));
pts.push_back(uniform(rng, tg::sphere3({0, 0, 0}, 1)));
for (auto i = 0; i < 100; ++i)
pts.push_back(uniform(rng, tg::ball3({2, 0, 0}, 1)));
pts.push_back(uniform(rng, tg::sphere3({2, 0, 0}, 1)));
// for (auto i = 0; i < 100; ++i)
// pts.push_back(uniform(rng, tg::aabb3({-1, 0, -1}, {1, 0, 1})));
// for (auto i = 0; i < 100; ++i)
......@@ -58,7 +58,7 @@ struct environment
individual mutated_individual(individual const& id) const
{
auto new_id = id; // copy
new_id.obb.center += tg::uniform_vec(rng, tg::ball3::unit) * 0.1f;
new_id.obb.center += tg::uniform_vec(rng, tg::sphere3::unit) * 0.1f;
auto rot = tg::rotation_around(tg::uniform<tg::dir3>(rng), uniform(rng, 0_deg, 3_deg));
for (auto i = 0; i < 3; ++i)
new_id.obb.half_extents[i] = rot * new_id.obb.half_extents[i] * uniform(rng, 0.9f, 1.1f);
......
#include <doctest.hh>
#include <ctracer/benchmark.hh>
#include <typed-geometry/tg.hh>
#include <thread>
namespace ct
{
sink_t operator<<(sink_t s, tg::vec3 v) { return s << v.x << v.y << v.z; }
}
template <>
struct ct::source<tg::vec3>
{
explicit source(tg::vec3 v) : x(v.x), y(v.y), z(v.z) {}
operator tg::vec3() const { return {x, y, z}; }
private:
source<float> x, y, z;
};
TEST_CASE("benchmark")
{
#ifdef TG_RELEASE
CHECK(ct::benchmark([](tg::vec3 v) { return cross(v, v); }, tg::vec3::zero).cycles_per_sample() < 20);
#endif
return;
// print tests:
ct::benchmark([](int a, int b) { return a % b; }, 17, 5).print_summary("a % b (32bit): ");
ct::benchmark([](int64_t a, int64_t b) { return a % b; }, 17, 5).print_summary("a % b (64bit): ");
ct::benchmark([](double a, double b, double c) { return length(tg::vec(a, b, c)); }, 1, 1, 1).print_summary("tg::length(vec3): ");
ct::benchmark(
[](int c) {
std::vector<float> v;
tg::rng rng;
for (auto i = 0; i < c; ++i)
v.push_back(uniform(rng, 0.0f, 1.0f));
return tg::sum(v);
},
100)
.print_summary("100 randoms: ");
tg::rng rng;
ct::benchmark([&] { return rng(); }).print_summary("rng: ");
ct::benchmark([&] { return uniform(rng, 1, 100); }).print_summary("uniform int: ");
ct::benchmark([](tg::vec3 v) { return cross(v, v); }, tg::vec3::zero).print_summary("cross: ");
}
#pragma once
// include this header temporarily for debugging a test
#include <iostream>
#include <typed-geometry/tg-std.hh>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment