Beispiel #1
0
 public UniformWorleyArgs(Vec2 scale, float jitter, DistanceKind distKind, WorleyNoiseKind noiseKind)
 {
     Scale        = Value(scale);
     Jitter       = Value(jitter);
     DistanceKind = Value((int)distKind);
     NoiseKind    = Value((int)noiseKind);
 }
Beispiel #2
0
 public WorleyArgs(DistanceKind distKind, WorleyNoiseKind noiseKind, params Vec2[] controlPoints)
 {
     DistanceKind  = Value((int)distKind);
     NoiseKind     = Value((int)noiseKind);
     ControlPoints = ReadBuffer(controlPoints);
     Count         = Value(controlPoints.Length);
 }
Beispiel #3
0
 protected override void Load(XElement xelem)
 {
     NoiseKind         = xelem.AttrEnum <WorleyNoiseKind> (nameof(NoiseKind));
     ControlPoints     = xelem.AttrEnum <ControlPointKind> (nameof(ControlPoints));
     DistanceKind      = xelem.AttrEnum <DistanceKind> (nameof(DistanceKind));
     ControlPointCount = xelem.AttrInt(nameof(ControlPointCount));
     Seed     = xelem.AttrInt(nameof(Seed));
     Jitter   = xelem.AttrFloat(nameof(Jitter));
     Periodic = xelem.AttrBool(nameof(Periodic));
 }
Beispiel #4
0
        protected override Control CreateControl()
        {
            var changed  = Changed.Adapt <int, AnySignalEditor> (this);
            var changedf = Changed.Adapt <float, AnySignalEditor> (this);

            return(FoldableContainer.WithLabel(Name, true, HAlign.Left,
                                               Container.LabelAndControl("Type: ",
                                                                         new Picker((int)NoiseKind,
                                                                                    React.By((int i) => NoiseKind = (WorleyNoiseKind)i).And(changed),
                                                                                    Enum.GetNames(typeof(WorleyNoiseKind))), true),
                                               Container.LabelAndControl("Seed: ",
                                                                         new NumericEdit(Seed, true, 1,
                                                                                         React.By((float i) => Seed = (int)i).And(changedf)), true),
                                               Container.LabelAndControl("CP Type: ",
                                                                         new Picker((int)ControlPoints,
                                                                                    React.By((int i) => ControlPoints = (ControlPointKind)i).And(changed),
                                                                                    Enum.GetNames(typeof(ControlPointKind))), true),
                                               Container.LabelAndControl("CP Count: ",
                                                                         new NumericEdit(ControlPointCount, true, 1,
                                                                                         React.By((float i) => ControlPointCount = (int)i).And(changedf).Filter(i => i > 2)), true),
                                               Container.LabelAndControl("Distance: ",
                                                                         new Picker((int)DistanceKind,
                                                                                    React.By((int i) => DistanceKind = (DistanceKind)i).And(changed),
                                                                                    Enum.GetNames(typeof(DistanceKind))), true),
                                               Container.LabelAndControl("Jitter: ",
                                                                         new NumericEdit(Jitter, false, 0.1f,
                                                                                         React.By((float x) => Jitter = x).And(changedf)), true),
                                               Container.LabelAndControl("Periodic: ",
                                                                         new Picker(Periodic ? 1 : 0,
                                                                                    React.By((int i) => Periodic = i != 0).And(changed),
                                                                                    "No", "Yes"), true)));
        }