Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for GeometryBasics refactor #4319

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d7d704f
get Makie to compile
ffreyer Sep 4, 2024
256822b
get GLMakie to compile
ffreyer Sep 4, 2024
3819a34
fix nromal rename, meshscatter
ffreyer Sep 4, 2024
b9fc885
fix pointtype in mesh conversion
ffreyer Sep 4, 2024
2ff3b65
avoid matrix in vector rotation
ffreyer Sep 5, 2024
97b17bc
fix more tests
ffreyer Sep 6, 2024
cd0db10
update GeometryBasics functions/interface
ffreyer Sep 6, 2024
cef70e4
fix voronoiplot clipping
ffreyer Sep 6, 2024
decdc83
update CairoMakie
ffreyer Sep 6, 2024
78fff6c
update RPRMakie
ffreyer Sep 6, 2024
1b72110
prepare WGLMakie
ffreyer Sep 6, 2024
26ff1d3
Update CI to use the GeometryBasics refactor branch (#4326)
asinghvi17 Sep 6, 2024
74e5801
update _faces
ffreyer Sep 6, 2024
2bd82bc
normals -> normal
ffreyer Sep 6, 2024
6ee1726
add ShaderAbstractions to ci
ffreyer Sep 6, 2024
8a33cf2
update docs, normals deprecation
ffreyer Sep 8, 2024
10e2042
Merge branch 'ff/GeometryBasics_refactor' of https://github.com/Makie…
ffreyer Sep 8, 2024
8d87754
fix branch names
ffreyer Sep 9, 2024
4b646de
fix catmesh getting normals regenerated
ffreyer Sep 9, 2024
c9c218c
Merge branch 'ff/GeometryBasics_refactor' of https://github.com/Makie…
ffreyer Sep 9, 2024
7bfad9e
update for ShaderAbstractions
ffreyer Sep 9, 2024
898a04b
handle voxel clipping in CairoMakie like in GLMakie
ffreyer Sep 9, 2024
24f38b9
fix another two "normals"
ffreyer Sep 9, 2024
ff76818
add dev branches for RPRMakie CI
ffreyer Sep 9, 2024
1179da4
fix missing kwarg name in conversion
ffreyer Sep 10, 2024
378e006
update for FaceViews
ffreyer Sep 12, 2024
2454cb4
Merge branch 'master' into ff/GeometryBasics_refactor
ffreyer Sep 12, 2024
9d01754
add example for per-face colors and normals
ffreyer Sep 14, 2024
6509e21
improve typing
ffreyer Sep 14, 2024
31aa47d
Merge branch 'master' into ff/GeometryBasics_refactor
ffreyer Sep 14, 2024
a8a6120
fix Sampler, allow mipmap via Sampler
ffreyer Sep 15, 2024
4f44333
try to fix benchmarks
SimonDanisch Sep 18, 2024
9e784ab
add to correct env
SimonDanisch Sep 18, 2024
a9cd8f0
remove from master project
SimonDanisch Sep 18, 2024
9631841
fix docs
SimonDanisch Sep 18, 2024
11fb653
fix Rect decomposition
ffreyer Sep 18, 2024
c8ec1be
Merge branch 'ff/GeometryBasics_refactor' of https://github.com/Makie…
ffreyer Sep 18, 2024
b1180d8
fix poly converts
ffreyer Sep 19, 2024
9657e6a
Merge branch 'master' into ff/GeometryBasics_refactor
ffreyer Sep 19, 2024
4c7ba89
fix typo
ffreyer Sep 20, 2024
f9871d1
Merge branch 'master' into ff/GeometryBasics_refactor
ffreyer Sep 26, 2024
0f7bddc
improve precompilation by avoiding constprop and more direct icon loa…
SimonDanisch Sep 27, 2024
5ac306e
fix CairoMakie precompile
SimonDanisch Sep 27, 2024
9003123
Merge branch 'master' into ff/GeometryBasics_refactor
ffreyer Oct 2, 2024
dfac11c
Merge branch 'master' into ff/GeometryBasics_refactor
SimonDanisch Oct 9, 2024
a3eb7a5
fix old syntax
ffreyer Oct 9, 2024
d8be6c7
fix ambient light
ffreyer Oct 9, 2024
0a8414e
Merge branch 'master' into ff/GeometryBasics_refactor
ffreyer Oct 10, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
pkg"registry up"
Pkg.update()
pkg"dev . ./MakieCore"
pkg"add GeometryBasics#ff/refactor"
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
Pkg.test("Makie"; coverage=true)

- uses: julia-actions/julia-processcoverage@v1
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add GeometryBasics#ff/refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
pkg"dev . ./MakieCore ./CairoMakie ./ReferenceTests"
- name: Run the tests
continue-on-error: true
Expand Down Expand Up @@ -95,6 +98,9 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add GeometryBasics#ff/refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
pkg"dev . ./MakieCore ./GLMakie ./ReferenceTests"
- name: Run the tests
id: referencetests
Expand Down Expand Up @@ -145,6 +151,9 @@ jobs:
# dev mono repo versions
pkg"registry up"
Pkg.update()
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add GeometryBasics#ff/refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
pkg"dev . ./MakieCore ./WGLMakie ./ReferenceTests"
- name: Run the tests
continue-on-error: true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
using Pkg;
pkg"registry up"
Pkg.update()
pkg"add GeometryBasics#ff/refactor"
pkg"add MeshIO#ff/GeometryBasics_refactor"
pkg"add ShaderAbstractions#ff/GeometryBasics_refactor"
# dev mono repo versions
pkg"dev . ./MakieCore ./RPRMakie ./ReferenceTests"
- name: Run the tests
Expand Down
2 changes: 1 addition & 1 deletion CairoMakie/src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Makie.backend_show(screen::Screen{SVG}, io::IO, ::MIME"image/svg+xml",
# xlink:href="someid" (but not xlink:href="data:someothercontent" which is how image data is attached)
# url(#someid)
svg = replace(svg, r"((?:(?:id|xlink:href)=\"(?!data:)[^\"]+)|url\(#[^)]+)" => SubstitutionString("\\1-$salt"))

print(io, svg)
return screen
end
Expand Down
16 changes: 10 additions & 6 deletions CairoMakie/src/overrides.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function draw_plot(scene::Scene, screen::Screen, poly::Poly)
# dispatch on input arguments to poly to use smarter drawing methods than
# meshes if possible.
# however, since recipes exist, we can't explicitly handle all cases here
# so, we should also take a look at converted
# so, we should also take a look at converted
# First, we check whether a `draw_poly` method exists for the input arguments
# before conversion:
return if Base.hasmethod(draw_poly, Tuple{Scene, Screen, typeof(poly), typeof.(to_value.(poly.args))...})
Expand Down Expand Up @@ -85,10 +85,14 @@ draw_poly(scene::Scene, screen::Screen, poly, rect::Rect2) = draw_poly(scene, sc
draw_poly(scene::Scene, screen::Screen, poly, bezierpath::BezierPath) = draw_poly(scene, screen, poly, [bezierpath])

function draw_poly(scene::Scene, screen::Screen, poly, shapes::Vector{<:Union{Rect2, BezierPath}})
model = poly.model[]
space = to_value(get(poly, :space, :data))
clipped_shapes = clip_shape.(Ref(poly.clip_planes[]), shapes, space, Ref(model))
projected_shapes = project_shape.(Ref(poly), space, clipped_shapes, Ref(model))
model = poly.model[]::Mat4d
space = to_value(get(poly, :space, :data))::Symbol
planes = poly.clip_planes[]::Vector{Plane3f}

projected_shapes = map(shapes) do shape
clipped = clip_shape(planes, shape, space, model)
return project_shape(poly, space, clipped, model)
end

color = to_cairo_color(poly.color[], poly)

Expand Down Expand Up @@ -188,7 +192,7 @@ end
function draw_poly(scene::Scene, screen::Screen, poly, polygons::AbstractArray{<: MultiPolygon})
model = poly.model[]
space = to_value(get(poly, :space, :data))
projected_polys = map(polygons) do polygon
projected_polys = map(polygons) do polygon
project_multipolygon(poly, space, polygon, poly.clip_planes[], model)
end

Expand Down
1 change: 1 addition & 0 deletions CairoMakie/src/precompiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let
include(shared_precompile)
end
end
precompile(openurl, (String,))
precompile(draw_atomic_scatter, (Scene, Cairo.CairoContext, Tuple{typeof(identity),typeof(identity)},
Vector{ColorTypes.RGBA{Float32}}, Vec{2,Float32}, ColorTypes.RGBA{Float32},
Float32, BezierPath, Vec{2,Float32}, Quaternionf,
Expand Down
26 changes: 5 additions & 21 deletions CairoMakie/src/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Unio

isempty(positions) && return

# workaround for a LineSegments object created from a GLNormalMesh
# the input argument is a view of points using faces, which results in
# a vector of tuples of two points. we convert those to a list of points
# so they don't trip up the rest of the pipeline
# TODO this shouldn't be necessary anymore!
if positions isa SubArray{<:Point3, 1, P, <:Tuple{Array{<:AbstractFace}}} where P
positions = let
pos = Point3f[]
for tup in positions
push!(pos, tup[1])
push!(pos, tup[2])
end
pos
end
end

# color is now a color or an array of colors
# if it's an array of colors, each segment must be stroked separately
color = to_color(primitive.calculated_colors[])
Expand Down Expand Up @@ -1200,7 +1184,7 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki

pos = primitive[1][]
# For correct z-ordering we need to be in view/camera or screen space
model = copy(model)
model = copy(model)::Mat4d
view = scene.camera.view[]

zorder = sortperm(pos, by = p -> begin
Expand Down Expand Up @@ -1253,17 +1237,17 @@ function draw_atomic(scene::Scene, screen::Screen, @nospecialize(primitive::Maki
pos = Makie.voxel_positions(primitive)
scale = Makie.voxel_size(primitive)
colors = Makie.voxel_colors(primitive)
marker = GeometryBasics.normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1)))
# Face culling
marker = GeometryBasics.clear_faceviews(normal_mesh(Rect3f(Point3f(-0.5), Vec3f(1))))


if !isempty(primitive.clip_planes[]) && Makie.is_data_space(primitive.space[])
valid = [is_visible(primitive.clip_planes[], p) for p in pos]
pos = pos[valid]
colors = colors[valid]
end

# For correct z-ordering we need to be in view/camera or screen space
model = copy(primitive.model[])
model = copy(primitive.model[])::Mat4d
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird to copy an immutable? Not part of this PR, but still we may want to remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may come from my first attempt to get 3D meshes working in CairoMakie where I didn't know what kind of types to expect. I guess technically you could do plot(..., model = rand(4, 4) and pass a Base.Matrix, but iirc this errored when copy(::Mat4d) was generating a Base.Matrix anyway...

view = scene.camera.view[]

zorder = sortperm(pos, by = p -> begin
Expand Down
39 changes: 20 additions & 19 deletions CairoMakie/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

# much faster than dot-ing `project_position` because it skips all the repeated mat * mat
function project_position(
scene::Scene, space::Symbol, ps::Vector{<: VecTypes{N, T1}},
scene::Scene, space::Symbol, ps::Vector{<: VecTypes{N, T1}},
indices::Vector{<:Integer}, model::Mat4, yflip::Bool = true
) where {N, T1}

Expand Down Expand Up @@ -44,7 +44,7 @@ function _project_position(scene::Scene, space, ps::AbstractArray{<: VecTypes{N,
end

function project_position(
scene::Scene, space::Symbol, ps::AbstractArray{<: VecTypes{N, T1}},
scene::Scene, space::Symbol, ps::AbstractArray{<: VecTypes{N, T1}},
indices::Base.OneTo, model::Mat4, yflip::Bool = true
) where {N, T1}

Expand Down Expand Up @@ -149,14 +149,15 @@ function clip_shape(clip_planes::Vector{Plane3f}, shape::Rect2, space::Symbol, m
if !Makie.is_data_space(space) || isempty(clip_planes)
return shape
end

xy = origin(shape)
w, h = widths(shape)
ps = [xy, xy + Vec2(w, 0), xy + Vec2f(w, h), xy + Vec2(0, h)]
ps = Vec2f[xy, xy + Vec2f(w, 0), xy + Vec2f(w, h), xy + Vec2f(0, h)]
if any(p -> Makie.is_clipped(clip_planes, p), ps)
push!(ps, xy)
ps = clip_poly(clip_planes, ps, space, model)
return BezierPath([MoveTo(ps[1]), LineTo.(ps[2:end])..., ClosePath()])
commands = Makie.PathCommand[MoveTo(ps[1]), LineTo.(ps[2:end])..., ClosePath()]
return BezierPath(commands::Vector{Makie.PathCommand})
else
return shape
end
Expand All @@ -173,7 +174,7 @@ function project_polygon(@nospecialize(scenelike), space, poly::Polygon{N, T}, c

ext_proj = PT[project(p) for p in clip_poly(clip_planes, ext, space, model)]
interiors_proj = Vector{PT}[
PT[project(p) for p in clip_poly(clip_planes, decompose(PT, points), space, model)]
PT[project(p) for p in clip_poly(clip_planes, decompose(PT, points), space, model)]
for points in poly.interiors]

return Polygon(ext_proj, interiors_proj)
Expand All @@ -195,7 +196,7 @@ end
# at clip planes
per_point_colors = colors <: AbstractArray
per_point_linewidths = (T <: Lines) && (linewidths <: AbstractArray)

quote
@get_attribute(plot, (space, model))

Expand All @@ -207,7 +208,7 @@ end
@inbounds for (i, point) in enumerate(points)
clip_points[i] = transform * to_ndim(Vec4d, to_ndim(Vec3d, point, 0), 1)
end

# yflip and clip -> screen/pixel coords
res = scene.camera.resolution[]

Expand All @@ -219,14 +220,14 @@ end
end

# Fix lines with points far outside the clipped region not drawing at all
# TODO this can probably be done more efficiently by checking -1 ≤ x, y ≤ 1
# TODO this can probably be done more efficiently by checking -1 ≤ x, y ≤ 1
# directly and calculating intersections directly (1D)
push!(clip_planes,
Plane3f(Vec3f(-1, 0, 0), -1f0), Plane3f(Vec3f(+1, 0, 0), -1f0),
Plane3f(Vec3f(0, -1, 0), -1f0), Plane3f(Vec3f(0, +1, 0), -1f0)
)


# outputs
screen_points = sizehint!(Vec2f[], length(clip_points))
$(if per_point_colors
Expand Down Expand Up @@ -314,8 +315,8 @@ end
end)
elseif !hidden
# if not hidden, always push the first element to 1:end-1 line points
# if the start of the segment is disconnected (moved), make sure the

# if the start of the segment is disconnected (moved), make sure the
# line separates before it
if disconnect1 && !last_is_nan
push!(screen_points, Vec2f(NaN))
Expand All @@ -326,7 +327,7 @@ end
:(push!(color_output, c1))
end)
end

last_is_nan = false
push!(screen_points, clip2screen(p1, res))
$(if per_point_linewidths
Expand All @@ -336,7 +337,7 @@ end
:(push!(color_output, c1))
end)

# if the end of the segment is disconnected (moved), add the adjusted
# if the end of the segment is disconnected (moved), add the adjusted
# point and separate it from from the next segment
if disconnect2
last_is_nan = true
Expand All @@ -351,8 +352,8 @@ end
end
end

# If last_is_nan == true, the last segment is either hidden or the moved
# end point has been added. If it is false we're missing the last regular
# If last_is_nan == true, the last segment is either hidden or the moved
# end point has been added. If it is false we're missing the last regular
# clip_points
if !last_is_nan
push!(screen_points, clip2screen(clip_points[end], res))
Expand All @@ -365,7 +366,7 @@ end
end

else # LineSegments

for i in 1:2:length(clip_points)-1
$(if per_point_colors
quote
Expand Down Expand Up @@ -525,8 +526,8 @@ end
"""
cairo_scatter_marker(marker)

Convert a Makie marker to a Cairo-compatible marker. This defaults to calling
`Makie.to_spritemarker`, but can be overridden for specific markers that can
Convert a Makie marker to a Cairo-compatible marker. This defaults to calling
`Makie.to_spritemarker`, but can be overridden for specific markers that can
be directly rendered to vector formats using Cairo.
"""
cairo_scatter_marker(marker) = Makie.to_spritemarker(marker)
Expand Down
10 changes: 7 additions & 3 deletions GLMakie/src/GLAbstraction/GLExtendedFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ function glGenRenderbuffers(format::GLenum, attachment::GLenum, dimensions)
return renderbuffer[1]
end

function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer, h::Integer, d::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
Makie.@noconstprop function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer,
h::Integer, d::Integer, border::Integer, format::GLenum,
datatype::GLenum, data)
glTexImage3D(GL_PROXY_TEXTURE_3D, level, internalFormat, w, h, d, border, format, datatype, C_NULL)
for l in 0:level
result = glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, l, GL_TEXTURE_WIDTH)
Expand All @@ -200,7 +202,8 @@ function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::In
glTexImage3D(ttype, level, internalFormat, w, h, d, border, format, datatype, data)
end

function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer, h::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
Makie.@noconstprop function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer,
h::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
maxsize = glGetIntegerv(GL_MAX_TEXTURE_SIZE)
glTexImage2D(GL_PROXY_TEXTURE_2D, level, internalFormat, w, h, border, format, datatype, C_NULL)
for l in 0:level
Expand All @@ -220,7 +223,8 @@ function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::In
glTexImage2D(ttype, level, internalFormat, w, h, border, format, datatype, data)
end

function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer, border::Integer, format::GLenum, datatype::GLenum, data)
Makie.@noconstprop function glTexImage(ttype::GLenum, level::Integer, internalFormat::GLenum, w::Integer,
border::Integer, format::GLenum, datatype::GLenum, data)
glTexImage1D(GL_PROXY_TEXTURE_1D, level, internalFormat, w, border, format, datatype, C_NULL)
for l in 0:level
result = glGetTexLevelParameteriv(GL_PROXY_TEXTURE_1D, l, GL_TEXTURE_WIDTH)
Expand Down
4 changes: 2 additions & 2 deletions GLMakie/src/GLAbstraction/GLTexture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function set_packing_alignment(a) # at some point we should specialize to array/
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0)
end

function Texture(
Makie.@noconstprop function Texture(
data::Ptr{T}, dims::NTuple{NDim, Int};
internalformat::GLenum = default_internalcolorformat(T),
texturetype ::GLenum = default_texturetype(NDim),
Expand Down Expand Up @@ -139,7 +139,7 @@ function Texture(s::ShaderAbstractions.Sampler{T, N}; kwargs...) where {T, N}
pointer(s.data), size(s.data),
minfilter = s.minfilter, magfilter = s.magfilter,
x_repeat = s.repeat[1], y_repeat = s.repeat[min(2, N)], z_repeat = s.repeat[min(3, N)],
anisotropic = s.anisotropic; kwargs...
mipmap = s.mipmap, anisotropic = s.anisotropic; kwargs...
)
obsfunc = ShaderAbstractions.connect!(s, tex)
push!(tex.observers, obsfunc)
Expand Down
1 change: 0 additions & 1 deletion GLMakie/src/GLAbstraction/GLTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ function RenderObject(
pre::Pre, post,
context=current_context()
) where Pre

switch_context!(context)

# This is a lazy workaround for disabling updates of `requires_update` when
Expand Down
8 changes: 5 additions & 3 deletions GLMakie/src/GLAbstraction/GLUniforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ function glsl_typename(t::Type{T}) where T <: Mat
string(opengl_prefix(eltype(t)), "mat", M==N ? M : string(N, "x", M))
end
toglsltype_string(t::Observable) = toglsltype_string(to_value(t))
toglsltype_string(x::T) where {T<:Union{Real, Mat, StaticVector, Texture, Colorant, TextureBuffer, Nothing}} = "uniform $(glsl_typename(x))"
function toglsltype_string(x::T) where {T<:Union{Real, Mat, StaticVector, Texture, Colorant, TextureBuffer, Nothing}}
return "uniform $(glsl_typename(x))"
end
#Handle GLSL structs, which need to be addressed via single fields
function toglsltype_string(x::T) where T
if isa_gl_struct(x)
string("uniform ", T.name.name)
else
error("can't splice $T into an OpenGL shader. Make sure all fields are of a concrete type and isbits(FieldType)-->true")
error("can't splice $T into an OpenGL shader. Make sure all fields are of a concrete type and isbits(FieldType)-->true\n\n$x")
end
end
toglsltype_string(t::Union{GLBuffer{T}, GPUVector{T}}) where {T} = string("in ", glsl_typename(T))
Expand Down Expand Up @@ -237,7 +239,7 @@ gl_convert(a::T) where {T <: NATIVE_TYPES} = a
gl_convert(s::Observable{T}) where {T <: NATIVE_TYPES} = s
gl_convert(s::Observable{T}) where T = const_lift(gl_convert, s)
gl_convert(x::StaticVector{N, T}) where {N, T} = map(gl_promote(T), x)
gl_convert(x::Mat{N, M, T}) where {N, M, T} = map(gl_promote(T), x)
gl_convert(x::Mat{N, M, T}) where {N, M, T} = Mat{N, M, gl_promote(T)}(x)
gl_convert(a::AbstractVector{<: AbstractFace}) = indexbuffer(s)
gl_convert(t::Type{T}, a::T; kw_args...) where T <: NATIVE_TYPES = a
gl_convert(::Type{<: GPUArray}, a::StaticVector) = gl_convert(a)
Expand Down
Loading
Loading