Esempio n. 1
0
        private void CollectTerrainGPU(Collector3.ShapeCollector shape)
        {
            foreach (var terrainGPU in terrainGPUResuts)
            {
                if (terrainGPU.info.alphaMap != null)
                {
                    byte[] areaSplatMap = Pool.GenericPoolArray <byte> .Take(shape.flattenSize);

                    GenerateTerrainAreaMapFromSplatMap(terrainGPU.info, shape, ref areaSplatMap);
                    shape.AppendComputeShaderResult(terrainGPU.result, areaSplatMap);
                    Pool.GenericPoolArray <byte> .ReturnToPool(ref areaSplatMap);
                }
                else
                {
                    shape.AppendComputeShaderResult(terrainGPU.result, 0);
                }

                foreach (var tree in terrainGPU.info.trees)
                {
                    shape.Append(tree);
                }
            }
        }
        private void CollectCollidersGPU(Collector3.ShapeCollector collector)
        {
            if (profiler != null)
            {
                profiler.AddLog("Start shape collecting by GPU");
            }
            int collectedSolidShapes = 0;

            foreach (var resultHolder in collectedComputeShaderData)
            {
                if (resultHolder.infoMode == ColliderInfoMode.Solid)
                {
                    collector.AppendComputeShaderResult(resultHolder.result, resultHolder.area);
                    collectedSolidShapes++;
                }
            }
            if (profiler != null)
            {
                profiler.AddLogFormat("End shape collecting by GPU. Added {0} shapes", collectedSolidShapes);
            }
        }