@@ -239,13 +239,16 @@ function assemble_scatter_robj(attr, args, uniforms, input2glname)
239
239
colornorm = args. scaled_colorrange[]
240
240
marker_shape = args. sdf_marker_shape[]
241
241
distancefield = marker_shape === Cint (DISTANCEFIELD) ? get_texture! (screen. glscreen, args. atlas[]) : nothing
242
+
242
243
data = Dict (
243
244
:vertex => positions,
244
245
:indices => length (positions),
245
246
:preprojection => Makie. get_preprojection (camera, space, markerspace),
246
247
:distancefield => distancefield,
247
248
:px_per_unit => screen. px_per_unit, # technically not const?
248
249
:ssao => false , # shader compilation const
250
+ :transparency => attr[:transparency ][],
251
+ :overdraw => attr[:overdraw ][],
249
252
:shape => marker_shape,
250
253
)
251
254
@@ -333,7 +336,7 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Scatter)
333
336
334
337
uniforms = [
335
338
:gl_markerspace , :quad_scale ,
336
- :transparency , : fxaa , :visible ,
339
+ :fxaa , :visible ,
337
340
:model_f32c ,
338
341
:_lowclip , :_highclip , :nan_color ,
339
342
:gl_clip_planes , :gl_num_clip_planes , :depth_shift , :gl_indices
@@ -349,7 +352,7 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Scatter)
349
352
:quad_scale ,
350
353
:quad_offset ,
351
354
:image ,
352
- :transparency , : fxaa , :visible ,
355
+ :fxaa , :visible ,
353
356
:strokecolor , :strokewidth , :glowcolor , :glowwidth ,
354
357
:model_f32c , :rotation , :transform_marker ,
355
358
:_lowclip , :_highclip , :nan_color ,
@@ -419,15 +422,10 @@ function assemble_meshscatter_robj(attr, args, uniforms, input2glname)
419
422
420
423
data = Dict {Symbol, Any} (
421
424
# Compile time variable
425
+ :transparency => attr[:transparency ][],
422
426
:overdraw => attr[:overdraw ][],
427
+ :shading => attr[:shading ][],
423
428
:ssao => attr[:ssao ][],
424
- :shading => attr[:shading ][]
425
-
426
- # :color_map => nothing,
427
- # :color_norm => nothing,
428
- # :view_normalmatrix => Mat4f(I),
429
- # :image => nothing,
430
- # :matcap => nothing,
431
429
)
432
430
433
431
if args. packed_uv_transform[] isa Vector{Vec2f}
@@ -482,9 +480,9 @@ function draw_atomic(screen::Screen, scene::Scene, plot::MeshScatter)
482
480
uniforms = [
483
481
:positions_transformed_f32c , :markersize , :rotation , :f32c_scale , :instances ,
484
482
:_lowclip , :_highclip , :nan_color , # :matcap,
485
- :transparency , : fxaa , :visible ,
483
+ :fxaa , :visible ,
486
484
:model_f32c , :gl_clip_planes , :gl_num_clip_planes , :depth_shift ,
487
- :diffuse , :specular , :shininess , :backlight , :world_normalmatrix , :shading
485
+ :diffuse , :specular , :shininess , :backlight , :world_normalmatrix ,
488
486
]
489
487
490
488
input2glname = Dict {Symbol, Symbol} (
@@ -530,12 +528,14 @@ function assemble_lines_robj(attr, args, uniforms, input2glname)
530
528
linestyle = attr[:linestyle ][]
531
529
camera = args. scene[]. camera
532
530
data = Dict {Symbol, Any} (
533
- :ssao => false ,
534
531
:fast => isnothing (linestyle),
535
532
# :fast == true removes pattern from the shader so we don't need
536
533
# to worry about this
537
534
:vertex => positions, # Needs to be set before draw_lines()
538
- :overdraw => attr[:overdraw ][]
535
+ :transparency => attr[:transparency ][],
536
+ :overdraw => attr[:overdraw ][],
537
+ :ssao => false ,
538
+ :debug => attr[:debug ][],
539
539
)
540
540
541
541
add_camera_attributes! (data, args. gl_screen[], camera, args. space[])
@@ -681,7 +681,6 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Lines)
681
681
return (output,)
682
682
end
683
683
684
-
685
684
add_input! (attr, :debug , false )
686
685
687
686
generate_clip_planes! (attr, :clip ) # requires projectionview
@@ -712,7 +711,7 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Lines)
712
711
:gl_indices , :gl_valid_vertex , :gl_total_length , :gl_last_length ,
713
712
:gl_pattern , :gl_pattern_length , :linecap , :gl_miter_limit , :joinstyle , :linewidth ,
714
713
:scene_origin , :px_per_unit ,
715
- :transparency , : fxaa, :debug , :visible ,
714
+ :fxaa , :visible ,
716
715
:model_f32c ,
717
716
:_lowclip , :_highclip , :nan_color ,
718
717
:gl_clip_planes , :gl_num_clip_planes , :depth_shift
@@ -750,15 +749,14 @@ end
750
749
# ###############################################################################
751
750
752
751
function assemble_linesegments_robj (attr, args, uniforms, input2glname)
753
- positions = args[1 ][] # changes name, so we use positional
754
752
linestyle = attr[:linestyle ][]
755
753
camera = args. scene[]. camera
756
754
757
755
data = Dict {Symbol, Any} (
758
- :ssao => false ,
759
- :vertex => positions, # TODO : can be automated
756
+ :transparency => attr[:transparency ][],
760
757
:overdraw => attr[:overdraw ][],
761
- :indices => length (positions)
758
+ :debug => attr[:debug ][],
759
+ :ssao => false ,
762
760
)
763
761
screen = args. gl_screen[]
764
762
add_camera_attributes! (data, screen, camera, args. space[])
@@ -777,7 +775,7 @@ function assemble_linesegments_robj(attr, args, uniforms, input2glname)
777
775
if isnothing (linestyle)
778
776
data[:pattern ] = nothing
779
777
end
780
- return draw_linesegments (screen, positions , data) # TODO : extract positions
778
+ return draw_linesegments (screen, data[ :vertex ] , data) # TODO : extract positions
781
779
end
782
780
783
781
function draw_atomic (screen:: Screen , scene:: Scene , plot:: LineSegments )
@@ -800,16 +798,19 @@ function draw_atomic(screen::Screen, scene::Scene, plot::LineSegments)
800
798
add_input! (attr, :projectionview , scene. camera. projectionview)
801
799
generate_clip_planes! (attr)
802
800
801
+ register_computation! (attr, [:positions_transformed_f32c ], [:indices ]) do (positions,), changed, cached
802
+ return (length (positions[]),)
803
+ end
804
+
803
805
inputs = [
804
- :positions_transformed_f32c ,
805
806
:space , :scene , :gl_screen ,
806
807
:synched_color , :alpha_colormap , :scaled_colorrange
807
808
]
808
809
uniforms = [
810
+ :positions_transformed_f32c , :indices ,
809
811
:gl_pattern , :gl_pattern_length , :linecap , :synched_linewidth ,
810
812
:scene_origin , :px_per_unit , :model_f32c ,
811
- :transparency , :fxaa , :debug ,
812
- :visible ,
813
+ :fxaa , :visible ,
813
814
:gl_clip_planes , :gl_num_clip_planes , :depth_shift
814
815
]
815
816
@@ -827,9 +828,6 @@ function draw_atomic(screen::Screen, scene::Scene, plot::LineSegments)
827
828
robj = assemble_linesegments_robj (attr, args, uniforms, input2glname)
828
829
else
829
830
robj = output[1 ][]
830
- if changed[1 ]
831
- robj. vertexarray. indices = length (args[1 ][])
832
- end
833
831
update_robjs! (robj, args, changed, input2glname)
834
832
end
835
833
screen. requires_update = true
@@ -845,20 +843,19 @@ end
845
843
# ###############################################################################
846
844
847
845
function assemble_image_robj (attr, args, uniforms, input2glname)
848
- positions = args[1 ][] # changes name, so we use positional
849
846
screen = args. gl_screen[]
850
847
851
848
r = Rect2f (0 ,0 ,1 ,1 )
852
849
853
850
data = Dict {Symbol, Any} (
854
- :vertices => positions,
855
- # Compile time variable
856
- :overdraw => attr[:overdraw ][],
857
- # Constants
858
- :ssao => false ,
859
851
:faces => decompose (GLTriangleFace, r),
860
852
:texturecoordinates => decompose_uv (r),
853
+
854
+ # Compile time variable/constants
861
855
:picking_mode => " #define PICKING_INDEX_FROM_UV" ,
856
+ :transparency => attr[:transparency ][],
857
+ :overdraw => attr[:overdraw ][],
858
+ :ssao => false ,
862
859
)
863
860
864
861
camera = args. scene[]. camera
@@ -875,7 +872,7 @@ function assemble_image_robj(attr, args, uniforms, input2glname)
875
872
876
873
# Correct the name mapping
877
874
input2glname[:scaled_color ] = :image
878
- interp = args . interpolate[] ? :linear : :nearest
875
+ interp = attr[ : interpolate] [] ? :linear : :nearest
879
876
data[:image ] = Texture (screen. glscreen, color; minfilter = interp)
880
877
881
878
# Transfer over uniforms
@@ -897,15 +894,15 @@ function draw_atomic_as_image(screen::Screen, scene::Scene, plot)
897
894
generate_clip_planes! (attr)
898
895
899
896
inputs = [
900
- :positions_transformed_f32c ,
901
897
# Special
902
898
:space , :scene , :gl_screen ,
903
899
# Needs explicit handling
904
- :alpha_colormap , :scaled_color , :scaled_colorrange , :interpolate ,
900
+ :alpha_colormap , :scaled_color , :scaled_colorrange ,
905
901
]
906
902
uniforms = [
903
+ :positions_transformed_f32c ,
907
904
:_lowclip , :_highclip , :nan_color ,
908
- :transparency , : fxaa , :visible ,
905
+ :fxaa , :visible ,
909
906
:model_f32c ,
910
907
:gl_clip_planes , :gl_num_clip_planes , :depth_shift
911
908
]
@@ -949,9 +946,9 @@ function assemble_heatmap_robj(attr, args, uniforms, input2glname)
949
946
data = Dict {Symbol, Any} (
950
947
:position_x => Texture (screen. glscreen, args[1 ][], minfilter = :nearest ),
951
948
:position_y => Texture (screen. glscreen, args[2 ][], minfilter = :nearest ),
952
- # Compile time variable
949
+ # Compile time variable, Constants
950
+ :transparency => attr[:transparency ][],
953
951
:overdraw => attr[:overdraw ][],
954
- # Constants
955
952
:ssao => false ,
956
953
)
957
954
@@ -969,7 +966,7 @@ function assemble_heatmap_robj(attr, args, uniforms, input2glname)
969
966
970
967
# Correct the name mapping
971
968
input2glname[:scaled_color ] = :intensity
972
- interp = args . interpolate[] ? :linear : :nearest
969
+ interp = attr[ : interpolate] [] ? :linear : :nearest
973
970
if color isa ShaderAbstractions. Sampler
974
971
data[:intensity ] = color
975
972
else
@@ -1009,11 +1006,11 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Heatmap)
1009
1006
# Special
1010
1007
:space , :scene , :gl_screen ,
1011
1008
# Needs explicit handling
1012
- :alpha_colormap , :scaled_color , :scaled_colorrange , :interpolate ,
1009
+ :alpha_colormap , :scaled_color , :scaled_colorrange
1013
1010
]
1014
1011
uniforms = [
1015
1012
:_lowclip , :_highclip , :nan_color ,
1016
- :transparency , : fxaa , :visible ,
1013
+ :fxaa , :visible ,
1017
1014
:model_f32c , :instances ,
1018
1015
:gl_clip_planes , :gl_num_clip_planes , :depth_shift
1019
1016
]
@@ -1053,19 +1050,19 @@ function assemble_surface_robj(attr, args, uniforms, input2glname)
1053
1050
screen = args. gl_screen[]
1054
1051
1055
1052
data = Dict {Symbol, Any} (
1056
- # Compile time variable
1053
+ # Compile time variable, Constants
1054
+ :transparency => attr[:transparency ][],
1057
1055
:overdraw => attr[:overdraw ][],
1058
- # Constants
1056
+ :shading => attr[ :shading ][],
1059
1057
:ssao => attr[:ssao ][],
1060
- :shading => attr[:shading ][]
1061
1058
)
1062
1059
1063
1060
colorname = add_mesh_color_attributes! (
1064
1061
screen, data,
1065
1062
args. scaled_color[],
1066
1063
args. alpha_colormap[],
1067
1064
args. scaled_colorrange[],
1068
- args . interpolate[]
1065
+ attr[ : interpolate] []
1069
1066
)
1070
1067
@assert colorname == :image
1071
1068
@@ -1102,12 +1099,12 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Surface)
1102
1099
# Special
1103
1100
:space , :scene , :gl_screen ,
1104
1101
# Needs explicit handling
1105
- :alpha_colormap , :scaled_color , :scaled_colorrange , :interpolate ,
1102
+ :alpha_colormap , :scaled_color , :scaled_colorrange
1106
1103
]
1107
1104
uniforms = [
1108
1105
:x_transformed_f32c , :y_transformed_f32c , :z_converted ,
1109
1106
:_lowclip , :_highclip , :nan_color ,
1110
- :transparency , : fxaa , :visible ,
1107
+ :fxaa , :visible ,
1111
1108
:model_f32c , :instances ,
1112
1109
:gl_clip_planes , :gl_num_clip_planes , :depth_shift ,
1113
1110
:diffuse , :specular , :shininess , :backlight , :world_normalmatrix ,
@@ -1195,11 +1192,11 @@ function assemble_mesh_robj(attr, args, uniforms, input2glname)
1195
1192
camera = args. scene[]. camera
1196
1193
1197
1194
data = Dict {Symbol, Any} (
1198
- # Compile time variable
1195
+ # Compile time variable, Constants
1196
+ :transparency => attr[:transparency ][],
1199
1197
:overdraw => attr[:overdraw ][],
1200
- # Constants
1198
+ :shading => attr[ :shading ][],
1201
1199
:ssao => attr[:ssao ][],
1202
- :shading => attr[:shading ][]
1203
1200
)
1204
1201
1205
1202
add_camera_attributes! (data, screen, camera, args. space[])
@@ -1209,7 +1206,7 @@ function assemble_mesh_robj(attr, args, uniforms, input2glname)
1209
1206
args. scaled_color[],
1210
1207
args. alpha_colormap[],
1211
1208
args. scaled_colorrange[],
1212
- args . interpolate[]
1209
+ attr[ : interpolate] []
1213
1210
)
1214
1211
1215
1212
add_light_attributes! (args. scene[], data, attr)
@@ -1238,12 +1235,12 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Mesh)
1238
1235
# Special
1239
1236
:space , :scene , :gl_screen ,
1240
1237
# Needs explicit handling
1241
- :alpha_colormap , :scaled_color , :scaled_colorrange , :interpolate ,
1238
+ :alpha_colormap , :scaled_color , :scaled_colorrange ,
1242
1239
]
1243
1240
uniforms = [
1244
1241
:positions_transformed_f32c , :faces , :normals , :texturecoordinates ,
1245
1242
:_lowclip , :_highclip , :nan_color ,
1246
- :transparency , : fxaa , :visible ,
1243
+ :fxaa , :visible ,
1247
1244
:model_f32c , :gl_clip_planes , :gl_num_clip_planes , :depth_shift ,
1248
1245
:diffuse , :specular , :shininess , :backlight , :world_normalmatrix
1249
1246
]
@@ -1288,11 +1285,11 @@ function assemble_voxel_robj(attr, args, uniforms, input2glname)
1288
1285
data = Dict {Symbol, Any} (
1289
1286
:voxel_id => voxel_id,
1290
1287
:uv_transform => isnothing (uvt) ? nothing : Texture (screen. glscreen, uvt, minfilter = :nearest ),
1291
- # Compile time variable
1288
+ # Compile time variable, Constants
1289
+ :transparency => attr[:transparency ][],
1292
1290
:overdraw => attr[:overdraw ][],
1293
- # Constants
1291
+ :shading => attr[ :shading ][],
1294
1292
:ssao => attr[:ssao ][],
1295
- :shading => attr[:shading ][]
1296
1293
)
1297
1294
1298
1295
add_camera_attributes! (data, screen, camera, args. space[])
@@ -1349,7 +1346,7 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Voxels)
1349
1346
uniforms = [
1350
1347
:instances , :colormap ,
1351
1348
:diffuse , :specular , :shininess , :backlight , :world_normalmatrix ,
1352
- :transparency , : fxaa , :visible ,
1349
+ :fxaa , :visible ,
1353
1350
:voxel_model , :gl_clip_planes , :gl_num_clip_planes , :depth_shift ,
1354
1351
:gap
1355
1352
]
@@ -1393,11 +1390,12 @@ function assemble_volume_robj(attr, args, uniforms, input2glname)
1393
1390
volume_data = Texture (screen. glscreen, args. volume[], minfilter = interp)
1394
1391
1395
1392
data = Dict {Symbol, Any} (
1396
- # Compile time variable
1393
+ # Compile time variable, Constants
1394
+ :transparency => attr[:transparency ][],
1397
1395
:overdraw => attr[:overdraw ][],
1398
- # Constants
1396
+ :shading => attr[ :shading ][],
1399
1397
:ssao => attr[:ssao ][],
1400
- :shading => attr[:shading ][]
1398
+ :enable_depth => attr[:enable_depth ][],
1401
1399
)
1402
1400
1403
1401
camera = args. scene[]. camera
@@ -1439,9 +1437,9 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Volume)
1439
1437
:alpha_colormap , :scaled_colorrange
1440
1438
]
1441
1439
uniforms = [
1442
- :volume , :modelinv , :algorithm , :absorption , :isovalue , :isorange , :enable_depth ,
1440
+ :volume , :modelinv , :algorithm , :absorption , :isovalue , :isorange ,
1443
1441
:diffuse , :specular , :shininess , :backlight , :world_normalmatrix ,
1444
- :transparency , : fxaa , :visible ,
1442
+ :fxaa , :visible ,
1445
1443
:volume_model , :gl_clip_planes , :gl_num_clip_planes , :depth_shift ,
1446
1444
]
1447
1445
0 commit comments