private static void OnMeshBuiltHandler(int tag, string name, IntPtr vertexPtr, int vertexCount, IntPtr trianglePtr, int triangleCount, IntPtr colorPtr, int colorCount, IntPtr uvPtr, int uvCount, IntPtr uvMapPtr, int uvMapCount) { Tile tile; if (!Tiles.TryGetValue(tag, out tile) || tile.IsDisposed) { return; } // NOTE ideally, arrays should be marshalled automatically which could enable some optimizations, // especially, for il2cpp. However, I was not able to make it work using il2cpp setting: all arrays // were passed to this method with just one element. I gave up and decided to use manual marshalling // here and in AdaptElement method below. var vertices = MarshalUtils.ReadDoubles(vertexPtr, vertexCount); var triangles = MarshalUtils.ReadInts(trianglePtr, triangleCount); var colors = MarshalUtils.ReadInts(colorPtr, colorCount); var uvs = MarshalUtils.ReadDoubles(uvPtr, uvCount); var uvMap = MarshalUtils.ReadInts(uvMapPtr, uvMapCount); MapDataAdapter.AdaptMesh(tile, _observers, _trace, name, vertices, triangles, colors, uvs, uvMap); }
public void OnMeshBuiltHandler(int tag, string name, double[] vertices, int vertexCount, int[] triangles, int triangleCount, int[] colors, int colorCount, double[] uvs, int uvCount, int[] uvMap, int uvMapCount) { MapDataAdapter.AdaptMesh(_tile, _observers, _trace, name, vertices, triangles, colors, uvs, uvMap); }