Esempio n. 1
0
            static public JobHandle Schedule(NativeArray <int> source, NativeArray <int> destination, NativeArray <Offset> submeshOffsets, NativeArray <DataInstance> instanceArray, JobHandle dependOn)
            {
                var job = new CombineTriangleBufferJob
                {
                    instances      = instanceArray,
                    submeshOffsets = submeshOffsets,
                    source         = source,
                    destination    = destination
                };

                return(job.Schedule(dependOn));
            }
Esempio n. 2
0
            public JobHandle ScheduleImmediateJobs(MeshData sourceMeshData, List <System.IDisposable> tempList, JobHandle dependOn)
            {
                var combinedInfo = CalcCombinedMeshInfo(instanceArray, sourceMeshData.BufferFlags);

                combinedMesh = combinedInfo.CreateMeshData(Allocator.TempJob);
                tempList.Add(combinedMesh);

                var submeshOffsets = new NativeArray <Offset>(combinedInfo.submeshTriangleOffsets, Allocator.TempJob);

                tempList.Add(submeshOffsets);

                JobHandle combined = default;

                if (combinedMesh.HasVertices)
                {
                    var h = CombineTransformedBufferJob.Schedule(BufferType.Vertex, sourceMeshData.Vertices, combinedMesh.Vertices, instanceArray, dependOn);
                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasTriangles)
                {
                    var h = CombineTriangleBufferJob.Schedule(sourceMeshData.Triangles, combinedMesh.Triangles, submeshOffsets, instanceArray, dependOn);
                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasNormals)
                {
                    var h = CombineTransformedBufferJob.Schedule(BufferType.Normal, sourceMeshData.Normals, combinedMesh.Normals, instanceArray, dependOn);
                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasColors)
                {
                    var h = CombineBufferJob <Color> .Schedule(sourceMeshData.Colors, combinedMesh.Colors, instanceArray, dependOn);

                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasTangents)
                {
                    var h = CombineBufferJob <float4> .Schedule(sourceMeshData.Tangents, combinedMesh.Tangents, instanceArray, dependOn);

                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasUVs)
                {
                    var h = CombineBufferJob <float2> .Schedule(sourceMeshData.UVs, combinedMesh.UVs, instanceArray, dependOn);

                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasUVs2)
                {
                    var h = CombineBufferJob <float2> .Schedule(sourceMeshData.UVs2, combinedMesh.UVs2, instanceArray, dependOn);

                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasUVs3)
                {
                    var h = CombineBufferJob <float2> .Schedule(sourceMeshData.UVs3, combinedMesh.UVs3, instanceArray, dependOn);

                    combined = JobHandle.CombineDependencies(combined, h);
                }

                if (combinedMesh.HasUVs4)
                {
                    var h = CombineBufferJob <float2> .Schedule(sourceMeshData.UVs4, combinedMesh.UVs4, instanceArray, dependOn);

                    combined = JobHandle.CombineDependencies(combined, h);
                }

                return(combined);
            }