diff --git a/HololensReceiver/Assets/ElemRenderer.cs b/HololensReceiver/Assets/ElemRenderer.cs index 182ca308..9c18cedb 100644 --- a/HololensReceiver/Assets/ElemRenderer.cs +++ b/HololensReceiver/Assets/ElemRenderer.cs @@ -1,5 +1,6 @@ using UnityEngine; using System.Collections; +using System.Linq; public class ElemRenderer : MonoBehaviour { @@ -19,26 +20,26 @@ void Update() { } - public void UpdateMesh(float[] arrVertices, byte[] arrColors, int nPointsToRender, int nPointsRendered) + public void UpdateMesh(float[] arrVertices, byte[] arrColors, int[] arrTriangles, int VerticesStart, int nVerticesToRender, int TrianglesStart, int nTrianglesToRender) { - int nPoints; - if (arrVertices == null || arrColors == null) - nPoints = 0; - else - nPoints = System.Math.Min(nPointsToRender, (arrVertices.Length / 3) - nPointsRendered); - nPoints = System.Math.Min(nPoints, 65535); + int nPoints = nVerticesToRender; + int nTriangles = nTrianglesToRender * 3; Vector3[] points = new Vector3[nPoints]; int[] indices = new int[nPoints]; Color[] colors = new Color[nPoints]; + int[] triangles = new int[nTriangles]; for (int i = 0; i < nPoints; i++) { - int ptIdx = 3 * (nPointsRendered + i); - + int ptIdx = 3 * (VerticesStart + i); points[i] = new Vector3(arrVertices[ptIdx + 0], arrVertices[ptIdx + 1], -arrVertices[ptIdx + 2]); indices[i] = i; - colors[i] = new Color((float)arrColors[ptIdx + 0] / 256.0f, (float)arrColors[ptIdx + 1] / 256.0f, (float)arrColors[ptIdx + 2] / 256.0f, 1.0f); + colors[i] = new Color((float)arrColors[ptIdx + 0] / 256.0f, (float)arrColors[ptIdx + 1] / 256.0f, (float)arrColors[ptIdx + 2] / 256.0f, 1.0f); + } + + for (int i = 0; i < nTriangles; i++) { + triangles[i] = arrTriangles[TrianglesStart + i]; } if (mesh != null) @@ -46,7 +47,8 @@ public void UpdateMesh(float[] arrVertices, byte[] arrColors, int nPointsToRende mesh = new Mesh(); mesh.vertices = points; mesh.colors = colors; - mesh.SetIndices(indices, MeshTopology.Points, 0); + mesh.triangles = triangles; GetComponent().mesh = mesh; + } } diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll index e71b88ae..a674139b 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll.meta index 00384afb..5147b2cd 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.dll.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: effd1b6be519a334f953222471b49cba -timeCreated: 1484065275 +guid: f49d48d4b43da8b4f9041e8173114144 +timeCreated: 1501587951 licenseType: Free PluginImporter: serializedVersion: 1 @@ -9,24 +9,40 @@ PluginImporter: isPreloaded: 0 isOverridable: 0 platformData: + Android: + enabled: 1 + settings: + CPU: ARMv7 Any: enabled: 1 - settings: {} + settings: + Exclude Android: 0 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 0 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 0 + Exclude OSXIntel64: 0 + Exclude OSXUniversal: 0 + Exclude Win: 0 + Exclude Win64: 0 + Exclude WindowsStoreApps: 0 Editor: - enabled: 0 + enabled: 1 settings: CPU: x86 DefaultValueInitialized: true + OS: AnyOS Linux: enabled: 1 settings: CPU: x86 Linux64: - enabled: 0 + enabled: 1 settings: CPU: None LinuxUniversal: - enabled: 0 + enabled: 1 settings: CPU: x86 OSXIntel: @@ -34,11 +50,11 @@ PluginImporter: settings: CPU: AnyCPU OSXIntel64: - enabled: 0 + enabled: 1 settings: CPU: None OSXUniversal: - enabled: 0 + enabled: 1 settings: CPU: x86 Win: @@ -46,9 +62,17 @@ PluginImporter: settings: CPU: AnyCPU Win64: - enabled: 0 + enabled: 1 settings: CPU: None + WindowsStoreApps: + enabled: 1 + settings: + CPU: X86 + DontProcess: False + PlaceholderPath: + SDK: AnySDK + ScriptingBackend: AnyScriptingBackend userData: assetBundleName: assetBundleVariant: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp index ac77ee82..e95bc0cb 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp.meta index f7c4feaa..ec04e5be 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.exp.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 07e570f1342c06748b52afe8895b1e68 -timeCreated: 1484065272 +guid: 642d1d80b029e364586121bf733f259d +timeCreated: 1501587948 licenseType: Free DefaultImporter: userData: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj index 02c92ba0..80a7668e 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj.meta index 25ecceae..1b232074 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.iobj.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 469f699b95ac248428fa8eb68468e28b -timeCreated: 1484065272 +guid: 355e3b41ca1b8e34394dbfe184e9fb87 +timeCreated: 1501587948 licenseType: Free DefaultImporter: userData: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb index 141e73c8..b03f806c 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb.meta index a5ae95b7..e4297d52 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.ipdb.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 17a3712816439bf478ae119602500d53 -timeCreated: 1484065272 +guid: 0e38e90b867ca53458d4875b0949ebab +timeCreated: 1501587948 licenseType: Free DefaultImporter: userData: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib index 4327b712..95d466aa 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib.meta index c0b9e247..d6884d70 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.lib.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: c1d5515147fbadd4198da290ba0c3553 -timeCreated: 1484065272 +guid: 5c6b5c0773c6bf644bf74f7bb1a6a710 +timeCreated: 1501587948 licenseType: Free DefaultImporter: userData: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb index c1de74a3..0abe13f0 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb.meta index 75e66653..4797340d 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pdb.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: ed635872cabd56a438dc0e298c4f66f4 -timeCreated: 1484065272 +guid: ef9d0637685b09242a685c351e0191c1 +timeCreated: 1501587948 licenseType: Free DefaultImporter: userData: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pri.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pri.meta index f13dd721..e4c5b325 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pri.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.pri.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 51c90d370f9126a4ebd60f87142a635f -timeCreated: 1484065272 +timeCreated: 1501587948 licenseType: Free DefaultImporter: userData: diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd index 1f68c58e..2fe16b42 100644 Binary files a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd and b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd differ diff --git a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd.meta b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd.meta index ad0368a3..ad784725 100644 --- a/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd.meta +++ b/HololensReceiver/Assets/Plugins/x86/NetworkCommunication.winmd.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: b96ae3b1a3a2869409aa8c5f44cc56e7 -timeCreated: 1484065272 +timeCreated: 1501587948 licenseType: Free PluginImporter: serializedVersion: 1 diff --git a/HololensReceiver/Assets/PointCloudMaterial.mat b/HololensReceiver/Assets/PointCloudMaterial.mat index 969d4b71..27e67c6b 100644 Binary files a/HololensReceiver/Assets/PointCloudMaterial.mat and b/HololensReceiver/Assets/PointCloudMaterial.mat differ diff --git a/HololensReceiver/Assets/PointCloudReceiver.cs b/HololensReceiver/Assets/PointCloudReceiver.cs index cced5c5f..4c4609c3 100644 --- a/HololensReceiver/Assets/PointCloudReceiver.cs +++ b/HololensReceiver/Assets/PointCloudReceiver.cs @@ -2,6 +2,7 @@ using UnityEngine.UI; using System; using System.Collections; +using System.Linq; #if WINDOWS_UWP using NetworkCommunication; @@ -36,7 +37,9 @@ void Update() float[] vertices; byte[] colors; - + int[] triangles; + int[] chunksVertices; + int[] chunksTriangles; if (bReadyForNextFrame) { Debug.Log("Requesting frame"); @@ -51,13 +54,14 @@ void Update() } #if WINDOWS_UWP - if (socket.GetFrame(out vertices, out colors)) - #else - if (ReceiveFrame(out vertices, out colors)) + if (socket.GetFrame(out vertices, out colors, out triangles, out chunksVertices, out chunksTriangles)) +#else + if (ReceiveFrame(out vertices, out colors,out triangles, out chunksVertices, out chunksTriangles)) #endif { Debug.Log("Frame received"); - pointCloudRenderer.Render(vertices, colors); + Debug.Log("max and min of index: " + triangles.Max() + " " + triangles.Min() + " " + triangles.Length); + pointCloudRenderer.Render(vertices, colors, triangles, chunksVertices,chunksTriangles); bReadyForNextFrame = true; } } @@ -94,27 +98,51 @@ int ReadInt() return BitConverter.ToInt32(buffer, 0); } - bool ReceiveFrame(out float[] lVertices, out byte[] lColors) + bool ReceiveFrame(out float[] lVertices, out byte[] lColors, out int[] lTriangles, out int[] chunksVertices, out int[] chunksTriangles) { int nPointsToRead = ReadInt(); - - lVertices = new float[3 * nPointsToRead]; - short[] lShortVertices = new short[3 * nPointsToRead]; - lColors = new byte[3 * nPointsToRead]; + int nTrianglesToRead = ReadInt(); + int nChunks = ReadInt(); - int nBytesToRead = sizeof(short) * 3 * nPointsToRead; + chunksVertices = new int[nChunks]; + int nBytesToRead = sizeof(int) * nChunks; int nBytesRead = 0; byte[] buffer = new byte[nBytesToRead]; while (nBytesRead < nBytesToRead) nBytesRead += socket.GetStream().Read(buffer, nBytesRead, Math.Min(nBytesToRead - nBytesRead, 64000)); - System.Buffer.BlockCopy(buffer, 0, lShortVertices, 0, nBytesToRead); + System.Buffer.BlockCopy(buffer, 0, chunksVertices, 0, nBytesToRead); + + + + chunksTriangles = new int[nChunks]; + nBytesToRead = sizeof(int) * nChunks; + nBytesRead = 0; + buffer = new byte[nBytesToRead]; + + while (nBytesRead < nBytesToRead) + nBytesRead += socket.GetStream().Read(buffer, nBytesRead, Math.Min(nBytesToRead - nBytesRead, 64000)); + + System.Buffer.BlockCopy(buffer, 0, chunksTriangles, 0, nBytesToRead); + + + + + lVertices = new float[3 * nPointsToRead]; + nBytesToRead = sizeof(float) * 3 * nPointsToRead; + nBytesRead = 0; + buffer = new byte[nBytesToRead]; + + while (nBytesRead < nBytesToRead) + nBytesRead += socket.GetStream().Read(buffer, nBytesRead, Math.Min(nBytesToRead - nBytesRead, 64000)); + + System.Buffer.BlockCopy(buffer, 0, lVertices, 0, nBytesToRead); - for (int i = 0; i < lShortVertices.Length; i++) - lVertices[i] = lShortVertices[i] / 1000.0f; + + lColors = new byte[3 * nPointsToRead]; nBytesToRead = sizeof(byte) * 3 * nPointsToRead; nBytesRead = 0; buffer = new byte[nBytesToRead]; @@ -124,6 +152,18 @@ bool ReceiveFrame(out float[] lVertices, out byte[] lColors) System.Buffer.BlockCopy(buffer, 0, lColors, 0, nBytesToRead); + + lTriangles = new int[3 * nTrianglesToRead]; + nBytesToRead = sizeof(int) * 3 * nTrianglesToRead; + nBytesRead = 0; + buffer = new byte[nBytesToRead]; + //Debug.Log(nBytesToRead); + while (nBytesRead < nBytesToRead) + nBytesRead += socket.GetStream().Read(buffer, nBytesRead, Math.Min(nBytesToRead - nBytesRead, 64000)); + + System.Buffer.BlockCopy(buffer, 0, lTriangles, 0, nBytesToRead); + + return true; } #endif diff --git a/HololensReceiver/Assets/PointCloudRenderer.cs b/HololensReceiver/Assets/PointCloudRenderer.cs index 35941ca2..a061c45e 100644 --- a/HololensReceiver/Assets/PointCloudRenderer.cs +++ b/HololensReceiver/Assets/PointCloudRenderer.cs @@ -30,34 +30,26 @@ void UpdatePointSize() pointCloudMaterial.SetFloat("_PointSize", pointSize * transform.localScale.x); } - public void Render(float[] arrVertices, byte[] arrColors) + public void Render(float[] arrVertices, byte[] arrColors, int[] arrTriangles, int[] chunksVertices, int[] chunksTriangles) { - int nPoints, nChunks; - if (arrVertices == null || arrColors == null) - { - nPoints = 0; - nChunks = 0; - } - else - { - nPoints = arrVertices.Length / 3; - nChunks = 1 + nPoints / maxChunkSize; - } + + int nChunks = chunksVertices.length; + + int VerticesRead = 0; + int TrianglesRead = 0; + if (elems.Count < nChunks) AddElems(nChunks - elems.Count); if (elems.Count > nChunks) RemoveElems(elems.Count - nChunks); - - int offset = 0; for (int i = 0; i < nChunks; i++) { - int nPointsToRender = System.Math.Min(maxChunkSize, nPoints - offset); ElemRenderer renderer = elems[i].GetComponent(); - renderer.UpdateMesh(arrVertices, arrColors, nPointsToRender, offset); - - offset += nPointsToRender; + renderer.UpdateMesh(arrVertices, arrColors, arrTriangles, VerticesRead, chunksVertices[i], TrianglesRead*3, chunksTriangles[i]); + VerticesRead += chunksVertices[i]; + TrianglesRead += chunksTriangles[i]; } } diff --git a/HololensReceiver/HololensReceiver.csproj b/HololensReceiver/HololensReceiver.csproj index b059c54b..3b5eba3e 100644 --- a/HololensReceiver/HololensReceiver.csproj +++ b/HololensReceiver/HololensReceiver.csproj @@ -15,8 +15,8 @@ Unity Subset v3.5 Game:1 - WSAPlayer:21 - 5.6.0f3 + StandaloneWindows:5 + 5.5.2f1 4 @@ -27,7 +27,7 @@ Temp\UnityVS_obj\Debug\ prompt 4 - DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_NETWORK;ENABLE_EVENT_QUEUE;UNITY_PLATFORM_THREAD_TO_CORE_MAPPING;ENABLE_SUBSTANCE;PLATFORM_SUPPORTS_ADS_ID;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;CURL_STATICLIB;ENABLE_VR;UNITY_WSA;ENABLE_DOTNET;ENABLE_PROFILER;UNITY_WSA_10_0;UNITY_WINRT_10_0;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU + DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_5_2;UNITY_5_5;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VIDEO;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;ENABLE_VSTU false @@ -37,7 +37,7 @@ Temp\UnityVS_obj\Release\ prompt 4 - TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_5_6_0;UNITY_5_6;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;INCLUDE_DYNAMIC_GI;INCLUDE_GI;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;ENABLE_VIDEO;UNITY_METRO;UNITY_METRO_API;UNITY_WINRT;ENABLE_WINRT_PINVOKE;ENABLE_LAZY_METHOD_CACHING;ENABLE_MOVIES;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_NETWORK;ENABLE_EVENT_QUEUE;UNITY_PLATFORM_THREAD_TO_CORE_MAPPING;ENABLE_SUBSTANCE;PLATFORM_SUPPORTS_ADS_ID;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;CURL_STATICLIB;ENABLE_VR;UNITY_WSA;ENABLE_DOTNET;ENABLE_PROFILER;UNITY_WSA_10_0;UNITY_WINRT_10_0;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU + TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_5_2;UNITY_5_5;UNITY_5;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_SCRIPTING_NEW_CSHARP_COMPILER;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VIDEO;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;UNITY_TEAM_LICENSE;ENABLE_VSTU false @@ -58,11 +58,8 @@ Library\UnityAssemblies\UnityEngine.Networking.dll - - Library\UnityAssemblies\UnityEngine.TestRunner.dll - - - Library\UnityAssemblies\nunit.framework.dll + + Library\UnityAssemblies\UnityEngine.PlaymodeTestsRunner.dll Library\UnityAssemblies\UnityEngine.Analytics.dll diff --git a/HololensReceiver/ProjectSettings/GraphicsSettings.asset b/HololensReceiver/ProjectSettings/GraphicsSettings.asset index be97b5e3..c3733403 100644 Binary files a/HololensReceiver/ProjectSettings/GraphicsSettings.asset and b/HololensReceiver/ProjectSettings/GraphicsSettings.asset differ diff --git a/HololensReceiver/ProjectSettings/ProjectVersion.txt b/HololensReceiver/ProjectSettings/ProjectVersion.txt index ca09a3da..1049cc72 100644 --- a/HololensReceiver/ProjectSettings/ProjectVersion.txt +++ b/HololensReceiver/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 5.6.0f3 +m_EditorVersion: 5.5.2f1 diff --git a/NetworkCommunication/NetworkCommunication.VC.db b/NetworkCommunication/NetworkCommunication.VC.db index c7a01b45..62e1d94c 100644 Binary files a/NetworkCommunication/NetworkCommunication.VC.db and b/NetworkCommunication/NetworkCommunication.VC.db differ diff --git a/NetworkCommunication/NetworkCommunicationWinRT/NetworkCommunicationWinRT.vcxproj b/NetworkCommunication/NetworkCommunicationWinRT/NetworkCommunicationWinRT.vcxproj index 7541fe77..017e9dc4 100644 --- a/NetworkCommunication/NetworkCommunicationWinRT/NetworkCommunicationWinRT.vcxproj +++ b/NetworkCommunication/NetworkCommunicationWinRT/NetworkCommunicationWinRT.vcxproj @@ -42,8 +42,8 @@ 14.0 true Windows Store - 10.0.10586.0 - 10.0.10240.0 + 10.0.14393.0 + 10.0.14393.0 10.0 diff --git a/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.cpp b/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.cpp index 7580854d..0b2f47c6 100644 --- a/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.cpp +++ b/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.cpp @@ -51,12 +51,15 @@ void TransferSocket::ReceiveFrameAsync() } -bool TransferSocket::GetFrame(Platform::Array^* vertices, Platform::Array^* colors) +bool TransferSocket::GetFrame(Platform::Array^* vertices, Platform::Array^* colors, Platform::Array^* triangles, Platform::Array^* chunksVertices, Platform::Array^* chunksTriangles) { if (frameReceiver != nullptr && frameReceiver->Status == Windows::Foundation::AsyncStatus::Completed) { *vertices = this->vertices; *colors = this->colors; + *triangles = this->triangles; + *chunksVertices = this->chunksVertices; + *chunksTriangles = this->chunksTriangles; return true; } @@ -67,22 +70,39 @@ bool TransferSocket::GetFrame(Platform::Array^* vertices, Platform::Array void TransferSocket::ReceiveFrame() { int nVertices = *(int*)ReadBytesBlocking(socket, 4).data(); + int nTriangles = *(int*)ReadBytesBlocking(socket, 4).data(); + int nChunks = *(int*)ReadBytesBlocking(socket, 4).data(); - vertices = ref new Array(nVertices * 3); - short *tempVertices = new short[nVertices * 3]; - colors = ref new Array(nVertices * 3); + chunksVertices = ref new Array(nChunks); + string res = ReadBytesBlocking(socket, sizeof(int) * nChunks); + memcpy(chunksVertices->Data, res.data(), sizeof(int) * nChunks); - string res = ReadBytesBlocking(socket, sizeof(short) * nVertices * 3); - memcpy(tempVertices, res.data(), sizeof(short) * nVertices * 3); + chunksTriangles = ref new Array(nChunks); + res = ReadBytesBlocking(socket, sizeof(int) * nChunks); + memcpy(chunksTriangles->Data, res.data(), sizeof(int) * nChunks); - for (int i = 0; i < nVertices * 3; i++) - { - vertices[i] = tempVertices[i] / 1000.0f; - } - delete[] tempVertices; + vertices = ref new Array(nVertices * 3); + //short *tempVertices = new short[nVertices * 3]; + + + res = ReadBytesBlocking(socket, sizeof(float) * nVertices * 3); + memcpy(vertices->Data, res.data(), sizeof(float) * nVertices * 3); + + //for (int i = 0; i < nVertices * 3; i++) + //{ + // vertices[i] = tempVertices[i] / 1000.0f; + //} + + //delete[] tempVertices; + colors = ref new Array(nVertices * 3); res = ReadBytesBlocking(socket, sizeof(unsigned char) * nVertices * 3); memcpy(colors->Data, res.data(), sizeof(unsigned char) * nVertices * 3); + + triangles = ref new Array(3 * nTriangles); + res = ReadBytesBlocking(socket, sizeof(int) * nTriangles * 3); + memcpy(triangles->Data, res.data(), sizeof(int) * nTriangles * 3); + } \ No newline at end of file diff --git a/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.h b/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.h index f823c74b..35f57b56 100644 --- a/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.h +++ b/NetworkCommunication/NetworkCommunicationWinRT/TransferSocket.h @@ -14,7 +14,7 @@ namespace NetworkCommunication void RequestFrame(); void ReceiveFrameAsync(); - bool GetFrame(Platform::Array^* vertices, Platform::Array^* colors); + bool GetFrame(Platform::Array^* vertices, Platform::Array^* colors, Platform::Array^* triangles, Platform::Array^* chunksVertices, Platform::Array^* chunksTriangles); private: ~TransferSocket(); void ReceiveFrame(); @@ -24,5 +24,8 @@ namespace NetworkCommunication Platform::Array^ vertices; Platform::Array^ colors; + Platform::Array^ triangles; + Platform::Array^ chunksVertices; + Platform::Array^ chunksTriangles; }; } \ No newline at end of file diff --git a/NetworkCommunication/NetworkCommunicationWinRT/socketCS.cpp b/NetworkCommunication/NetworkCommunicationWinRT/socketCS.cpp index dab55acb..bf91ad6a 100644 --- a/NetworkCommunication/NetworkCommunicationWinRT/socketCS.cpp +++ b/NetworkCommunication/NetworkCommunicationWinRT/socketCS.cpp @@ -189,8 +189,8 @@ SocketClient::SocketClient(const std::string& host, int port) : Socket() { hostent *he; if ((he = gethostbyname(host.c_str())) == 0) { - error = strerror(errno); - throw error; + //error = strerror(errno); + //throw error; } sockaddr_in addr; @@ -200,8 +200,8 @@ SocketClient::SocketClient(const std::string& host, int port) : Socket() { memset(&(addr.sin_zero), 0, 8); if (::connect(s_, (sockaddr *) &addr, sizeof(sockaddr))) { - error = strerror(WSAGetLastError()); - throw error; + //error = strerror(WSAGetLastError()); + //throw error; } }