protected void GeneratePoint(Vector3Int threadId, ref TempPointsBuffer tempBuffer)
        {
#if BIOSEARCHER_PROFILING
            Profiler.BeginSample("GenerateSinglePoint");
#endif
            if (threadId.x >= _constantInputOutput.pointsPerChunk1D || threadId.y >= _constantInputOutput.pointsPerChunk1D || threadId.z >= _constantInputOutput.pointsPerChunk1D)
            {
#if BIOSEARCHER_PROFILING
                Profiler.EndSample();
#endif
                return;
            }

            Vector3Int position = (threadId - Vector3Int.one * (_constantInputOutput.pointsPerChunk1D - 1) / 2) * tempBuffer.cubeSize;

            // todo
            tempBuffer.points[_common.MatrixId2ArrayId(threadId, _constantInputOutput.pointsPerChunk1D)] =
                new MarchPoint
            {
                position = position,
                value    = GenerateValue(position + tempBuffer.chunkPosition)
            };
#if BIOSEARCHER_PROFILING
            Profiler.EndSample();
#endif
        }
Exemple #2
0
        public override MarchPoint[] GeneratePoints(Vector3Int chunkPosition, int cubeSize)
        {
            TempPointsBuffer tempPointsBuffer = new TempPointsBuffer
            {
                chunkPosition = chunkPosition,
                cubeSize      = cubeSize
            };

            _generator.GeneratePoints(ref tempPointsBuffer);

            return(tempPointsBuffer.points);
        }
        protected internal void GeneratePoints(ref TempPointsBuffer tempBuffer)
        {
#if BIOSEARCHER_PROFILING
            Profiler.BeginSample("GeneratePoints");
#endif
            int x, y, z;
            int pointsPerChunk = _constantInputOutput.pointsPerChunk1D;
            for (z = 0; z < pointsPerChunk; z++)
            {
                for (y = 0; y < pointsPerChunk; y++)
                {
                    for (x = 0; x < pointsPerChunk; x++)
                    {
                        GeneratePoint(new Vector3Int(x, y, z), ref tempBuffer);
                    }
                }
            }
#if BIOSEARCHER_PROFILING
            Profiler.EndSample();
#endif
        }
Exemple #4
0
        public override MeshData GenerateMeshData(Vector3Int chunkPosition, int cubeSize)
        {
            TempPointsBuffer tempPointsBuffer = new TempPointsBuffer
            {
                chunkPosition = chunkPosition,
                cubeSize      = cubeSize,
                points        = new MarchPoint[_constantBuffer.pointsPerChunk1D * _constantBuffer.pointsPerChunk1D * _constantBuffer.pointsPerChunk1D]
            };

            _generator.GeneratePoints(ref tempPointsBuffer);

            TempMeshBuffer tempMeshBuffer = new TempMeshBuffer
            {
                points    = tempPointsBuffer.points,
                vertices  = new List <Vector3>(),
                triangles = new List <int>(),
                counter   = 0
            };

            _generator.GenerateMesh(ref tempMeshBuffer);

            return(new MeshData(tempMeshBuffer.vertices.ToArray(), tempMeshBuffer.triangles.ToArray()));
        }