Ejemplo n.º 1
0
    public override void Deform(IPointCloudBrush brush, Vector2 worldPos)
    {
        Vector2 localPos = transform.InverseTransformPoint(worldPos);
        //TODO: Choose all clouds touching radius

        // X1, Y1, X2, Y2;
        Vector4 bounds = brush.GetBounds();

        int minX = Mathf.FloorToInt((localPos.x + bounds.x) / pageSize),
            maxX = Mathf.FloorToInt((localPos.x + bounds.z) / pageSize),
            minY = Mathf.FloorToInt((localPos.y + bounds.y) / pageSize),
            maxY = Mathf.FloorToInt((localPos.y + bounds.w) / pageSize);

        float pointSize = this.PointSize;

        for (int y = minY; y <= maxY; y++)
        {
            for (int x = minX; x <= maxX; x++)
            {
                Vector2Int coord = new Vector2Int(x, y);
                if (!clouds.TryGetValue(coord, out PointCloud cloud))
                {
                    cloud = CreatePage(coord);
                }

                if (brush.Modify(cloud.cloud, pageDetail, localPos - (new Vector2(x, y) * pageSize), pointSize) != 0)
                {
                    cloud.MarchMesh();
                }
            }
        }
    }
Ejemplo n.º 2
0
    //TODO: Identify possibility of alternate deformable types. Generic type?

    public abstract void Deform(IPointCloudBrush brush, Vector2 worldPos);