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

fxaa, transparency and stuff... #36

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/GLWindow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export screenbuffer
export zeroposition
export create_glcontext
export renderlist

export add_oit_fxaa_postprocessing!
export destroy!
export robj_from_camera

end
7 changes: 5 additions & 2 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ returns `Signal{Vector{Compat.UTF8String}}`, which are absolute file paths
"""
function dropped_files(window, s::Signal{Vector{Compat.UTF8String}}=Signal(Compat.UTF8String[]))
GLFW.SetDropCallback(window, (window, files) -> begin
push!(s, map(utf8, files))
push!(s, map(Compat.String, files))
end)
s
end
Expand Down Expand Up @@ -147,7 +147,10 @@ Takes a screen and registers a list of callback functions.
Returns a dict{Symbol, Signal}(name_of_callback => signal)
"""
function register_callbacks(window::GLFW.Window, callbacks::Vector{Function})
Dict{Symbol, Any}([Symbol(last(split(string(f),"."))) => f(window) for f in callbacks])
tmp = map(callbacks) do f
(Symbol(last(split(string(f),"."))), f(window))
end
Dict{Symbol, Any}(tmp)
end
function register_callbacks(window::Screen, callbacks::Vector{Function})
register_callbacks(window.nativewindow, callbacks)
Expand Down
15 changes: 11 additions & 4 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ function Base.show(io::IO, m::Screen)
end
end

GeometryTypes.isinside{T}(x::Screen, position::Vec{2, T}) =
!any(screen->isinside(screen.area.value, position...), x.children) && isinside(x.area.value, position...)

GeometryTypes.isinside(screen::Screen, point) = isinside(screen.area.value, point...)
"""
mouse position is in coorditnates relative to `screen`
"""
function GeometryTypes.isinside(screen::Screen, mpos)
isinside(zeroposition(value(screen.area)), mpos...) || return false
for s in screen.children
# if inside any children, it's not inside screen
isinside(value(s.area), mpos...) && return false
end
true
end

"""
Args: `screens_mpos` -> Tuple{Vector{Screen}, Vec{2,T}}
Expand Down
12 changes: 7 additions & 5 deletions src/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,17 @@ begin
global push_selectionqueries!

const selection_data = Array(SelectionID{UInt16}, 1, 1)
const old_mouse_position = Array(Vec{2, Float64}, 1)
const old_mouse_position = Ref{Vec{2, Float64}}()

function push_selectionqueries!(screen)
mouse_position = value(mouseposition(screen))
mouse_position = value(mouseposition(screen))
selection_signal = mouse2id(screen)
window_size = widths(screen)
buff = framebuffer(screen).objectid
window_size = widths(screen)
framebuffer = screen.renderpasses[1].target # first renderpass
# fourth buffer is the id picking buffer. [1] because framebuffer[4] == (Texture, Attachment)
buff = framebuffer[4][1]
if old_mouse_position[] != mouse_position
glReadBuffer(GL_COLOR_ATTACHMENT1)
glReadBuffer(GL_COLOR_ATTACHMENT3)
x,y = Vec{2, Int}(map(floor, mouse_position))
w,h = window_size
if x > 0 && y > 0 && x <= w && y <= h
Expand Down
File renamed without changes.
Loading