Commit 179a4cac authored by Jan Möbius's avatar Jan Möbius

Merge branch 'boxes-node-colors' into 'master'

BoxesNode: choose darker colors for negative coordinate sides to visualise vector orientation

See merge request !17
parents 873577dd eb8440b9
......@@ -53,10 +53,13 @@ BoxesNode::BoxesNode(BaseNode* _parent,
MaterialNode(_parent, _name),
updateVBO_(true)
{
const std::array<Vec4f,3> dim_color = {
const std::array<Vec4f,6> dir_color = {
Vec4f{1.f,0.f,0.f,1.f},
Vec4f{0.f,1.f,0.f,1.f},
Vec4f{0.f,0.f,1.f,1.f}
Vec4f{0.f,0.f,1.f,1.f},
Vec4f{.4f,0.f,0.f,1.f},
Vec4f{0.f,.4f,0.f,1.f},
Vec4f{0.f,0.f,.3f,1.f}
};
const std::array<Vec3f, 8> vertices = {
......@@ -64,34 +67,35 @@ BoxesNode::BoxesNode(BaseNode* _parent,
Vec3f( 1.f, 1.f, -1.f),
Vec3f( 1.f, 1.f, 1.f),
Vec3f( 1.f, -1.f, 1.f),
Vec3f(-1.f, -1.f, -1.f),
Vec3f(-1.f, 1.f, -1.f),
Vec3f(-1.f, 1.f, 1.f),
Vec3f(-1.f, -1.f, 1.f)};
auto add_triangle = [this, &vertices, &dim_color]
auto add_triangle = [this, &vertices, &dir_color]
(size_t v0, size_t v1, size_t v2, size_t dim)
{
triangles_.push_back({vertices[v0], vertices[v1], vertices[v2]});
triangle_colors_.push_back(dim_color[dim]);
triangle_colors_.push_back(dir_color[dim]);
};
triangles_.reserve(6*2);
triangle_colors_.reserve(6*2);
add_triangle(0, 1, 2, 0);
add_triangle(0, 2, 3, 0);
add_triangle(4, 6, 5, 0);
add_triangle(4, 7, 6, 0);
add_triangle(4, 6, 5, 3);
add_triangle(4, 7, 6, 3);
add_triangle(1, 5, 6, 1);
add_triangle(1, 6, 2, 1);
add_triangle(0, 3, 7, 1);
add_triangle(0, 7, 4, 1);
add_triangle(0, 3, 7, 4);
add_triangle(0, 7, 4, 4);
add_triangle(2, 7, 3, 2);
add_triangle(2, 6, 7, 2);
add_triangle(0, 4, 1, 2);
add_triangle(1, 4, 5, 2);
add_triangle(0, 4, 1, 5);
add_triangle(1, 4, 5, 5);
}
void
......
Markdown is supported
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