mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
make xray counting color hardcoded value
Somewhere between the xray.shader and the xray_composite.shader the colors are stored as unsigned int. Since we want to count the integer number of faces behind a pixel in the red channel, we simply use a color with an r value of 1/255.
This commit is contained in:
parent
b515a0f744
commit
4a8385e3e8
4 changed files with 6 additions and 8 deletions
|
@ -120,7 +120,6 @@ class SolidView(View):
|
||||||
|
|
||||||
if not self._xray_shader:
|
if not self._xray_shader:
|
||||||
self._xray_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "xray.shader"))
|
self._xray_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "xray.shader"))
|
||||||
self._xray_shader.setUniformValue("u_color", Color(*Application.getInstance().getTheme().getColor("xray").getRgb()))
|
|
||||||
|
|
||||||
if not self._xray_composite_shader:
|
if not self._xray_composite_shader:
|
||||||
self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SolidView"), "xray_composite.shader"))
|
self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SolidView"), "xray_composite.shader"))
|
||||||
|
|
|
@ -58,7 +58,7 @@ fragment =
|
||||||
|
|
||||||
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
||||||
|
|
||||||
float intersection_count = (texture2D(u_layer2, v_uvs).r * 255.0) / 5.0;
|
float intersection_count = texture2D(u_layer2, v_uvs).r * 255.0;
|
||||||
if(mod(intersection_count, 2.0) >= 1.0)
|
if(mod(intersection_count, 2.0) >= 1.0)
|
||||||
{
|
{
|
||||||
if (hash12(v_uvs) > 0.5)
|
if (hash12(v_uvs) > 0.5)
|
||||||
|
@ -146,7 +146,7 @@ fragment41core =
|
||||||
|
|
||||||
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
||||||
|
|
||||||
float intersection_count = (texture(u_layer2, v_uvs).r * 255.0) / 5.0;
|
float intersection_count = texture(u_layer2, v_uvs).r * 255.0;
|
||||||
if(mod(intersection_count, 2.0) >= 1.0)
|
if(mod(intersection_count, 2.0) >= 1.0)
|
||||||
{
|
{
|
||||||
if (hash12(v_uvs) > 0.5)
|
if (hash12(v_uvs) > 0.5)
|
||||||
|
|
|
@ -50,7 +50,7 @@ fragment =
|
||||||
|
|
||||||
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
||||||
|
|
||||||
float intersection_count = (texture2D(u_layer2, v_uvs).r * 255.0) / 5.0;
|
float intersection_count = texture2D(u_layer2, v_uvs).r * 255.0;
|
||||||
if(mod(intersection_count, 2.0) >= 1.0)
|
if(mod(intersection_count, 2.0) >= 1.0)
|
||||||
{
|
{
|
||||||
result = u_error_color;
|
result = u_error_color;
|
||||||
|
@ -121,7 +121,7 @@ fragment41core =
|
||||||
|
|
||||||
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
||||||
|
|
||||||
float intersection_count = (texture(u_layer2, v_uvs).r * 255.0) / 5.0;
|
float intersection_count = texture(u_layer2, v_uvs).r * 255.0;
|
||||||
if(mod(intersection_count, 2.0) >= 1.0)
|
if(mod(intersection_count, 2.0) >= 1.0)
|
||||||
{
|
{
|
||||||
result = u_error_color;
|
result = u_error_color;
|
||||||
|
|
|
@ -12,7 +12,7 @@ vertex =
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment =
|
fragment =
|
||||||
uniform lowp vec4 u_color;
|
const lowp vec4 u_color = vec4(1.0 / 255.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ vertex41core =
|
||||||
|
|
||||||
fragment41core =
|
fragment41core =
|
||||||
#version 410
|
#version 410
|
||||||
uniform lowp vec4 u_color;
|
const lowp vec4 u_color = vec4(1.0 / 255.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
out vec4 frag_color;
|
out vec4 frag_color;
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@ fragment41core =
|
||||||
}
|
}
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
u_color = [0.02, 0.02, 0.02, 1.0]
|
|
||||||
|
|
||||||
[bindings]
|
[bindings]
|
||||||
u_modelMatrix = model_matrix
|
u_modelMatrix = model_matrix
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue