box2d-bindings 0.1.0-x86_64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,832 @@
1
+ # Ruby-Box2D : Yet another Box2D wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/box2d-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module Box2D
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ MAX_POLYGON_VERTICES = 8
14
+
15
+ # Enum
16
+
17
+ TOIState_toiStateUnknown = 0
18
+ TOIState_toiStateFailed = 1
19
+ TOIState_toiStateOverlapped = 2
20
+ TOIState_toiStateHit = 3
21
+ TOIState_toiStateSeparated = 4
22
+
23
+ # Typedef
24
+
25
+ typedef :int, :b2TOIState
26
+ typedef :pointer, :b2TreeQueryCallbackFcn
27
+ typedef :pointer, :b2TreeRayCastCallbackFcn
28
+ typedef :pointer, :b2TreeShapeCastCallbackFcn
29
+
30
+ # Struct
31
+
32
+
33
+ class TreeNode_Union < FFI::Union
34
+ layout(
35
+ :parent, :int,
36
+ :next, :int,
37
+ )
38
+ end
39
+
40
+ class TreeNode < FFI::Struct
41
+ layout(
42
+ :aabb, AABB,
43
+ :categoryBits, :uint,
44
+ :union, TreeNode_Union,
45
+ :child1, :int,
46
+ :child2, :int,
47
+ :userData, :int,
48
+ :height, :short,
49
+ :enlarged, :int,
50
+ :pad, [:char, 9],
51
+ )
52
+ def aabb = self[:aabb]
53
+ def aabb=(v) self[:aabb] = v end
54
+ def categoryBits = self[:categoryBits]
55
+ def categoryBits=(v) self[:categoryBits] = v end
56
+ def union = self[:union]
57
+ def union=(v) self[:union] = v end
58
+ def child1 = self[:child1]
59
+ def child1=(v) self[:child1] = v end
60
+ def child2 = self[:child2]
61
+ def child2=(v) self[:child2] = v end
62
+ def userData = self[:userData]
63
+ def userData=(v) self[:userData] = v end
64
+ def height = self[:height]
65
+ def height=(v) self[:height] = v end
66
+ def enlarged = self[:enlarged]
67
+ def enlarged=(v) self[:enlarged] = v end
68
+ def pad = self[:pad]
69
+ def pad=(v) self[:pad] = v end
70
+ def self.create_as(_aabb_, _categoryBits_, _union_, _child1_, _child2_, _userData_, _height_, _enlarged_, _pad_)
71
+ instance = b2TreeNode.new
72
+ instance[:aabb] = _aabb_
73
+ instance[:categoryBits] = _categoryBits_
74
+ instance[:union] = _union_
75
+ instance[:child1] = _child1_
76
+ instance[:child2] = _child2_
77
+ instance[:userData] = _userData_
78
+ instance[:height] = _height_
79
+ instance[:enlarged] = _enlarged_
80
+ instance[:pad] = _pad_
81
+ instance
82
+ end
83
+ end
84
+
85
+ class SimplexCache < FFI::Struct
86
+ layout(
87
+ :count, :ushort,
88
+ :indexA, [:uchar, 3],
89
+ :indexB, [:uchar, 3],
90
+ )
91
+ def count = self[:count]
92
+ def count=(v) self[:count] = v end
93
+ def indexA = self[:indexA]
94
+ def indexA=(v) self[:indexA] = v end
95
+ def indexB = self[:indexB]
96
+ def indexB=(v) self[:indexB] = v end
97
+ def self.create_as(_count_, _indexA_, _indexB_)
98
+ instance = SimplexCache.new
99
+ instance[:count] = _count_
100
+ instance[:indexA] = _indexA_
101
+ instance[:indexB] = _indexB_
102
+ instance
103
+ end
104
+ end
105
+
106
+ class Hull < FFI::Struct
107
+ layout(
108
+ :points, [Vec2, 8],
109
+ :count, :int,
110
+ )
111
+ def points = self[:points]
112
+ def points=(v) self[:points] = v end
113
+ def count = self[:count]
114
+ def count=(v) self[:count] = v end
115
+ def self.create_as(_points_, _count_)
116
+ instance = Hull.new
117
+ instance[:points] = _points_
118
+ instance[:count] = _count_
119
+ instance
120
+ end
121
+ end
122
+
123
+ class RayCastInput < FFI::Struct
124
+ layout(
125
+ :origin, Vec2,
126
+ :translation, Vec2,
127
+ :maxFraction, :float,
128
+ )
129
+ def origin = self[:origin]
130
+ def origin=(v) self[:origin] = v end
131
+ def translation = self[:translation]
132
+ def translation=(v) self[:translation] = v end
133
+ def maxFraction = self[:maxFraction]
134
+ def maxFraction=(v) self[:maxFraction] = v end
135
+ def self.create_as(_origin_, _translation_, _maxFraction_)
136
+ instance = RayCastInput.new
137
+ instance[:origin] = _origin_
138
+ instance[:translation] = _translation_
139
+ instance[:maxFraction] = _maxFraction_
140
+ instance
141
+ end
142
+ end
143
+
144
+ class ShapeCastInput < FFI::Struct
145
+ layout(
146
+ :points, [Vec2, 8],
147
+ :count, :int,
148
+ :radius, :float,
149
+ :translation, Vec2,
150
+ :maxFraction, :float,
151
+ )
152
+ def points = self[:points]
153
+ def points=(v) self[:points] = v end
154
+ def count = self[:count]
155
+ def count=(v) self[:count] = v end
156
+ def radius = self[:radius]
157
+ def radius=(v) self[:radius] = v end
158
+ def translation = self[:translation]
159
+ def translation=(v) self[:translation] = v end
160
+ def maxFraction = self[:maxFraction]
161
+ def maxFraction=(v) self[:maxFraction] = v end
162
+ def self.create_as(_points_, _count_, _radius_, _translation_, _maxFraction_)
163
+ instance = ShapeCastInput.new
164
+ instance[:points] = _points_
165
+ instance[:count] = _count_
166
+ instance[:radius] = _radius_
167
+ instance[:translation] = _translation_
168
+ instance[:maxFraction] = _maxFraction_
169
+ instance
170
+ end
171
+ end
172
+
173
+ class CastOutput < FFI::Struct
174
+ layout(
175
+ :normal, Vec2,
176
+ :point, Vec2,
177
+ :fraction, :float,
178
+ :iterations, :int,
179
+ :hit, :bool,
180
+ )
181
+ def normal = self[:normal]
182
+ def normal=(v) self[:normal] = v end
183
+ def point = self[:point]
184
+ def point=(v) self[:point] = v end
185
+ def fraction = self[:fraction]
186
+ def fraction=(v) self[:fraction] = v end
187
+ def iterations = self[:iterations]
188
+ def iterations=(v) self[:iterations] = v end
189
+ def hit = self[:hit]
190
+ def hit=(v) self[:hit] = v end
191
+ def self.create_as(_normal_, _point_, _fraction_, _iterations_, _hit_)
192
+ instance = CastOutput.new
193
+ instance[:normal] = _normal_
194
+ instance[:point] = _point_
195
+ instance[:fraction] = _fraction_
196
+ instance[:iterations] = _iterations_
197
+ instance[:hit] = _hit_
198
+ instance
199
+ end
200
+ end
201
+
202
+ class MassData < FFI::Struct
203
+ layout(
204
+ :mass, :float,
205
+ :center, Vec2,
206
+ :rotationalInertia, :float,
207
+ )
208
+ def mass = self[:mass]
209
+ def mass=(v) self[:mass] = v end
210
+ def center = self[:center]
211
+ def center=(v) self[:center] = v end
212
+ def rotationalInertia = self[:rotationalInertia]
213
+ def rotationalInertia=(v) self[:rotationalInertia] = v end
214
+ def self.create_as(_mass_, _center_, _rotationalInertia_)
215
+ instance = MassData.new
216
+ instance[:mass] = _mass_
217
+ instance[:center] = _center_
218
+ instance[:rotationalInertia] = _rotationalInertia_
219
+ instance
220
+ end
221
+ end
222
+
223
+ class Circle < FFI::Struct
224
+ layout(
225
+ :center, Vec2,
226
+ :radius, :float,
227
+ )
228
+ def center = self[:center]
229
+ def center=(v) self[:center] = v end
230
+ def radius = self[:radius]
231
+ def radius=(v) self[:radius] = v end
232
+ def self.create_as(_center_, _radius_)
233
+ instance = Circle.new
234
+ instance[:center] = _center_
235
+ instance[:radius] = _radius_
236
+ instance
237
+ end
238
+ end
239
+
240
+ class Capsule < FFI::Struct
241
+ layout(
242
+ :center1, Vec2,
243
+ :center2, Vec2,
244
+ :radius, :float,
245
+ )
246
+ def center1 = self[:center1]
247
+ def center1=(v) self[:center1] = v end
248
+ def center2 = self[:center2]
249
+ def center2=(v) self[:center2] = v end
250
+ def radius = self[:radius]
251
+ def radius=(v) self[:radius] = v end
252
+ def self.create_as(_center1_, _center2_, _radius_)
253
+ instance = Capsule.new
254
+ instance[:center1] = _center1_
255
+ instance[:center2] = _center2_
256
+ instance[:radius] = _radius_
257
+ instance
258
+ end
259
+ end
260
+
261
+ class Polygon < FFI::Struct
262
+ layout(
263
+ :vertices, [Vec2, 8],
264
+ :normals, [Vec2, 8],
265
+ :centroid, Vec2,
266
+ :radius, :float,
267
+ :count, :int,
268
+ )
269
+ def vertices = self[:vertices]
270
+ def vertices=(v) self[:vertices] = v end
271
+ def normals = self[:normals]
272
+ def normals=(v) self[:normals] = v end
273
+ def centroid = self[:centroid]
274
+ def centroid=(v) self[:centroid] = v end
275
+ def radius = self[:radius]
276
+ def radius=(v) self[:radius] = v end
277
+ def count = self[:count]
278
+ def count=(v) self[:count] = v end
279
+ def self.create_as(_vertices_, _normals_, _centroid_, _radius_, _count_)
280
+ instance = Polygon.new
281
+ instance[:vertices] = _vertices_
282
+ instance[:normals] = _normals_
283
+ instance[:centroid] = _centroid_
284
+ instance[:radius] = _radius_
285
+ instance[:count] = _count_
286
+ instance
287
+ end
288
+ end
289
+
290
+ class Segment < FFI::Struct
291
+ layout(
292
+ :point1, Vec2,
293
+ :point2, Vec2,
294
+ )
295
+ def point1 = self[:point1]
296
+ def point1=(v) self[:point1] = v end
297
+ def point2 = self[:point2]
298
+ def point2=(v) self[:point2] = v end
299
+ def self.create_as(_point1_, _point2_)
300
+ instance = Segment.new
301
+ instance[:point1] = _point1_
302
+ instance[:point2] = _point2_
303
+ instance
304
+ end
305
+ end
306
+
307
+ class ChainSegment < FFI::Struct
308
+ layout(
309
+ :ghost1, Vec2,
310
+ :segment, Segment,
311
+ :ghost2, Vec2,
312
+ :chainId, :int,
313
+ )
314
+ def ghost1 = self[:ghost1]
315
+ def ghost1=(v) self[:ghost1] = v end
316
+ def segment = self[:segment]
317
+ def segment=(v) self[:segment] = v end
318
+ def ghost2 = self[:ghost2]
319
+ def ghost2=(v) self[:ghost2] = v end
320
+ def chainId = self[:chainId]
321
+ def chainId=(v) self[:chainId] = v end
322
+ def self.create_as(_ghost1_, _segment_, _ghost2_, _chainId_)
323
+ instance = ChainSegment.new
324
+ instance[:ghost1] = _ghost1_
325
+ instance[:segment] = _segment_
326
+ instance[:ghost2] = _ghost2_
327
+ instance[:chainId] = _chainId_
328
+ instance
329
+ end
330
+ end
331
+
332
+ class SegmentDistanceResult < FFI::Struct
333
+ layout(
334
+ :closest1, Vec2,
335
+ :closest2, Vec2,
336
+ :fraction1, :float,
337
+ :fraction2, :float,
338
+ :distanceSquared, :float,
339
+ )
340
+ def closest1 = self[:closest1]
341
+ def closest1=(v) self[:closest1] = v end
342
+ def closest2 = self[:closest2]
343
+ def closest2=(v) self[:closest2] = v end
344
+ def fraction1 = self[:fraction1]
345
+ def fraction1=(v) self[:fraction1] = v end
346
+ def fraction2 = self[:fraction2]
347
+ def fraction2=(v) self[:fraction2] = v end
348
+ def distanceSquared = self[:distanceSquared]
349
+ def distanceSquared=(v) self[:distanceSquared] = v end
350
+ def self.create_as(_closest1_, _closest2_, _fraction1_, _fraction2_, _distanceSquared_)
351
+ instance = SegmentDistanceResult.new
352
+ instance[:closest1] = _closest1_
353
+ instance[:closest2] = _closest2_
354
+ instance[:fraction1] = _fraction1_
355
+ instance[:fraction2] = _fraction2_
356
+ instance[:distanceSquared] = _distanceSquared_
357
+ instance
358
+ end
359
+ end
360
+
361
+ class ShapeProxy < FFI::Struct
362
+ layout(
363
+ :points, [Vec2, 8],
364
+ :count, :int,
365
+ :radius, :float,
366
+ )
367
+ def points = self[:points]
368
+ def points=(v) self[:points] = v end
369
+ def count = self[:count]
370
+ def count=(v) self[:count] = v end
371
+ def radius = self[:radius]
372
+ def radius=(v) self[:radius] = v end
373
+ def self.create_as(_points_, _count_, _radius_)
374
+ instance = ShapeProxy.new
375
+ instance[:points] = _points_
376
+ instance[:count] = _count_
377
+ instance[:radius] = _radius_
378
+ instance
379
+ end
380
+ end
381
+
382
+ class DistanceInput < FFI::Struct
383
+ layout(
384
+ :proxyA, ShapeProxy,
385
+ :proxyB, ShapeProxy,
386
+ :transformA, Transform,
387
+ :transformB, Transform,
388
+ :useRadii, :bool,
389
+ )
390
+ def proxyA = self[:proxyA]
391
+ def proxyA=(v) self[:proxyA] = v end
392
+ def proxyB = self[:proxyB]
393
+ def proxyB=(v) self[:proxyB] = v end
394
+ def transformA = self[:transformA]
395
+ def transformA=(v) self[:transformA] = v end
396
+ def transformB = self[:transformB]
397
+ def transformB=(v) self[:transformB] = v end
398
+ def useRadii = self[:useRadii]
399
+ def useRadii=(v) self[:useRadii] = v end
400
+ def self.create_as(_proxyA_, _proxyB_, _transformA_, _transformB_, _useRadii_)
401
+ instance = DistanceInput.new
402
+ instance[:proxyA] = _proxyA_
403
+ instance[:proxyB] = _proxyB_
404
+ instance[:transformA] = _transformA_
405
+ instance[:transformB] = _transformB_
406
+ instance[:useRadii] = _useRadii_
407
+ instance
408
+ end
409
+ end
410
+
411
+ class DistanceOutput < FFI::Struct
412
+ layout(
413
+ :pointA, Vec2,
414
+ :pointB, Vec2,
415
+ :distance, :float,
416
+ :iterations, :int,
417
+ :simplexCount, :int,
418
+ )
419
+ def pointA = self[:pointA]
420
+ def pointA=(v) self[:pointA] = v end
421
+ def pointB = self[:pointB]
422
+ def pointB=(v) self[:pointB] = v end
423
+ def distance = self[:distance]
424
+ def distance=(v) self[:distance] = v end
425
+ def iterations = self[:iterations]
426
+ def iterations=(v) self[:iterations] = v end
427
+ def simplexCount = self[:simplexCount]
428
+ def simplexCount=(v) self[:simplexCount] = v end
429
+ def self.create_as(_pointA_, _pointB_, _distance_, _iterations_, _simplexCount_)
430
+ instance = DistanceOutput.new
431
+ instance[:pointA] = _pointA_
432
+ instance[:pointB] = _pointB_
433
+ instance[:distance] = _distance_
434
+ instance[:iterations] = _iterations_
435
+ instance[:simplexCount] = _simplexCount_
436
+ instance
437
+ end
438
+ end
439
+
440
+ class SimplexVertex < FFI::Struct
441
+ layout(
442
+ :wA, Vec2,
443
+ :wB, Vec2,
444
+ :w, Vec2,
445
+ :a, :float,
446
+ :indexA, :int,
447
+ :indexB, :int,
448
+ )
449
+ def wA = self[:wA]
450
+ def wA=(v) self[:wA] = v end
451
+ def wB = self[:wB]
452
+ def wB=(v) self[:wB] = v end
453
+ def w = self[:w]
454
+ def w=(v) self[:w] = v end
455
+ def a = self[:a]
456
+ def a=(v) self[:a] = v end
457
+ def indexA = self[:indexA]
458
+ def indexA=(v) self[:indexA] = v end
459
+ def indexB = self[:indexB]
460
+ def indexB=(v) self[:indexB] = v end
461
+ def self.create_as(_wA_, _wB_, _w_, _a_, _indexA_, _indexB_)
462
+ instance = SimplexVertex.new
463
+ instance[:wA] = _wA_
464
+ instance[:wB] = _wB_
465
+ instance[:w] = _w_
466
+ instance[:a] = _a_
467
+ instance[:indexA] = _indexA_
468
+ instance[:indexB] = _indexB_
469
+ instance
470
+ end
471
+ end
472
+
473
+ class Simplex < FFI::Struct
474
+ layout(
475
+ :v1, SimplexVertex,
476
+ :v2, SimplexVertex,
477
+ :v3, SimplexVertex,
478
+ :count, :int,
479
+ )
480
+ def v1 = self[:v1]
481
+ def v1=(v) self[:v1] = v end
482
+ def v2 = self[:v2]
483
+ def v2=(v) self[:v2] = v end
484
+ def v3 = self[:v3]
485
+ def v3=(v) self[:v3] = v end
486
+ def count = self[:count]
487
+ def count=(v) self[:count] = v end
488
+ def self.create_as(_v1_, _v2_, _v3_, _count_)
489
+ instance = Simplex.new
490
+ instance[:v1] = _v1_
491
+ instance[:v2] = _v2_
492
+ instance[:v3] = _v3_
493
+ instance[:count] = _count_
494
+ instance
495
+ end
496
+ end
497
+
498
+ class ShapeCastPairInput < FFI::Struct
499
+ layout(
500
+ :proxyA, ShapeProxy,
501
+ :proxyB, ShapeProxy,
502
+ :transformA, Transform,
503
+ :transformB, Transform,
504
+ :translationB, Vec2,
505
+ :maxFraction, :float,
506
+ )
507
+ def proxyA = self[:proxyA]
508
+ def proxyA=(v) self[:proxyA] = v end
509
+ def proxyB = self[:proxyB]
510
+ def proxyB=(v) self[:proxyB] = v end
511
+ def transformA = self[:transformA]
512
+ def transformA=(v) self[:transformA] = v end
513
+ def transformB = self[:transformB]
514
+ def transformB=(v) self[:transformB] = v end
515
+ def translationB = self[:translationB]
516
+ def translationB=(v) self[:translationB] = v end
517
+ def maxFraction = self[:maxFraction]
518
+ def maxFraction=(v) self[:maxFraction] = v end
519
+ def self.create_as(_proxyA_, _proxyB_, _transformA_, _transformB_, _translationB_, _maxFraction_)
520
+ instance = ShapeCastPairInput.new
521
+ instance[:proxyA] = _proxyA_
522
+ instance[:proxyB] = _proxyB_
523
+ instance[:transformA] = _transformA_
524
+ instance[:transformB] = _transformB_
525
+ instance[:translationB] = _translationB_
526
+ instance[:maxFraction] = _maxFraction_
527
+ instance
528
+ end
529
+ end
530
+
531
+ class Sweep < FFI::Struct
532
+ layout(
533
+ :localCenter, Vec2,
534
+ :c1, Vec2,
535
+ :c2, Vec2,
536
+ :q1, Rot,
537
+ :q2, Rot,
538
+ )
539
+ def localCenter = self[:localCenter]
540
+ def localCenter=(v) self[:localCenter] = v end
541
+ def c1 = self[:c1]
542
+ def c1=(v) self[:c1] = v end
543
+ def c2 = self[:c2]
544
+ def c2=(v) self[:c2] = v end
545
+ def q1 = self[:q1]
546
+ def q1=(v) self[:q1] = v end
547
+ def q2 = self[:q2]
548
+ def q2=(v) self[:q2] = v end
549
+ def self.create_as(_localCenter_, _c1_, _c2_, _q1_, _q2_)
550
+ instance = Sweep.new
551
+ instance[:localCenter] = _localCenter_
552
+ instance[:c1] = _c1_
553
+ instance[:c2] = _c2_
554
+ instance[:q1] = _q1_
555
+ instance[:q2] = _q2_
556
+ instance
557
+ end
558
+ end
559
+
560
+ class TOIInput < FFI::Struct
561
+ layout(
562
+ :proxyA, ShapeProxy,
563
+ :proxyB, ShapeProxy,
564
+ :sweepA, Sweep,
565
+ :sweepB, Sweep,
566
+ :maxFraction, :float,
567
+ )
568
+ def proxyA = self[:proxyA]
569
+ def proxyA=(v) self[:proxyA] = v end
570
+ def proxyB = self[:proxyB]
571
+ def proxyB=(v) self[:proxyB] = v end
572
+ def sweepA = self[:sweepA]
573
+ def sweepA=(v) self[:sweepA] = v end
574
+ def sweepB = self[:sweepB]
575
+ def sweepB=(v) self[:sweepB] = v end
576
+ def maxFraction = self[:maxFraction]
577
+ def maxFraction=(v) self[:maxFraction] = v end
578
+ def self.create_as(_proxyA_, _proxyB_, _sweepA_, _sweepB_, _maxFraction_)
579
+ instance = TOIInput.new
580
+ instance[:proxyA] = _proxyA_
581
+ instance[:proxyB] = _proxyB_
582
+ instance[:sweepA] = _sweepA_
583
+ instance[:sweepB] = _sweepB_
584
+ instance[:maxFraction] = _maxFraction_
585
+ instance
586
+ end
587
+ end
588
+
589
+ class TOIOutput < FFI::Struct
590
+ layout(
591
+ :state, :int,
592
+ :fraction, :float,
593
+ )
594
+ def state = self[:state]
595
+ def state=(v) self[:state] = v end
596
+ def fraction = self[:fraction]
597
+ def fraction=(v) self[:fraction] = v end
598
+ def self.create_as(_state_, _fraction_)
599
+ instance = TOIOutput.new
600
+ instance[:state] = _state_
601
+ instance[:fraction] = _fraction_
602
+ instance
603
+ end
604
+ end
605
+
606
+ class ManifoldPoint < FFI::Struct
607
+ layout(
608
+ :point, Vec2,
609
+ :anchorA, Vec2,
610
+ :anchorB, Vec2,
611
+ :separation, :float,
612
+ :normalImpulse, :float,
613
+ :tangentImpulse, :float,
614
+ :maxNormalImpulse, :float,
615
+ :normalVelocity, :float,
616
+ :id, :ushort,
617
+ :persisted, :bool,
618
+ )
619
+ def point = self[:point]
620
+ def point=(v) self[:point] = v end
621
+ def anchorA = self[:anchorA]
622
+ def anchorA=(v) self[:anchorA] = v end
623
+ def anchorB = self[:anchorB]
624
+ def anchorB=(v) self[:anchorB] = v end
625
+ def separation = self[:separation]
626
+ def separation=(v) self[:separation] = v end
627
+ def normalImpulse = self[:normalImpulse]
628
+ def normalImpulse=(v) self[:normalImpulse] = v end
629
+ def tangentImpulse = self[:tangentImpulse]
630
+ def tangentImpulse=(v) self[:tangentImpulse] = v end
631
+ def maxNormalImpulse = self[:maxNormalImpulse]
632
+ def maxNormalImpulse=(v) self[:maxNormalImpulse] = v end
633
+ def normalVelocity = self[:normalVelocity]
634
+ def normalVelocity=(v) self[:normalVelocity] = v end
635
+ def id = self[:id]
636
+ def id=(v) self[:id] = v end
637
+ def persisted = self[:persisted]
638
+ def persisted=(v) self[:persisted] = v end
639
+ def self.create_as(_point_, _anchorA_, _anchorB_, _separation_, _normalImpulse_, _tangentImpulse_, _maxNormalImpulse_, _normalVelocity_, _id_, _persisted_)
640
+ instance = ManifoldPoint.new
641
+ instance[:point] = _point_
642
+ instance[:anchorA] = _anchorA_
643
+ instance[:anchorB] = _anchorB_
644
+ instance[:separation] = _separation_
645
+ instance[:normalImpulse] = _normalImpulse_
646
+ instance[:tangentImpulse] = _tangentImpulse_
647
+ instance[:maxNormalImpulse] = _maxNormalImpulse_
648
+ instance[:normalVelocity] = _normalVelocity_
649
+ instance[:id] = _id_
650
+ instance[:persisted] = _persisted_
651
+ instance
652
+ end
653
+ end
654
+
655
+ class Manifold < FFI::Struct
656
+ layout(
657
+ :points, [ManifoldPoint, 2],
658
+ :normal, Vec2,
659
+ :pointCount, :int,
660
+ )
661
+ def points = self[:points]
662
+ def points=(v) self[:points] = v end
663
+ def normal = self[:normal]
664
+ def normal=(v) self[:normal] = v end
665
+ def pointCount = self[:pointCount]
666
+ def pointCount=(v) self[:pointCount] = v end
667
+ def self.create_as(_points_, _normal_, _pointCount_)
668
+ instance = Manifold.new
669
+ instance[:points] = _points_
670
+ instance[:normal] = _normal_
671
+ instance[:pointCount] = _pointCount_
672
+ instance
673
+ end
674
+ end
675
+
676
+ class DynamicTree < FFI::Struct
677
+ layout(
678
+ :nodes, :pointer,
679
+ :root, :int,
680
+ :nodeCount, :int,
681
+ :nodeCapacity, :int,
682
+ :freeList, :int,
683
+ :proxyCount, :int,
684
+ :leafIndices, :pointer,
685
+ :leafBoxes, :pointer,
686
+ :leafCenters, :pointer,
687
+ :binIndices, :pointer,
688
+ :rebuildCapacity, :int,
689
+ )
690
+ def nodes = self[:nodes]
691
+ def nodes=(v) self[:nodes] = v end
692
+ def root = self[:root]
693
+ def root=(v) self[:root] = v end
694
+ def nodeCount = self[:nodeCount]
695
+ def nodeCount=(v) self[:nodeCount] = v end
696
+ def nodeCapacity = self[:nodeCapacity]
697
+ def nodeCapacity=(v) self[:nodeCapacity] = v end
698
+ def freeList = self[:freeList]
699
+ def freeList=(v) self[:freeList] = v end
700
+ def proxyCount = self[:proxyCount]
701
+ def proxyCount=(v) self[:proxyCount] = v end
702
+ def leafIndices = self[:leafIndices]
703
+ def leafIndices=(v) self[:leafIndices] = v end
704
+ def leafBoxes = self[:leafBoxes]
705
+ def leafBoxes=(v) self[:leafBoxes] = v end
706
+ def leafCenters = self[:leafCenters]
707
+ def leafCenters=(v) self[:leafCenters] = v end
708
+ def binIndices = self[:binIndices]
709
+ def binIndices=(v) self[:binIndices] = v end
710
+ def rebuildCapacity = self[:rebuildCapacity]
711
+ def rebuildCapacity=(v) self[:rebuildCapacity] = v end
712
+ def self.create_as(_nodes_, _root_, _nodeCount_, _nodeCapacity_, _freeList_, _proxyCount_, _leafIndices_, _leafBoxes_, _leafCenters_, _binIndices_, _rebuildCapacity_)
713
+ instance = DynamicTree.new
714
+ instance[:nodes] = _nodes_
715
+ instance[:root] = _root_
716
+ instance[:nodeCount] = _nodeCount_
717
+ instance[:nodeCapacity] = _nodeCapacity_
718
+ instance[:freeList] = _freeList_
719
+ instance[:proxyCount] = _proxyCount_
720
+ instance[:leafIndices] = _leafIndices_
721
+ instance[:leafBoxes] = _leafBoxes_
722
+ instance[:leafCenters] = _leafCenters_
723
+ instance[:binIndices] = _binIndices_
724
+ instance[:rebuildCapacity] = _rebuildCapacity_
725
+ instance
726
+ end
727
+ end
728
+
729
+ class TreeStats < FFI::Struct
730
+ layout(
731
+ :nodeVisits, :int,
732
+ :leafVisits, :int,
733
+ )
734
+ def nodeVisits = self[:nodeVisits]
735
+ def nodeVisits=(v) self[:nodeVisits] = v end
736
+ def leafVisits = self[:leafVisits]
737
+ def leafVisits=(v) self[:leafVisits] = v end
738
+ def self.create_as(_nodeVisits_, _leafVisits_)
739
+ instance = TreeStats.new
740
+ instance[:nodeVisits] = _nodeVisits_
741
+ instance[:leafVisits] = _leafVisits_
742
+ instance
743
+ end
744
+ end
745
+
746
+
747
+ # Function
748
+
749
+ def self.setup_collision_symbols(method_naming: :original)
750
+ entries = [
751
+ [:IsValidRay, :b2IsValidRay, [:pointer], :bool],
752
+ [:MakePolygon, :b2MakePolygon, [:pointer, :float], Polygon.by_value],
753
+ [:MakeOffsetPolygon, :b2MakeOffsetPolygon, [:pointer, Vec2.by_value, Rot.by_value], Polygon.by_value],
754
+ [:MakeOffsetRoundedPolygon, :b2MakeOffsetRoundedPolygon, [:pointer, Vec2.by_value, Rot.by_value, :float], Polygon.by_value],
755
+ [:MakeSquare, :b2MakeSquare, [:float], Polygon.by_value],
756
+ [:MakeBox, :b2MakeBox, [:float, :float], Polygon.by_value],
757
+ [:MakeRoundedBox, :b2MakeRoundedBox, [:float, :float, :float], Polygon.by_value],
758
+ [:MakeOffsetBox, :b2MakeOffsetBox, [:float, :float, Vec2.by_value, Rot.by_value], Polygon.by_value],
759
+ [:MakeOffsetRoundedBox, :b2MakeOffsetRoundedBox, [:float, :float, Vec2.by_value, Rot.by_value, :float], Polygon.by_value],
760
+ [:TransformPolygon, :b2TransformPolygon, [Transform.by_value, :pointer], Polygon.by_value],
761
+ [:ComputeCircleMass, :b2ComputeCircleMass, [:pointer, :float], MassData.by_value],
762
+ [:ComputeCapsuleMass, :b2ComputeCapsuleMass, [:pointer, :float], MassData.by_value],
763
+ [:ComputePolygonMass, :b2ComputePolygonMass, [:pointer, :float], MassData.by_value],
764
+ [:ComputeCircleAABB, :b2ComputeCircleAABB, [:pointer, Transform.by_value], AABB.by_value],
765
+ [:ComputeCapsuleAABB, :b2ComputeCapsuleAABB, [:pointer, Transform.by_value], AABB.by_value],
766
+ [:ComputePolygonAABB, :b2ComputePolygonAABB, [:pointer, Transform.by_value], AABB.by_value],
767
+ [:ComputeSegmentAABB, :b2ComputeSegmentAABB, [:pointer, Transform.by_value], AABB.by_value],
768
+ [:PointInCircle, :b2PointInCircle, [Vec2.by_value, :pointer], :bool],
769
+ [:PointInCapsule, :b2PointInCapsule, [Vec2.by_value, :pointer], :bool],
770
+ [:PointInPolygon, :b2PointInPolygon, [Vec2.by_value, :pointer], :bool],
771
+ [:RayCastCircle, :b2RayCastCircle, [:pointer, :pointer], CastOutput.by_value],
772
+ [:RayCastCapsule, :b2RayCastCapsule, [:pointer, :pointer], CastOutput.by_value],
773
+ [:RayCastSegment, :b2RayCastSegment, [:pointer, :pointer, :bool], CastOutput.by_value],
774
+ [:RayCastPolygon, :b2RayCastPolygon, [:pointer, :pointer], CastOutput.by_value],
775
+ [:ShapeCastCircle, :b2ShapeCastCircle, [:pointer, :pointer], CastOutput.by_value],
776
+ [:ShapeCastCapsule, :b2ShapeCastCapsule, [:pointer, :pointer], CastOutput.by_value],
777
+ [:ShapeCastSegment, :b2ShapeCastSegment, [:pointer, :pointer], CastOutput.by_value],
778
+ [:ShapeCastPolygon, :b2ShapeCastPolygon, [:pointer, :pointer], CastOutput.by_value],
779
+ [:ComputeHull, :b2ComputeHull, [:pointer, :int], Hull.by_value],
780
+ [:ValidateHull, :b2ValidateHull, [:pointer], :bool],
781
+ [:SegmentDistance, :b2SegmentDistance, [Vec2.by_value, Vec2.by_value, Vec2.by_value, Vec2.by_value], SegmentDistanceResult.by_value],
782
+ [:ShapeDistance, :b2ShapeDistance, [:pointer, :pointer, :pointer, :int], DistanceOutput.by_value],
783
+ [:ShapeCast, :b2ShapeCast, [:pointer], CastOutput.by_value],
784
+ [:MakeProxy, :b2MakeProxy, [:pointer, :int, :float], ShapeProxy.by_value],
785
+ [:GetSweepTransform, :b2GetSweepTransform, [:pointer, :float], Transform.by_value],
786
+ [:TimeOfImpact, :b2TimeOfImpact, [:pointer], TOIOutput.by_value],
787
+ [:CollideCircles, :b2CollideCircles, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
788
+ [:CollideCapsuleAndCircle, :b2CollideCapsuleAndCircle, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
789
+ [:CollideSegmentAndCircle, :b2CollideSegmentAndCircle, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
790
+ [:CollidePolygonAndCircle, :b2CollidePolygonAndCircle, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
791
+ [:CollideCapsules, :b2CollideCapsules, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
792
+ [:CollideSegmentAndCapsule, :b2CollideSegmentAndCapsule, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
793
+ [:CollidePolygonAndCapsule, :b2CollidePolygonAndCapsule, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
794
+ [:CollidePolygons, :b2CollidePolygons, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
795
+ [:CollideSegmentAndPolygon, :b2CollideSegmentAndPolygon, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
796
+ [:CollideChainSegmentAndCircle, :b2CollideChainSegmentAndCircle, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
797
+ [:CollideChainSegmentAndCapsule, :b2CollideChainSegmentAndCapsule, [:pointer, Transform.by_value, :pointer, Transform.by_value, :pointer], Manifold.by_value],
798
+ [:CollideChainSegmentAndPolygon, :b2CollideChainSegmentAndPolygon, [:pointer, Transform.by_value, :pointer, Transform.by_value, :pointer], Manifold.by_value],
799
+ [:DynamicTree_Create, :b2DynamicTree_Create, [], DynamicTree.by_value],
800
+ [:DynamicTree_Destroy, :b2DynamicTree_Destroy, [:pointer], :void],
801
+ [:DynamicTree_CreateProxy, :b2DynamicTree_CreateProxy, [:pointer, AABB.by_value, :ulong_long, :int], :int],
802
+ [:DynamicTree_DestroyProxy, :b2DynamicTree_DestroyProxy, [:pointer, :int], :void],
803
+ [:DynamicTree_MoveProxy, :b2DynamicTree_MoveProxy, [:pointer, :int, AABB.by_value], :void],
804
+ [:DynamicTree_EnlargeProxy, :b2DynamicTree_EnlargeProxy, [:pointer, :int, AABB.by_value], :void],
805
+ [:DynamicTree_Query, :b2DynamicTree_Query, [:pointer, AABB.by_value, :ulong_long, :pointer, :pointer], TreeStats.by_value],
806
+ [:DynamicTree_RayCast, :b2DynamicTree_RayCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
807
+ [:DynamicTree_ShapeCast, :b2DynamicTree_ShapeCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
808
+ [:DynamicTree_Validate, :b2DynamicTree_Validate, [:pointer], :void],
809
+ [:DynamicTree_GetHeight, :b2DynamicTree_GetHeight, [:pointer], :int],
810
+ [:DynamicTree_GetAreaRatio, :b2DynamicTree_GetAreaRatio, [:pointer], :float],
811
+ [:DynamicTree_GetProxyCount, :b2DynamicTree_GetProxyCount, [:pointer], :int],
812
+ [:DynamicTree_Rebuild, :b2DynamicTree_Rebuild, [:pointer, :bool], :int],
813
+ [:DynamicTree_GetByteCount, :b2DynamicTree_GetByteCount, [:pointer], :int],
814
+ ]
815
+ entries.each do |entry|
816
+ api_name = if method_naming == :snake_case
817
+ snake_case_name = entry[0].to_s.gsub(/([A-Z]+)([A-Z0-9][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z0-9])/, '\1_\2').downcase
818
+ snake_case_name.gsub!('vector_3', 'vector3_') if snake_case_name.include?('vector_3')
819
+ snake_case_name.gsub!('vector_2', 'vector2_') if snake_case_name.include?('vector_2')
820
+ snake_case_name.chop! if snake_case_name.end_with?('_')
821
+ snake_case_name.to_sym
822
+ else
823
+ entry[0]
824
+ end
825
+ attach_function api_name, entry[1], entry[2], entry[3]
826
+ rescue FFI::NotFoundError => e
827
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
828
+ end
829
+ end
830
+
831
+ end
832
+