From 3cb26d4fd25e18c1371c121dd0ac93254802b1e6 Mon Sep 17 00:00:00 2001 From: akreuzberg <aaron.kreuzberg@rwth-aachen.de> Date: Wed, 9 Jun 2021 13:59:31 +0200 Subject: [PATCH] improved suzanne example by different colors for each triangle face --- extern/glow-extras | 2 +- samples/basic/viewer/main.cc | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/extern/glow-extras b/extern/glow-extras index c2d9d8b..7bd27e7 160000 --- a/extern/glow-extras +++ b/extern/glow-extras @@ -1 +1 @@ -Subproject commit c2d9d8b00be704588186a7484f949c503bb04994 +Subproject commit 7bd27e7e229d16008e3c926b614c5a2165a83e7e diff --git a/samples/basic/viewer/main.cc b/samples/basic/viewer/main.cc index 9222608..26ce1cc 100644 --- a/samples/basic/viewer/main.cc +++ b/samples/basic/viewer/main.cc @@ -16,6 +16,7 @@ #include <glow-extras/viewer/view.hh> #include <typed-geometry/tg.hh> +#include <polymesh/objects/cube.hh> // path to sample files std::string const dataPath = glow::util::pathOf(__FILE__) + "/../../../data/"; @@ -1054,15 +1055,18 @@ int main() // load a sample polymesh mesh pm::Mesh m; auto pos = m.vertices().make_attribute<tg::pos3>(); - load(dataPath + "suzanne.obj", m, pos); + //load(dataPath + "suzanne.obj", m, pos); + pm::objects::add_cube(m, pos); //normalize(pos); // make it -1..1*/ auto col = pm::face_attribute<tg::color3>(m); int it = 0; + auto r = tg::rng(); for (auto x : m.faces()) { tg::color3 color; - switch (it % 6) + color = tg::uniform<tg::color3>(r); + /*switch (it % 6) { case 0: color = tg::color3::blue; @@ -1084,7 +1088,7 @@ int main() break; default: color = tg::color3::white; - } + }*/ it++; col[x] = color; } -- GitLab