box2d-bindings 0.1.1-x86_64-linux → 0.1.3-x86_64-linux
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.
- checksums.yaml +4 -4
- data/ChangeLog +8 -0
- data/README.md +1 -1
- data/lib/box2d_base.rb +0 -1
- data/lib/box2d_collision.rb +110 -37
- data/lib/box2d_id.rb +25 -0
- data/lib/box2d_id_inline.rb +4 -0
- data/lib/box2d_main.rb +26 -19
- data/lib/box2d_math_functions.rb +22 -3
- data/lib/box2d_math_inline_functions.rb +7 -2
- data/lib/box2d_types.rb +245 -325
- data/lib/libbox2d.x86_64.so +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5008b5a00d825d39b1beb0b7beaca624a22a8f19979ed5645fafdfe7a2353da8
|
4
|
+
data.tar.gz: 93db5c88923a2d0ec561737628b89f87109522392d25b2f8ca4866edbaf649a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 863868e60ff09a19d16ab38373b9b7de903482c42b1d6b2ce54de1d4c2ba42a27cadec29e99997e3b3adf3e5e0b0a4b8d7086c649420c803e21785b935bf5c4c
|
7
|
+
data.tar.gz: c272b50d5b8f75b92e36a4bf6f4f97bce15220fe087897dd15f1caafd2dfb00ee3689a5a488af521687bf782e23bc6a0b66af5214459941dc8dd705829cdca14
|
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
2025-06-06 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
|
+
|
3
|
+
* https://github.com/erincatto/box2d/commit/d3d2b926c6694f46f8d511ee90cb3f553bf488b2
|
4
|
+
|
5
|
+
2025-05-11 vaiorabbit <http://twitter.com/vaiorabbit>
|
6
|
+
|
7
|
+
* https://github.com/erincatto/box2d/commit/2d088533b921e912c18c654f8b46c43e04ad0ca8
|
8
|
+
|
1
9
|
2025-02-01 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
10
|
|
3
11
|
* https://github.com/erincatto/box2d/commit/28adacf82377d4113f2ed00586141463244b9d10
|
data/README.md
CHANGED
data/lib/box2d_base.rb
CHANGED
@@ -52,7 +52,6 @@ module Box2D
|
|
52
52
|
[:SetAllocator, :b2SetAllocator, [:pointer, :pointer], :void],
|
53
53
|
[:GetByteCount, :b2GetByteCount, [], :int],
|
54
54
|
[:SetAssertFcn, :b2SetAssertFcn, [:pointer], :void],
|
55
|
-
[:InternalAssertFcn, :b2InternalAssertFcn, [:pointer, :pointer, :int], :int],
|
56
55
|
[:GetVersion, :b2GetVersion, [], Version.by_value],
|
57
56
|
[:GetTicks, :b2GetTicks, [], :ulong_long],
|
58
57
|
[:GetMilliseconds, :b2GetMilliseconds, [:ulong_long], :float],
|
data/lib/box2d_collision.rb
CHANGED
@@ -141,13 +141,11 @@ module Box2D
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
class
|
144
|
+
class ShapeProxy < FFI::Struct
|
145
145
|
layout(
|
146
146
|
:points, [Vec2, 8],
|
147
147
|
:count, :int,
|
148
148
|
:radius, :float,
|
149
|
-
:translation, Vec2,
|
150
|
-
:maxFraction, :float,
|
151
149
|
)
|
152
150
|
def points = self[:points]
|
153
151
|
def points=(v) self[:points] = v end
|
@@ -155,17 +153,36 @@ module Box2D
|
|
155
153
|
def count=(v) self[:count] = v end
|
156
154
|
def radius = self[:radius]
|
157
155
|
def radius=(v) self[:radius] = v end
|
156
|
+
def self.create_as(_points_, _count_, _radius_)
|
157
|
+
instance = ShapeProxy.new
|
158
|
+
instance[:points] = _points_
|
159
|
+
instance[:count] = _count_
|
160
|
+
instance[:radius] = _radius_
|
161
|
+
instance
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
class ShapeCastInput < FFI::Struct
|
166
|
+
layout(
|
167
|
+
:proxy, ShapeProxy,
|
168
|
+
:translation, Vec2,
|
169
|
+
:maxFraction, :float,
|
170
|
+
:canEncroach, :bool,
|
171
|
+
)
|
172
|
+
def proxy = self[:proxy]
|
173
|
+
def proxy=(v) self[:proxy] = v end
|
158
174
|
def translation = self[:translation]
|
159
175
|
def translation=(v) self[:translation] = v end
|
160
176
|
def maxFraction = self[:maxFraction]
|
161
177
|
def maxFraction=(v) self[:maxFraction] = v end
|
162
|
-
def
|
178
|
+
def canEncroach = self[:canEncroach]
|
179
|
+
def canEncroach=(v) self[:canEncroach] = v end
|
180
|
+
def self.create_as(_proxy_, _translation_, _maxFraction_, _canEncroach_)
|
163
181
|
instance = ShapeCastInput.new
|
164
|
-
instance[:
|
165
|
-
instance[:count] = _count_
|
166
|
-
instance[:radius] = _radius_
|
182
|
+
instance[:proxy] = _proxy_
|
167
183
|
instance[:translation] = _translation_
|
168
184
|
instance[:maxFraction] = _maxFraction_
|
185
|
+
instance[:canEncroach] = _canEncroach_
|
169
186
|
instance
|
170
187
|
end
|
171
188
|
end
|
@@ -358,27 +375,6 @@ module Box2D
|
|
358
375
|
end
|
359
376
|
end
|
360
377
|
|
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
378
|
class DistanceInput < FFI::Struct
|
383
379
|
layout(
|
384
380
|
:proxyA, ShapeProxy,
|
@@ -412,6 +408,7 @@ module Box2D
|
|
412
408
|
layout(
|
413
409
|
:pointA, Vec2,
|
414
410
|
:pointB, Vec2,
|
411
|
+
:normal, Vec2,
|
415
412
|
:distance, :float,
|
416
413
|
:iterations, :int,
|
417
414
|
:simplexCount, :int,
|
@@ -420,16 +417,19 @@ module Box2D
|
|
420
417
|
def pointA=(v) self[:pointA] = v end
|
421
418
|
def pointB = self[:pointB]
|
422
419
|
def pointB=(v) self[:pointB] = v end
|
420
|
+
def normal = self[:normal]
|
421
|
+
def normal=(v) self[:normal] = v end
|
423
422
|
def distance = self[:distance]
|
424
423
|
def distance=(v) self[:distance] = v end
|
425
424
|
def iterations = self[:iterations]
|
426
425
|
def iterations=(v) self[:iterations] = v end
|
427
426
|
def simplexCount = self[:simplexCount]
|
428
427
|
def simplexCount=(v) self[:simplexCount] = v end
|
429
|
-
def self.create_as(_pointA_, _pointB_, _distance_, _iterations_, _simplexCount_)
|
428
|
+
def self.create_as(_pointA_, _pointB_, _normal_, _distance_, _iterations_, _simplexCount_)
|
430
429
|
instance = DistanceOutput.new
|
431
430
|
instance[:pointA] = _pointA_
|
432
431
|
instance[:pointB] = _pointB_
|
432
|
+
instance[:normal] = _normal_
|
433
433
|
instance[:distance] = _distance_
|
434
434
|
instance[:iterations] = _iterations_
|
435
435
|
instance[:simplexCount] = _simplexCount_
|
@@ -503,6 +503,7 @@ module Box2D
|
|
503
503
|
:transformB, Transform,
|
504
504
|
:translationB, Vec2,
|
505
505
|
:maxFraction, :float,
|
506
|
+
:canEncroach, :bool,
|
506
507
|
)
|
507
508
|
def proxyA = self[:proxyA]
|
508
509
|
def proxyA=(v) self[:proxyA] = v end
|
@@ -516,7 +517,9 @@ module Box2D
|
|
516
517
|
def translationB=(v) self[:translationB] = v end
|
517
518
|
def maxFraction = self[:maxFraction]
|
518
519
|
def maxFraction=(v) self[:maxFraction] = v end
|
519
|
-
def
|
520
|
+
def canEncroach = self[:canEncroach]
|
521
|
+
def canEncroach=(v) self[:canEncroach] = v end
|
522
|
+
def self.create_as(_proxyA_, _proxyB_, _transformA_, _transformB_, _translationB_, _maxFraction_, _canEncroach_)
|
520
523
|
instance = ShapeCastPairInput.new
|
521
524
|
instance[:proxyA] = _proxyA_
|
522
525
|
instance[:proxyB] = _proxyB_
|
@@ -524,6 +527,7 @@ module Box2D
|
|
524
527
|
instance[:transformB] = _transformB_
|
525
528
|
instance[:translationB] = _translationB_
|
526
529
|
instance[:maxFraction] = _maxFraction_
|
530
|
+
instance[:canEncroach] = _canEncroach_
|
527
531
|
instance
|
528
532
|
end
|
529
533
|
end
|
@@ -611,7 +615,7 @@ module Box2D
|
|
611
615
|
:separation, :float,
|
612
616
|
:normalImpulse, :float,
|
613
617
|
:tangentImpulse, :float,
|
614
|
-
:
|
618
|
+
:totalNormalImpulse, :float,
|
615
619
|
:normalVelocity, :float,
|
616
620
|
:id, :ushort,
|
617
621
|
:persisted, :bool,
|
@@ -628,15 +632,15 @@ module Box2D
|
|
628
632
|
def normalImpulse=(v) self[:normalImpulse] = v end
|
629
633
|
def tangentImpulse = self[:tangentImpulse]
|
630
634
|
def tangentImpulse=(v) self[:tangentImpulse] = v end
|
631
|
-
def
|
632
|
-
def
|
635
|
+
def totalNormalImpulse = self[:totalNormalImpulse]
|
636
|
+
def totalNormalImpulse=(v) self[:totalNormalImpulse] = v end
|
633
637
|
def normalVelocity = self[:normalVelocity]
|
634
638
|
def normalVelocity=(v) self[:normalVelocity] = v end
|
635
639
|
def id = self[:id]
|
636
640
|
def id=(v) self[:id] = v end
|
637
641
|
def persisted = self[:persisted]
|
638
642
|
def persisted=(v) self[:persisted] = v end
|
639
|
-
def self.create_as(_point_, _anchorA_, _anchorB_, _separation_, _normalImpulse_, _tangentImpulse_,
|
643
|
+
def self.create_as(_point_, _anchorA_, _anchorB_, _separation_, _normalImpulse_, _tangentImpulse_, _totalNormalImpulse_, _normalVelocity_, _id_, _persisted_)
|
640
644
|
instance = ManifoldPoint.new
|
641
645
|
instance[:point] = _point_
|
642
646
|
instance[:anchorA] = _anchorA_
|
@@ -644,7 +648,7 @@ module Box2D
|
|
644
648
|
instance[:separation] = _separation_
|
645
649
|
instance[:normalImpulse] = _normalImpulse_
|
646
650
|
instance[:tangentImpulse] = _tangentImpulse_
|
647
|
-
instance[:
|
651
|
+
instance[:totalNormalImpulse] = _totalNormalImpulse_
|
648
652
|
instance[:normalVelocity] = _normalVelocity_
|
649
653
|
instance[:id] = _id_
|
650
654
|
instance[:persisted] = _persisted_
|
@@ -747,6 +751,69 @@ module Box2D
|
|
747
751
|
end
|
748
752
|
end
|
749
753
|
|
754
|
+
class PlaneResult < FFI::Struct
|
755
|
+
layout(
|
756
|
+
:plane, Plane,
|
757
|
+
:point, Vec2,
|
758
|
+
:hit, :bool,
|
759
|
+
)
|
760
|
+
def plane = self[:plane]
|
761
|
+
def plane=(v) self[:plane] = v end
|
762
|
+
def point = self[:point]
|
763
|
+
def point=(v) self[:point] = v end
|
764
|
+
def hit = self[:hit]
|
765
|
+
def hit=(v) self[:hit] = v end
|
766
|
+
def self.create_as(_plane_, _point_, _hit_)
|
767
|
+
instance = PlaneResult.new
|
768
|
+
instance[:plane] = _plane_
|
769
|
+
instance[:point] = _point_
|
770
|
+
instance[:hit] = _hit_
|
771
|
+
instance
|
772
|
+
end
|
773
|
+
end
|
774
|
+
|
775
|
+
class CollisionPlane < FFI::Struct
|
776
|
+
layout(
|
777
|
+
:plane, Plane,
|
778
|
+
:pushLimit, :float,
|
779
|
+
:push, :float,
|
780
|
+
:clipVelocity, :bool,
|
781
|
+
)
|
782
|
+
def plane = self[:plane]
|
783
|
+
def plane=(v) self[:plane] = v end
|
784
|
+
def pushLimit = self[:pushLimit]
|
785
|
+
def pushLimit=(v) self[:pushLimit] = v end
|
786
|
+
def push = self[:push]
|
787
|
+
def push=(v) self[:push] = v end
|
788
|
+
def clipVelocity = self[:clipVelocity]
|
789
|
+
def clipVelocity=(v) self[:clipVelocity] = v end
|
790
|
+
def self.create_as(_plane_, _pushLimit_, _push_, _clipVelocity_)
|
791
|
+
instance = CollisionPlane.new
|
792
|
+
instance[:plane] = _plane_
|
793
|
+
instance[:pushLimit] = _pushLimit_
|
794
|
+
instance[:push] = _push_
|
795
|
+
instance[:clipVelocity] = _clipVelocity_
|
796
|
+
instance
|
797
|
+
end
|
798
|
+
end
|
799
|
+
|
800
|
+
class PlaneSolverResult < FFI::Struct
|
801
|
+
layout(
|
802
|
+
:translation, Vec2,
|
803
|
+
:iterationCount, :int,
|
804
|
+
)
|
805
|
+
def translation = self[:translation]
|
806
|
+
def translation=(v) self[:translation] = v end
|
807
|
+
def iterationCount = self[:iterationCount]
|
808
|
+
def iterationCount=(v) self[:iterationCount] = v end
|
809
|
+
def self.create_as(_translation_, _iterationCount_)
|
810
|
+
instance = PlaneSolverResult.new
|
811
|
+
instance[:translation] = _translation_
|
812
|
+
instance[:iterationCount] = _iterationCount_
|
813
|
+
instance
|
814
|
+
end
|
815
|
+
end
|
816
|
+
|
750
817
|
|
751
818
|
# Function
|
752
819
|
|
@@ -786,6 +853,7 @@ module Box2D
|
|
786
853
|
[:ShapeDistance, :b2ShapeDistance, [:pointer, :pointer, :pointer, :int], DistanceOutput.by_value],
|
787
854
|
[:ShapeCast, :b2ShapeCast, [:pointer], CastOutput.by_value],
|
788
855
|
[:MakeProxy, :b2MakeProxy, [:pointer, :int, :float], ShapeProxy.by_value],
|
856
|
+
[:MakeOffsetProxy, :b2MakeOffsetProxy, [:pointer, :int, :float, Vec2.by_value, Rot.by_value], ShapeProxy.by_value],
|
789
857
|
[:GetSweepTransform, :b2GetSweepTransform, [:pointer, :float], Transform.by_value],
|
790
858
|
[:TimeOfImpact, :b2TimeOfImpact, [:pointer], TOIOutput.by_value],
|
791
859
|
[:CollideCircles, :b2CollideCircles, [:pointer, Transform.by_value, :pointer, Transform.by_value], Manifold.by_value],
|
@@ -802,22 +870,27 @@ module Box2D
|
|
802
870
|
[:CollideChainSegmentAndPolygon, :b2CollideChainSegmentAndPolygon, [:pointer, Transform.by_value, :pointer, Transform.by_value, :pointer], Manifold.by_value],
|
803
871
|
[:DynamicTree_Create, :b2DynamicTree_Create, [], DynamicTree.by_value],
|
804
872
|
[:DynamicTree_Destroy, :b2DynamicTree_Destroy, [:pointer], :void],
|
805
|
-
[:DynamicTree_CreateProxy, :b2DynamicTree_CreateProxy, [:pointer, AABB.by_value, :ulong_long, :
|
873
|
+
[:DynamicTree_CreateProxy, :b2DynamicTree_CreateProxy, [:pointer, AABB.by_value, :ulong_long, :ulong_long], :int],
|
806
874
|
[:DynamicTree_DestroyProxy, :b2DynamicTree_DestroyProxy, [:pointer, :int], :void],
|
807
875
|
[:DynamicTree_MoveProxy, :b2DynamicTree_MoveProxy, [:pointer, :int, AABB.by_value], :void],
|
808
876
|
[:DynamicTree_EnlargeProxy, :b2DynamicTree_EnlargeProxy, [:pointer, :int, AABB.by_value], :void],
|
877
|
+
[:DynamicTree_SetCategoryBits, :b2DynamicTree_SetCategoryBits, [:pointer, :int, :ulong_long], :void],
|
878
|
+
[:DynamicTree_GetCategoryBits, :b2DynamicTree_GetCategoryBits, [:pointer, :int], :ulong_long],
|
809
879
|
[:DynamicTree_Query, :b2DynamicTree_Query, [:pointer, AABB.by_value, :ulong_long, :pointer, :pointer], TreeStats.by_value],
|
810
880
|
[:DynamicTree_RayCast, :b2DynamicTree_RayCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
|
811
881
|
[:DynamicTree_ShapeCast, :b2DynamicTree_ShapeCast, [:pointer, :pointer, :ulong_long, :pointer, :pointer], TreeStats.by_value],
|
812
882
|
[:DynamicTree_GetHeight, :b2DynamicTree_GetHeight, [:pointer], :int],
|
813
883
|
[:DynamicTree_GetAreaRatio, :b2DynamicTree_GetAreaRatio, [:pointer], :float],
|
884
|
+
[:DynamicTree_GetRootBounds, :b2DynamicTree_GetRootBounds, [:pointer], AABB.by_value],
|
814
885
|
[:DynamicTree_GetProxyCount, :b2DynamicTree_GetProxyCount, [:pointer], :int],
|
815
886
|
[:DynamicTree_Rebuild, :b2DynamicTree_Rebuild, [:pointer, :bool], :int],
|
816
887
|
[:DynamicTree_GetByteCount, :b2DynamicTree_GetByteCount, [:pointer], :int],
|
817
|
-
[:DynamicTree_GetUserData, :b2DynamicTree_GetUserData, [:pointer, :int], :
|
888
|
+
[:DynamicTree_GetUserData, :b2DynamicTree_GetUserData, [:pointer, :int], :ulong_long],
|
818
889
|
[:DynamicTree_GetAABB, :b2DynamicTree_GetAABB, [:pointer, :int], AABB.by_value],
|
819
890
|
[:DynamicTree_Validate, :b2DynamicTree_Validate, [:pointer], :void],
|
820
891
|
[:DynamicTree_ValidateNoEnlarged, :b2DynamicTree_ValidateNoEnlarged, [:pointer], :void],
|
892
|
+
[:SolvePlanes, :b2SolvePlanes, [Vec2.by_value, :pointer, :int], PlaneSolverResult.by_value],
|
893
|
+
[:ClipVector, :b2ClipVector, [Vec2.by_value, :pointer, :int], Vec2.by_value],
|
821
894
|
]
|
822
895
|
entries.each do |entry|
|
823
896
|
api_name = if method_naming == :snake_case
|
data/lib/box2d_id.rb
CHANGED
@@ -120,6 +120,31 @@ module Box2D
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
class ContactId < FFI::Struct
|
124
|
+
layout(
|
125
|
+
:index1, :int,
|
126
|
+
:world0, :ushort,
|
127
|
+
:padding, :short,
|
128
|
+
:generation, :uint,
|
129
|
+
)
|
130
|
+
def index1 = self[:index1]
|
131
|
+
def index1=(v) self[:index1] = v end
|
132
|
+
def world0 = self[:world0]
|
133
|
+
def world0=(v) self[:world0] = v end
|
134
|
+
def padding = self[:padding]
|
135
|
+
def padding=(v) self[:padding] = v end
|
136
|
+
def generation = self[:generation]
|
137
|
+
def generation=(v) self[:generation] = v end
|
138
|
+
def self.create_as(_index1_, _world0_, _padding_, _generation_)
|
139
|
+
instance = ContactId.new
|
140
|
+
instance[:index1] = _index1_
|
141
|
+
instance[:world0] = _world0_
|
142
|
+
instance[:padding] = _padding_
|
143
|
+
instance[:generation] = _generation_
|
144
|
+
instance
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
123
148
|
|
124
149
|
# Function
|
125
150
|
|
data/lib/box2d_id_inline.rb
CHANGED
@@ -24,6 +24,8 @@ module Box2D
|
|
24
24
|
|
25
25
|
def self.setup_id_inline_symbols(method_naming: :original)
|
26
26
|
entries = [
|
27
|
+
[:StoreWorldId, :b2StoreWorldId, [WorldId.by_value], :uint],
|
28
|
+
[:LoadWorldId, :b2LoadWorldId, [:uint], WorldId.by_value],
|
27
29
|
[:StoreBodyId, :b2StoreBodyId, [BodyId.by_value], :ulong_long],
|
28
30
|
[:LoadBodyId, :b2LoadBodyId, [:ulong_long], BodyId.by_value],
|
29
31
|
[:StoreShapeId, :b2StoreShapeId, [ShapeId.by_value], :ulong_long],
|
@@ -32,6 +34,8 @@ module Box2D
|
|
32
34
|
[:LoadChainId, :b2LoadChainId, [:ulong_long], ChainId.by_value],
|
33
35
|
[:StoreJointId, :b2StoreJointId, [JointId.by_value], :ulong_long],
|
34
36
|
[:LoadJointId, :b2LoadJointId, [:ulong_long], JointId.by_value],
|
37
|
+
[:StoreContactId, :b2StoreContactId, [ContactId.by_value, :pointer], :void],
|
38
|
+
[:LoadContactId, :b2LoadContactId, [:pointer], ContactId.by_value],
|
35
39
|
]
|
36
40
|
entries.each do |entry|
|
37
41
|
api_name = if method_naming == :snake_case
|
data/lib/box2d_main.rb
CHANGED
@@ -32,16 +32,14 @@ module Box2D
|
|
32
32
|
[:World_GetBodyEvents, :b2World_GetBodyEvents, [WorldId.by_value], BodyEvents.by_value],
|
33
33
|
[:World_GetSensorEvents, :b2World_GetSensorEvents, [WorldId.by_value], SensorEvents.by_value],
|
34
34
|
[:World_GetContactEvents, :b2World_GetContactEvents, [WorldId.by_value], ContactEvents.by_value],
|
35
|
+
[:World_GetJointEvents, :b2World_GetJointEvents, [WorldId.by_value], JointEvents.by_value],
|
35
36
|
[:World_OverlapAABB, :b2World_OverlapAABB, [WorldId.by_value, AABB.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
36
|
-
[:
|
37
|
-
[:World_OverlapCircle, :b2World_OverlapCircle, [WorldId.by_value, :pointer, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
38
|
-
[:World_OverlapCapsule, :b2World_OverlapCapsule, [WorldId.by_value, :pointer, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
39
|
-
[:World_OverlapPolygon, :b2World_OverlapPolygon, [WorldId.by_value, :pointer, Transform.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
37
|
+
[:World_OverlapShape, :b2World_OverlapShape, [WorldId.by_value, :pointer, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
40
38
|
[:World_CastRay, :b2World_CastRay, [WorldId.by_value, Vec2.by_value, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
41
39
|
[:World_CastRayClosest, :b2World_CastRayClosest, [WorldId.by_value, Vec2.by_value, Vec2.by_value, QueryFilter.by_value], RayResult.by_value],
|
42
|
-
[:
|
43
|
-
[:
|
44
|
-
[:
|
40
|
+
[:World_CastShape, :b2World_CastShape, [WorldId.by_value, :pointer, Vec2.by_value, QueryFilter.by_value, :pointer, :pointer], TreeStats.by_value],
|
41
|
+
[:World_CastMover, :b2World_CastMover, [WorldId.by_value, :pointer, Vec2.by_value, QueryFilter.by_value], :float],
|
42
|
+
[:World_CollideMover, :b2World_CollideMover, [WorldId.by_value, :pointer, QueryFilter.by_value, :pointer, :pointer], :void],
|
45
43
|
[:World_EnableSleeping, :b2World_EnableSleeping, [WorldId.by_value, :bool], :void],
|
46
44
|
[:World_IsSleepingEnabled, :b2World_IsSleepingEnabled, [WorldId.by_value], :bool],
|
47
45
|
[:World_EnableContinuous, :b2World_EnableContinuous, [WorldId.by_value, :bool], :void],
|
@@ -56,7 +54,6 @@ module Box2D
|
|
56
54
|
[:World_GetGravity, :b2World_GetGravity, [WorldId.by_value], Vec2.by_value],
|
57
55
|
[:World_Explode, :b2World_Explode, [WorldId.by_value, :pointer], :void],
|
58
56
|
[:World_SetContactTuning, :b2World_SetContactTuning, [WorldId.by_value, :float, :float, :float], :void],
|
59
|
-
[:World_SetJointTuning, :b2World_SetJointTuning, [WorldId.by_value, :float, :float], :void],
|
60
57
|
[:World_SetMaximumLinearSpeed, :b2World_SetMaximumLinearSpeed, [WorldId.by_value, :float], :void],
|
61
58
|
[:World_GetMaximumLinearSpeed, :b2World_GetMaximumLinearSpeed, [WorldId.by_value], :float],
|
62
59
|
[:World_EnableWarmStarting, :b2World_EnableWarmStarting, [WorldId.by_value, :bool], :void],
|
@@ -92,6 +89,7 @@ module Box2D
|
|
92
89
|
[:Body_GetAngularVelocity, :b2Body_GetAngularVelocity, [BodyId.by_value], :float],
|
93
90
|
[:Body_SetLinearVelocity, :b2Body_SetLinearVelocity, [BodyId.by_value, Vec2.by_value], :void],
|
94
91
|
[:Body_SetAngularVelocity, :b2Body_SetAngularVelocity, [BodyId.by_value, :float], :void],
|
92
|
+
[:Body_SetTargetTransform, :b2Body_SetTargetTransform, [BodyId.by_value, Transform.by_value, :float], :void],
|
95
93
|
[:Body_GetLocalPointVelocity, :b2Body_GetLocalPointVelocity, [BodyId.by_value, Vec2.by_value], Vec2.by_value],
|
96
94
|
[:Body_GetWorldPointVelocity, :b2Body_GetWorldPointVelocity, [BodyId.by_value, Vec2.by_value], Vec2.by_value],
|
97
95
|
[:Body_ApplyForce, :b2Body_ApplyForce, [BodyId.by_value, Vec2.by_value, Vec2.by_value, :bool], :void],
|
@@ -156,8 +154,12 @@ module Box2D
|
|
156
154
|
[:Shape_GetRestitution, :b2Shape_GetRestitution, [ShapeId.by_value], :float],
|
157
155
|
[:Shape_SetMaterial, :b2Shape_SetMaterial, [ShapeId.by_value, :int], :void],
|
158
156
|
[:Shape_GetMaterial, :b2Shape_GetMaterial, [ShapeId.by_value], :int],
|
157
|
+
[:Shape_SetSurfaceMaterial, :b2Shape_SetSurfaceMaterial, [ShapeId.by_value, SurfaceMaterial.by_value], :void],
|
158
|
+
[:Shape_GetSurfaceMaterial, :b2Shape_GetSurfaceMaterial, [ShapeId.by_value], SurfaceMaterial.by_value],
|
159
159
|
[:Shape_GetFilter, :b2Shape_GetFilter, [ShapeId.by_value], Filter.by_value],
|
160
160
|
[:Shape_SetFilter, :b2Shape_SetFilter, [ShapeId.by_value, Filter.by_value], :void],
|
161
|
+
[:Shape_EnableSensorEvents, :b2Shape_EnableSensorEvents, [ShapeId.by_value, :bool], :void],
|
162
|
+
[:Shape_AreSensorEventsEnabled, :b2Shape_AreSensorEventsEnabled, [ShapeId.by_value], :bool],
|
161
163
|
[:Shape_EnableContactEvents, :b2Shape_EnableContactEvents, [ShapeId.by_value, :bool], :void],
|
162
164
|
[:Shape_AreContactEventsEnabled, :b2Shape_AreContactEventsEnabled, [ShapeId.by_value], :bool],
|
163
165
|
[:Shape_EnablePreSolveEvents, :b2Shape_EnablePreSolveEvents, [ShapeId.by_value, :bool], :void],
|
@@ -201,8 +203,10 @@ module Box2D
|
|
201
203
|
[:Joint_GetBodyA, :b2Joint_GetBodyA, [JointId.by_value], BodyId.by_value],
|
202
204
|
[:Joint_GetBodyB, :b2Joint_GetBodyB, [JointId.by_value], BodyId.by_value],
|
203
205
|
[:Joint_GetWorld, :b2Joint_GetWorld, [JointId.by_value], WorldId.by_value],
|
204
|
-
[:
|
205
|
-
[:
|
206
|
+
[:Joint_SetLocalFrameA, :b2Joint_SetLocalFrameA, [JointId.by_value, Transform.by_value], :void],
|
207
|
+
[:Joint_GetLocalFrameA, :b2Joint_GetLocalFrameA, [JointId.by_value], Transform.by_value],
|
208
|
+
[:Joint_SetLocalFrameB, :b2Joint_SetLocalFrameB, [JointId.by_value, Transform.by_value], :void],
|
209
|
+
[:Joint_GetLocalFrameB, :b2Joint_GetLocalFrameB, [JointId.by_value], Transform.by_value],
|
206
210
|
[:Joint_SetCollideConnected, :b2Joint_SetCollideConnected, [JointId.by_value, :bool], :void],
|
207
211
|
[:Joint_GetCollideConnected, :b2Joint_GetCollideConnected, [JointId.by_value], :bool],
|
208
212
|
[:Joint_SetUserData, :b2Joint_SetUserData, [JointId.by_value, :pointer], :void],
|
@@ -210,6 +214,10 @@ module Box2D
|
|
210
214
|
[:Joint_WakeBodies, :b2Joint_WakeBodies, [JointId.by_value], :void],
|
211
215
|
[:Joint_GetConstraintForce, :b2Joint_GetConstraintForce, [JointId.by_value], Vec2.by_value],
|
212
216
|
[:Joint_GetConstraintTorque, :b2Joint_GetConstraintTorque, [JointId.by_value], :float],
|
217
|
+
[:Joint_GetLinearSeparation, :b2Joint_GetLinearSeparation, [JointId.by_value], :float],
|
218
|
+
[:Joint_GetAngularSeparation, :b2Joint_GetAngularSeparation, [JointId.by_value], :float],
|
219
|
+
[:Joint_GetConstraintTuning, :b2Joint_GetConstraintTuning, [JointId.by_value, :pointer, :pointer], :void],
|
220
|
+
[:Joint_SetConstraintTuning, :b2Joint_SetConstraintTuning, [JointId.by_value, :float, :float], :void],
|
213
221
|
[:CreateDistanceJoint, :b2CreateDistanceJoint, [WorldId.by_value, :pointer], JointId.by_value],
|
214
222
|
[:DistanceJoint_SetLength, :b2DistanceJoint_SetLength, [JointId.by_value, :float], :void],
|
215
223
|
[:DistanceJoint_GetLength, :b2DistanceJoint_GetLength, [JointId.by_value], :float],
|
@@ -233,10 +241,6 @@ module Box2D
|
|
233
241
|
[:DistanceJoint_GetMaxMotorForce, :b2DistanceJoint_GetMaxMotorForce, [JointId.by_value], :float],
|
234
242
|
[:DistanceJoint_GetMotorForce, :b2DistanceJoint_GetMotorForce, [JointId.by_value], :float],
|
235
243
|
[:CreateMotorJoint, :b2CreateMotorJoint, [WorldId.by_value, :pointer], JointId.by_value],
|
236
|
-
[:MotorJoint_SetLinearOffset, :b2MotorJoint_SetLinearOffset, [JointId.by_value, Vec2.by_value], :void],
|
237
|
-
[:MotorJoint_GetLinearOffset, :b2MotorJoint_GetLinearOffset, [JointId.by_value], Vec2.by_value],
|
238
|
-
[:MotorJoint_SetAngularOffset, :b2MotorJoint_SetAngularOffset, [JointId.by_value, :float], :void],
|
239
|
-
[:MotorJoint_GetAngularOffset, :b2MotorJoint_GetAngularOffset, [JointId.by_value], :float],
|
240
244
|
[:MotorJoint_SetMaxForce, :b2MotorJoint_SetMaxForce, [JointId.by_value, :float], :void],
|
241
245
|
[:MotorJoint_GetMaxForce, :b2MotorJoint_GetMaxForce, [JointId.by_value], :float],
|
242
246
|
[:MotorJoint_SetMaxTorque, :b2MotorJoint_SetMaxTorque, [JointId.by_value, :float], :void],
|
@@ -244,15 +248,13 @@ module Box2D
|
|
244
248
|
[:MotorJoint_SetCorrectionFactor, :b2MotorJoint_SetCorrectionFactor, [JointId.by_value, :float], :void],
|
245
249
|
[:MotorJoint_GetCorrectionFactor, :b2MotorJoint_GetCorrectionFactor, [JointId.by_value], :float],
|
246
250
|
[:CreateMouseJoint, :b2CreateMouseJoint, [WorldId.by_value, :pointer], JointId.by_value],
|
247
|
-
[:MouseJoint_SetTarget, :b2MouseJoint_SetTarget, [JointId.by_value, Vec2.by_value], :void],
|
248
|
-
[:MouseJoint_GetTarget, :b2MouseJoint_GetTarget, [JointId.by_value], Vec2.by_value],
|
249
251
|
[:MouseJoint_SetSpringHertz, :b2MouseJoint_SetSpringHertz, [JointId.by_value, :float], :void],
|
250
252
|
[:MouseJoint_GetSpringHertz, :b2MouseJoint_GetSpringHertz, [JointId.by_value], :float],
|
251
253
|
[:MouseJoint_SetSpringDampingRatio, :b2MouseJoint_SetSpringDampingRatio, [JointId.by_value, :float], :void],
|
252
254
|
[:MouseJoint_GetSpringDampingRatio, :b2MouseJoint_GetSpringDampingRatio, [JointId.by_value], :float],
|
253
255
|
[:MouseJoint_SetMaxForce, :b2MouseJoint_SetMaxForce, [JointId.by_value, :float], :void],
|
254
256
|
[:MouseJoint_GetMaxForce, :b2MouseJoint_GetMaxForce, [JointId.by_value], :float],
|
255
|
-
[:
|
257
|
+
[:CreateFilterJoint, :b2CreateFilterJoint, [WorldId.by_value, :pointer], JointId.by_value],
|
256
258
|
[:CreatePrismaticJoint, :b2CreatePrismaticJoint, [WorldId.by_value, :pointer], JointId.by_value],
|
257
259
|
[:PrismaticJoint_EnableSpring, :b2PrismaticJoint_EnableSpring, [JointId.by_value, :bool], :void],
|
258
260
|
[:PrismaticJoint_IsSpringEnabled, :b2PrismaticJoint_IsSpringEnabled, [JointId.by_value], :bool],
|
@@ -260,6 +262,8 @@ module Box2D
|
|
260
262
|
[:PrismaticJoint_GetSpringHertz, :b2PrismaticJoint_GetSpringHertz, [JointId.by_value], :float],
|
261
263
|
[:PrismaticJoint_SetSpringDampingRatio, :b2PrismaticJoint_SetSpringDampingRatio, [JointId.by_value, :float], :void],
|
262
264
|
[:PrismaticJoint_GetSpringDampingRatio, :b2PrismaticJoint_GetSpringDampingRatio, [JointId.by_value], :float],
|
265
|
+
[:PrismaticJoint_SetTargetTranslation, :b2PrismaticJoint_SetTargetTranslation, [JointId.by_value, :float], :void],
|
266
|
+
[:PrismaticJoint_GetTargetTranslation, :b2PrismaticJoint_GetTargetTranslation, [JointId.by_value], :float],
|
263
267
|
[:PrismaticJoint_EnableLimit, :b2PrismaticJoint_EnableLimit, [JointId.by_value, :bool], :void],
|
264
268
|
[:PrismaticJoint_IsLimitEnabled, :b2PrismaticJoint_IsLimitEnabled, [JointId.by_value], :bool],
|
265
269
|
[:PrismaticJoint_GetLowerLimit, :b2PrismaticJoint_GetLowerLimit, [JointId.by_value], :float],
|
@@ -281,6 +285,8 @@ module Box2D
|
|
281
285
|
[:RevoluteJoint_GetSpringHertz, :b2RevoluteJoint_GetSpringHertz, [JointId.by_value], :float],
|
282
286
|
[:RevoluteJoint_SetSpringDampingRatio, :b2RevoluteJoint_SetSpringDampingRatio, [JointId.by_value, :float], :void],
|
283
287
|
[:RevoluteJoint_GetSpringDampingRatio, :b2RevoluteJoint_GetSpringDampingRatio, [JointId.by_value], :float],
|
288
|
+
[:RevoluteJoint_SetTargetAngle, :b2RevoluteJoint_SetTargetAngle, [JointId.by_value, :float], :void],
|
289
|
+
[:RevoluteJoint_GetTargetAngle, :b2RevoluteJoint_GetTargetAngle, [JointId.by_value], :float],
|
284
290
|
[:RevoluteJoint_GetAngle, :b2RevoluteJoint_GetAngle, [JointId.by_value], :float],
|
285
291
|
[:RevoluteJoint_EnableLimit, :b2RevoluteJoint_EnableLimit, [JointId.by_value, :bool], :void],
|
286
292
|
[:RevoluteJoint_IsLimitEnabled, :b2RevoluteJoint_IsLimitEnabled, [JointId.by_value], :bool],
|
@@ -295,8 +301,6 @@ module Box2D
|
|
295
301
|
[:RevoluteJoint_SetMaxMotorTorque, :b2RevoluteJoint_SetMaxMotorTorque, [JointId.by_value, :float], :void],
|
296
302
|
[:RevoluteJoint_GetMaxMotorTorque, :b2RevoluteJoint_GetMaxMotorTorque, [JointId.by_value], :float],
|
297
303
|
[:CreateWeldJoint, :b2CreateWeldJoint, [WorldId.by_value, :pointer], JointId.by_value],
|
298
|
-
[:WeldJoint_GetReferenceAngle, :b2WeldJoint_GetReferenceAngle, [JointId.by_value], :float],
|
299
|
-
[:WeldJoint_SetReferenceAngle, :b2WeldJoint_SetReferenceAngle, [JointId.by_value, :float], :void],
|
300
304
|
[:WeldJoint_SetLinearHertz, :b2WeldJoint_SetLinearHertz, [JointId.by_value, :float], :void],
|
301
305
|
[:WeldJoint_GetLinearHertz, :b2WeldJoint_GetLinearHertz, [JointId.by_value], :float],
|
302
306
|
[:WeldJoint_SetLinearDampingRatio, :b2WeldJoint_SetLinearDampingRatio, [JointId.by_value, :float], :void],
|
@@ -324,6 +328,9 @@ module Box2D
|
|
324
328
|
[:WheelJoint_SetMaxMotorTorque, :b2WheelJoint_SetMaxMotorTorque, [JointId.by_value, :float], :void],
|
325
329
|
[:WheelJoint_GetMaxMotorTorque, :b2WheelJoint_GetMaxMotorTorque, [JointId.by_value], :float],
|
326
330
|
[:WheelJoint_GetMotorTorque, :b2WheelJoint_GetMotorTorque, [JointId.by_value], :float],
|
331
|
+
[:Contact_IsValid, :b2Contact_IsValid, [ContactId.by_value], :bool],
|
332
|
+
[:Contact_GetManifold, :b2Contact_GetManifold, [ContactId.by_value], Manifold.by_value],
|
333
|
+
[:Contact_GetShapeIds, :b2Contact_GetShapeIds, [ContactId.by_value, :pointer, :pointer], :void],
|
327
334
|
]
|
328
335
|
entries.each do |entry|
|
329
336
|
api_name = if method_naming == :snake_case
|
data/lib/box2d_math_functions.rb
CHANGED
@@ -121,18 +121,37 @@ module Box2D
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
class Plane < FFI::Struct
|
125
|
+
layout(
|
126
|
+
:normal, Vec2,
|
127
|
+
:offset, :float,
|
128
|
+
)
|
129
|
+
def normal = self[:normal]
|
130
|
+
def normal=(v) self[:normal] = v end
|
131
|
+
def offset = self[:offset]
|
132
|
+
def offset=(v) self[:offset] = v end
|
133
|
+
def self.create_as(_normal_, _offset_)
|
134
|
+
instance = Plane.new
|
135
|
+
instance[:normal] = _normal_
|
136
|
+
instance[:offset] = _offset_
|
137
|
+
instance
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
124
141
|
|
125
142
|
# Function
|
126
143
|
|
127
144
|
def self.setup_math_functions_symbols(method_naming: :original)
|
128
145
|
entries = [
|
129
|
-
[:Atan2, :b2Atan2, [:float, :float], :float],
|
130
|
-
[:ComputeCosSin, :b2ComputeCosSin, [:float], CosSin.by_value],
|
131
|
-
[:ComputeRotationBetweenUnitVectors, :b2ComputeRotationBetweenUnitVectors, [Vec2.by_value, Vec2.by_value], Rot.by_value],
|
132
146
|
[:IsValidFloat, :b2IsValidFloat, [:float], :bool],
|
133
147
|
[:IsValidVec2, :b2IsValidVec2, [Vec2.by_value], :bool],
|
134
148
|
[:IsValidRotation, :b2IsValidRotation, [Rot.by_value], :bool],
|
149
|
+
[:IsValidTransform, :b2IsValidTransform, [Transform.by_value], :bool],
|
135
150
|
[:IsValidAABB, :b2IsValidAABB, [AABB.by_value], :bool],
|
151
|
+
[:IsValidPlane, :b2IsValidPlane, [Plane.by_value], :bool],
|
152
|
+
[:Atan2, :b2Atan2, [:float, :float], :float],
|
153
|
+
[:ComputeCosSin, :b2ComputeCosSin, [:float], CosSin.by_value],
|
154
|
+
[:ComputeRotationBetweenUnitVectors, :b2ComputeRotationBetweenUnitVectors, [Vec2.by_value, Vec2.by_value], Rot.by_value],
|
136
155
|
[:SetLengthUnitsPerMeter, :b2SetLengthUnitsPerMeter, [:float], :void],
|
137
156
|
[:GetLengthUnitsPerMeter, :b2GetLengthUnitsPerMeter, [], :float],
|
138
157
|
]
|
@@ -53,13 +53,15 @@ module Box2D
|
|
53
53
|
[:Length, :b2Length, [Vec2.by_value], :float],
|
54
54
|
[:Distance, :b2Distance, [Vec2.by_value, Vec2.by_value], :float],
|
55
55
|
[:Normalize, :b2Normalize, [Vec2.by_value], Vec2.by_value],
|
56
|
+
[:IsNormalized, :b2IsNormalized, [Vec2.by_value], :bool],
|
56
57
|
[:GetLengthAndNormalize, :b2GetLengthAndNormalize, [:pointer, Vec2.by_value], Vec2.by_value],
|
57
58
|
[:NormalizeRot, :b2NormalizeRot, [Rot.by_value], Rot.by_value],
|
58
59
|
[:IntegrateRotation, :b2IntegrateRotation, [Rot.by_value, :float], Rot.by_value],
|
59
60
|
[:LengthSquared, :b2LengthSquared, [Vec2.by_value], :float],
|
60
61
|
[:DistanceSquared, :b2DistanceSquared, [Vec2.by_value, Vec2.by_value], :float],
|
61
62
|
[:MakeRot, :b2MakeRot, [:float], Rot.by_value],
|
62
|
-
[:
|
63
|
+
[:MakeRotFromUnitVector, :b2MakeRotFromUnitVector, [Vec2.by_value], Rot.by_value],
|
64
|
+
[:IsNormalizedRot, :b2IsNormalizedRot, [Rot.by_value], :bool],
|
63
65
|
[:NLerp, :b2NLerp, [Rot.by_value, Rot.by_value, :float], Rot.by_value],
|
64
66
|
[:ComputeAngularVelocity, :b2ComputeAngularVelocity, [Rot.by_value, Rot.by_value, :float], :float],
|
65
67
|
[:Rot_GetAngle, :b2Rot_GetAngle, [Rot.by_value], :float],
|
@@ -69,7 +71,6 @@ module Box2D
|
|
69
71
|
[:InvMulRot, :b2InvMulRot, [Rot.by_value, Rot.by_value], Rot.by_value],
|
70
72
|
[:RelativeAngle, :b2RelativeAngle, [Rot.by_value, Rot.by_value], :float],
|
71
73
|
[:UnwindAngle, :b2UnwindAngle, [:float], :float],
|
72
|
-
[:UnwindLargeAngle, :b2UnwindLargeAngle, [:float], :float],
|
73
74
|
[:RotateVector, :b2RotateVector, [Rot.by_value, Vec2.by_value], Vec2.by_value],
|
74
75
|
[:InvRotateVector, :b2InvRotateVector, [Rot.by_value, Vec2.by_value], Vec2.by_value],
|
75
76
|
[:TransformPoint, :b2TransformPoint, [Transform.by_value, Vec2.by_value], Vec2.by_value],
|
@@ -83,6 +84,10 @@ module Box2D
|
|
83
84
|
[:AABB_Center, :b2AABB_Center, [AABB.by_value], Vec2.by_value],
|
84
85
|
[:AABB_Extents, :b2AABB_Extents, [AABB.by_value], Vec2.by_value],
|
85
86
|
[:AABB_Union, :b2AABB_Union, [AABB.by_value, AABB.by_value], AABB.by_value],
|
87
|
+
[:AABB_Overlaps, :b2AABB_Overlaps, [AABB.by_value, AABB.by_value], :bool],
|
88
|
+
[:MakeAABB, :b2MakeAABB, [:pointer, :int, :float], AABB.by_value],
|
89
|
+
[:PlaneSeparation, :b2PlaneSeparation, [Plane.by_value, Vec2.by_value], :float],
|
90
|
+
[:SpringDamper, :b2SpringDamper, [:float, :float, :float, :float, :float], :float],
|
86
91
|
]
|
87
92
|
entries.each do |entry|
|
88
93
|
api_name = if method_naming == :snake_case
|