Skip to content
This repository was archived by the owner on Apr 28, 2021. It is now read-only.

Commit bbdaf87

Browse files
committed
fix vertexcolor mesh without shading
1 parent 572f003 commit bbdaf87

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

assets/shader/standard.frag

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ void write2framebuffer(vec4 color, uvec2 id);
5656
void main(){
5757
vec4 color = get_color(color, o_uv);
5858
{{light_calc}}
59-
6059
write2framebuffer(
6160
color,
6261
o_id

src/visualize/mesh.jl

+13-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ function _default{M <: GLNormalMesh}(mesh::TOrSignal{M}, s::Style, data::Dict)
1515
@gen_defaults! data begin
1616
shading = true
1717
end
18-
if !shading
18+
view = if !shading
19+
# we need to remove the normals, because they're unused
1920
mesh = const_lift(x-> convert(GLPlainMesh, x), mesh)
2021
end
2122
@gen_defaults! data begin
@@ -30,10 +31,20 @@ function _default{M <: GLNormalMesh}(mesh::TOrSignal{M}, s::Style, data::Dict)
3031
end
3132
end
3233
function _default{M <: GLNormalVertexcolorMesh}(mesh::TOrSignal{M}, s::Style, data::Dict)
34+
@gen_defaults! data begin
35+
shading = true
36+
end
37+
if !shading
38+
# TODO remove this hack in a more graceful way!
39+
mesh = const_lift(mesh) do x
40+
dict = attributes(mesh)
41+
delete!(dict, :normals)
42+
GeometryTypes.homogenousmesh(dict)
43+
end
44+
end
3345
@gen_defaults! data begin
3446
main = mesh
3547
boundingbox = const_lift(GLBoundingBox, mesh)
36-
shading = true
3748
color = nothing
3849
shader = GLVisualizeShader(
3950
"fragment_output.frag", "util.vert", "vertexcolor.vert", "standard.frag",

0 commit comments

Comments
 (0)