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

Issue with typing on LScene with lights #2985

Closed
DanielVandH opened this issue May 28, 2023 · 1 comment · Fixed by #3113
Closed

Issue with typing on LScene with lights #2985

DanielVandH opened this issue May 28, 2023 · 1 comment · Fixed by #3113
Labels
Makie Backend independent issues (Makie core)

Comments

@DanielVandH
Copy link
Contributor

The following fails:

julia> using RPRMakie
julia> let
           fig = Figure();
           radiance = 10000
           lights = [PointLight(Vec3f(0, 0, 20), RGBf(radiance, radiance, radiance))]
           ax = LScene(fig[1, 1]; show_axis = false, scenekw=(lights=lights,))
       end
ERROR: MethodError: no method matching Scene(::Scene, ::Events, ::Observable{GeometryBasics.HyperRectangle{2, Int64}}, ::Observable{Bool}, ::Camera, ::EmptyCamera, ::Transformation, ::Vector{AbstractPlot}, ::Attributes, ::Vector{Scene}, ::Vector{MakieScreen}, ::Observable{ColorTypes.RGBA{Float32}}, ::Observable{Bool}, ::SSAO, ::Vector{PointLight})

Closest candidates are:
  Scene(::Union{Nothing, Scene}, ::Events, ::Observable{GeometryBasics.HyperRectangle{2, Int64}}, ::Observable{Bool}, ::Camera, ::AbstractCamera, ::Transformation, ::Vector{AbstractPlot}, ::Attributes, ::Vector{Scene}, ::Vector{MakieScreen}, ::Observable{ColorTypes.RGBA{Float32}}, ::Observable{Bool}, ::SSAO, ::Vector{Makie.AbstractLight})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\scenes.jl:118
  Scene(::Scene, ::Any; kw...)
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\scenes.jl:345
  Scene(::Scene; events, px_area, clear, camera, camera_controls, transformation, kw...)
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\scenes.jl:303

Stacktrace:
 [1] Scene(; px_area::Observable{GeometryBasics.HyperRectangle{2, Int64}}, events::Events, clear::Observable{Bool}, transform_func::Function, camera::typeof(cam3d!), camera_controls::EmptyCamera, transformation::Transformation, plots::Vector{AbstractPlot}, children::Vector{Scene}, current_screens::Vector{MakieScreen}, parent::Scene, visible::Observable{Bool}, ssao::SSAO, lights::Vector{PointLight}, theme::Attributes, theme_kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\scenes.jl:253
 [2] Scene(parent::Scene; events::Events, px_area::Observable{GeometryBasics.HyperRectangle{2, Int64}}, clear::Bool, camera::Function, camera_controls::Makie.PixelCamera, transformation::Transformation, kw::Base.Pairs{Symbol, Vector{PointLight}, Tuple{Symbol}, NamedTuple{(:lights,), Tuple{Vector{PointLight}}}})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\scenes.jl:318
 [3] Scene(parent::Scene, area::Observable{GeometryBasics.HyperRectangle{2, Int64}}; kw::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:clear, :camera, :lights), Tuple{Bool, typeof(cam3d!), Vector{PointLight}}}})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\scenes.jl:346
 [4] initialize_block!(ls::LScene; scenekw::NamedTuple{(:lights,), Tuple{Vector{PointLight}}})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\makielayout\blocks\scene.jl:23
 [5] _block(::Type{LScene}, ::Figure; bbox::Nothing, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:show_axis, :scenekw), Tuple{Bool, NamedTuple{(:lights,), Tuple{Vector{PointLight}}}}}})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\makielayout\blocks.jl:374
 [6] _block(::Type{LScene}, ::GridPosition; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:show_axis, :scenekw), Tuple{Bool, NamedTuple{(:lights,), Tuple{Vector{PointLight}}}}}})
   @ Makie C:\Users\User\.julia\packages\Makie\DekzU\src\makielayout\blocks.jl:268
 [7] _block
   @ C:\Users\User\.julia\packages\Makie\DekzU\src\makielayout\blocks.jl:261 [inlined]
 [8] #_#1103
   @ C:\Users\User\.julia\packages\Makie\DekzU\src\makielayout\blocks.jl:253 [inlined]
 [9] top-level scope
   @ REPL[13]:5

since typeof(lights) == Vector{PointLight}. If instead typeof(lights) == Vector{AbstractLight}, it works:

julia> let
           fig = Figure();
           radiance = 10000
           lights = Vector{Makie.AbstractLight}([PointLight(Vec3f(0, 0, 20), RGBf(radiance, radiance, radiance))])
           ax = LScene(fig[1, 1]; show_axis = false, scenekw=(lights=lights,))
       end
LScene()

Code's taken from https://docs.makie.org/stable/documentation/backends/rprmakie/, on:

julia> versioninfo()
Julia Version 1.9.0
Commit 8e63055292 (2023-05-07 11:25 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900K
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, goldmont)
  Threads: 1 on 32 virtual cores

(jl_8jzM0Y) pkg> st
Status `C:\Users\User\AppData\Local\Temp\jl_8jzM0Y\Project.toml`
  [22d9f318] RPRMakie v0.5.5
@asinghvi17 asinghvi17 added the Makie Backend independent issues (Makie core) label May 28, 2023
@asinghvi17
Copy link
Member

Yep, this is a Makie issue. Will try to patch, it's just a bad type constraint in the Scene struct definition.

ffreyer added a commit that referenced this issue Sep 29, 2023
SimonDanisch added a commit that referenced this issue Nov 17, 2023
Continues #2831 !
Still needs to check, if I rebased correctly and didn't incorrectly
apply some of the changes!

## Merged PRs
- #2598
- #2746
- #2346
- #2544
- #3082
- #2868
- #3062
- #3106
- #3281
- #3246

## TODOS

- [x] fix flaky test `@test GLMakie.window_size(screen.glscreen) ==
scaled(screen, (W, H))`
- [x] Merge axis type inferences from #2220 
- [x] Test on different resolution screens, IJulia, Pluto, VSCode,
Windowed
- [x] rebase to only have merge commits from the PRs 
- [x] investigate unexpected speed ups
- [x] reset camera settings from tests
- [ ] check doc image generation
- [x] rethink default near/far in Camera3D (compatability with OIT)
- [x] merge #3246
- [x] fix WGLMakie issues/tests:
- [x] fix line depth issues (see tests: ~~hexbin colorrange~~ (not new),
LaTeXStrings in Axis3, Axis3 axis reversal)
  - [x] fix lighting of surface with nan points (fixed in #3246)
- ~~volume/3D contour artifacts (see 3D Contour with 2D contour
slices)~~ not new
  - ~~artifacting in "colorscale (lines)"~~ not new
- [x] GLMakie:
  - [x] slight outline in "scatter image markers" test
  - ~~clipping/z-fighting in "volume translated"~~ not new
- [x] CairoMakie:
  -  ~~Artfiacting in `colorscale (lines)"~~ not new
  - ~~markersize in "scatter rotations" changed?~~ not new
  - ~~color change in "colorscale (poly)"~~ not new
  - ~~transparency/render order of "OldAxis + Surface"~~ not new
  - ~~render order in "Merged color mesh"~~ not new
  - ~~render order of "Surface + wireframe + contour"~~ not new
- [x] Check "SpecApi in convert_arguments" (colors swapped?)


## Fixes the following errors

- fixes #2721 via #2746
- fixes #1600 via #2746
- fixes #1236 via #2746
- fixes MakieOrg/GeoMakie.jl#133 via #2598
- closes #2522
- closes #3239 via #3246
- fixes #3238 via #3246
- fixes #2985 via #3246
- fixes #3307 via #3281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Makie Backend independent issues (Makie core)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants