mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 22:35:03 -06:00
Merge pull request #7441 from Ultimaker/xray_in_solid_sidequest
CURA-7262 X-Ray in solid-view (colors instead)
This commit is contained in:
commit
74253e420a
11 changed files with 304 additions and 34 deletions
|
@ -1,22 +1,43 @@
|
|||
# Copyright (c) 2019 Ultimaker B.V.
|
||||
# Copyright (c) 2020 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os.path
|
||||
from UM.View.View import View
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
from UM.Scene.Selection import Selection
|
||||
from UM.Resources import Resources
|
||||
from PyQt5.QtGui import QOpenGLContext, QImage
|
||||
from PyQt5.QtCore import QSize
|
||||
|
||||
import numpy as np
|
||||
import time
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.View.RenderBatch import RenderBatch
|
||||
from UM.Logger import Logger
|
||||
from UM.Message import Message
|
||||
from UM.Math.Color import Color
|
||||
from UM.PluginRegistry import PluginRegistry
|
||||
from UM.Platform import Platform
|
||||
from UM.Event import Event
|
||||
|
||||
from UM.View.RenderBatch import RenderBatch
|
||||
from UM.View.GL.OpenGL import OpenGL
|
||||
|
||||
from UM.i18n import i18nCatalog
|
||||
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
|
||||
from cura import XRayPass
|
||||
|
||||
import math
|
||||
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
## Standard view for mesh models.
|
||||
|
||||
class SolidView(View):
|
||||
_show_xray_warning_preference = "view/show_xray_warning"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
application = Application.getInstance()
|
||||
|
@ -27,13 +48,31 @@ class SolidView(View):
|
|||
self._non_printing_shader = None
|
||||
self._support_mesh_shader = None
|
||||
|
||||
self._xray_shader = None
|
||||
self._xray_pass = None
|
||||
self._xray_composite_shader = None
|
||||
self._composite_pass = None
|
||||
|
||||
self._extruders_model = None
|
||||
self._theme = None
|
||||
self._support_angle = 90
|
||||
|
||||
self._global_stack = None
|
||||
|
||||
Application.getInstance().engineCreatedSignal.connect(self._onGlobalContainerChanged)
|
||||
self._old_composite_shader = None
|
||||
self._old_layer_bindings = None
|
||||
|
||||
self._next_xray_checking_time = time.time()
|
||||
self._xray_checking_update_time = 1.0 # seconds
|
||||
self._xray_warning_cooldown = 60 * 10 # reshow Model error message every 10 minutes
|
||||
self._xray_warning_message = Message(
|
||||
catalog.i18nc("@info:status", "Your model is not manifold. The highlighted areas indicate either missing or extraneous surfaces."),
|
||||
lifetime = 60 * 5, # leave message for 5 minutes
|
||||
title = catalog.i18nc("@info:title", "Model errors"),
|
||||
)
|
||||
application.getPreferences().addPreference(self._show_xray_warning_preference, True)
|
||||
|
||||
application.engineCreatedSignal.connect(self._onGlobalContainerChanged)
|
||||
|
||||
def _onGlobalContainerChanged(self) -> None:
|
||||
if self._global_stack:
|
||||
|
@ -92,6 +131,41 @@ class SolidView(View):
|
|||
self._support_mesh_shader.setUniformValue("u_vertical_stripes", True)
|
||||
self._support_mesh_shader.setUniformValue("u_width", 5.0)
|
||||
|
||||
if not Application.getInstance().getPreferences().getValue(self._show_xray_warning_preference):
|
||||
self._xray_shader = None
|
||||
self._xray_composite_shader = None
|
||||
if self._composite_pass and 'xray' in self._composite_pass.getLayerBindings():
|
||||
self._composite_pass.setLayerBindings(self._old_layer_bindings)
|
||||
self._composite_pass.setCompositeShader(self._old_composite_shader)
|
||||
self._old_layer_bindings = None
|
||||
self._old_composite_shader = None
|
||||
self._xray_warning_message.hide()
|
||||
else:
|
||||
if not self._xray_shader:
|
||||
self._xray_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "xray.shader"))
|
||||
|
||||
if not self._xray_composite_shader:
|
||||
self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "xray_composite.shader"))
|
||||
theme = Application.getInstance().getTheme()
|
||||
self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb()))
|
||||
self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb()))
|
||||
|
||||
renderer = self.getRenderer()
|
||||
if not self._composite_pass or not 'xray' in self._composite_pass.getLayerBindings():
|
||||
# Currently the RenderPass constructor requires a size > 0
|
||||
# This should be fixed in RenderPass's constructor.
|
||||
self._xray_pass = XRayPass.XRayPass(1, 1)
|
||||
|
||||
renderer.addRenderPass(self._xray_pass)
|
||||
|
||||
if not self._composite_pass:
|
||||
self._composite_pass = self.getRenderer().getRenderPass("composite")
|
||||
|
||||
self._old_layer_bindings = self._composite_pass.getLayerBindings()
|
||||
self._composite_pass.setLayerBindings(["default", "selection", "xray"])
|
||||
self._old_composite_shader = self._composite_pass.getCompositeShader()
|
||||
self._composite_pass.setCompositeShader(self._xray_composite_shader)
|
||||
|
||||
def beginRendering(self):
|
||||
scene = self.getController().getScene()
|
||||
renderer = self.getRenderer()
|
||||
|
@ -175,4 +249,65 @@ class SolidView(View):
|
|||
renderer.queueNode(scene.getRoot(), mesh = node.getBoundingBoxMesh(), mode = RenderBatch.RenderMode.LineLoop)
|
||||
|
||||
def endRendering(self):
|
||||
pass
|
||||
# check whether the xray overlay is showing badness
|
||||
if time.time() > self._next_xray_checking_time\
|
||||
and Application.getInstance().getPreferences().getValue(self._show_xray_warning_preference):
|
||||
self._next_xray_checking_time = time.time() + self._xray_checking_update_time
|
||||
|
||||
xray_img = self._xray_pass.getOutput()
|
||||
xray_img = xray_img.convertToFormat(QImage.Format_RGB888)
|
||||
|
||||
# We can't just read the image since the pixels are aligned to internal memory positions.
|
||||
# xray_img.byteCount() != xray_img.width() * xray_img.height() * 3
|
||||
# The byte count is a little higher sometimes. We need to check the data per line, but fast using Numpy.
|
||||
# See https://stackoverflow.com/questions/5810970/get-raw-data-from-qimage for a description of the problem.
|
||||
# We can't use that solution though, since it doesn't perform well in Python.
|
||||
class QImageArrayView:
|
||||
"""
|
||||
Class that ducktypes to be a Numpy ndarray.
|
||||
"""
|
||||
def __init__(self, qimage):
|
||||
self.__array_interface__ = {
|
||||
"shape": (qimage.height(), qimage.width()),
|
||||
"typestr": "|u4", # Use 4 bytes per pixel rather than 3, since Numpy doesn't support 3.
|
||||
"data": (int(qimage.bits()), False),
|
||||
"strides": (qimage.bytesPerLine(), 3), # This does the magic: For each line, skip the correct number of bytes. Bytes per pixel is always 3 due to QImage.Format.Format_RGB888.
|
||||
"version": 3
|
||||
}
|
||||
array = np.asarray(QImageArrayView(xray_img)).view(np.dtype({
|
||||
"r": (np.uint8, 0, "red"),
|
||||
"g": (np.uint8, 1, "green"),
|
||||
"b": (np.uint8, 2, "blue"),
|
||||
"a": (np.uint8, 3, "alpha") # Never filled since QImage was reformatted to RGB888.
|
||||
}), np.recarray)
|
||||
if np.any(np.mod(array.r, 2)):
|
||||
self._next_xray_checking_time = time.time() + self._xray_warning_cooldown
|
||||
self._xray_warning_message.show()
|
||||
Logger.log("i", "X-Ray overlay found non-manifold pixels.")
|
||||
|
||||
def event(self, event):
|
||||
if event.type == Event.ViewActivateEvent:
|
||||
# FIX: on Max OS X, somehow QOpenGLContext.currentContext() can become None during View switching.
|
||||
# This can happen when you do the following steps:
|
||||
# 1. Start Cura
|
||||
# 2. Load a model
|
||||
# 3. Switch to Custom mode
|
||||
# 4. Select the model and click on the per-object tool icon
|
||||
# 5. Switch view to Layer view or X-Ray
|
||||
# 6. Cura will very likely crash
|
||||
# It seems to be a timing issue that the currentContext can somehow be empty, but I have no clue why.
|
||||
# This fix tries to reschedule the view changing event call on the Qt thread again if the current OpenGL
|
||||
# context is None.
|
||||
if Platform.isOSX():
|
||||
if QOpenGLContext.currentContext() is None:
|
||||
Logger.log("d", "current context of OpenGL is empty on Mac OS X, will try to create shaders later")
|
||||
Application.getInstance().callLater(lambda e = event: self.event(e))
|
||||
return
|
||||
|
||||
|
||||
if event.type == Event.ViewDeactivateEvent:
|
||||
if self._composite_pass and 'xray' in self._composite_pass.getLayerBindings():
|
||||
self.getRenderer().removeRenderPass(self._xray_pass)
|
||||
self._composite_pass.setLayerBindings(self._old_layer_bindings)
|
||||
self._composite_pass.setCompositeShader(self._old_composite_shader)
|
||||
self._xray_warning_message.hide()
|
||||
|
|
50
plugins/SolidView/xray_overlay.shader
Executable file
50
plugins/SolidView/xray_overlay.shader
Executable file
|
@ -0,0 +1,50 @@
|
|||
[shaders]
|
||||
vertex =
|
||||
uniform highp mat4 u_modelViewProjectionMatrix;
|
||||
|
||||
attribute highp vec4 a_vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_modelViewProjectionMatrix * a_vertex;
|
||||
}
|
||||
|
||||
fragment =
|
||||
uniform lowp vec4 u_xray_error;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = u_xray_error;
|
||||
}
|
||||
|
||||
vertex41core =
|
||||
#version 410
|
||||
uniform highp mat4 u_modelViewProjectionMatrix;
|
||||
|
||||
in highp vec4 a_vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_modelViewProjectionMatrix * a_vertex;
|
||||
}
|
||||
|
||||
fragment41core =
|
||||
#version 410
|
||||
uniform lowp vec4 u_xray_error;
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
frag_color = u_xray_error;
|
||||
}
|
||||
|
||||
[defaults]
|
||||
u_xray_error = [1.0, 1.0, 1.0, 1.0]
|
||||
|
||||
[bindings]
|
||||
u_modelViewProjectionMatrix = model_view_projection_matrix
|
||||
|
||||
[attributes]
|
||||
a_vertex = vertex
|
|
@ -1,39 +0,0 @@
|
|||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os.path
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.PluginRegistry import PluginRegistry
|
||||
|
||||
from UM.View.RenderPass import RenderPass
|
||||
from UM.View.RenderBatch import RenderBatch
|
||||
from UM.View.GL.OpenGL import OpenGL
|
||||
|
||||
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||
|
||||
class XRayPass(RenderPass):
|
||||
def __init__(self, width, height):
|
||||
super().__init__("xray", width, height)
|
||||
|
||||
self._shader = None
|
||||
self._gl = OpenGL.getInstance().getBindingsObject()
|
||||
self._scene = Application.getInstance().getController().getScene()
|
||||
|
||||
def render(self):
|
||||
if not self._shader:
|
||||
self._shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("XRayView"), "xray.shader"))
|
||||
|
||||
batch = RenderBatch(self._shader, type = RenderBatch.RenderType.NoType, backface_cull = False, blend_mode = RenderBatch.BlendMode.Additive)
|
||||
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||
if isinstance(node, CuraSceneNode) and node.getMeshData() and node.isVisible():
|
||||
batch.addItem(node.getWorldTransformation(), node.getMeshData())
|
||||
|
||||
self.bind()
|
||||
|
||||
self._gl.glDisable(self._gl.GL_DEPTH_TEST)
|
||||
batch.render(self._scene.getActiveCamera())
|
||||
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
|
||||
|
||||
self.release()
|
|
@ -1,13 +1,14 @@
|
|||
# Copyright (c) 2015 Ultimaker B.V.
|
||||
# Copyright (c) 2020 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os.path
|
||||
from PyQt5.QtGui import QOpenGLContext
|
||||
from PyQt5.QtGui import QOpenGLContext, QImage
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Math.Color import Color
|
||||
from UM.PluginRegistry import PluginRegistry
|
||||
from UM.Resources import Resources
|
||||
from UM.Platform import Platform
|
||||
from UM.Event import Event
|
||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||
|
@ -19,7 +20,8 @@ from cura.CuraApplication import CuraApplication
|
|||
from cura.CuraView import CuraView
|
||||
from cura.Scene.ConvexHullNode import ConvexHullNode
|
||||
|
||||
from . import XRayPass
|
||||
from cura import XRayPass
|
||||
|
||||
|
||||
## View used to display a see-through version of objects with errors highlighted.
|
||||
class XRayView(CuraView):
|
||||
|
@ -38,7 +40,7 @@ class XRayView(CuraView):
|
|||
renderer = self.getRenderer()
|
||||
|
||||
if not self._xray_shader:
|
||||
self._xray_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("XRayView"), "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()))
|
||||
|
||||
for node in BreadthFirstIterator(scene.getRoot()):
|
||||
|
@ -87,10 +89,8 @@ class XRayView(CuraView):
|
|||
self.getRenderer().addRenderPass(self._xray_pass)
|
||||
|
||||
if not self._xray_composite_shader:
|
||||
self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("XRayView"), "xray_composite.shader"))
|
||||
theme = Application.getInstance().getTheme()
|
||||
self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "xray_composite.shader"))
|
||||
self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb()))
|
||||
self._xray_composite_shader.setUniformValue("u_error_color", Color(*theme.getColor("xray_error").getRgb()))
|
||||
self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb()))
|
||||
|
||||
if not self._composite_pass:
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
[shaders]
|
||||
vertex =
|
||||
uniform highp mat4 u_modelMatrix;
|
||||
uniform highp mat4 u_viewMatrix;
|
||||
uniform highp mat4 u_projectionMatrix;
|
||||
|
||||
attribute highp vec4 a_vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
||||
}
|
||||
|
||||
fragment =
|
||||
uniform lowp vec4 u_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = u_color;
|
||||
}
|
||||
|
||||
vertex41core =
|
||||
#version 410
|
||||
uniform highp mat4 u_modelMatrix;
|
||||
uniform highp mat4 u_viewMatrix;
|
||||
uniform highp mat4 u_projectionMatrix;
|
||||
|
||||
in highp vec4 a_vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * a_vertex;
|
||||
}
|
||||
|
||||
fragment41core =
|
||||
#version 410
|
||||
uniform lowp vec4 u_color;
|
||||
|
||||
out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = u_color;
|
||||
}
|
||||
|
||||
[defaults]
|
||||
u_color = [0.02, 0.02, 0.02, 1.0]
|
||||
|
||||
[bindings]
|
||||
u_modelMatrix = model_matrix
|
||||
u_viewMatrix = view_matrix
|
||||
u_projectionMatrix = projection_matrix
|
||||
|
||||
[attributes]
|
||||
a_vertex = vertex
|
|
@ -1,162 +0,0 @@
|
|||
[shaders]
|
||||
vertex =
|
||||
uniform highp mat4 u_modelViewProjectionMatrix;
|
||||
attribute highp vec4 a_vertex;
|
||||
attribute highp vec2 a_uvs;
|
||||
|
||||
varying highp vec2 v_uvs;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_modelViewProjectionMatrix * a_vertex;
|
||||
v_uvs = a_uvs;
|
||||
}
|
||||
|
||||
fragment =
|
||||
#ifdef GL_ES
|
||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||
precision highp float;
|
||||
#else
|
||||
precision mediump float;
|
||||
#endif // GL_FRAGMENT_PRECISION_HIGH
|
||||
#endif // GL_ES
|
||||
uniform sampler2D u_layer0; //Default pass.
|
||||
uniform sampler2D u_layer1; //Selection pass.
|
||||
uniform sampler2D u_layer2; //X-ray pass.
|
||||
|
||||
uniform vec2 u_offset[9];
|
||||
|
||||
uniform float u_outline_strength;
|
||||
uniform vec4 u_outline_color;
|
||||
uniform vec4 u_error_color;
|
||||
uniform vec4 u_background_color;
|
||||
|
||||
const vec3 x_axis = vec3(1.0, 0.0, 0.0);
|
||||
const vec3 y_axis = vec3(0.0, 1.0, 0.0);
|
||||
const vec3 z_axis = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
varying vec2 v_uvs;
|
||||
|
||||
float kernel[9];
|
||||
|
||||
void main()
|
||||
{
|
||||
kernel[0] = 0.0; kernel[1] = 1.0; kernel[2] = 0.0;
|
||||
kernel[3] = 1.0; kernel[4] = -4.0; kernel[5] = 1.0;
|
||||
kernel[6] = 0.0; kernel[7] = 1.0; kernel[8] = 0.0;
|
||||
|
||||
vec4 result = u_background_color;
|
||||
vec4 layer0 = texture2D(u_layer0, v_uvs);
|
||||
|
||||
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
||||
|
||||
float intersection_count = (texture2D(u_layer2, v_uvs).r * 255.0) / 5.0;
|
||||
if(mod(intersection_count, 2.0) == 1.0)
|
||||
{
|
||||
result = u_error_color;
|
||||
}
|
||||
|
||||
vec4 sum = vec4(0.0);
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
vec4 color = vec4(texture2D(u_layer1, v_uvs.xy + u_offset[i]).a);
|
||||
sum += color * (kernel[i] / u_outline_strength);
|
||||
}
|
||||
|
||||
vec4 layer1 = texture2D(u_layer1, v_uvs);
|
||||
if((layer1.rgb == x_axis || layer1.rgb == y_axis || layer1.rgb == z_axis))
|
||||
{
|
||||
gl_FragColor = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_FragColor = mix(result, vec4(abs(sum.a)) * u_outline_color, abs(sum.a));
|
||||
}
|
||||
}
|
||||
|
||||
vertex41core =
|
||||
#version 410
|
||||
uniform highp mat4 u_modelViewProjectionMatrix;
|
||||
in highp vec4 a_vertex;
|
||||
in highp vec2 a_uvs;
|
||||
|
||||
out highp vec2 v_uvs;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = u_modelViewProjectionMatrix * a_vertex;
|
||||
v_uvs = a_uvs;
|
||||
}
|
||||
|
||||
fragment41core =
|
||||
#version 410
|
||||
uniform sampler2D u_layer0; //Default pass.
|
||||
uniform sampler2D u_layer1; //Selection pass.
|
||||
uniform sampler2D u_layer2; //X-ray pass.
|
||||
|
||||
uniform vec2 u_offset[9];
|
||||
|
||||
uniform float u_outline_strength;
|
||||
uniform vec4 u_outline_color;
|
||||
uniform vec4 u_error_color;
|
||||
uniform vec4 u_background_color;
|
||||
|
||||
const vec3 x_axis = vec3(1.0, 0.0, 0.0);
|
||||
const vec3 y_axis = vec3(0.0, 1.0, 0.0);
|
||||
const vec3 z_axis = vec3(0.0, 0.0, 1.0);
|
||||
|
||||
in vec2 v_uvs;
|
||||
out vec4 frag_color;
|
||||
|
||||
float kernel[9];
|
||||
|
||||
void main()
|
||||
{
|
||||
kernel[0] = 0.0; kernel[1] = 1.0; kernel[2] = 0.0;
|
||||
kernel[3] = 1.0; kernel[4] = -4.0; kernel[5] = 1.0;
|
||||
kernel[6] = 0.0; kernel[7] = 1.0; kernel[8] = 0.0;
|
||||
|
||||
vec4 result = u_background_color;
|
||||
vec4 layer0 = texture(u_layer0, v_uvs);
|
||||
|
||||
result = layer0 * layer0.a + result * (1.0 - layer0.a);
|
||||
|
||||
float intersection_count = (texture(u_layer2, v_uvs).r * 255.0) / 5.0;
|
||||
if(mod(intersection_count, 2.0) == 1.0)
|
||||
{
|
||||
result = u_error_color;
|
||||
}
|
||||
|
||||
vec4 sum = vec4(0.0);
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
vec4 color = vec4(texture(u_layer1, v_uvs.xy + u_offset[i]).a);
|
||||
sum += color * (kernel[i] / u_outline_strength);
|
||||
}
|
||||
|
||||
vec4 layer1 = texture(u_layer1, v_uvs);
|
||||
if((layer1.rgb == x_axis || layer1.rgb == y_axis || layer1.rgb == z_axis))
|
||||
{
|
||||
frag_color = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
frag_color = mix(result, vec4(abs(sum.a)) * u_outline_color, abs(sum.a));
|
||||
}
|
||||
}
|
||||
|
||||
[defaults]
|
||||
u_layer0 = 0
|
||||
u_layer1 = 1
|
||||
u_layer2 = 2
|
||||
u_background_color = [0.965, 0.965, 0.965, 1.0]
|
||||
u_outline_strength = 1.0
|
||||
u_outline_color = [0.05, 0.66, 0.89, 1.0]
|
||||
u_error_color = [1.0, 0.0, 0.0, 1.0]
|
||||
|
||||
[bindings]
|
||||
|
||||
[attributes]
|
||||
a_vertex = vertex
|
||||
a_uvs = uv
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue