|
4 | 4 |
|
5 | 5 | using System; |
6 | 6 | using System.Runtime.CompilerServices; |
| 7 | +using System.Runtime.InteropServices; |
7 | 8 | using static Box2D.NET.B2Constants; |
8 | 9 | using static Box2D.NET.B2Diagnostics; |
9 | 10 | using static Box2D.NET.B2Buffers; |
@@ -1084,11 +1085,11 @@ internal static void b2DynamicTree_ValidateNoEnlarged(B2DynamicTree tree) |
1084 | 1085 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
1085 | 1086 | public static int b2DynamicTree_GetByteCount(B2DynamicTree tree) |
1086 | 1087 | { |
1087 | | - // TODO: @ikpil, check |
1088 | | - // int size = sizeof( b2DynamicTree ) + sizeof( b2TreeNode ) * tree.nodeCapacity + |
1089 | | - // tree.rebuildCapacity * ( sizeof( int ) + sizeof( b2AABB ) + sizeof( B2Vec2 ) + sizeof( int ) ); |
1090 | | - //return (int)size; |
1091 | | - return -1; |
| 1088 | + // int size = Marshal.SizeOf<B2DynamicTree>() + Marshal.SizeOf<B2TreeNode>() * tree.nodeCapacity + |
| 1089 | + // tree.rebuildCapacity * (sizeof(int) + Marshal.SizeOf<B2AABB>() + Marshal.SizeOf<B2Vec2>() + sizeof(int)); |
| 1090 | + int size = sizeof(int) * 6 + sizeof(ulong) * 4 + Marshal.SizeOf<B2TreeNode>() * tree.nodeCapacity + |
| 1091 | + tree.rebuildCapacity * (sizeof(int) + Marshal.SizeOf<B2AABB>() + Marshal.SizeOf<B2Vec2>() + sizeof(int)); |
| 1092 | + return (int)size; |
1092 | 1093 | } |
1093 | 1094 |
|
1094 | 1095 | /// Get proxy user data |
@@ -1166,7 +1167,7 @@ public static B2TreeStats b2DynamicTree_Query<T>(B2DynamicTree tree, in B2AABB a |
1166 | 1167 | /// Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB. |
1167 | 1168 | /// No filtering is performed. |
1168 | 1169 | /// @return performance data |
1169 | | - internal static B2TreeStats b2DynamicTree_QueryAll<T>(B2DynamicTree tree, in B2AABB aabb, b2TreeQueryCallbackFcn<T> callback, ref T context) |
| 1170 | + public static B2TreeStats b2DynamicTree_QueryAll<T>(B2DynamicTree tree, in B2AABB aabb, b2TreeQueryCallbackFcn<T> callback, ref T context) |
1170 | 1171 | { |
1171 | 1172 | B2TreeStats result = new B2TreeStats(); |
1172 | 1173 |
|
@@ -1232,7 +1233,7 @@ internal static B2TreeStats b2DynamicTree_QueryAll<T>(B2DynamicTree tree, in B2A |
1232 | 1233 | /// @param callback a callback class that is called for each proxy that is hit by the ray |
1233 | 1234 | /// @param context user context that is passed to the callback |
1234 | 1235 | /// @return performance data |
1235 | | - public static B2TreeStats b2DynamicTree_RayCast<T>(B2DynamicTree tree, ref B2RayCastInput input, ulong maskBits, |
| 1236 | + public static B2TreeStats b2DynamicTree_RayCast<T>(B2DynamicTree tree, in B2RayCastInput input, ulong maskBits, |
1236 | 1237 | b2TreeRayCastCallbackFcn<T> callback, ref T context) where T : struct |
1237 | 1238 | { |
1238 | 1239 | B2TreeStats result = new B2TreeStats(); |
|
0 commit comments