-
Notifications
You must be signed in to change notification settings - Fork 0
/
LibStereoKit.jl
3346 lines (2616 loc) · 106 KB
/
LibStereoKit.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module LibStereoKit
using CEnum
#
# Automatically generated file
#
using Pkg.Artifacts
using IMisc
StereoKitC = joinpath(artifact"StereoKitC", "win-x64\\native\\StereoKitC.dll")
const uint64_t = Culonglong
const char16_t = Cushort
const char32_t = Cuint
const bool32_t = Int32
@cenum display_mode_::UInt32 begin
display_mode_mixedreality = 0
display_mode_flatscreen = 1
display_mode_none = 2
end
@cenum depth_mode_::UInt32 begin
depth_mode_balanced = 0
depth_mode_d16 = 1
depth_mode_d32 = 2
depth_mode_stencil = 3
end
@cenum display_::UInt32 begin
display_none = 0
display_opaque = 1
display_additive = 2
display_blend = 4
display_passthrough = 4
display_any_transparent = 6
end
@cenum display_blend_::UInt32 begin
display_blend_none = 0
display_blend_opaque = 1
display_blend_additive = 2
display_blend_blend = 4
display_blend_any_transparent = 6
end
@cenum log_::UInt32 begin
log_none = 0
log_diagnostic = 1
log_inform = 2
log_warning = 3
log_error = 4
end
@cenum render_layer_::UInt32 begin
render_layer_0 = 1
render_layer_1 = 2
render_layer_2 = 4
render_layer_3 = 8
render_layer_4 = 16
render_layer_5 = 32
render_layer_6 = 64
render_layer_7 = 128
render_layer_8 = 256
render_layer_9 = 512
render_layer_vfx = 1024
render_layer_all = 65535
render_layer_all_regular = 1023
end
@cenum app_focus_::UInt32 begin
app_focus_active = 0
app_focus_background = 1
app_focus_hidden = 2
end
@cenum asset_state_::Int32 begin
asset_state_error_unsupported = -3
asset_state_error_not_found = -2
asset_state_error = -1
asset_state_none = 0
asset_state_loading = 1
asset_state_loaded_meta = 2
asset_state_loaded = 3
end
@cenum memory_::UInt32 begin
memory_reference = 0
memory_copy = 1
end
struct sk_settings_t
app_name::Ptr{Cchar}
assets_folder::Ptr{Cchar}
display_preference::display_mode_
blend_preference::display_blend_
no_flatscreen_fallback::bool32_t
depth_mode::depth_mode_
log_filter::log_
overlay_app::bool32_t
overlay_priority::UInt32
flatscreen_pos_x::Int32
flatscreen_pos_y::Int32
flatscreen_width::Int32
flatscreen_height::Int32
disable_flatscreen_mr_sim::bool32_t
disable_unfocused_sleep::bool32_t
android_java_vm::Ptr{Cvoid}
android_activity::Ptr{Cvoid}
end
struct system_info_t
display_type::display_
display_width::Int32
display_height::Int32
spatial_bridge_present::bool32_t
perception_bridge_present::bool32_t
eye_tracking_present::bool32_t
overlay_app::bool32_t
world_occlusion_present::bool32_t
world_raycast_present::bool32_t
end
function sk_init(settings)
@ccall StereoKitC.sk_init(settings::sk_settings_t)::bool32_t
end
function sk_set_window(window)
@ccall StereoKitC.sk_set_window(window::Ptr{Cvoid})::Cvoid
end
function sk_set_window_xam(window)
@ccall StereoKitC.sk_set_window_xam(window::Ptr{Cvoid})::Cvoid
end
# no prototype is found for this function at stereokit.h:317:22, please use with caution
function sk_shutdown()
@ccall StereoKitC.sk_shutdown()::Cvoid
end
# no prototype is found for this function at stereokit.h:318:22, please use with caution
function sk_quit()
@ccall StereoKitC.sk_quit()::Cvoid
end
function sk_step(app_update)
@ccall StereoKitC.sk_step(app_update::Ptr{Cvoid})::bool32_t
end
function sk_run(app_update, app_shutdown)
@ccall StereoKitC.sk_run(app_update::Ptr{Cvoid}, app_shutdown::Ptr{Cvoid})::Cvoid
end
function sk_run_data(app_update, update_data, app_shutdown, shutdown_data)
@ccall StereoKitC.sk_run_data(app_update::Ptr{Cvoid}, update_data::Ptr{Cvoid}, app_shutdown::Ptr{Cvoid}, shutdown_data::Ptr{Cvoid})::Cvoid
end
# no prototype is found for this function at stereokit.h:322:22, please use with caution
function sk_active_display_mode()
@ccall StereoKitC.sk_active_display_mode()::display_mode_
end
# no prototype is found for this function at stereokit.h:323:22, please use with caution
function sk_get_settings()
@ccall StereoKitC.sk_get_settings()::sk_settings_t
end
# no prototype is found for this function at stereokit.h:324:22, please use with caution
function sk_system_info()
@ccall StereoKitC.sk_system_info()::system_info_t
end
# no prototype is found for this function at stereokit.h:325:22, please use with caution
function sk_version_name()
@ccall StereoKitC.sk_version_name()::Ptr{Cchar}
end
# no prototype is found for this function at stereokit.h:326:22, please use with caution
function sk_version_id()
@ccall StereoKitC.sk_version_id()::uint64_t
end
# no prototype is found for this function at stereokit.h:327:22, please use with caution
function sk_app_focus()
@ccall StereoKitC.sk_app_focus()::app_focus_
end
# no prototype is found for this function at stereokit.h:331:22, please use with caution
function time_getf_unscaled()
@ccall StereoKitC.time_getf_unscaled()::Cfloat
end
# no prototype is found for this function at stereokit.h:332:22, please use with caution
function time_get_unscaled()
@ccall StereoKitC.time_get_unscaled()::Cdouble
end
# no prototype is found for this function at stereokit.h:333:22, please use with caution
function time_getf()
@ccall StereoKitC.time_getf()::Cfloat
end
# no prototype is found for this function at stereokit.h:334:22, please use with caution
function time_get()
@ccall StereoKitC.time_get()::Cdouble
end
# no prototype is found for this function at stereokit.h:335:22, please use with caution
function time_elapsedf_unscaled()
@ccall StereoKitC.time_elapsedf_unscaled()::Cfloat
end
# no prototype is found for this function at stereokit.h:336:22, please use with caution
function time_elapsed_unscaled()
@ccall StereoKitC.time_elapsed_unscaled()::Cdouble
end
# no prototype is found for this function at stereokit.h:337:22, please use with caution
function time_elapsedf()
@ccall StereoKitC.time_elapsedf()::Cfloat
end
# no prototype is found for this function at stereokit.h:338:22, please use with caution
function time_elapsed()
@ccall StereoKitC.time_elapsed()::Cdouble
end
function time_scale(scale)
@ccall StereoKitC.time_scale(scale::Cdouble)::Cvoid
end
function time_set_time(total_seconds, frame_elapsed_seconds)
@ccall StereoKitC.time_set_time(total_seconds::Cdouble, frame_elapsed_seconds::Cdouble)::Cvoid
end
struct vec2
x::Cfloat
y::Cfloat
end
struct vec3
x::Cfloat
y::Cfloat
z::Cfloat
end
struct vec4
x::Cfloat
y::Cfloat
z::Cfloat
w::Cfloat
end
struct quat
x::Cfloat
y::Cfloat
z::Cfloat
w::Cfloat
end
struct matrix
data::NTuple{64, UInt8}
end
function Base.getproperty(x::Ptr{matrix}, f::Symbol)
f === :row && return Ptr{NTuple{4, vec4}}(x + 0)
f === :m && return Ptr{NTuple{16, Cfloat}}(x + 0)
return getfield(x, f)
end
function Base.getproperty(x::matrix, f::Symbol)
r = Ref{matrix}(x)
ptr = Base.unsafe_convert(Ptr{matrix}, r)
fptr = getproperty(ptr, f)
GC.@preserve r unsafe_load(fptr)
end
function Base.setproperty!(x::Ptr{matrix}, f::Symbol, v)
unsafe_store!(getproperty(x, f), v)
end
struct rect_t
x::Cfloat
y::Cfloat
w::Cfloat
h::Cfloat
end
struct ray_t
pos::vec3
dir::vec3
end
struct bounds_t
center::vec3
dimensions::vec3
end
struct plane_t
normal::vec3
d::Cfloat
end
struct sphere_t
center::vec3
radius::Cfloat
end
struct pose_t
position::vec3
orientation::quat
end
function vec3_cross(a, b)
@ccall StereoKitC.vec3_cross(a::Ptr{vec3}, b::Ptr{vec3})::vec3
end
function quat_difference(a, b)
@ccall StereoKitC.quat_difference(a::Ptr{quat}, b::Ptr{quat})::quat
end
function quat_lookat(from, at)
@ccall StereoKitC.quat_lookat(from::Ptr{vec3}, at::Ptr{vec3})::quat
end
function quat_lookat_up(from, at, up)
@ccall StereoKitC.quat_lookat_up(from::Ptr{vec3}, at::Ptr{vec3}, up::Ptr{vec3})::quat
end
function quat_from_angles(pitch_x_deg, yaw_y_deg, roll_z_deg)
@ccall StereoKitC.quat_from_angles(pitch_x_deg::Cfloat, yaw_y_deg::Cfloat, roll_z_deg::Cfloat)::quat
end
function quat_slerp(a, b, t)
@ccall StereoKitC.quat_slerp(a::Ptr{quat}, b::Ptr{quat}, t::Cfloat)::quat
end
function quat_normalize(a)
@ccall StereoKitC.quat_normalize(a::Ptr{quat})::quat
end
function quat_inverse(a)
@ccall StereoKitC.quat_inverse(a::Ptr{quat})::quat
end
function quat_mul(a, b)
@ccall StereoKitC.quat_mul(a::Ptr{quat}, b::Ptr{quat})::quat
end
function quat_mul_vec(a, b)
@ccall StereoKitC.quat_mul_vec(a::Ptr{quat}, b::Ptr{vec3})::vec3
end
function pose_matrix(pose, scale)
@ccall StereoKitC.pose_matrix(pose::Ptr{pose_t}, scale::vec3)::matrix
end
function pose_matrix_out(pose, out_result, scale)
@ccall StereoKitC.pose_matrix_out(pose::Ptr{pose_t}, out_result::Ptr{matrix}, scale::vec3)::Cvoid
end
function matrix_inverse(a, out_matrix)
@ccall StereoKitC.matrix_inverse(a::Ptr{matrix}, out_matrix::Ptr{matrix})::Cvoid
end
function matrix_invert(a)
@ccall StereoKitC.matrix_invert(a::Ptr{matrix})::matrix
end
function matrix_mul(a, b, out_matrix)
@ccall StereoKitC.matrix_mul(a::Ptr{matrix}, b::Ptr{matrix}, out_matrix::Ptr{matrix})::Cvoid
end
function matrix_mul_point(transform, point)
@ccall StereoKitC.matrix_mul_point(transform::Ptr{matrix}, point::Ptr{vec3})::vec3
end
function matrix_mul_point4(transform, point)
@ccall StereoKitC.matrix_mul_point4(transform::Ptr{matrix}, point::Ptr{vec4})::vec4
end
function matrix_mul_direction(transform, direction)
@ccall StereoKitC.matrix_mul_direction(transform::Ptr{matrix}, direction::Ptr{vec3})::vec3
end
function matrix_mul_rotation(transform, orientation)
@ccall StereoKitC.matrix_mul_rotation(transform::Ptr{matrix}, orientation::Ptr{quat})::quat
end
function matrix_mul_pose(transform, pose)
@ccall StereoKitC.matrix_mul_pose(transform::Ptr{matrix}, pose::Ptr{pose_t})::pose_t
end
function matrix_transform_pt(transform, point)
@ccall StereoKitC.matrix_transform_pt(transform::matrix, point::vec3)::vec3
end
function matrix_transform_pt4(transform, point)
@ccall StereoKitC.matrix_transform_pt4(transform::matrix, point::vec4)::vec4
end
function matrix_transform_dir(transform, direction)
@ccall StereoKitC.matrix_transform_dir(transform::matrix, direction::vec3)::vec3
end
function matrix_transform_ray(transform, ray)
@ccall StereoKitC.matrix_transform_ray(transform::matrix, ray::ray_t)::ray_t
end
function matrix_transform_quat(transform, rotation)
@ccall StereoKitC.matrix_transform_quat(transform::matrix, rotation::quat)::quat
end
function matrix_transform_pose(transform, pose)
@ccall StereoKitC.matrix_transform_pose(transform::matrix, pose::pose_t)::pose_t
end
function matrix_to_angles(transform)
@ccall StereoKitC.matrix_to_angles(transform::Ptr{matrix})::vec3
end
function matrix_trs(position, orientation, scale)
@ccall StereoKitC.matrix_trs(position::Ptr{vec3}, orientation::Ptr{quat}, scale::Ptr{vec3})::matrix
end
function matrix_t(position)
@ccall StereoKitC.matrix_t(position::vec3)::matrix
end
function matrix_r(orientation)
@ccall StereoKitC.matrix_r(orientation::quat)::matrix
end
function matrix_s(scale)
@ccall StereoKitC.matrix_s(scale::vec3)::matrix
end
function matrix_ts(position, scale)
@ccall StereoKitC.matrix_ts(position::vec3, scale::vec3)::matrix
end
function matrix_trs_out(out_result, position, orientation, scale)
@ccall StereoKitC.matrix_trs_out(out_result::Ptr{matrix}, position::Ptr{vec3}, orientation::Ptr{quat}, scale::Ptr{vec3})::Cvoid
end
function matrix_perspective(fov_degrees, aspect_ratio, near_clip, far_clip)
@ccall StereoKitC.matrix_perspective(fov_degrees::Cfloat, aspect_ratio::Cfloat, near_clip::Cfloat, far_clip::Cfloat)::matrix
end
function matrix_orthographic(width, height, near_clip, far_clip)
@ccall StereoKitC.matrix_orthographic(width::Cfloat, height::Cfloat, near_clip::Cfloat, far_clip::Cfloat)::matrix
end
function matrix_decompose(transform, out_position, out_scale, out_orientation)
@ccall StereoKitC.matrix_decompose(transform::Ptr{matrix}, out_position::Ptr{vec3}, out_scale::Ptr{vec3}, out_orientation::Ptr{quat})::bool32_t
end
function matrix_extract_translation(transform)
@ccall StereoKitC.matrix_extract_translation(transform::Ptr{matrix})::vec3
end
function matrix_extract_scale(transform)
@ccall StereoKitC.matrix_extract_scale(transform::Ptr{matrix})::vec3
end
function matrix_extract_rotation(transform)
@ccall StereoKitC.matrix_extract_rotation(transform::Ptr{matrix})::quat
end
function matrix_extract_pose(transform)
@ccall StereoKitC.matrix_extract_pose(transform::Ptr{matrix})::pose_t
end
function ray_intersect_plane(ray, plane_pt, plane_normal, out_t)
@ccall StereoKitC.ray_intersect_plane(ray::ray_t, plane_pt::vec3, plane_normal::vec3, out_t::Ptr{Cfloat})::bool32_t
end
function ray_from_mouse(screen_pixel_pos, out_ray)
@ccall StereoKitC.ray_from_mouse(screen_pixel_pos::vec2, out_ray::Ptr{ray_t})::bool32_t
end
function plane_from_points(p1, p2, p3)
@ccall StereoKitC.plane_from_points(p1::vec3, p2::vec3, p3::vec3)::plane_t
end
function plane_from_ray(ray)
@ccall StereoKitC.plane_from_ray(ray::ray_t)::plane_t
end
function vec4_magnitude(a)
@ccall StereoKitC.vec4_magnitude(a::vec4)::Cfloat
end
function vec3_magnitude(a)
@ccall StereoKitC.vec3_magnitude(a::vec3)::Cfloat
end
function vec2_magnitude(a)
@ccall StereoKitC.vec2_magnitude(a::vec2)::Cfloat
end
function vec3_magnitude_sq(a)
@ccall StereoKitC.vec3_magnitude_sq(a::vec3)::Cfloat
end
function vec2_magnitude_sq(a)
@ccall StereoKitC.vec2_magnitude_sq(a::vec2)::Cfloat
end
function vec3_dot(a, b)
@ccall StereoKitC.vec3_dot(a::vec3, b::vec3)::Cfloat
end
function vec2_dot(a, b)
@ccall StereoKitC.vec2_dot(a::vec2, b::vec2)::Cfloat
end
function vec3_distance_sq(a, b)
@ccall StereoKitC.vec3_distance_sq(a::vec3, b::vec3)::Cfloat
end
function vec2_distance_sq(a, b)
@ccall StereoKitC.vec2_distance_sq(a::vec2, b::vec2)::Cfloat
end
function vec3_distance(a, b)
@ccall StereoKitC.vec3_distance(a::vec3, b::vec3)::Cfloat
end
function vec2_distance(a, b)
@ccall StereoKitC.vec2_distance(a::vec2, b::vec2)::Cfloat
end
function vec3_project(a, onto_b)
@ccall StereoKitC.vec3_project(a::vec3, onto_b::vec3)::vec3
end
function vec4_normalize(a)
@ccall StereoKitC.vec4_normalize(a::vec4)::vec4
end
function vec3_normalize(a)
@ccall StereoKitC.vec3_normalize(a::vec3)::vec3
end
function vec2_normalize(a)
@ccall StereoKitC.vec2_normalize(a::vec2)::vec2
end
function vec3_abs(a)
@ccall StereoKitC.vec3_abs(a::vec3)::vec3
end
function vec2_abs(a)
@ccall StereoKitC.vec2_abs(a::vec2)::vec2
end
function vec3_lerp(a, b, t)
@ccall StereoKitC.vec3_lerp(a::vec3, b::vec3, t::Cfloat)::vec3
end
function vec2_lerp(a, b, t)
@ccall StereoKitC.vec2_lerp(a::vec2, b::vec2, t::Cfloat)::vec2
end
function vec3_in_radius(pt, center, radius)
@ccall StereoKitC.vec3_in_radius(pt::vec3, center::vec3, radius::Cfloat)::bool32_t
end
function vec2_in_radius(pt, center, radius)
@ccall StereoKitC.vec2_in_radius(pt::vec2, center::vec2, radius::Cfloat)::bool32_t
end
function plane_ray_intersect(plane, ray, out_pt)
@ccall StereoKitC.plane_ray_intersect(plane::plane_t, ray::ray_t, out_pt::Ptr{vec3})::bool32_t
end
function plane_line_intersect(plane, p1, p2, out_pt)
@ccall StereoKitC.plane_line_intersect(plane::plane_t, p1::vec3, p2::vec3, out_pt::Ptr{vec3})::bool32_t
end
function plane_point_closest(plane, pt)
@ccall StereoKitC.plane_point_closest(plane::plane_t, pt::vec3)::vec3
end
function sphere_ray_intersect(sphere, ray, out_pt)
@ccall StereoKitC.sphere_ray_intersect(sphere::sphere_t, ray::ray_t, out_pt::Ptr{vec3})::bool32_t
end
function sphere_point_contains(sphere, pt)
@ccall StereoKitC.sphere_point_contains(sphere::sphere_t, pt::vec3)::bool32_t
end
function bounds_ray_intersect(bounds, ray, out_pt)
@ccall StereoKitC.bounds_ray_intersect(bounds::bounds_t, ray::ray_t, out_pt::Ptr{vec3})::bool32_t
end
function bounds_point_contains(bounds, pt)
@ccall StereoKitC.bounds_point_contains(bounds::bounds_t, pt::vec3)::bool32_t
end
function bounds_line_contains(bounds, pt1, pt2)
@ccall StereoKitC.bounds_line_contains(bounds::bounds_t, pt1::vec3, pt2::vec3)::bool32_t
end
function bounds_capsule_contains(bounds, pt1, pt2, radius)
@ccall StereoKitC.bounds_capsule_contains(bounds::bounds_t, pt1::vec3, pt2::vec3, radius::Cfloat)::bool32_t
end
function ray_point_closest(ray, pt)
@ccall StereoKitC.ray_point_closest(ray::ray_t, pt::vec3)::vec3
end
struct color32
r::UInt8
g::UInt8
b::UInt8
a::UInt8
end
struct color128
r::Cfloat
g::Cfloat
b::Cfloat
a::Cfloat
end
function color_hsv(hue, saturation, value, transparency)
@ccall StereoKitC.color_hsv(hue::Cfloat, saturation::Cfloat, value::Cfloat, transparency::Cfloat)::color128
end
function color_to_hsv(color)
@ccall StereoKitC.color_to_hsv(color::Ptr{color128})::vec3
end
function color_lab(l, a, b, transparency)
@ccall StereoKitC.color_lab(l::Cfloat, a::Cfloat, b::Cfloat, transparency::Cfloat)::color128
end
function color_to_lab(color)
@ccall StereoKitC.color_to_lab(color::Ptr{color128})::vec3
end
function color_to_linear(srgb_gamma_correct)
@ccall StereoKitC.color_to_linear(srgb_gamma_correct::color128)::color128
end
function color_to_gamma(srgb_linear)
@ccall StereoKitC.color_to_gamma(srgb_linear::color128)::color128
end
function color_lerp(a, b, t)
@ccall StereoKitC.color_lerp(a::color128, b::color128, t::Cfloat)::color128
end
function color_to_32(a)
@ccall StereoKitC.color_to_32(a::color128)::color32
end
function color32_to_128(color)
@ccall StereoKitC.color32_to_128(color::color32)::color128
end
function color32_hex(hex)
@ccall StereoKitC.color32_hex(hex::UInt32)::color32
end
function color_hex(hex)
@ccall StereoKitC.color_hex(hex::UInt32)::color128
end
mutable struct _gradient_t end
const gradient_t = Ptr{_gradient_t}
mutable struct _mesh_t end
const mesh_t = Ptr{_mesh_t}
mutable struct _tex_t end
const tex_t = Ptr{_tex_t}
mutable struct _font_t end
const font_t = Ptr{_font_t}
mutable struct _shader_t end
const shader_t = Ptr{_shader_t}
mutable struct _material_t end
const material_t = Ptr{_material_t}
mutable struct _material_buffer_t end
const material_buffer_t = Ptr{_material_buffer_t}
mutable struct _model_t end
const model_t = Ptr{_model_t}
mutable struct _sprite_t end
const sprite_t = Ptr{_sprite_t}
mutable struct _sound_t end
const sound_t = Ptr{_sound_t}
mutable struct _solid_t end
const solid_t = Ptr{_solid_t}
struct gradient_key_t
color::color128
position::Cfloat
end
# no prototype is found for this function at stereokit.h:603:19, please use with caution
function gradient_create()
@ccall StereoKitC.gradient_create()::gradient_t
end
function gradient_create_keys(keys, count)
@ccall StereoKitC.gradient_create_keys(keys::Ptr{gradient_key_t}, count::Int32)::gradient_t
end
function gradient_add(gradient, color_linear, position)
@ccall StereoKitC.gradient_add(gradient::gradient_t, color_linear::color128, position::Cfloat)::Cvoid
end
function gradient_set(gradient, index, color_linear, position)
@ccall StereoKitC.gradient_set(gradient::gradient_t, index::Int32, color_linear::color128, position::Cfloat)::Cvoid
end
function gradient_remove(gradient, index)
@ccall StereoKitC.gradient_remove(gradient::gradient_t, index::Int32)::Cvoid
end
function gradient_count(gradient)
@ccall StereoKitC.gradient_count(gradient::gradient_t)::Int32
end
function gradient_get(gradient, at)
@ccall StereoKitC.gradient_get(gradient::gradient_t, at::Cfloat)::color128
end
function gradient_get32(gradient, at)
@ccall StereoKitC.gradient_get32(gradient::gradient_t, at::Cfloat)::color32
end
function gradient_release(gradient)
@ccall StereoKitC.gradient_release(gradient::gradient_t)::Cvoid
end
struct spherical_harmonics_t
coefficients::NTuple{9, vec3}
end
struct sh_light_t
dir_to::vec3
color::color128
end
function sh_create(lights, light_count)
@ccall StereoKitC.sh_create(lights::Ptr{sh_light_t}, light_count::Int32)::spherical_harmonics_t
end
function sh_brightness(harmonics, scale)
@ccall StereoKitC.sh_brightness(harmonics::Ptr{spherical_harmonics_t}, scale::Cfloat)::Cvoid
end
function sh_add(harmonics, light_dir, light_color)
@ccall StereoKitC.sh_add(harmonics::Ptr{spherical_harmonics_t}, light_dir::vec3, light_color::vec3)::Cvoid
end
function sh_lookup(harmonics, normal)
@ccall StereoKitC.sh_lookup(harmonics::Ptr{spherical_harmonics_t}, normal::vec3)::color128
end
function sh_dominant_dir(harmonics)
@ccall StereoKitC.sh_dominant_dir(harmonics::Ptr{spherical_harmonics_t})::vec3
end
struct vert_t
pos::vec3
norm::vec3
uv::vec2
col::color32
end
function vert_create(position, normal, texture_coordinates, vertex_color)
@ccall StereoKitC.vert_create(position::vec3, normal::vec3, texture_coordinates::vec2, vertex_color::color32)::vert_t
end
const vind_t = UInt32
function mesh_find(name)
@ccall StereoKitC.mesh_find(name::Ptr{Cchar})::mesh_t
end
# no prototype is found for this function at stereokit.h:648:17, please use with caution
function mesh_create()
@ccall StereoKitC.mesh_create()::mesh_t
end
function mesh_copy(mesh)
@ccall StereoKitC.mesh_copy(mesh::mesh_t)::mesh_t
end
function mesh_set_id(mesh, id)
@ccall StereoKitC.mesh_set_id(mesh::mesh_t, id::Ptr{Cchar})::Cvoid
end
function mesh_addref(mesh)
@ccall StereoKitC.mesh_addref(mesh::mesh_t)::Cvoid
end
function mesh_release(mesh)
@ccall StereoKitC.mesh_release(mesh::mesh_t)::Cvoid
end
function mesh_draw(mesh, material, transform, color_linear, layer)
@ccall StereoKitC.mesh_draw(mesh::mesh_t, material::material_t, transform::matrix, color_linear::color128, layer::render_layer_)::Cvoid
end
function mesh_set_keep_data(mesh, keep_data)
@ccall StereoKitC.mesh_set_keep_data(mesh::mesh_t, keep_data::bool32_t)::Cvoid
end
function mesh_get_keep_data(mesh)
@ccall StereoKitC.mesh_get_keep_data(mesh::mesh_t)::bool32_t
end
function mesh_set_data(mesh, vertices, vertex_count, indices, index_count, calculate_bounds)
@ccall StereoKitC.mesh_set_data(mesh::mesh_t, vertices::Ptr{vert_t}, vertex_count::Int32, indices::Ptr{vind_t}, index_count::Int32, calculate_bounds::bool32_t)::Cvoid
end
function mesh_set_verts(mesh, vertices, vertex_count, calculate_bounds)
@ccall StereoKitC.mesh_set_verts(mesh::mesh_t, vertices::Ptr{vert_t}, vertex_count::Int32, calculate_bounds::bool32_t)::Cvoid
end
function mesh_get_verts(mesh, out_vertices, out_vertex_count, reference_mode)
@ccall StereoKitC.mesh_get_verts(mesh::mesh_t, out_vertices::Ptr{Ptr{vert_t}}, out_vertex_count::Ptr{Int32}, reference_mode::memory_)::Cvoid
end
function mesh_get_vert_count(mesh)
@ccall StereoKitC.mesh_get_vert_count(mesh::mesh_t)::Int32
end
function mesh_set_inds(mesh, indices, index_count)
@ccall StereoKitC.mesh_set_inds(mesh::mesh_t, indices::Ptr{vind_t}, index_count::Int32)::Cvoid
end
function mesh_get_inds(mesh, out_indices, out_index_count, reference_mode)
@ccall StereoKitC.mesh_get_inds(mesh::mesh_t, out_indices::Ptr{Ptr{vind_t}}, out_index_count::Ptr{Int32}, reference_mode::memory_)::Cvoid
end
function mesh_get_ind_count(mesh)
@ccall StereoKitC.mesh_get_ind_count(mesh::mesh_t)::Int32
end
function mesh_set_draw_inds(mesh, index_count)
@ccall StereoKitC.mesh_set_draw_inds(mesh::mesh_t, index_count::Int32)::Cvoid
end
function mesh_set_bounds(mesh, bounds)
@ccall StereoKitC.mesh_set_bounds(mesh::mesh_t, bounds::Ptr{bounds_t})::Cvoid
end
function mesh_get_bounds(mesh)
@ccall StereoKitC.mesh_get_bounds(mesh::mesh_t)::bounds_t
end
function mesh_has_skin(mesh)
@ccall StereoKitC.mesh_has_skin(mesh::mesh_t)::bool32_t
end
function mesh_set_skin(mesh, bone_ids_4, bone_id_4_count, bone_weights, bone_weight_count, bone_resting_transforms, bone_count)
@ccall StereoKitC.mesh_set_skin(mesh::mesh_t, bone_ids_4::Ptr{UInt16}, bone_id_4_count::Int32, bone_weights::Ptr{vec4}, bone_weight_count::Int32, bone_resting_transforms::Ptr{matrix}, bone_count::Int32)::Cvoid
end
function mesh_update_skin(mesh, bone_transforms, bone_count)
@ccall StereoKitC.mesh_update_skin(mesh::mesh_t, bone_transforms::Ptr{matrix}, bone_count::Int32)::Cvoid
end
function mesh_ray_intersect(mesh, model_space_ray, out_pt, out_start_inds)
@ccall StereoKitC.mesh_ray_intersect(mesh::mesh_t, model_space_ray::ray_t, out_pt::Ptr{ray_t}, out_start_inds::Ptr{UInt32})::bool32_t
end
function mesh_get_triangle(mesh, triangle_index, a, b, c)
@ccall StereoKitC.mesh_get_triangle(mesh::mesh_t, triangle_index::UInt32, a::Ptr{vert_t}, b::Ptr{vert_t}, c::Ptr{vert_t})::bool32_t
end
function mesh_gen_plane(dimensions, plane_normal, plane_top_direction, subdivisions)
@ccall StereoKitC.mesh_gen_plane(dimensions::vec2, plane_normal::vec3, plane_top_direction::vec3, subdivisions::Int32)::mesh_t
end
function mesh_gen_cube(dimensions, subdivisions)
@ccall StereoKitC.mesh_gen_cube(dimensions::vec3, subdivisions::Int32)::mesh_t
end
function mesh_gen_sphere(diameter, subdivisions)
@ccall StereoKitC.mesh_gen_sphere(diameter::Cfloat, subdivisions::Int32)::mesh_t
end
function mesh_gen_rounded_cube(dimensions, edge_radius, subdivisions)
@ccall StereoKitC.mesh_gen_rounded_cube(dimensions::vec3, edge_radius::Cfloat, subdivisions::Int32)::mesh_t
end
function mesh_gen_cylinder(diameter, depth, direction, subdivisions)
@ccall StereoKitC.mesh_gen_cylinder(diameter::Cfloat, depth::Cfloat, direction::vec3, subdivisions::Int32)::mesh_t
end
@cenum tex_type_::UInt32 begin
tex_type_image_nomips = 1
tex_type_cubemap = 2
tex_type_rendertarget = 4
tex_type_depth = 8
tex_type_mips = 16
tex_type_dynamic = 32
tex_type_image = 17
end
@cenum tex_format_::UInt32 begin
tex_format_none = 0
tex_format_rgba32 = 1
tex_format_rgba32_linear = 2
tex_format_bgra32 = 3
tex_format_bgra32_linear = 4
tex_format_rg11b10 = 5
tex_format_rgb10a2 = 6
tex_format_rgba64 = 7
tex_format_rgba64s = 8
tex_format_rgba64f = 9
tex_format_rgba128 = 10
tex_format_r8 = 11
tex_format_r16 = 12
tex_format_r32 = 13
tex_format_depthstencil = 14
tex_format_depth32 = 15
tex_format_depth16 = 16
tex_format_rgba64u = 7
end
@cenum tex_sample_::UInt32 begin
tex_sample_linear = 0
tex_sample_point = 1
tex_sample_anisotropic = 2
end
@cenum tex_address_::UInt32 begin
tex_address_wrap = 0
tex_address_clamp = 1
tex_address_mirror = 2
end
function tex_find(id)
@ccall StereoKitC.tex_find(id::Ptr{Cchar})::tex_t
end
function tex_create(type, format)
@ccall StereoKitC.tex_create(type::tex_type_, format::tex_format_)::tex_t
end
function tex_create_color32(data, width, height, srgb_data)
@ccall StereoKitC.tex_create_color32(data::Ptr{color32}, width::Int32, height::Int32, srgb_data::bool32_t)::tex_t
end
function tex_create_color128(data, width, height, srgb_data)
@ccall StereoKitC.tex_create_color128(data::Ptr{color128}, width::Int32, height::Int32, srgb_data::bool32_t)::tex_t
end
function tex_create_mem(file_data, file_size, srgb_data, priority)
@ccall StereoKitC.tex_create_mem(file_data::Ptr{Cvoid}, file_size::Csize_t, srgb_data::bool32_t, priority::Int32)::tex_t
end
function tex_create_file(file, srgb_data, priority)
@ccall StereoKitC.tex_create_file(file::Ptr{Cchar}, srgb_data::bool32_t, priority::Int32)::tex_t
end
function tex_create_file_arr(files, file_count, srgb_data, priority)
@ccall StereoKitC.tex_create_file_arr(files::Ptr{Ptr{Cchar}}, file_count::Int32, srgb_data::bool32_t, priority::Int32)::tex_t
end
function tex_create_cubemap_file(equirectangular_file, srgb_data, out_sh_lighting_info, priority)
@ccall StereoKitC.tex_create_cubemap_file(equirectangular_file::Ptr{Cchar}, srgb_data::bool32_t, out_sh_lighting_info::Ptr{spherical_harmonics_t}, priority::Int32)::tex_t
end
function tex_create_cubemap_files(cube_face_file_xxyyzz, srgb_data, out_sh_lighting_info, priority)
@ccall StereoKitC.tex_create_cubemap_files(cube_face_file_xxyyzz::Ptr{Ptr{Cchar}}, srgb_data::bool32_t, out_sh_lighting_info::Ptr{spherical_harmonics_t}, priority::Int32)::tex_t
end