public override void OnEditorGUI(UltimateTerrain uTerrain, VoxelType voxelType)
        {
#if UNITY_EDITOR
            vertexColor = EditorGUILayout.ColorField("Vertex Color:", vertexColor);
            uv2         = EditorGUILayout.ColorField("UV2 (X = R, Y = G):", uv2);
#endif
        }
Пример #2
0
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorUtils.CenteredBoxedLabelField(string.Format("in ∈ [{0},{1}]\n=> out ∈ [{2},{3}]",
                                                          inBounds.x, inBounds.y, outBounds.x, outBounds.y),
                                            GUILayout.MaxWidth(100));

        EditorGUILayout.BeginVertical(GUILayout.MaxWidth(100));

        inBounds = EditorUtils.MinMaxField("Input min/max", inBounds);
        if (inBounds.y < inBounds.x + 0.001f)
        {
            inBounds.y = inBounds.x + 0.001f;
        }

        outBounds = EditorUtils.MinMaxField("Output min/max", outBounds);
        if (outBounds.y < outBounds.x + 0.001f)
        {
            outBounds.y = outBounds.x + 0.001f;
        }

        EditorGUILayout.EndVertical();
        base.OnEditorGUI(uTerrain, graph);
#endif
    }
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorUtils.CenteredBoxedLabelField("out = -in");
        base.OnEditorGUI(uTerrain, graph);
#endif
    }
Пример #4
0
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorUtils.CenteredBoxedLabelField("out = y - in * scale");
        scale = EditorGUILayout.FloatField("Scale", scale);
#endif
    }
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorUtils.CenteredBoxedLabelField("Uses Sobel Filter.\n" +
                                            "CAUTION: This is costly as it needs to compute the input 4 times at different positions.");
#endif
    }
    public static Parallelepiped CreateFromUnityWorld(UltimateTerrain uTerrain, bool dig, Vector3 corner, Vector3 vL, Vector3 vH,
                                                      Vector3 vW, VoxelType voxelType)
    {
        var conv = uTerrain.Converter;

        return(new Parallelepiped(uTerrain, dig, conv.UnityToVoxelPosition(corner),
                                  conv.UnityToVoxel(vL), conv.UnityToVoxel(vH), conv.UnityToVoxel(vW), voxelType));
    }
Пример #7
0
 //
 public Perturb(UltimateTerrain uTerrain, Vector3d position, double radius, double weight)
 {
     this.position = position;
     this.radius   = radius;
     this.weight   = weight;
     this.octave   = 1;
     Init(uTerrain);
 }
Пример #8
0
 //
 public Cylinder(UltimateTerrain uTerrain, bool dig, Vector3d start, Vector3d end, double radius, VoxelType voxelType) : this(uTerrain, dig, start, end, radius)
 {
     if (voxelType != null)
     {
         this.voxelType = voxelType;
         voxelTypeName  = voxelType.Name;
     }
 }
        public override void OnEditorGUI(UltimateTerrain uTerrain, VoxelType voxelType)
        {
#if UNITY_EDITOR
            topColor   = EditorGUILayout.ColorField("Top Color:", topColor);
            sidesColor = EditorGUILayout.ColorField("Sides Color:", sidesColor);
            slopeLimit = EditorGUILayout.Slider("Slope limit:", slopeLimit, -1f, 1f);
#endif
        }
 //
 public FlattenAxisAlignedCube(UltimateTerrain uTerrain, bool upsideDown, Vector3d position, Vector3d size, double desiredHeight, VoxelType voxelType) : this(uTerrain, upsideDown, position, size, desiredHeight)
 {
     if (voxelType != null)
     {
         this.voxelType = voxelType;
         voxelTypeName  = voxelType.Name;
     }
 }
Пример #11
0
 //
 public DigCube(UltimateTerrain uTerrain, Vector3d position, Vector3 size)
 {
     this.position = position;
     this.size     = size;
     voxelType     = null;
     voxelTypeName = string.Empty;
     Init(uTerrain);
 }
Пример #12
0
 //
 public Sharpen(UltimateTerrain uTerrain, Vector3d position, double radius, double step)
 {
     this.position = position;
     this.radius   = radius;
     this.step     = step;
     Init(uTerrain);
     PickupVoxels(uTerrain);
 }
Пример #13
0
    // Protected methods /////////////////

    protected void Init(UltimateTerrain uTerrain)
    {
        var halfSize = new Vector3i(voxelRadius, voxelRadius, voxelRadius);

        from          = voxelPosition - halfSize;
        to            = voxelPosition + halfSize;
        radiusSquared = voxelRadius * voxelRadius;
    }
Пример #14
0
 //
 public FlattenSphere(UltimateTerrain uTerrain, bool upsideDown, Vector3d position, double radius, double desiredHeight, VoxelType voxelType) : this(uTerrain, upsideDown, position, radius, desiredHeight)
 {
     if (voxelType != null)
     {
         this.voxelType = voxelType;
         voxelTypeName  = voxelType.Name;
     }
 }
Пример #15
0
 // Called after this object has been deserialized. You can init some stuff that you would normally do in the constructor.
 public void AfterDeserialize(UltimateTerrain uTerrain)
 {
     Init(uTerrain);
     if (!string.IsNullOrEmpty(voxelTypeName))
     {
         voxelType = uTerrain.VoxelTypeSet.GetVoxelType(voxelTypeName);
     }
 }
Пример #16
0
 //
 public Paint(UltimateTerrain uTerrain, Vector3d position, double radius, VoxelType voxelType)
 {
     this.voxelPosition = position.Rounded;
     this.voxelRadius   = Convert.ToInt32(radius);
     this.voxelType     = voxelType;
     voxelTypeName      = voxelType.Name;
     Init(uTerrain);
 }
 public override IGeneratorNode CreateModule(UltimateTerrain uTerrain, List <CallableNode> inputs)
 {
     return(new TunnelNetwork3DPrimitive(frequency, seed,
                                         frequencyAltitude, scaleAltitude, baseAltitude,
                                         tunnelsHeight, threshold,
                                         frequencyPerturbation, scalePerturbation,
                                         frequencyMicroPerturbation, scaleMicroPerturbation));
 }
Пример #18
0
 public AdditiveSphere(UltimateTerrain uTerrain, bool dig, Vector3d position, double radius, double speed, VoxelType voxelType) : this(uTerrain, dig, position, radius, speed)
 {
     if (voxelType != null)
     {
         this.voxelType = voxelType;
         voxelTypeName  = voxelType.Name;
     }
 }
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        frequency = EditorGUILayout.FloatField("Frequency:", frequency);
        scale     = EditorGUILayout.FloatField("Scale:", scale);
        seed      = EditorGUILayout.IntField("Seed:", seed);
        quality   = (NoiseQuality)EditorGUILayout.EnumPopup("Quality:", quality);
#endif
    }
Пример #20
0
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorGUIUtility.labelWidth = 60;
        width = EditorGUILayout.FloatField("Width", width);
        base.OnEditorGUI(uTerrain, graph);
        EditorGUIUtility.labelWidth = 0;
#endif
    }
    // Protected methods /////////////////

    private void Init(UltimateTerrain uTerrain)
    {
        converter = uTerrain.Converter;
        var halfSize = (size * 0.5).Rounded;
        var voxelPos = position.Rounded;

        from = voxelPos - halfSize - Vector3i.one;
        to   = voxelPos + halfSize + Vector3i.one;
    }
Пример #22
0
        public override void OnEditorGUI(UltimateTerrain uTerrain, VoxelType voxelType)
        {
#if UNITY_EDITOR
            var vColLabel = new GUIContent("Vertex Color:", "(RGBA) R <=> 1st texture, G <=> 2nd texture, B <=> 3rd texture, A <=> 4th texture");
            vertexColor = EditorGUILayout.ColorField(vColLabel, vertexColor);
            var vUV2Label = new GUIContent("UV2 (X = R, Y = G):", "(RG) R <=> 5th texture, G <=> 6th texture");
            uv2 = EditorGUILayout.ColorField(vUV2Label, uv2);
#endif
        }
Пример #23
0
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorGUIUtility.labelWidth = 60;
        origin.x = EditorGUILayout.FloatField("From X", origin.x, GUILayout.Width(100));
        origin.y = EditorGUILayout.FloatField("From Z", origin.y, GUILayout.Width(100));
        EditorGUIUtility.labelWidth = 0;
#endif
    }
Пример #24
0
    public override void OnEditorGUI(UltimateTerrain uTerrain, IReadOnlyFlowGraph graph)
    {
#if UNITY_EDITOR
        EditorGUIUtility.labelWidth = 60;
        EditorUtils.CenteredBoxedLabelField("out = |in|");
        base.OnEditorGUI(uTerrain, graph);
        EditorGUIUtility.labelWidth = 0;
#endif
    }
Пример #25
0
    private void Init(UltimateTerrain uTerrain)
    {
        var halfSize = new Vector3i(voxelRadius, voxelRadius, voxelRadius);

        from          = voxelPosition - halfSize;
        to            = voxelPosition + halfSize;
        unityPosition = uTerrain.Converter.VoxelToUnityPosition(voxelPosition);
        unityRadius   = (float)uTerrain.Converter.VoxelToUnityDisance(voxelRadius);
    }
Пример #26
0
 //
 public Sphere(UltimateTerrain uTerrain, bool dig, Vector3d position, double radius)
 {
     this.dig      = dig;
     this.position = position;
     this.radius   = radius;
     voxelType     = null;
     voxelTypeName = string.Empty;
     Init(uTerrain);
 }
 public AxisAlignedCube(UltimateTerrain uTerrain, bool dig, Vector3d position, Vector3d size, VoxelType voxelType) :
     this(uTerrain, dig, position, size)
 {
     if (voxelType != null)
     {
         this.voxelType = voxelType;
         voxelTypeName  = voxelType.Name;
     }
 }
Пример #28
0
 //
 public FlattenSphere(UltimateTerrain uTerrain, bool upsideDown, Vector3d position, double radius, double desiredHeight)
 {
     this.upsideDown    = upsideDown;
     this.position      = position;
     this.radius        = radius;
     this.desiredHeight = desiredHeight;
     voxelType          = null;
     voxelTypeName      = string.Empty;
     Init(uTerrain);
 }
Пример #29
0
 public AdditiveSphere(UltimateTerrain uTerrain, bool dig, Vector3d position, double radius, double speed)
 {
     this.speed         = speed;
     this.dig           = dig;
     this.voxelPosition = position.Rounded;
     this.voxelRadius   = Convert.ToInt32(radius);
     voxelType          = null;
     voxelTypeName      = string.Empty;
     Init(uTerrain);
 }
Пример #30
0
 //
 public Parallelepiped(UltimateTerrain uTerrain, bool dig, Vector3d corner, Vector3d vL, Vector3d vH,
                       Vector3d vW, VoxelType voxelType) : this(
         uTerrain, dig, corner, vL, vH, vW)
 {
     if (voxelType != null)
     {
         this.voxelType = voxelType;
         voxelTypeName  = voxelType.Name;
     }
 }