Skip to content
Snippets Groups Projects
Commit bb14f1ad authored by Philip Trettner's avatar Philip Trettner
Browse files

tg objects in viewer

parent 4e327544
No related branches found
No related tags found
No related merge requests found
Pipeline #9963 passed
Subproject commit 477e803f388de7ba1ddbf2b46abf0f332eb454b3
Subproject commit 21a30e11164c6ffc1ec12811cf7ce82c9f3b2d1f
glow @ 2b4182a2
Subproject commit 55f4b0eb10488e0bfcc5c35aba15d214898a33a1
Subproject commit 2b4182a2b654dcc8d601188f267058a7ba2e0cd9
glow-extras @ 06673fa9
Subproject commit 87f48ac179239a5ec9ff9e7d8b70752be87c2d1e
Subproject commit 06673fa92980b5a8b2ba04337ee70a818f7adf90
polymesh @ 707da368
Subproject commit 622e04156e2bd771d3131a35fb90008c83b807e3
Subproject commit 707da368c4f7eef2f31818d15a0220c41199bdd7
typed-geometry @ 190c2432
Subproject commit 12b7f4ae7ccf066874388d7223d43868bce7c71c
Subproject commit 190c2432940026159b2b1bf6ac4561f0d88e4b3d
......@@ -12,6 +12,8 @@
#include <glow-extras/glfw/GlfwContext.hh>
#include <glow-extras/viewer/view.hh>
#include <typed-geometry/tg.hh>
const bool sCustomSkybox = false;
int main()
......@@ -143,6 +145,57 @@ int main()
}
}
// tg objects
{
auto v = glow::viewer::grid();
tg::rng rng;
view(tg::segment3(tg::pos3(0, 0, 0), tg::pos3(1, 0, 0)), tg::color3::red);
view(tg::triangle3({0, 0, 0}, {1, 0, 0}, {0, 1, 0}), tg::color3::blue);
view(tg::aabb3({-0.3f, 0, -0.4f}, {0.2f, 0.5f, 0.1f}), tg::color3::green);
view(lines(tg::aabb3({-0.3f, 0, -0.4f}, {0.2f, 0.5f, 0.1f})));
// vector versions
{
std::vector<tg::segment3> segs;
for (auto i = 0; i < 20; ++i)
segs.emplace_back(uniform(rng, tg::sphere3::unit), uniform(rng, tg::sphere3::unit));
view(segs);
}
{
std::vector<tg::triangle3> tris;
for (auto i = 0; i < 20; ++i)
tris.emplace_back(uniform(rng, tg::sphere3::unit), uniform(rng, tg::sphere3::unit), uniform(rng, tg::sphere3::unit));
view(tris);
}
{
std::vector<tg::pos3> pts;
for (auto i = 0; i < 500; ++i)
pts.push_back(uniform(rng, tg::sphere3::unit));
view(pts);
}
{
std::vector<tg::box3> bbs;
for (auto i = 0; i < 4; ++i)
{
auto e0 = uniform_vec(rng, tg::sphere3::unit);
auto e1 = cross(e0, uniform_vec(rng, tg::sphere3::unit));
auto e2 = cross(e1, e0);
auto c = uniform(rng, tg::ball3::unit);
e0 = normalize(e0) * uniform(rng, 0.2f, 0.5f);
e1 = normalize(e1) * uniform(rng, 0.2f, 0.5f);
e2 = normalize(e2) * uniform(rng, 0.2f, 0.5f);
bbs.push_back(tg::box3(c, {e0, e1, e2}));
}
view(lines(bbs));
view(bbs);
}
}
// Animation
{
// TODO
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment