-
Notifications
You must be signed in to change notification settings - Fork 0
/
raylibw.cpp
2002 lines (1867 loc) · 109 KB
/
raylibw.cpp
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
#include "raylib.h"
#include "pocketpy.h"
namespace pkpy{
template<typename T0, typename T1>
T1 _struct_cast(T0& v){
static_assert(sizeof(T0) == sizeof(T1));
static_assert(std::is_trivially_copyable_v<T0>);
static_assert(std::is_trivially_copyable_v<T1>);
return (T1&)v;
}
template<size_t N>
void _bind_enums(VM* vm, PyVar mod, Str name, const std::pair<const char*, i64> (&enums)[N]){
Dict d(vm);
for(auto [k, v]: enums){
PyVar int_obj = py_var(vm, v);
mod->attr().set(k, int_obj);
d.set(int_obj, py_var(vm, k));
}
mod->attr().set(name + "_NAMES", py_var(vm, std::move(d)));
}
PyVar py_var(VM* vm, Vector2 v){
return py_var(vm, _struct_cast<Vector2, Vec2>(v));
}
template<>
Vector2 py_cast<Vector2>(VM* vm, PyVar obj){
Vec2 v = py_cast<Vec2>(vm, obj);
return _struct_cast<Vec2, Vector2>(v);
}
template<>
Vector2 _py_cast<Vector2>(VM* vm, PyVar obj){
Vec2 v = _py_cast<Vec2>(vm, obj);
return _struct_cast<Vec2, Vector2>(v);
}
PyVar py_var(VM* vm, Vector3 v){
return py_var(vm, _struct_cast<Vector3, Vec3>(v));
}
template<>
Vector3 py_cast<Vector3>(VM* vm, PyVar obj){
Vec3 v = py_cast<Vec3>(vm, obj);
return _struct_cast<Vec3, Vector3>(v);
}
template<>
Vector3 _py_cast<Vector3>(VM* vm, PyVar obj){
Vec3 v = _py_cast<Vec3>(vm, obj);
return _struct_cast<Vec3, Vector3>(v);
}
PyVar py_var(VM* vm, Vector4 v){
return py_var(vm, _struct_cast<Vector4, Vec4>(v));
}
template<>
Vector4 py_cast<Vector4>(VM* vm, PyVar obj){
Vec4 v = py_cast<Vec4>(vm, obj);
return _struct_cast<Vec4, Vector4>(v);
}
template<>
Vector4 _py_cast<Vector4>(VM* vm, PyVar obj){
Vec4 v = _py_cast<Vec4>(vm, obj);
return _struct_cast<Vec4, Vector4>(v);
}
/*************** Matrix ***************/
struct wrapped__Matrix{
Matrix _value;
wrapped__Matrix() = default;
wrapped__Matrix(const wrapped__Matrix& other) = default;
wrapped__Matrix(const Matrix& other){
memcpy(&_value, &other, sizeof(Matrix));
}
bool operator==(const wrapped__Matrix& other) const{
return memcmp(&_value, &other._value, sizeof(Matrix)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"m0", "m4", "m8", "m12", "m1", "m5", "m9", "m13", "m2", "m6", "m10", "m14", "m3", "m7", "m11", "m15"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 16) vm->TypeError(_S("expected 16 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Matrix)
PY_FIELD(wrapped__Matrix, "m0", _value.m0)
PY_FIELD(wrapped__Matrix, "m4", _value.m4)
PY_FIELD(wrapped__Matrix, "m8", _value.m8)
PY_FIELD(wrapped__Matrix, "m12", _value.m12)
PY_FIELD(wrapped__Matrix, "m1", _value.m1)
PY_FIELD(wrapped__Matrix, "m5", _value.m5)
PY_FIELD(wrapped__Matrix, "m9", _value.m9)
PY_FIELD(wrapped__Matrix, "m13", _value.m13)
PY_FIELD(wrapped__Matrix, "m2", _value.m2)
PY_FIELD(wrapped__Matrix, "m6", _value.m6)
PY_FIELD(wrapped__Matrix, "m10", _value.m10)
PY_FIELD(wrapped__Matrix, "m14", _value.m14)
PY_FIELD(wrapped__Matrix, "m3", _value.m3)
PY_FIELD(wrapped__Matrix, "m7", _value.m7)
PY_FIELD(wrapped__Matrix, "m11", _value.m11)
PY_FIELD(wrapped__Matrix, "m15", _value.m15)
}
};
PyVar py_var(VM* vm, Matrix v){
return vm->new_user_object<wrapped__Matrix>(v);
}
template<>
Matrix py_cast<Matrix>(VM* vm, PyVar obj){
return py_cast<wrapped__Matrix&>(vm, obj)._value;
}
template<>
Matrix _py_cast<Matrix>(VM* vm, PyVar obj){
return _py_cast<wrapped__Matrix&>(vm, obj)._value;
}
/*************** Color ***************/
struct wrapped__Color{
Color _value;
wrapped__Color() = default;
wrapped__Color(const wrapped__Color& other) = default;
wrapped__Color(const Color& other){
memcpy(&_value, &other, sizeof(Color));
}
bool operator==(const wrapped__Color& other) const{
return memcmp(&_value, &other._value, sizeof(Color)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"r", "g", "b", "a"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 4) vm->TypeError(_S("expected 4 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Color)
PY_FIELD(wrapped__Color, "r", _value.r)
PY_FIELD(wrapped__Color, "g", _value.g)
PY_FIELD(wrapped__Color, "b", _value.b)
PY_FIELD(wrapped__Color, "a", _value.a)
}
};
PyVar py_var(VM* vm, Color v){
return vm->new_user_object<wrapped__Color>(v);
}
template<>
Color py_cast<Color>(VM* vm, PyVar obj){
return py_cast<wrapped__Color&>(vm, obj)._value;
}
template<>
Color _py_cast<Color>(VM* vm, PyVar obj){
return _py_cast<wrapped__Color&>(vm, obj)._value;
}
/*************** Rectangle ***************/
struct wrapped__Rectangle{
Rectangle _value;
wrapped__Rectangle() = default;
wrapped__Rectangle(const wrapped__Rectangle& other) = default;
wrapped__Rectangle(const Rectangle& other){
memcpy(&_value, &other, sizeof(Rectangle));
}
bool operator==(const wrapped__Rectangle& other) const{
return memcmp(&_value, &other._value, sizeof(Rectangle)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"x", "y", "width", "height"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 4) vm->TypeError(_S("expected 4 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Rectangle)
PY_FIELD(wrapped__Rectangle, "x", _value.x)
PY_FIELD(wrapped__Rectangle, "y", _value.y)
PY_FIELD(wrapped__Rectangle, "width", _value.width)
PY_FIELD(wrapped__Rectangle, "height", _value.height)
}
};
PyVar py_var(VM* vm, Rectangle v){
return vm->new_user_object<wrapped__Rectangle>(v);
}
template<>
Rectangle py_cast<Rectangle>(VM* vm, PyVar obj){
return py_cast<wrapped__Rectangle&>(vm, obj)._value;
}
template<>
Rectangle _py_cast<Rectangle>(VM* vm, PyVar obj){
return _py_cast<wrapped__Rectangle&>(vm, obj)._value;
}
/*************** Image ***************/
struct wrapped__Image{
Image _value;
wrapped__Image() = default;
wrapped__Image(const wrapped__Image& other) = default;
wrapped__Image(const Image& other){
memcpy(&_value, &other, sizeof(Image));
}
bool operator==(const wrapped__Image& other) const{
return memcmp(&_value, &other._value, sizeof(Image)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"data", "width", "height", "mipmaps", "format"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 5) vm->TypeError(_S("expected 5 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Image)
PY_FIELD(wrapped__Image, "data", _value.data)
PY_FIELD(wrapped__Image, "width", _value.width)
PY_FIELD(wrapped__Image, "height", _value.height)
PY_FIELD(wrapped__Image, "mipmaps", _value.mipmaps)
PY_FIELD(wrapped__Image, "format", _value.format)
}
};
PyVar py_var(VM* vm, Image v){
return vm->new_user_object<wrapped__Image>(v);
}
template<>
Image py_cast<Image>(VM* vm, PyVar obj){
return py_cast<wrapped__Image&>(vm, obj)._value;
}
template<>
Image _py_cast<Image>(VM* vm, PyVar obj){
return _py_cast<wrapped__Image&>(vm, obj)._value;
}
/*************** Texture ***************/
struct wrapped__Texture{
Texture _value;
wrapped__Texture() = default;
wrapped__Texture(const wrapped__Texture& other) = default;
wrapped__Texture(const Texture& other){
memcpy(&_value, &other, sizeof(Texture));
}
bool operator==(const wrapped__Texture& other) const{
return memcmp(&_value, &other._value, sizeof(Texture)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"id", "width", "height", "mipmaps", "format"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 5) vm->TypeError(_S("expected 5 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Texture)
PY_FIELD(wrapped__Texture, "id", _value.id)
PY_FIELD(wrapped__Texture, "width", _value.width)
PY_FIELD(wrapped__Texture, "height", _value.height)
PY_FIELD(wrapped__Texture, "mipmaps", _value.mipmaps)
PY_FIELD(wrapped__Texture, "format", _value.format)
}
};
PyVar py_var(VM* vm, Texture v){
return vm->new_user_object<wrapped__Texture>(v);
}
template<>
Texture py_cast<Texture>(VM* vm, PyVar obj){
return py_cast<wrapped__Texture&>(vm, obj)._value;
}
template<>
Texture _py_cast<Texture>(VM* vm, PyVar obj){
return _py_cast<wrapped__Texture&>(vm, obj)._value;
}
/*************** RenderTexture ***************/
struct wrapped__RenderTexture{
RenderTexture _value;
wrapped__RenderTexture() = default;
wrapped__RenderTexture(const wrapped__RenderTexture& other) = default;
wrapped__RenderTexture(const RenderTexture& other){
memcpy(&_value, &other, sizeof(RenderTexture));
}
bool operator==(const wrapped__RenderTexture& other) const{
return memcmp(&_value, &other._value, sizeof(RenderTexture)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"id", "texture", "depth"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 3) vm->TypeError(_S("expected 3 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__RenderTexture)
PY_FIELD(wrapped__RenderTexture, "id", _value.id)
PY_FIELD(wrapped__RenderTexture, "texture", _value.texture)
PY_FIELD(wrapped__RenderTexture, "depth", _value.depth)
}
};
PyVar py_var(VM* vm, RenderTexture v){
return vm->new_user_object<wrapped__RenderTexture>(v);
}
template<>
RenderTexture py_cast<RenderTexture>(VM* vm, PyVar obj){
return py_cast<wrapped__RenderTexture&>(vm, obj)._value;
}
template<>
RenderTexture _py_cast<RenderTexture>(VM* vm, PyVar obj){
return _py_cast<wrapped__RenderTexture&>(vm, obj)._value;
}
/*************** NPatchInfo ***************/
struct wrapped__NPatchInfo{
NPatchInfo _value;
wrapped__NPatchInfo() = default;
wrapped__NPatchInfo(const wrapped__NPatchInfo& other) = default;
wrapped__NPatchInfo(const NPatchInfo& other){
memcpy(&_value, &other, sizeof(NPatchInfo));
}
bool operator==(const wrapped__NPatchInfo& other) const{
return memcmp(&_value, &other._value, sizeof(NPatchInfo)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"source", "left", "top", "right", "bottom", "layout"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 6) vm->TypeError(_S("expected 6 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__NPatchInfo)
PY_FIELD(wrapped__NPatchInfo, "source", _value.source)
PY_FIELD(wrapped__NPatchInfo, "left", _value.left)
PY_FIELD(wrapped__NPatchInfo, "top", _value.top)
PY_FIELD(wrapped__NPatchInfo, "right", _value.right)
PY_FIELD(wrapped__NPatchInfo, "bottom", _value.bottom)
PY_FIELD(wrapped__NPatchInfo, "layout", _value.layout)
}
};
PyVar py_var(VM* vm, NPatchInfo v){
return vm->new_user_object<wrapped__NPatchInfo>(v);
}
template<>
NPatchInfo py_cast<NPatchInfo>(VM* vm, PyVar obj){
return py_cast<wrapped__NPatchInfo&>(vm, obj)._value;
}
template<>
NPatchInfo _py_cast<NPatchInfo>(VM* vm, PyVar obj){
return _py_cast<wrapped__NPatchInfo&>(vm, obj)._value;
}
/*************** GlyphInfo ***************/
struct wrapped__GlyphInfo{
GlyphInfo _value;
wrapped__GlyphInfo() = default;
wrapped__GlyphInfo(const wrapped__GlyphInfo& other) = default;
wrapped__GlyphInfo(const GlyphInfo& other){
memcpy(&_value, &other, sizeof(GlyphInfo));
}
bool operator==(const wrapped__GlyphInfo& other) const{
return memcmp(&_value, &other._value, sizeof(GlyphInfo)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"value", "offsetX", "offsetY", "advanceX", "image"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 5) vm->TypeError(_S("expected 5 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__GlyphInfo)
PY_FIELD(wrapped__GlyphInfo, "value", _value.value)
PY_FIELD(wrapped__GlyphInfo, "offsetX", _value.offsetX)
PY_FIELD(wrapped__GlyphInfo, "offsetY", _value.offsetY)
PY_FIELD(wrapped__GlyphInfo, "advanceX", _value.advanceX)
PY_FIELD(wrapped__GlyphInfo, "image", _value.image)
}
};
PyVar py_var(VM* vm, GlyphInfo v){
return vm->new_user_object<wrapped__GlyphInfo>(v);
}
template<>
GlyphInfo py_cast<GlyphInfo>(VM* vm, PyVar obj){
return py_cast<wrapped__GlyphInfo&>(vm, obj)._value;
}
template<>
GlyphInfo _py_cast<GlyphInfo>(VM* vm, PyVar obj){
return _py_cast<wrapped__GlyphInfo&>(vm, obj)._value;
}
/*************** Font ***************/
struct wrapped__Font{
Font _value;
wrapped__Font() = default;
wrapped__Font(const wrapped__Font& other) = default;
wrapped__Font(const Font& other){
memcpy(&_value, &other, sizeof(Font));
}
bool operator==(const wrapped__Font& other) const{
return memcmp(&_value, &other._value, sizeof(Font)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"baseSize", "glyphCount", "glyphPadding", "texture", "recs", "glyphs"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 6) vm->TypeError(_S("expected 6 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Font)
PY_FIELD(wrapped__Font, "baseSize", _value.baseSize)
PY_FIELD(wrapped__Font, "glyphCount", _value.glyphCount)
PY_FIELD(wrapped__Font, "glyphPadding", _value.glyphPadding)
PY_FIELD(wrapped__Font, "texture", _value.texture)
PY_FIELD(wrapped__Font, "recs", _value.recs)
PY_FIELD(wrapped__Font, "glyphs", _value.glyphs)
}
};
PyVar py_var(VM* vm, Font v){
return vm->new_user_object<wrapped__Font>(v);
}
template<>
Font py_cast<Font>(VM* vm, PyVar obj){
return py_cast<wrapped__Font&>(vm, obj)._value;
}
template<>
Font _py_cast<Font>(VM* vm, PyVar obj){
return _py_cast<wrapped__Font&>(vm, obj)._value;
}
/*************** Camera3D ***************/
struct wrapped__Camera3D{
Camera3D _value;
wrapped__Camera3D() = default;
wrapped__Camera3D(const wrapped__Camera3D& other) = default;
wrapped__Camera3D(const Camera3D& other){
memcpy(&_value, &other, sizeof(Camera3D));
}
bool operator==(const wrapped__Camera3D& other) const{
return memcmp(&_value, &other._value, sizeof(Camera3D)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"position", "target", "up", "fovy", "projection"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 5) vm->TypeError(_S("expected 5 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Camera3D)
PY_FIELD(wrapped__Camera3D, "position", _value.position)
PY_FIELD(wrapped__Camera3D, "target", _value.target)
PY_FIELD(wrapped__Camera3D, "up", _value.up)
PY_FIELD(wrapped__Camera3D, "fovy", _value.fovy)
PY_FIELD(wrapped__Camera3D, "projection", _value.projection)
}
};
PyVar py_var(VM* vm, Camera3D v){
return vm->new_user_object<wrapped__Camera3D>(v);
}
template<>
Camera3D py_cast<Camera3D>(VM* vm, PyVar obj){
return py_cast<wrapped__Camera3D&>(vm, obj)._value;
}
template<>
Camera3D _py_cast<Camera3D>(VM* vm, PyVar obj){
return _py_cast<wrapped__Camera3D&>(vm, obj)._value;
}
/*************** Camera2D ***************/
struct wrapped__Camera2D{
Camera2D _value;
wrapped__Camera2D() = default;
wrapped__Camera2D(const wrapped__Camera2D& other) = default;
wrapped__Camera2D(const Camera2D& other){
memcpy(&_value, &other, sizeof(Camera2D));
}
bool operator==(const wrapped__Camera2D& other) const{
return memcmp(&_value, &other._value, sizeof(Camera2D)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"offset", "target", "rotation", "zoom"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 4) vm->TypeError(_S("expected 4 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Camera2D)
PY_FIELD(wrapped__Camera2D, "offset", _value.offset)
PY_FIELD(wrapped__Camera2D, "target", _value.target)
PY_FIELD(wrapped__Camera2D, "rotation", _value.rotation)
PY_FIELD(wrapped__Camera2D, "zoom", _value.zoom)
}
};
PyVar py_var(VM* vm, Camera2D v){
return vm->new_user_object<wrapped__Camera2D>(v);
}
template<>
Camera2D py_cast<Camera2D>(VM* vm, PyVar obj){
return py_cast<wrapped__Camera2D&>(vm, obj)._value;
}
template<>
Camera2D _py_cast<Camera2D>(VM* vm, PyVar obj){
return _py_cast<wrapped__Camera2D&>(vm, obj)._value;
}
/*************** Mesh ***************/
struct wrapped__Mesh{
Mesh _value;
wrapped__Mesh() = default;
wrapped__Mesh(const wrapped__Mesh& other) = default;
wrapped__Mesh(const Mesh& other){
memcpy(&_value, &other, sizeof(Mesh));
}
bool operator==(const wrapped__Mesh& other) const{
return memcmp(&_value, &other._value, sizeof(Mesh)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"vertexCount", "triangleCount", "vertices", "texcoords", "texcoords2", "normals", "tangents", "colors", "indices", "animVertices", "animNormals", "boneIds", "boneWeights", "vaoId", "vboId"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 15) vm->TypeError(_S("expected 15 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Mesh)
PY_FIELD(wrapped__Mesh, "vertexCount", _value.vertexCount)
PY_FIELD(wrapped__Mesh, "triangleCount", _value.triangleCount)
PY_FIELD(wrapped__Mesh, "vertices", _value.vertices)
PY_FIELD(wrapped__Mesh, "texcoords", _value.texcoords)
PY_FIELD(wrapped__Mesh, "texcoords2", _value.texcoords2)
PY_FIELD(wrapped__Mesh, "normals", _value.normals)
PY_FIELD(wrapped__Mesh, "tangents", _value.tangents)
PY_FIELD(wrapped__Mesh, "colors", _value.colors)
PY_FIELD(wrapped__Mesh, "indices", _value.indices)
PY_FIELD(wrapped__Mesh, "animVertices", _value.animVertices)
PY_FIELD(wrapped__Mesh, "animNormals", _value.animNormals)
PY_FIELD(wrapped__Mesh, "boneIds", _value.boneIds)
PY_FIELD(wrapped__Mesh, "boneWeights", _value.boneWeights)
PY_FIELD(wrapped__Mesh, "vaoId", _value.vaoId)
PY_FIELD(wrapped__Mesh, "vboId", _value.vboId)
}
};
PyVar py_var(VM* vm, Mesh v){
return vm->new_user_object<wrapped__Mesh>(v);
}
template<>
Mesh py_cast<Mesh>(VM* vm, PyVar obj){
return py_cast<wrapped__Mesh&>(vm, obj)._value;
}
template<>
Mesh _py_cast<Mesh>(VM* vm, PyVar obj){
return _py_cast<wrapped__Mesh&>(vm, obj)._value;
}
/*************** Shader ***************/
struct wrapped__Shader{
Shader _value;
wrapped__Shader() = default;
wrapped__Shader(const wrapped__Shader& other) = default;
wrapped__Shader(const Shader& other){
memcpy(&_value, &other, sizeof(Shader));
}
bool operator==(const wrapped__Shader& other) const{
return memcmp(&_value, &other._value, sizeof(Shader)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"id", "locs"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 2) vm->TypeError(_S("expected 2 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Shader)
PY_FIELD(wrapped__Shader, "id", _value.id)
PY_FIELD(wrapped__Shader, "locs", _value.locs)
}
};
PyVar py_var(VM* vm, Shader v){
return vm->new_user_object<wrapped__Shader>(v);
}
template<>
Shader py_cast<Shader>(VM* vm, PyVar obj){
return py_cast<wrapped__Shader&>(vm, obj)._value;
}
template<>
Shader _py_cast<Shader>(VM* vm, PyVar obj){
return _py_cast<wrapped__Shader&>(vm, obj)._value;
}
/*************** MaterialMap ***************/
struct wrapped__MaterialMap{
MaterialMap _value;
wrapped__MaterialMap() = default;
wrapped__MaterialMap(const wrapped__MaterialMap& other) = default;
wrapped__MaterialMap(const MaterialMap& other){
memcpy(&_value, &other, sizeof(MaterialMap));
}
bool operator==(const wrapped__MaterialMap& other) const{
return memcmp(&_value, &other._value, sizeof(MaterialMap)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"texture", "color", "value"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 3) vm->TypeError(_S("expected 3 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__MaterialMap)
PY_FIELD(wrapped__MaterialMap, "texture", _value.texture)
PY_FIELD(wrapped__MaterialMap, "color", _value.color)
PY_FIELD(wrapped__MaterialMap, "value", _value.value)
}
};
PyVar py_var(VM* vm, MaterialMap v){
return vm->new_user_object<wrapped__MaterialMap>(v);
}
template<>
MaterialMap py_cast<MaterialMap>(VM* vm, PyVar obj){
return py_cast<wrapped__MaterialMap&>(vm, obj)._value;
}
template<>
MaterialMap _py_cast<MaterialMap>(VM* vm, PyVar obj){
return _py_cast<wrapped__MaterialMap&>(vm, obj)._value;
}
/*************** Material ***************/
struct wrapped__Material{
Material _value;
wrapped__Material() = default;
wrapped__Material(const wrapped__Material& other) = default;
wrapped__Material(const Material& other){
memcpy(&_value, &other, sizeof(Material));
}
bool operator==(const wrapped__Material& other) const{
return memcmp(&_value, &other._value, sizeof(Material)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"shader", "maps", "params"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 3) vm->TypeError(_S("expected 3 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Material)
PY_FIELD(wrapped__Material, "shader", _value.shader)
PY_FIELD(wrapped__Material, "maps", _value.maps)
PY_READONLY_FIELD(wrapped__Material, "params", _value.params)
}
};
PyVar py_var(VM* vm, Material v){
return vm->new_user_object<wrapped__Material>(v);
}
template<>
Material py_cast<Material>(VM* vm, PyVar obj){
return py_cast<wrapped__Material&>(vm, obj)._value;
}
template<>
Material _py_cast<Material>(VM* vm, PyVar obj){
return _py_cast<wrapped__Material&>(vm, obj)._value;
}
/*************** Transform ***************/
struct wrapped__Transform{
Transform _value;
wrapped__Transform() = default;
wrapped__Transform(const wrapped__Transform& other) = default;
wrapped__Transform(const Transform& other){
memcpy(&_value, &other, sizeof(Transform));
}
bool operator==(const wrapped__Transform& other) const{
return memcmp(&_value, &other._value, sizeof(Transform)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"translation", "rotation", "scale"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 3) vm->TypeError(_S("expected 3 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Transform)
PY_FIELD(wrapped__Transform, "translation", _value.translation)
PY_FIELD(wrapped__Transform, "rotation", _value.rotation)
PY_FIELD(wrapped__Transform, "scale", _value.scale)
}
};
PyVar py_var(VM* vm, Transform v){
return vm->new_user_object<wrapped__Transform>(v);
}
template<>
Transform py_cast<Transform>(VM* vm, PyVar obj){
return py_cast<wrapped__Transform&>(vm, obj)._value;
}
template<>
Transform _py_cast<Transform>(VM* vm, PyVar obj){
return _py_cast<wrapped__Transform&>(vm, obj)._value;
}
/*************** BoneInfo ***************/
struct wrapped__BoneInfo{
BoneInfo _value;
wrapped__BoneInfo() = default;
wrapped__BoneInfo(const wrapped__BoneInfo& other) = default;
wrapped__BoneInfo(const BoneInfo& other){
memcpy(&_value, &other, sizeof(BoneInfo));
}
bool operator==(const wrapped__BoneInfo& other) const{
return memcmp(&_value, &other._value, sizeof(BoneInfo)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"name", "parent"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 2) vm->TypeError(_S("expected 2 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__BoneInfo)
PY_READONLY_FIELD(wrapped__BoneInfo, "name", _value.name)
PY_FIELD(wrapped__BoneInfo, "parent", _value.parent)
}
};
PyVar py_var(VM* vm, BoneInfo v){
return vm->new_user_object<wrapped__BoneInfo>(v);
}
template<>
BoneInfo py_cast<BoneInfo>(VM* vm, PyVar obj){
return py_cast<wrapped__BoneInfo&>(vm, obj)._value;
}
template<>
BoneInfo _py_cast<BoneInfo>(VM* vm, PyVar obj){
return _py_cast<wrapped__BoneInfo&>(vm, obj)._value;
}
/*************** Model ***************/
struct wrapped__Model{
Model _value;
wrapped__Model() = default;
wrapped__Model(const wrapped__Model& other) = default;
wrapped__Model(const Model& other){
memcpy(&_value, &other, sizeof(Model));
}
bool operator==(const wrapped__Model& other) const{
return memcmp(&_value, &other._value, sizeof(Model)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"transform", "meshCount", "materialCount", "meshes", "materials", "meshMaterial", "boneCount", "bones", "bindPose"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 9) vm->TypeError(_S("expected 9 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Model)
PY_FIELD(wrapped__Model, "transform", _value.transform)
PY_FIELD(wrapped__Model, "meshCount", _value.meshCount)
PY_FIELD(wrapped__Model, "materialCount", _value.materialCount)
PY_FIELD(wrapped__Model, "meshes", _value.meshes)
PY_FIELD(wrapped__Model, "materials", _value.materials)
PY_FIELD(wrapped__Model, "meshMaterial", _value.meshMaterial)
PY_FIELD(wrapped__Model, "boneCount", _value.boneCount)
PY_FIELD(wrapped__Model, "bones", _value.bones)
PY_FIELD(wrapped__Model, "bindPose", _value.bindPose)
}
};
PyVar py_var(VM* vm, Model v){
return vm->new_user_object<wrapped__Model>(v);
}
template<>
Model py_cast<Model>(VM* vm, PyVar obj){
return py_cast<wrapped__Model&>(vm, obj)._value;
}
template<>
Model _py_cast<Model>(VM* vm, PyVar obj){
return _py_cast<wrapped__Model&>(vm, obj)._value;
}
/*************** ModelAnimation ***************/
struct wrapped__ModelAnimation{
ModelAnimation _value;
wrapped__ModelAnimation() = default;
wrapped__ModelAnimation(const wrapped__ModelAnimation& other) = default;
wrapped__ModelAnimation(const ModelAnimation& other){
memcpy(&_value, &other, sizeof(ModelAnimation));
}
bool operator==(const wrapped__ModelAnimation& other) const{
return memcmp(&_value, &other._value, sizeof(ModelAnimation)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"boneCount", "frameCount", "bones", "framePoses", "name"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 5) vm->TypeError(_S("expected 5 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__ModelAnimation)
PY_FIELD(wrapped__ModelAnimation, "boneCount", _value.boneCount)
PY_FIELD(wrapped__ModelAnimation, "frameCount", _value.frameCount)
PY_FIELD(wrapped__ModelAnimation, "bones", _value.bones)
PY_FIELD(wrapped__ModelAnimation, "framePoses", _value.framePoses)
PY_READONLY_FIELD(wrapped__ModelAnimation, "name", _value.name)
}
};
PyVar py_var(VM* vm, ModelAnimation v){
return vm->new_user_object<wrapped__ModelAnimation>(v);
}
template<>
ModelAnimation py_cast<ModelAnimation>(VM* vm, PyVar obj){
return py_cast<wrapped__ModelAnimation&>(vm, obj)._value;
}
template<>
ModelAnimation _py_cast<ModelAnimation>(VM* vm, PyVar obj){
return _py_cast<wrapped__ModelAnimation&>(vm, obj)._value;
}
/*************** Ray ***************/
struct wrapped__Ray{
Ray _value;
wrapped__Ray() = default;
wrapped__Ray(const wrapped__Ray& other) = default;
wrapped__Ray(const Ray& other){
memcpy(&_value, &other, sizeof(Ray));
}
bool operator==(const wrapped__Ray& other) const{
return memcmp(&_value, &other._value, sizeof(Ray)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"position", "direction"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 2) vm->TypeError(_S("expected 2 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__Ray)
PY_FIELD(wrapped__Ray, "position", _value.position)
PY_FIELD(wrapped__Ray, "direction", _value.direction)
}
};
PyVar py_var(VM* vm, Ray v){
return vm->new_user_object<wrapped__Ray>(v);
}
template<>
Ray py_cast<Ray>(VM* vm, PyVar obj){
return py_cast<wrapped__Ray&>(vm, obj)._value;
}
template<>
Ray _py_cast<Ray>(VM* vm, PyVar obj){
return _py_cast<wrapped__Ray&>(vm, obj)._value;
}
/*************** RayCollision ***************/
struct wrapped__RayCollision{
RayCollision _value;
wrapped__RayCollision() = default;
wrapped__RayCollision(const wrapped__RayCollision& other) = default;
wrapped__RayCollision(const RayCollision& other){
memcpy(&_value, &other, sizeof(RayCollision));
}
bool operator==(const wrapped__RayCollision& other) const{
return memcmp(&_value, &other._value, sizeof(RayCollision)) == 0;
}
static void _register(VM* vm, PyVar mod, PyVar type){
vm->bind_func(type, __init__, -1, [](VM* vm, ArgsView args){
const StrName _fields_[] = {"hit", "distance", "point", "normal"};
if(args.size() == 1) return vm->None;
if(args.size()-1 != 4) vm->TypeError(_S("expected 4 arguments, got ", args.size()-1));
for(int i=1; i<args.size(); i++){
vm->setattr(args[0], _fields_[i-1], args[i]);
}
return vm->None;
});
PY_STRUCT_LIKE(wrapped__RayCollision)
PY_FIELD(wrapped__RayCollision, "hit", _value.hit)
PY_FIELD(wrapped__RayCollision, "distance", _value.distance)
PY_FIELD(wrapped__RayCollision, "point", _value.point)
PY_FIELD(wrapped__RayCollision, "normal", _value.normal)
}
};
PyVar py_var(VM* vm, RayCollision v){
return vm->new_user_object<wrapped__RayCollision>(v);
}
template<>
RayCollision py_cast<RayCollision>(VM* vm, PyVar obj){
return py_cast<wrapped__RayCollision&>(vm, obj)._value;
}
template<>
RayCollision _py_cast<RayCollision>(VM* vm, PyVar obj){
return _py_cast<wrapped__RayCollision&>(vm, obj)._value;
}
/*************** BoundingBox ***************/
struct wrapped__BoundingBox{
BoundingBox _value;