Skip to content

Commit

Permalink
Make sure to use float values for mesh colors
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed May 10, 2023
1 parent 04b4ee2 commit d0d34a5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions avogadro/rendering/povrayvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ void POVRayVisitor::visit(MeshGeometry& geometry)
}
str << "\n}\n";
str << "texture_list{" << v.size() << ",\n";
int r, g, b;
int t = geometry.opacity();
float r, g, b;
float t = 1.0 - geometry.opacity() / 255.0;

for (auto& i : v) {
r = i.color[0];
g = i.color[1];
b = i.color[2];
r = i.color[0] / 255.0;
g = i.color[1] / 255.0;
b = i.color[2] / 255.0;
str << "texture{pigment{rgbt<" << r << ", " << g << ", " << b << "," << t
<< ">}}\n";
}
Expand Down

0 comments on commit d0d34a5

Please sign in to comment.