Exemplo n.º 1
0
    public void InitWithParameter(FloatParameter f)
    {
        currentParameter = f;

        if (paramName == null)
        {
            StartInit();
        }

        minSlider.minValue    = currentParameter.ClampRange.min;
        minSlider.maxValue    = currentParameter.ClampRange.max;
        maxSlider.minValue    = currentParameter.ClampRange.min;
        maxSlider.maxValue    = currentParameter.ClampRange.max;
        rateSlider.minValue   = currentParameter.ClampRange.min;
        rateSlider.maxValue   = currentParameter.ClampRange.max;
        offsetSlider.minValue = currentParameter.ClampRange.min;
        offsetSlider.maxValue = currentParameter.ClampRange.max;
        randomSlider.minValue = currentParameter.ClampRange.min;
        randomSlider.maxValue = currentParameter.ClampRange.max;

        paramName.text            = f.Name;
        minSlider.value           = currentParameter.Min;
        maxSlider.value           = currentParameter.Max;
        rateSlider.value          = currentParameter.Rate;
        offsetSlider.value        = currentParameter.Offset;
        randomSlider.value        = currentParameter.Randomness;
        cyclicalToggle.isOn       = currentParameter.IsCyclical;
        ascendToggle.isOn         = currentParameter.Ascend;
        startAscendingToggle.isOn = currentParameter.StartAscending;



        UpdateSliders();
    }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new blur post process effect.
        /// </summary>
        /// <param name="root">Root object to which the material belongs.</param>
        /// <param name="distance">The distance from the camera at which objects are focused.</param>
        /// <param name="range">Range of the focused area.</param>
        public DOFEffect(Root root, float distance = 30.0f, float range = 10.0f) : base(root)
        {
            mDistanceParam = new FloatParameter(Root, "distance", distance);
            mRangeParam    = new FloatParameter(Root, "range", range);

            Setup();
        }
Exemplo n.º 3
0
    private void startBlur()
    {
        FloatParameter sf = new FloatParameter {
            value = 360f
        };
        FloatParameter af = new FloatParameter {
            value = 24f
        };
        IntParameter si = new IntParameter {
            value = 32
        };

        //print("start blur");
        blurComponent.gameObject.GetComponent <CameraBob>().Bob = true;
        //blurComponent.enabled = true;
        //camEffects.profile.AddSettings<MotionBlur>().shutterAngle = sf;
        //camEffects.profile.AddSettings<MotionBlur>().sampleCount = si;
        //camEffects.profile.AddSettings<DepthOfField>().aperture= af;

        MotionBlur mb;

        camEffects.profile.TryGetSettings(out mb);
        mb.enabled.value = true;
        DepthOfField df;

        camEffects.profile.TryGetSettings(out df);
        df.enabled.value = true;

        frameCounter = 0;
    }
        private void WriteShipViewer(BinaryWriter Writer)
        {
            foreach (GameObject g in Children)
            {
                if (g.GetType().Equals(typeof(ShipViewer)))
                {
                    ShipViewer s = (ShipViewer)g;

                    Writer.Write(s.model.getFullPath());
                    Writer.Write(s.effect.getFullPath());

                    ColorParameter     DrawColor        = (ColorParameter)s.effect.findValueParameter("DrawColor");
                    ColorParameter     SpecularColor    = (ColorParameter)s.effect.findValueParameter("SpecularColor");
                    FloatParameter     SpecularExponent = (FloatParameter)s.effect.findValueParameter("SpecularExponent");
                    Texture2DParameter Texture          = (Texture2DParameter)s.effect.findValueParameter("Texture");

                    Writer.Write(Texture.getFullPath());

                    SaveHelper.Write(DrawColor.get());
                    SaveHelper.Write(SpecularColor.get());
                    Writer.Write((Single)SpecularExponent.get());

                    return;
                }
            }
            throw new Exception("No ShipViewer to save");
        }
        public void Clones_Have_Same_Value()
        {
            FloatParameter p0 = new FloatParameter("id", null, 784.4243f);
            FloatParameter p1 = p0.Clone() as FloatParameter;

            Assert.AreEqual((float)p0.GetValue(), (float)p1.GetValue(), 0.001f);
        }
Exemplo n.º 6
0
    void OnEnable()
    {
        FloatParameter fparam = ParameterPool.GetParameter <FloatParameter>();

        fparam.value = gunAccuracy;
        GlobalEventQueue.EnQueueEvent(E_Event.GunChange, fparam);
    }
        private IEnumerator TrippingCoroutine()
        {
            ColorGrading colorGrading = PostProcessing.CurrentFilter.GetSetting <ColorGrading>();

            colorGrading.enabled.Override(true);

            while (true)
            {
                for (int i = 0; i < 101; i++)
                {
                    if (PostProcessing.CurrentFilter != null)
                    {
                        FloatParameter newValue = new FloatParameter();
                        newValue.value = i;
                        colorGrading.temperature.Override(newValue);
                    }
                    yield return(null);
                }
                for (int i = -100; i < 1; i++)
                {
                    if (PostProcessing.CurrentFilter != null)
                    {
                        FloatParameter newValue = new FloatParameter();
                        newValue.value = i;
                        colorGrading.temperature.Override(newValue);
                    }
                    yield return(null);
                }
            }
        }
Exemplo n.º 8
0
        public void ModificationTest()
        {
            var p = new FloatParameter(null, "myFloatId", "myFloatName", 11.123, "m/s", 5);

            p.OnChanged += ParamOnChanged;

            _passedOnChanged = false;
            p.Value          = 11.123;
            Assert.IsFalse(_passedOnChanged, "OnChanged called without a cause");
            Assert.IsFalse(p.IsModified, "IsModified = true but must be false");

            _passedOnChanged = false;
            p.Value          = 0;
            Assert.IsTrue(_passedOnChanged, "OnChanged call missing");
            Assert.IsTrue(p.IsModified, "IsModified = false but must be true");

            _passedOnChanged = false;
            p.Value          = 55.7689;
            Assert.IsTrue(_passedOnChanged, "OnChanged call missing");

            p.Value          = 123455.12345;
            _passedOnChanged = false;
            p.Value          = 123455.123451234; // more decimals then precision
            Assert.IsFalse(_passedOnChanged, "OnChanged called without a cause");

            p.OnChanged     -= ParamOnChanged;
            _passedOnChanged = false;
            p.Value          = 345.1;
            Assert.IsFalse(_passedOnChanged, "OnChanged not allowed but occurred");
        }
Exemplo n.º 9
0
    private void endBlur()
    {
        FloatParameter sf = new FloatParameter {
            value = 4f
        };
        FloatParameter af = new FloatParameter {
            value = 32f
        };
        IntParameter si = new IntParameter {
            value = 0
        };

        //print("end blur");
        blurComponent.gameObject.GetComponent <CameraBob>().Bob = false;
        //blurComponent.enabled = false;
        //camEffects.profile.AddSettings<MotionBlur>().shutterAngle = sf;
        //camEffects.profile.AddSettings<MotionBlur>().sampleCount = si;
        //camEffects.profile.AddSettings<DepthOfField>().aperture = af;


        MotionBlur mb;

        if (camEffects.profile.TryGetSettings(out mb))
        {
            mb.enabled.value = false;
        }
        DepthOfField df;

        if (camEffects.profile.TryGetSettings(out df))
        {
            df.enabled.value = false;
        }
    }
Exemplo n.º 10
0
            public void Opt(string key, FloatParameter v)
            {
                if (!HasKey(key))
                {
                    return;
                }

                var node = c_[key];

                var o = node as JSONClass;

                if (o == null)
                {
                    v.Value = node.AsFloat;
                }
                else
                {
                    v.Value = o["value"].AsFloat;

                    if (o.HasKey("parameter"))
                    {
                        v.Name = o["parameter"];
                        v.Register();
                    }
                }
            }
Exemplo n.º 11
0
    public PolarTrig2D() : base()
    {
        parameterMap = new ParameterMap();

        emission          = new FloatParameter("Emission", new float[] { }, new ParameterRange(0, 60), 10, ParameterDictionary.EmissionKey);
        XRadius           = new FloatParameter("X Radius", new float[] { 1f, 2f, 3f, 4f }, new ParameterRange(0, 5f), 1, ParameterDictionary.X_RadiusKey);
        YRadius           = new FloatParameter("Y Radius", new float[] { 1f, 2f, 3f, 4f }, new ParameterRange(0, 5f), 1, ParameterDictionary.Y_RadiusKey);
        SyncRadius        = new BooleanParameter("Synch Radius", ParameterDictionary.SyncRadiusKey, true);
        SineCoefficient   = new FloatParameter("Sine Coeffecient", new float[] { }, new ParameterRange(0, 50), 5, ParameterDictionary.SineCoefKey);
        CosineCoefficient = new FloatParameter("Cosine Coeffecient", new float[] { }, new ParameterRange(0, 50), 19, ParameterDictionary.CosCoefKey);
        SineExponent      = new FloatParameter("Sine Exponent", new float[] { 0.5f, 1f, 2f, 3f, 4f }, new ParameterRange(0.25f, 4f), 2, ParameterDictionary.SineExponentKey);
        CosineExponent    = new FloatParameter("Cosine Exponent", new float[] { 0.5f, 1f, 2f, 3f, 4f }, new ParameterRange(0.25f, 4f), 2, ParameterDictionary.CosExponentKey);
        Hue        = new FloatParameter("Hue", new float[] { }, new ParameterRange(0, 360), 0, ParameterDictionary.HueKey);
        Saturation = new FloatParameter("Saturation", new float[] { }, new ParameterRange(0, 1), 0.8f, ParameterDictionary.SaturationKey);
        Brightness = new FloatParameter("Brightness", new float[] { }, new ParameterRange(0, 1), 0.8f, ParameterDictionary.BrightnessKey);
        Alpha      = new FloatParameter("Alpha", new float[] { }, new ParameterRange(0, 1f), 0.5f, ParameterDictionary.AlphaKey);
        Theta      = new FloatParameter("Theta", new float[] { Mathf.PI / 2, Mathf.PI, 3 * Mathf.PI / 2 }, new ParameterRange(0, 2 * Mathf.PI), 3.14f, ParameterDictionary.ThetaKey);

        parameterMap.AddFloatParameter(emission, ParameterDictionary.EmissionKey);
        parameterMap.AddFloatParameter(XRadius, ParameterDictionary.X_RadiusKey);
        parameterMap.AddFloatParameter(YRadius, ParameterDictionary.Y_RadiusKey);
        parameterMap.AddBoolParameter(SyncRadius, ParameterDictionary.SyncRadiusKey);
        parameterMap.AddFloatParameter(SineCoefficient, ParameterDictionary.SineCoefKey);
        parameterMap.AddFloatParameter(CosineCoefficient, ParameterDictionary.CosCoefKey);
        parameterMap.AddFloatParameter(SineExponent, ParameterDictionary.SineExponentKey);
        parameterMap.AddFloatParameter(CosineExponent, ParameterDictionary.CosExponentKey);
        parameterMap.AddFloatParameter(Hue, ParameterDictionary.HueKey);
        parameterMap.AddFloatParameter(Saturation, ParameterDictionary.SaturationKey);
        parameterMap.AddFloatParameter(Brightness, ParameterDictionary.BrightnessKey);
        parameterMap.AddFloatParameter(Alpha, ParameterDictionary.AlphaKey);
        parameterMap.AddFloatParameter(Theta, ParameterDictionary.ThetaKey);
    }
Exemplo n.º 12
0
    private void Start()
    {
        //Finds PostProcessing layer to apply effect.
        //Must have PostProcessing layer added in order for effect to work properly.
        layerIndex = LayerMask.NameToLayer("PostProcessing");
        camera.GetComponent <PostProcessLayer>().volumeLayer = LayerMask.GetMask("PostProcessing");

        //Creates vignette effect and sets default settings.
        vignette = ScriptableObject.CreateInstance <Vignette>();
        vignette.enabled.Override(false);
        vignette.intensity.Override(0f);

        //Creates color grading effect and sets default settings.
        colorGrading = ScriptableObject.CreateInstance <ColorGrading>();
        colorGrading.enabled.Override(false);

        //Gets settings to use from effect profile provided.
        vColor      = postProfile.GetSetting <Vignette>().color;
        vCenter     = postProfile.GetSetting <Vignette>().center;
        vSmoothness = postProfile.GetSetting <Vignette>().smoothness;
        vRoundness  = postProfile.GetSetting <Vignette>().roundness;
        vRounded    = postProfile.GetSetting <Vignette>().rounded;

        //Sets settings to approprate values.
        vignette.color.Override(vColor);
        vignette.center.Override(vCenter);
        vignette.smoothness.Override(vSmoothness);
        vignette.roundness.Override(vRoundness);
        vignette.rounded.Override(vRounded);

        //Creates volume for effect to be applied.
        volume          = PostProcessManager.instance.QuickVolume(layerIndex, 0, vignette, colorGrading);
        volume.isGlobal = true;
    }
Exemplo n.º 13
0
 private void Awake()
 {
     ppVol             = GetComponent <PostProcessVolume>();
     colorGradingDrunk = ppVol.profile.settings[2] as ColorGrading;
     hueShift          = new FloatParameter();
     audioSrc          = GetComponent <AudioSource>();
 }
    IEnumerator AddGlitch(FloatParameter _drift, FloatParameter _jitter, FloatParameter _cutoff, FloatParameter _jump)
    {
        addDrift  = _drift;
        addJitter = _jitter;
        addCutoff = _cutoff;
        addJump   = _jump;
        float _addDrift  = addDrift;
        float _addJitter = addJitter;
        float _addCutoff = addCutoff;
        float _addJump   = addJump;

        float elapsedTime = 0;
        float timer       = 0.8f;

        margin = new FloatParameter {
            value = 0.15f
        };

        //Glitch effects reduces over time
        while (elapsedTime < timer)
        {
            _addDrift  = Mathf.Lerp(_addDrift, 0, elapsedTime / timer);
            _addJitter = Mathf.Lerp(_addJitter, 0, elapsedTime / timer);
            _addCutoff = Mathf.Lerp(_addCutoff, 0, elapsedTime / timer);
            _addJump   = Mathf.Lerp(_addJump, 0, elapsedTime / timer);

            addDrift.value  = _addDrift;
            addJitter.value = _addJitter;
            addCutoff.value = _addCutoff;
            addJump.value   = _addJump;

            elapsedTime += Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }

        addDrift = new FloatParameter {
            value = 0.0f
        };
        addJitter = new FloatParameter {
            value = 0.0f
        };
        addCutoff = new FloatParameter {
            value = 0.0f
        };
        addJump = new FloatParameter {
            value = 0.0f
        };

        //Resets GlitchBuzz()
        margin = new FloatParameter {
            value = 0.0f
        };
        driftBuzz.value  = 0.0f;
        jitterBuzz.value = 0.0f;
        cutoffBuzz.value = 0.0f;
        jumpBuzz.value   = 0.0f;
        //print("Drift = drift: " + drift.value + " + addDrift: " + addDrift.value + " + driftBuzz: " + driftBuzz.value);

        yield return(null);
    }
        private IEnumerator SickCoroutine()
        {
            LensDistortion lensDistortion = PostProcessing.CurrentFilter.GetSetting <LensDistortion>();

            lensDistortion.enabled.Override(true);

            while (true)
            {
                for (float i = -1; i < 1; i += 0.01f)
                {
                    if (PostProcessing.CurrentFilter != null)
                    {
                        FloatParameter newValue = new FloatParameter();
                        newValue.value = i;
                        lensDistortion.centerY.Override(newValue);
                    }
                    yield return(null);
                }

                for (float i = 1; i > -1; i -= 0.01f)
                {
                    if (PostProcessing.CurrentFilter != null)
                    {
                        FloatParameter newValue = new FloatParameter();
                        newValue.value = i;
                        lensDistortion.centerY.Override(newValue);
                    }
                    yield return(null);
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Creates a new blur post process effect.
        /// </summary>
        /// <param name="root">Root object to which the material belongs.</param>
        /// <param name="isFirstPass">Whether the effect is to be applied as a first blur pass.</param>
        /// <param name="blurDistance">How much the image will be blurred by the effect.</param>
        public BlurEffect(Root root, bool isFirstPass = true, float blurDistance = 0.003f)
            : base(root)
        {
            mIsFirstPass       = isFirstPass;
            mBlurDistanceParam = new FloatParameter(root, "blurDistance", blurDistance);

            Setup();
        }
Exemplo n.º 17
0
 public Cont1(DataContainer parent)
     : base(parent, "Cont1", "Cont1")
 {
     IntParam    = new IntParameter(this, "IntParam", "IntParam", 0);
     StrParam    = new StringParameter(this, "StrParam", "StrParam", "abc");
     FloatParam1 = new FloatParameter(this, "FloatParam1", "FloatParam1", 0.5f, "m/s", 5);
     FloatParam2 = new FloatParameter(this, "FP2", "FloatParam2", 5.5f, "m/s", 8);
 }
Exemplo n.º 18
0
        public void BufferTest()
        {
            var p = new FloatParameter(null, "myFloatId", "myFloatName", 123.0, "m/s", 5);

            p.Value = 555555.66;
            p.ResetModifiedState();
            Assert.AreEqual(p.BufferedValue, p.Value, "BufferedValue not set correctly");
        }
Exemplo n.º 19
0
        public void SetValueTest()
        {
            var p = new FloatParameter(null, "myFloatId", "myFloatName", 55.076, "m/s", 5);

            p.AsString = $"123456789{CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator}23";

            CheckSetErroneousValueAsString(p, "Otto");
            CheckSetErroneousValueAsString(p, "true");
        }
Exemplo n.º 20
0
        public void ProhibitedValueChangeTest()
        {
            var p = new FloatParameter(null, "myFloatId", "myFloatName", 55.076, "m/s", 5);

            CheckProhibitedValueChange(p, 77,
                                       param =>
                                       ((FloatParameter)param).Value = 1234.34
                                       );
        }
Exemplo n.º 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TexturedMaterial"/> class.
        /// </summary>
        /// <param name="root">Root object to which the material belongs.</param>
        public TexturedMaterial(Root root) : base(root)
        {
            mAmbientColorParam      = new ColorParameter(root, "ambientColor", Color.Black);
            mDiffuseTextureParam    = new TextureParameter(Root, "txDiffuse", null);
            mSpecularIntensityParam = new FloatParameter(root, "specularIntensity", 0.0f);
            mShininessParam         = new FloatParameter(root, "shininess", 1.0f);
            mReceiveShadowsParam    = new FloatParameter(root, "receiveShadows", 1.0f);

            Setup();
        }
Exemplo n.º 22
0
    private IEnumerator BloomProcessing()
    {
        FloatParameter _float = bloom.intensity;

        while (true)
        {
            _float.Interp(bloom.intensity, Random.Range(1, 7), 0.1f);
            yield return(null);
        }
    }
Exemplo n.º 23
0
    //총바꿈
    public void ListenGunChange(object param)
    {
        FloatParameter p = param as FloatParameter;

        accuracy = p.value;
        float size = DEFAULT_SIZE * accuracy;

        rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size);
        rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size);
    }
Exemplo n.º 24
0
        public static void Convert(this BIRPRendering.FloatParameter birpSource, FloatParameter target, float scale = 1f, bool enabledState = true)
        {
            if (target == null)
            {
                return;
            }

            target.value         = enabledState ? birpSource.value * scale : 0f;
            target.overrideState = birpSource.overrideState;
        }
Exemplo n.º 25
0
 private void Awake()
 {
     ppVol    = GetComponent <PostProcessVolume>();
     lens     = ppVol.profile.settings[0] as LensDistortion;
     x        = new FloatParameter();
     y        = new FloatParameter();
     x.value  = lens.intensityX;
     y.value  = lens.intensityY;
     audioSrc = GetComponent <AudioSource>();
 }
Exemplo n.º 26
0
        /// <summary>
        /// Creates a new material with no textures. Textures must be set before rendering any
        /// object with the material.
        /// </summary>
        /// <param name="root">Root object to which the material belongs.</param>
        public NormalMappedMaterial(Root root) : base(root)
        {
            mAmbientColorParam    = new ColorParameter(Root, "ambientColor", Color.Black);
            mDiffuseTextureParam  = new TextureParameter(Root, "txDiffuse", null);
            mNormalTextureParam   = new TextureParameter(Root, "txNormal", null);
            mSpecularTextureParam = new TextureParameter(Root, "txSpecular", null);
            mBumpinessParam       = new FloatParameter(Root, "bumpiness", 1.0f);
            mReceiveShadowsParam  = new FloatParameter(root, "receiveShadows", 1.0f);

            Setup();
        }
Exemplo n.º 27
0
 void Start()
 {
     foreach (FloatParameter parameter in m_animator.FloatParams)
     {
         if (parameter.Name == m_paramName)
         {
             m_parameter = parameter;
             break;
         }
     }
 }
Exemplo n.º 28
0
        public MovingMatrix4 getMovingMatrix(string name, MovingMatrix4 defaultValue)
        {
            // step 1: check for a non-moving specification:
            Matrix4 m = getMatrix(name, null);

            if (m != null)
            {
                return(new MovingMatrix4(m));
            }
            // step 2: check to see if the time range has been updated
            FloatParameter times = getFloatArray(name + ".times");

            if (times != null)
            {
                if (times.data.Length <= 1)
                {
                    defaultValue.updateTimes(0, 0);
                }
                else
                {
                    if (times.data.Length != 2)
                    {
                        UI.printWarning(UI.Module.API, "Time value specification using only endpoints of {0} values specified", times.data.Length);
                    }
                    // get endpoint times - we might allow multiple time values
                    // later
                    float t0 = times.data[0];
                    float t1 = times.data[times.data.Length - 1];
                    defaultValue.updateTimes(t0, t1);
                }
            }
            else
            {
                // time range stays at default
            }
            // step 3: check to see if a number of steps has been specified
            int steps = getInt(name + ".steps", 0);

            if (steps <= 0)
            {
                // not specified - return default value
            }
            else
            {
                // update each element
                defaultValue.setSteps(steps);
                for (int i = 0; i < steps; i++)
                {
                    defaultValue.updateData(i, getMatrix(String.Format("{0}[{1}]", name, i), defaultValue.getData(i)));
                }
            }
            return(defaultValue);
        }
Exemplo n.º 29
0
    /// <summary> Called when a float parameter is detected. Override to assign to the proper variable. </summary>
    /// count tells how many float parameters have been identified so far and can be used to identify them.
    protected override void ReceiveFloatParameter(FloatParameter floatParameter, int count)
    {
        switch (count)
        {
        case 1:
            _DegreesPerSecond = floatParameter;
            break;

        default:
            break;
        }
    }
        public void ImplicitOperator_ReturnsValue()
        {
            FloatParameter p = new FloatParameter("id", null, 68);

            if (p > 5)
            {
                Assert.Pass();
            }


            Assert.Fail();
        }