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

Commit

Permalink
fix images for real
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Feb 6, 2017
1 parent 631efcc commit dd867a0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions assets/shader/distance_shape.frag
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ void fill(vec4 fillcolor, Nothing image, vec2 uv, float infill, inout vec4 color
color = mix(color, fillcolor, infill);
}
void fill(vec4 c, sampler2D image, vec2 uv, float infill, inout vec4 color){
color.rgba = mix(color, texture(image, uv), infill);
color.rgba = mix(color, texture(image, uv.yx), infill);
}
void fill(vec4 c, sampler2DArray image, vec2 uv, float infill, inout vec4 color){
color = mix(color, texture(image, vec3(uv, f_primitive_index)), infill);
color = mix(color, texture(image, vec3(uv.yx, f_primitive_index)), infill);
}


Expand Down
2 changes: 1 addition & 1 deletion examples/ExampleRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function create_screens(rootscreen)
push!(preserved_signals, s)

_w, _h, _ = widths(value(boundingbox(b)))
ratio = _h / _w
ratio = _w / _h
x_width = ratio * iconsize # we have half widthed icons
place = SimpleRectangle{Float32}(
last_x + 1, last_y + 1,
Expand Down
1 change: 1 addition & 0 deletions examples/imagelike/imageio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ x = Any[
loadasset("mario", "stand", "right.png"),
loadasset("mario", "jump", "left.gif"),
]
x = map(x-> convert(Array{eltype(x), ndims(x)}, x), x)

# visualize all images and convert the array to be a vector of element type context
# This shouldn't be necessary, but it seems map is not able to infer the type alone
Expand Down
4 changes: 2 additions & 2 deletions src/visualize/image_like.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
GLAbstraction.gl_convert{T}(::Type{T}, img::Images.Image) = gl_convert(T, Images.data(img))
GLAbstraction.gl_convert{T}(::Type{T}, img::Images.Image) = gl_convert(T, convert(Matrix, img))

function _default{T <: Colorant, X}(main::TOrSignal{Images.Image{T, 2, X}}, s::Style, d::Dict)
props = value(main).properties # TODO update this if signal
if haskey(props, "spatialorder")
so = props["spatialorder"]
get!(d, :spatialorder, join(so, ""))
end
_default(const_lift(Images.data, main), s, d)
_default(const_lift(x-> convert(Matrix, x), main), s, d)
end


Expand Down
2 changes: 1 addition & 1 deletion src/visualize/particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ function sprites(p, s, data)
scale_z = nothing => GLBuffer

rotation = Vec3f0(0,0,1) => GLBuffer
image = nothing => Texture
end
# TODO don't make this dependant on some shady type dispatch
if isa(p[1], Char) && !isa(scale, Vec) # correct dimensions
Expand All @@ -452,7 +453,6 @@ function sprites(p, s, data)
glow_width = 0f0
uv_offset_width = primitive_uv_offset_width(p[1]) => GLBuffer

image = nothing => Texture
distancefield = primitive_distancefield(p[1]) => Texture
indices = const_lift(length, p[2]) => to_indices
boundingbox = const_lift(GLBoundingBox, inst)
Expand Down

0 comments on commit dd867a0

Please sign in to comment.