Skip to content
Snippets Groups Projects

Add colors(...) to tri_ref and line_ref

Merged Julius Nehring-Wirxel requested to merge jn/develop into develop
1 file
+ 23
0
Compare changes
  • Side-by-side
  • Inline
@@ -382,6 +382,17 @@ protected:
line_ref& color(float r, float g, float b, float a = 1) { return color(tg::color4(r, g, b, a)); }
line_ref& color(std::string_view color_str);
/// sets the two vertex colors (for all lines, probably only useful for add_line(line))
line_ref& colors(tg::color4 const& c0, tg::color4 const& c1)
{
for (auto& l : _lines)
{
l.p0.color = c0;
l.p1.color = c1;
}
return *this;
}
/// sets the size of all added lines
/// NOTE: world size or px size is determined by canvas state and cannot be changed!
line_ref& size(float s)
@@ -498,6 +509,18 @@ protected:
triangle_ref& color(float r, float g, float b, float a = 1) { return color(tg::color4(r, g, b, a)); }
triangle_ref& color(std::string_view color_str);
/// sets the three vertex colors (for all triangles, probably only useful for add_face(tri))
triangle_ref& colors(tg::color4 const& c0, tg::color4 const& c1, tg::color4 const& c2)
{
for (auto& t : _triangles)
{
t.color[0] = c0;
t.color[1] = c1;
t.color[2] = c2;
}
return *this;
}
/// sets the triangle normal of all triangles
triangle_ref& normal(tg::vec3 const& n)
{
Loading