mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Fix/blackcolor gcode preview (#11912)
* Fix dark color rendering in G-code preview by using additive specular lighting
* Revert "Fix dark color rendering in G-code preview by using additive specular lighting"
This reverts commit 2a65bc9060.
* Fix dark color rendering in G-code preview (Standard & ES shaders) by using additive specular lighting
* Fix dark color preview: Increase minimum brightness to 48/255 (~19%)
* Refactor: Revert to combined lighting calculation in shaders
This commit is contained in:
@@ -54,7 +54,11 @@ Slic3r::ColorRGBA convert(const Color& c)
|
||||
|
||||
Color convert(const Slic3r::ColorRGBA& c)
|
||||
{
|
||||
return { static_cast<uint8_t>(c.r() * 255.0f), static_cast<uint8_t>(c.g() * 255.0f), static_cast<uint8_t>(c.b() * 255.0f) };
|
||||
// ORCA: Fix dark color rendering. Ensure minimal brightness.
|
||||
auto safe_val = [](float v) -> uint8_t {
|
||||
return std::max((uint8_t)(v * 255.0f), (uint8_t)48);
|
||||
};
|
||||
return { safe_val(c.r()), safe_val(c.g()), safe_val(c.b()) };
|
||||
}
|
||||
|
||||
Color convert(const std::string& color_str)
|
||||
|
||||
Reference in New Issue
Block a user