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

Commit

Permalink
fix vertexcolor mesh without shading
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Aug 1, 2017
1 parent 572f003 commit bbdaf87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion assets/shader/standard.frag
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ void write2framebuffer(vec4 color, uvec2 id);
void main(){
vec4 color = get_color(color, o_uv);
{{light_calc}}

write2framebuffer(
color,
o_id
Expand Down
15 changes: 13 additions & 2 deletions src/visualize/mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ function _default{M <: GLNormalMesh}(mesh::TOrSignal{M}, s::Style, data::Dict)
@gen_defaults! data begin
shading = true
end
if !shading
view = if !shading
# we need to remove the normals, because they're unused
mesh = const_lift(x-> convert(GLPlainMesh, x), mesh)
end
@gen_defaults! data begin
Expand All @@ -30,10 +31,20 @@ function _default{M <: GLNormalMesh}(mesh::TOrSignal{M}, s::Style, data::Dict)
end
end
function _default{M <: GLNormalVertexcolorMesh}(mesh::TOrSignal{M}, s::Style, data::Dict)
@gen_defaults! data begin
shading = true
end
if !shading
# TODO remove this hack in a more graceful way!
mesh = const_lift(mesh) do x
dict = attributes(mesh)
delete!(dict, :normals)
GeometryTypes.homogenousmesh(dict)
end
end
@gen_defaults! data begin
main = mesh
boundingbox = const_lift(GLBoundingBox, mesh)
shading = true
color = nothing
shader = GLVisualizeShader(
"fragment_output.frag", "util.vert", "vertexcolor.vert", "standard.frag",
Expand Down

0 comments on commit bbdaf87

Please sign in to comment.