Ejemplo n.º 1
0
    protected void applyBrush(Vox.VoxelEditor editor, Ray mouseLocation)
    {
        // get point clicked on
        System.Nullable<Vector3> point = editor.getBrushPoint(mouseLocation);
        if (point == null)
            return;

        // check if control pressed.  If so, add point to pathList
        if(editor.isPathing()) {
            editor.addPathPoint(point.Value);
            return;
        }

        // check for showPositionHandles
        if (editor.showPositionHandles && editor.isSelectedBrushPathable()
            && editor.pathPoints != null && editor.pathPoints.Length > 0)
            return;

        // create mutator
        Vox.Mutator mutator = buildMutator(editor, point.Value);

        // apply mutator
        if (mutator == null)
            return;
        Vox.LocalMutator localMutator = mutator as Vox.LocalMutator;
        if (localMutator != null && editor.pathPoints != null && editor.pathPoints.Length > 0) {
            editor.addPathPoint(point.Value);
            mutator = new Vox.LineMutator(editor.pathPoints, localMutator);
            editor.pathPoints = null;
        }
        mutator.apply(editor);
    }