Ejemplo n.º 1
0
        void SaveGUIDArray(NativeList <int4x4> arr)
        {
            byte[] cacheArray = SceneStreaming.GetByteArray(arr.Length * sizeof(int4x4) + sizeof(int));
            int *  intPtr     = (int *)cacheArray.Ptr();

            *intPtr = arr.Length;
            UnsafeUtility.MemCpy(intPtr + 1, arr.unsafePtr, sizeof(int4x4) * arr.Length);
            fsm.Write(cacheArray, 0, arr.Length * sizeof(int4x4) + sizeof(int));
        }
Ejemplo n.º 2
0
        void SaveMaterialArray(NativeList <VirtualMaterial.MaterialProperties> arr)
        {
            byte[] cacheArray = SceneStreaming.GetByteArray(arr.Length * sizeof(VirtualMaterial.MaterialProperties) + sizeof(int));
            int *  intPtr     = (int *)cacheArray.Ptr();

            *intPtr = arr.Length;
            UnsafeUtility.MemCpy(intPtr + 1, arr.unsafePtr, sizeof(VirtualMaterial.MaterialProperties) * arr.Length);
            fsm.Write(cacheArray, 0, arr.Length * sizeof(VirtualMaterial.MaterialProperties) + sizeof(int));
        }
Ejemplo n.º 3
0
        void SaveClusterData(NativeList <Cluster> cluster, NativeList <Point> points, NativeList <int> triangleMats)
        {
            int length = cluster.Length * sizeof(Cluster) + points.Length * sizeof(Point) + triangleMats.Length * sizeof(int);

            byte[] bytes = SceneStreaming.GetByteArray(length);
            fixed(byte *b = bytes)
            {
                UnsafeUtility.MemCpy(b, cluster.unsafePtr, cluster.Length * sizeof(Cluster));
                UnsafeUtility.MemCpy(b + cluster.Length * sizeof(Cluster), points.unsafePtr, points.Length * sizeof(Point));
                UnsafeUtility.MemCpy(b + cluster.Length * sizeof(Cluster) + points.Length * sizeof(Point), triangleMats.unsafePtr, triangleMats.Length * sizeof(int));
            }

            fsm.Write(bytes, 0, length);
        }
Ejemplo n.º 4
0
        void LoadClusterData(out NativeList <Cluster> cluster, out NativeList <Point> points, out NativeList <int> triangleMats)
        {
            cluster      = new NativeList <Cluster>(clusterCount, clusterCount, Allocator.Persistent);
            points       = new NativeList <Point>(clusterCount * PipelineBaseBuffer.CLUSTERCLIPCOUNT, clusterCount * PipelineBaseBuffer.CLUSTERCLIPCOUNT, Allocator.Persistent);
            triangleMats = new NativeList <int>(clusterCount * PipelineBaseBuffer.CLUSTERTRIANGLECOUNT, clusterCount * PipelineBaseBuffer.CLUSTERTRIANGLECOUNT, Allocator.Persistent);
            int length = cluster.Length * sizeof(Cluster) + points.Length * sizeof(Point) + triangleMats.Length * sizeof(int);

            byte[] bytes = SceneStreaming.GetByteArray(length);
            fsm.Read(bytes, 0, length);
            fixed(byte *b = bytes)
            {
                UnsafeUtility.MemCpy(cluster.unsafePtr, b, cluster.Length * sizeof(Cluster));
                UnsafeUtility.MemCpy(points.unsafePtr, b + cluster.Length * sizeof(Cluster), points.Length * sizeof(Point));
                UnsafeUtility.MemCpy(triangleMats.unsafePtr, b + cluster.Length * sizeof(Cluster) + points.Length * sizeof(Point), triangleMats.Length * sizeof(int));
            }
        }
Ejemplo n.º 5
0
        void LoadMaterialArray(ref NativeList <VirtualMaterial.MaterialProperties> arr)
        {
            byte[] cacheArray = SceneStreaming.GetByteArray(4);
            fsm.Read(cacheArray, 0, 4);
            int len = *(int *)cacheArray.Ptr();

            if (arr.isCreated)
            {
                arr.Clear();
            }
            else
            {
                arr = new NativeList <VirtualMaterial.MaterialProperties>(len, Allocator.Persistent);
            }
            cacheArray = SceneStreaming.GetByteArray(sizeof(VirtualMaterial.MaterialProperties) * len);
            fsm.Read(cacheArray, 0, sizeof(VirtualMaterial.MaterialProperties) * len);
            VirtualMaterial.MaterialProperties *arrPtr = (VirtualMaterial.MaterialProperties *)cacheArray.Ptr();
            arr.AddRange(arrPtr, len);
        }
Ejemplo n.º 6
0
        void LoadGUIDArray(ref NativeList <int4x4> arr)
        {
            byte[] cacheArray = SceneStreaming.GetByteArray(4);
            fsm.Read(cacheArray, 0, 4);
            int len = *(int *)cacheArray.Ptr();

            if (arr.isCreated)
            {
                arr.Clear();
            }
            else
            {
                arr = new NativeList <int4x4>(len, Allocator.Persistent);
            }
            cacheArray = SceneStreaming.GetByteArray(sizeof(int4x4) * len);
            fsm.Read(cacheArray, 0, sizeof(int4x4) * len);
            int4x4 *arrPtr = (int4x4 *)cacheArray.Ptr();

            arr.AddRange(arrPtr, len);
        }
Ejemplo n.º 7
0
 void SaveClusterCount()
 {
     byte[] bytes = SceneStreaming.GetByteArray(4);
     *(int *)bytes.Ptr() = clusterCount;
     fsm.Write(bytes, 0, 4);
 }
Ejemplo n.º 8
0
 void LoadClusterCount()
 {
     byte[] bytes = SceneStreaming.GetByteArray(4);
     fsm.Read(bytes, 0, 4);
     clusterCount = *(int *)bytes.Ptr();
 }