Ejemplo n.º 1
0
        public void FlushMeshGenerationData(string outputDirectory)
        {
            if (outputPoints.Count == 0)
            {
                return;
            }

            var data = outputPoints.ToDictionary(x => x.Key, x => x.Value.Position);

            EditorTreeUtility.SaveMeshGenerationData(
                Path.Combine(outputDirectory, $"{nodeRecord.Identifier}.meshdata"),
                cellsPerAxis,
                data);

            bool IsEdgeCell(int id)
            {
                var xyz = TreeUtility.Unflatten(id, cellsPerAxis);

                return((xyz.x == 0) || (xyz.y == 0) || (xyz.z == 0));
            }

            var edgeData = data
                           .Where(x => IsEdgeCell(x.Key))
                           .ToDictionary(x => x.Key, x => x.Value);

            if (edgeData.Count == 0)
            {
                return;
            }

            EditorTreeUtility.SaveMeshGenerationData(
                Path.Combine(outputDirectory, $"{nodeRecord.Identifier}.meshedge"),
                cellsPerAxis,
                edgeData);
        }
Ejemplo n.º 2
0
        public void UpdateVolatileData()
        {
            builderVerts.Clear();

            foreach (var cell in cells)
            {
                var coord = TreeUtility.Unflatten(cell.Key, gridSize);
                builderVerts.Add(coord, new Vert()
                {
                    position = cell.Value
                });
            }
        }