コード例 #1
0
    protected static void applyBrush(Vox.VoxelEditor editor, Ray mouseLocation)
    {
        byte opacity = byte.MaxValue;

        if (UnityEngine.Event.current.shift)
        {
            opacity = byte.MinValue;
        }
        Vector3 point = editor.getBrushPoint(mouseLocation);

        switch (editor.selectedBrush)
        {
        case 0:
            Vox.SphereModifier sphereMod = new Vox.SphereModifier(editor, point, editor.sphereBrushSize, new Vox.Voxel(editor.sphereBrushSubstance, opacity), true);
            sphereMod.overwriteShape = !editor.sphereSubstanceOnly;
            sphereMod.apply();
            break;

        case 1:
            Vox.CubeModifier cubeMod = new Vox.CubeModifier(editor, point, editor.cubeBrushDimensions, new Vox.Voxel(editor.cubeBrushSubstance, opacity), true);
            cubeMod.overwriteShape = !editor.cubeSubstanceOnly;
            cubeMod.apply();
            break;

        case 2:
            Vox.BlurModifier blur = new Vox.BlurModifier(editor, point, editor.smoothBrushSize, editor.smoothBrushStrength, true);
            blur.blurRadius = editor.smoothBrushBlurRadius;
            blur.apply();
            break;
        }
    }
コード例 #2
0
 protected static void applyBrush(Vox.VoxelEditor editor, Ray mouseLocation)
 {
     byte opacity = byte.MaxValue;
     if (UnityEngine.Event.current.shift) {
         opacity = byte.MinValue;
     }
     Vector3 point = editor.getBrushPoint(mouseLocation);
     switch(editor.selectedBrush) {
     case 0:
         Vox.SphereModifier sphereMod = new Vox.SphereModifier(editor, point, editor.sphereBrushSize, new Vox.Voxel(editor.sphereBrushSubstance, opacity), true);
         sphereMod.overwriteShape = !editor.sphereSubstanceOnly;
         sphereMod.apply();
         break;
     case 1:
         Vox.CubeModifier cubeMod = new Vox.CubeModifier(editor, point, editor.cubeBrushDimensions, new Vox.Voxel(editor.cubeBrushSubstance, opacity), true);
         cubeMod.overwriteShape = !editor.cubeSubstanceOnly;
         cubeMod.apply();
         break;
     case 2:
         Vox.BlurModifier blur = new Vox.BlurModifier(editor, point, editor.smoothBrushSize, editor.smoothBrushStrength, true);
         blur.blurRadius = editor.smoothBrushBlurRadius;
         blur.apply();
         break;
     }
 }