Exemple #1
0
        public override bool Calculate()
        {
            if (input1Knob.connected())
            {
                Input1Val = input1Knob.GetValue <float> ();
            }
            if (input2Knob.connected())
            {
                Input2Val = input2Knob.GetValue <float> ();
            }

            switch (type)
            {
            case CalcType.Add:
                outputKnob.SetValue <float> (Input1Val + Input2Val);
                break;

            case CalcType.Substract:
                outputKnob.SetValue <float> (Input1Val - Input2Val);
                break;

            case CalcType.Multiply:
                outputKnob.SetValue <float> (Input1Val * Input2Val);
                break;

            case CalcType.Divide:
                outputKnob.SetValue <float> (Input1Val / Input2Val);
                break;
            }

            return(true);
        }
Exemple #2
0
    public override bool Calculate()
    {
        Texture tex = textureInputKnob.GetValue <Texture>();

        if (!textureInputKnob.connected() || tex == null)
        { // Reset outputs if no texture is available
            textureOutputKnob.ResetValue();
            outputSize = Vector2Int.zero;
            if (outputTex != null)
            {
                outputTex.Release();
            }
            return(true);
        }

        // Guard against multiple Calculate()'s per frame
        if (Time.time - lastStep > Time.deltaTime)
        {
            lastStep = Time.time;
        }
        else
        {
            textureOutputKnob.SetValue(outputTex);
            return(true);
        }

        var inputSize = new Vector2Int(tex.width, tex.height);

        if (inputSize != outputSize)
        {
            outputSize = inputSize;
            InitializeRenderTexture();
        }
        in1 = in1Knob.connected() ? in1Knob.GetValue <float>() : in1;
        in2 = in2Knob.connected() ? in2Knob.GetValue <float>() : in2;

        SetOffsetAndKnobParams();
        BoundOffset();

        int panKernel = ChooseKernel();

        panShader.SetInt("width", tex.width);
        panShader.SetInt("height", tex.height);
        panShader.SetFloats("offset", offset.x, offset.y);
        panShader.SetTexture(panKernel, "OutputTex", outputTex);
        panShader.SetTexture(panKernel, "InputTex", tex);
        var threadGroupX = Mathf.CeilToInt(tex.width / 16.0f);
        var threadGroupY = Mathf.CeilToInt(tex.height / 16.0f);

        panShader.Dispatch(panKernel, threadGroupX, threadGroupY, 1);

        // Assign output channels
        textureOutputKnob.SetValue(outputTex);

        return(true);
    }
Exemple #3
0
        public override bool Calculate()
        {
            var input = inputKnob.GetValue <Texture>();

            if (!input || !outputKnob.connected())
            {
                return(true);
            }
            var output = CreateOutputTexture(input);

            if (_material == null)
            {
                _material = new Material(GetShader());
            }
            ConfigureMaterial(_material);
            Graphics.Blit(input, output, _material);

            var prevActive = RenderTexture.active;

            RenderTexture.active = output;
            var outputTexture = new Texture2D(output.width, output.height);

            outputTexture.ReadPixels(new Rect(0, 0, output.width, output.height), 0, 0);
            outputTexture.Apply();
            RenderTexture.active = prevActive;

            outputKnob.SetValue <Texture>(outputTexture);
            return(true);
        }
Exemple #4
0
    public override bool Calculate()
    {
        var dummySpectrum = new float[32];

        for (int i = 0; i < 32; i++)
        {
            dummySpectrum[i] = 0.5f;
        }

        spectrumData = spectrumDataKnob.GetValue <float[]>();
        if (spectrumData != null)
        {
            patternShader.SetInt("width", outputSize.x);
            patternShader.SetInt("height", outputSize.y);
            patternShader.SetInt("spectrumSize", spectrumData.Length);
            patternShader.SetFloats("spectrumData", spectrumData);
            patternShader.SetTexture(patternKernel, "outputTex", outputTex);
            uint tx, ty, tz;
            patternShader.GetKernelThreadGroupSizes(patternKernel, out tx, out ty, out tz);
            var threadGroupX = Mathf.CeilToInt(((float)outputSize.x) / tx);
            var threadGroupY = Mathf.CeilToInt(((float)outputSize.y) / ty);
            patternShader.Dispatch(patternKernel, threadGroupX, threadGroupY, 1);
            outputTexKnob.SetValue(outputTex);
        }
        return(true);
    }
    public override bool Calculate()
    {
        a  = aKnob.connected() ? aKnob.GetValue <float>(): a;
        b  = bKnob.connected() ? bKnob.GetValue <float>() : b;
        m1 = m1Knob.connected() ? m1Knob.GetValue <float>() : m1;
        m2 = m2Knob.connected() ? m2Knob.GetValue <float>() : m2;
        n1 = n1Knob.connected() ? n1Knob.GetValue <float>() : n1;
        n2 = n2Knob.connected() ? n2Knob.GetValue <float>() : n2;
        n3 = n3Knob.connected() ? n3Knob.GetValue <float>() : n3;


        patternShader.SetFloat("a", a);
        patternShader.SetFloat("b", b);
        patternShader.SetFloat("m1", m1);
        patternShader.SetFloat("m2", m2);
        patternShader.SetFloat("n1", n1);
        patternShader.SetFloat("n2", n2);
        patternShader.SetFloat("n3", n3);

        patternShader.SetInt("width", outputSize.x);
        patternShader.SetInt("height", outputSize.y);

        patternShader.SetTexture(patternKernel, "outputTex", outputTex);
        uint tx, ty, tz;

        patternShader.GetKernelThreadGroupSizes(patternKernel, out tx, out ty, out tz);
        var threadGroupX = Mathf.CeilToInt(((float)outputSize.x) / tx);
        var threadGroupY = Mathf.CeilToInt(((float)outputSize.y) / ty);

        patternShader.Dispatch(patternKernel, threadGroupX, threadGroupY, 1);
        outputTexKnob.SetValue(outputTex);
        return(true);
    }
Exemple #6
0
        public override bool Calculate()
        {
            Channel RChannel = channelRKnob.connected() ? channelRKnob.GetValue <Channel>() : null;
            Channel GChannel = channelGKnob.connected() ? channelGKnob.GetValue <Channel>() : null;
            Channel BChannel = channelBKnob.connected() ? channelBKnob.GetValue <Channel>() : null;
            Channel AChannel = channelAKnob.connected() ? channelAKnob.GetValue <Channel>() : null;

            if (RChannel == null && GChannel == null && BChannel == null)
            {
                bundledKnob.ResetValue();
                return(true);
            }

            int width  = Mathf.Max(new int[] { RChannel != null ? RChannel.width : 0, GChannel != null ? GChannel.width : 0, BChannel != null ? BChannel.width : 0, AChannel != null ? AChannel.width : 0 });
            int height = Mathf.Max(new int[] { RChannel != null ? RChannel.height : 0, GChannel != null ? GChannel.height : 0, BChannel != null ? BChannel.height : 0, AChannel != null ? AChannel.height : 0 });

            Texture2D bundled = new Texture2D(width, height, AChannel != null ? TextureFormat.RGBA32 : TextureFormat.RGB24, false);

            bundled.name = "Bundled Tex";

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    bundled.SetPixel(x, y, new Color(RChannel != null ? RChannel.GetValue(x, y, width, height) : 0,
                                                     GChannel != null ? GChannel.GetValue(x, y, width, height) : 0,
                                                     BChannel != null ? BChannel.GetValue(x, y, width, height) : 0,
                                                     AChannel != null ? AChannel.GetValue(x, y, width, height) : 1));
                }
            }

            bundled.Apply();
            bundledKnob.SetValue(bundled);
            return(true);
        }
Exemple #7
0
    public override bool Calculate()
    {
        Texture tex = textureInputKnob.GetValue <Texture>();

        if (!textureInputKnob.connected() || tex == null)
        { // Reset outputs if no texture is available
            textureOutputKnob.ResetValue();
            outputSize = Vector2Int.zero;
            return(true);
        }

        var inputSize = new Vector2Int(tex.width, tex.height);

        if (inputSize != outputSize)
        {
            outputSize = inputSize;
            InitializeRenderTexture();
        }

        //Execute compute shader
        PolarizeShader.SetInt("width", tex.width);
        PolarizeShader.SetInt("height", tex.height);
        PolarizeShader.SetTexture(kernelId, "OutputTex", outputTex);
        PolarizeShader.SetTexture(kernelId, "InputTex", tex);
        var threadGroupX = Mathf.CeilToInt(tex.width / 16.0f);
        var threadGroupY = Mathf.CeilToInt(tex.height / 16.0f);

        PolarizeShader.Dispatch(kernelId, threadGroupX, threadGroupY, 1);

        // Assign output channels
        textureOutputKnob.SetValue(outputTex);

        return(true);
    }
Exemple #8
0
    public override bool Calculate()
    {
        Texture tex = textureInputKnob.GetValue <Texture>();

        if (!textureInputKnob.connected() || tex == null)
        { // Reset outputs if no texture is available
            textureOutputKnob.ResetValue();
            outputSize = Vector2Int.zero;
            return(true);
        }

        if (outputSize.x == 0 || outputSize.y == 0 || reflections != previousReflections)
        {
            outputSize          = new Vector2Int(tex.width, tex.height * reflections);
            previousReflections = reflections;
            InitializeRenderTexture();
            Debug.Log("tex.height");
            Debug.Log(tex.height);
        }

        //Execute compute shader
        KaleidoscopeShader.SetInt("width", tex.width);
        KaleidoscopeShader.SetInt("height", tex.height);
        KaleidoscopeShader.SetTexture(kernelId, "InputTex", tex);
        KaleidoscopeShader.SetTexture(kernelId, "OutputTex", outputTex);
        var threadGroupX = Mathf.CeilToInt(outputTex.width / 16.0f);
        var threadGroupY = Mathf.CeilToInt(outputTex.height / 16.0f);

        KaleidoscopeShader.Dispatch(kernelId, threadGroupX, threadGroupY, 1);

        // Assign output channels
        textureOutputKnob.SetValue(outputTex);

        return(true);
    }
Exemple #9
0
    public override bool Calculate()
    {
        emissionRate = emissionRateKnob.connected() ? emissionRateKnob.GetValue <float>(): emissionRate;

        outputTexKnob.SetValue(outputTex);
        return(true);
    }
Exemple #10
0
    public override bool Calculate()
    {
        signalValue = inputSignalKnob.GetValue <float>();
        switch (triggerMode.SelectedOption())
        {
        case "leadingEdge":
            output = (signalValue > threshold) && !wasOverThreshold;
            break;

        case "trailingEdge":
            output = (signalValue < threshold) && wasOverThreshold;
            break;

        case "high":
            output = signalValue > threshold;
            break;

        case "low":
            output = signalValue < threshold;
            break;

        default:
            output = false;
            break;
        }
        wasOverThreshold = signalValue > threshold;
        outputEventKnob.SetValue(output);
        return(true);
    }
Exemple #11
0
        public override bool Calculate()
        {
            float value = 0;
            float t     = Time.time;

            amplitude = amplInputKnob.connected()  ? amplInputKnob.GetValue <float>()   : amplitude;
            period    = periodInputKnob.connected()   ? periodInputKnob.GetValue <float>() : period;
            phase     = phaseInputKnob.connected()    ? phaseInputKnob.GetValue <float>()  : phase;

            offset = 0;
            if (paramStyle.SelectedOption() == "min max")
            {
                amplitude = (max - min) / 2;
                offset    = min + amplitude;
            }

            var newParams = (period, amplitude, phase);
            var oldParams = (lastPeriod, lastAmplitude, lastPhase);

            if (newParams != oldParams)
            {
                if (period != lastPeriod)
                {
                    phase = (t - period / lastPeriod * (t - lastPhase)) % period;
                }
            }

            value = signalGenerators[signalType.SelectedOption()](t, period, amplitude, phase, 0);
            outputKnob.SetValue(value + offset);
            lastPeriod    = period;
            lastPhase     = phase;
            lastAmplitude = amplitude;
            return(true);
        }
    public override bool Calculate()
    {
        tinselOne.phase     = Time.time / 10;
        tinselOne.amplitude = tinselAmplitude;
        tinselOne.thickness = tinselThickness;
        tinselOne.offset    = tinselOffset;
        tinselOne.period    = tinselOne.amplitude * 1.25f;

        turbScale = turbScaleKnob.connected() ? turbScaleKnob.GetValue <float>() : turbScale;
        if (turbScale != oldScale)
        {
            oldScale = turbScale;
            GenerateNoiseTex();
            patternShader.SetTexture(patternKernel, "noiseTex", noiseTex);
        }
        turbFactor = turbIntensityKnob.connected() ? turbIntensityKnob.GetValue <float>() : turbFactor;

        patternShader.SetInt("width", outputTex.width);
        patternShader.SetInt("height", outputTex.height);
        patternShader.SetTexture(patternKernel, "OutputTex", outputTex);
        uint tx, ty, tz;

        //patternShader.GetKernelThreadGroupSizes(patternKernel, out tx, out ty, out tz);
        //patternShader.Dispatch(patternKernel, Mathf.CeilToInt(outputTex.width / tx), Mathf.CeilToInt(outputTex.height / ty), 1);
        DrawTree();
        textureOutputKnob.SetValue(treeTex);
        return(true);
    }
Exemple #13
0
    public override bool Calculate()
    {
        var newPeriod = periodInputKnob.connected() ? periodInputKnob.GetValue <float>() : period;
        var newPhase  = phaseInputKnob.connected() ? phaseInputKnob.GetValue <float>() : phase;

        if (newPeriod != period ||
            newPhase != phase)
        {
            if (newPeriod != period)
            {
                //Find a phase such that the oscillator won't instantaneously jump in amplitude
                //If phase and freq change on the same Calculate()... we pick freq.
                float t = Time.time;
                newPhase = 2 * Mathf.PI * t - (newPeriod / period) * (2 * Mathf.PI * t - phase);
            }
            period = newPeriod;
            phase  = newPhase;
        }
        synthShader.SetInt("width", outputSize.x);
        synthShader.SetInt("height", outputSize.y);
        synthShader.SetFloat("period", period);
        synthShader.SetFloat("phase", phase);
        synthShader.SetFloat("time", Time.time);
        synthShader.SetTexture(kernelId, "OutputTex", outputTex);
        var threadGroupX = Mathf.CeilToInt(outputSize.x / 16.0f);
        var threadGroupY = Mathf.CeilToInt(outputSize.y / 16.0f);

        synthShader.Dispatch(kernelId, threadGroupX, threadGroupY, 1);

        // Assign output channels
        textureOutputKnob.SetValue(outputTex);

        return(true);
    }
Exemple #14
0
    public override bool Calculate()
    {
        patternShader.SetInts("outputSize", outputSize.x, outputSize.y);
        patternShader.SetInt("maxIterations", maxIterations);
        patternShader.SetInt("order", order);
        patternShader.SetFloat("bias", bias);
        patternShader.SetFloat("zoom", zoom);
        patternShader.SetFloat("radius", radius);
        if (offsetKnob.connected())
        {
            offset = offsetKnob.GetValue <Vector2>();
        }
        else
        {
            offset = new Vector2(1, 1);
        }
        patternShader.SetFloats("offset", offset.x, offset.y);
        patternShader.SetVector("convergeColor", Color.red);
        patternShader.SetVector("divergeColor", Color.black);
        patternShader.SetTexture(patternKernel, "outputTex", outputTex);
        uint tx, ty, tz;

        patternShader.GetKernelThreadGroupSizes(patternKernel, out tx, out ty, out tz);
        var threadGroupX = Mathf.CeilToInt(((float)outputSize.x) / tx);
        var threadGroupY = Mathf.CeilToInt(((float)outputSize.y) / ty);

        patternShader.Dispatch(patternKernel, threadGroupX, threadGroupY, 1);
        outputTexKnob.SetValue(outputTex);
        return(true);
    }
Exemple #15
0
 public override bool Calculate()
 {
     if (timeMultiplierKnob.connected())
     {
         timeMultiplier = timeMultiplierKnob.GetValue <float>();
     }
     if (applyForceKnob.GetValue <bool>())
     {
         ApplyVelocity();
     }
     if (running && Time.time - lastStep > 1 / 60f)
     {
         if (continuousDye)
         {
             AddDye();
         }
         if (clicked)
         {
             timestep = Time.deltaTime;
         }
         else
         {
             timestep = Time.time - lastStep;
         }
         lastStep = Time.time;
         SimulateFluid();
     }
     if (clicked)
     {
         clicked = false;
     }
     textureOutputKnob.SetValue <Texture>(dyeField);
     return(true);
 }
Exemple #16
0
    public override bool Calculate()
    {
        VoxelBlock <T> block = input.GetValue <VoxelBlock <T> >();

        if (block == null || block.Layers == null)
        {
            return(false);
        }

        CalculationSetup(block);
        bool success = true;

        for (int i = 0; i < block.Layers.Count(); i++)
        {
            if (!CalculateLayer(block.Layers[i], i - block.Overlap))
            {
                success = false;
                break;
            }
        }
        CalculationTeardown();

        output.SetValue(block);

        return(success);
    }
Exemple #17
0
 public override bool Calculate()
 {
     CheckCaptureParams();
     smoother.AdvanceFrame();
     spectrumDataKnob.SetValue(GetSpectrumData());
     return(true);
 }
        public override bool Calculate()
        {
            var seed = SeedGUIUtils.GetSeed(_seedInputKnob, _seed);

            outputKnob.SetValue <ModuleBase>(new Perlin(_frequency, _lacunarity, _persistence, _octaves, seed, _quality));
            return(true);
        }
Exemple #19
0
    public override bool Calculate()
    {
        VoxelBlock <T> block = new VoxelBlock <T>();

        block.Offset = Offset;
        output.SetValue(InitBlock(block));
        return(true);
    }
Exemple #20
0
        public override bool Calculate()
        {
            outputTop.SetValue <float> (inputTop.GetValue <float> ());
            outputBottom.SetValue <float> (inputBottom.GetValue <float> ());
            outputRight.SetValue <float> (inputRight.GetValue <float> ());
            outputLeft.SetValue <float> (inputLeft.GetValue <float> ());

            return(true);
        }
Exemple #21
0
    public override bool Calculate()
    {
        // Bind the
        BindAndExecute();
        // Assign output channels
        textureOutputKnob.SetValue(outputTex);

        return(true);
    }
Exemple #22
0
    public override bool Calculate()
    {
        if (!controlSignalKnob.connected())
        {
            outputSignalKnob.SetValue(latchedValue);
            return(true);
        }
        var inputValue  = controlSignalKnob.GetValue <float>();
        var sensitivity = sensitivityKnob.connected() ? sensitivityKnob.GetValue <float>() : 1;

        latchedValue += inputValue * sensitivity;
        if (useRange)
        {
            latchedValue = Mathf.Clamp(latchedValue, min, max);
        }
        outputSignalKnob.SetValue(latchedValue);
        return(true);
    }
Exemple #23
0
    public override bool Calculate()
    {
        if (!block1Connection.connected() || !block2Connection.connected())
        {
            return(false);
        }
        VoxelBlock <Voxel> block1 = block1Connection.GetValue <VoxelBlock <Voxel> >();
        VoxelBlock <Voxel> block2 = block2Connection.GetValue <VoxelBlock <Voxel> >();

        int overlap = block1.Overlap;
        int width   = block1.Width;
        int height  = block1.Height;
        int length  = block1.Length;

        for (int y = 0; y < height + 2 * overlap; y++)
        {
            VoxelLayer <Voxel> l1 = block1.Layers[y];
            VoxelLayer <Voxel> l2 = block2.Layers[y];
            for (int x = 0; x < width + 2 * overlap; x++)
            {
                for (int z = 0; z < length + 2 * overlap; z++)
                {
                    var v1 = l1.Layer[x, z];
                    var v2 = l2.Layer[x, z];
                    switch (mode)
                    {
                    case CombiningMode.Average:
                        v1.Data = (v1.Data + v2.Data) / 2;
                        break;

                    case CombiningMode.Add:
                        v1.Data = v1.Data + v2.Data;
                        break;

                    case CombiningMode.Subtract:
                        v1.Data = v1.Data - v2.Data;
                        break;

                    case CombiningMode.Divide:
                        if (v2.Data != 0)
                        {
                            v1.Data = v1.Data / v2.Data;
                        }
                        break;

                    case CombiningMode.Multiply:
                        v1.Data = v1.Data * v2.Data;
                        break;
                    }
                }
            }
        }
        outputConnection.SetValue(block1);

        return(true);
    }
    public override bool Calculate()
    {
        float epsilon = 0.000001f;

        if (binding)
        {
            var controllerCount          = XCI.GetNumPluggedCtrlrs();
            XboxController[] controllers = { XboxController.First, XboxController.Second, XboxController.Third, XboxController.Fourth };
            for (int i = 0; i < controllerCount; i++)
            {
                var controller = controllers[i];

                var     leftStickX = XCI.GetAxis(XboxAxis.LeftStickX, controller);
                var     leftStickY = XCI.GetAxis(XboxAxis.LeftStickY, controller);
                Vector2 leftStick  = new Vector2(leftStickX, leftStickY);
                if (leftStick.magnitude > epsilon)
                {
                    boundController = controller;
                    boundStick      = XboxStickId.left;
                    binding         = false;
                    bound           = true;
                }
                var     rightStickX = XCI.GetAxis(XboxAxis.RightStickX, controller);
                var     rightStickY = XCI.GetAxis(XboxAxis.RightStickY, controller);
                Vector2 rightStick  = new Vector2(rightStickX, rightStickY);
                if (rightStick.magnitude > epsilon)
                {
                    boundController = controller;
                    boundStick      = XboxStickId.right;
                    binding         = false;
                    bound           = true;
                }
            }
        }
        else if (bound)
        {
            float stickX = 0, stickY = 0;
            switch (boundStick)
            {
            case XboxStickId.left:
                stickX = XCI.GetAxis(XboxAxis.LeftStickX, boundController);
                stickY = XCI.GetAxis(XboxAxis.LeftStickY, boundController);
                break;

            case XboxStickId.right:
                stickX = XCI.GetAxis(XboxAxis.RightStickX, boundController);
                stickY = XCI.GetAxis(XboxAxis.RightStickY, boundController);
                break;
            }
            axis2D = new Vector2(stickX, stickY);
            axis2DKnob.SetValue(axis2D);
            axisXKnob.SetValue(axis2D.x);
            axisYKnob.SetValue(axis2D.y);
        }
        return(true);
    }
    /*public override void NodeGUI ()
     * {
     *      GUILayout.BeginHorizontal();
     *      GUILayout.BeginVertical();
     *      xConnection.DisplayLayout ();
     *      yConnection.DisplayLayout ();
     *      zConnection.DisplayLayout ();
     *      GUILayout.EndVertical();
     *      outputConnection.DisplayLayout();
     *      GUILayout.EndHorizontal ();
     * }*/

    public override bool Calculate()
    {
        float x          = xConnection.GetValue <float>();
        float y          = yConnection.GetValue <float>();
        float z          = zConnection.GetValue <float>();
        float noiseValue = fractal.Sample3D(x, y, z);

        outputConnection.SetValue <float>(noiseValue);
        return(true);
    }
Exemple #26
0
 public override bool Calculate()
 {
     // Assign output channels
     if (nextIndex != currentIndex)
     {
         SelectClip(nextIndex);
     }
     textureOutputKnob.SetValue(outputTex);
     return(true);
 }
Exemple #27
0
    public override bool Calculate()
    {
        float input = inputConnection.GetValue <float>();

        if (thresholdConnection.connected())
        {
            threshold = thresholdConnection.GetValue <float>();
        }
        outputConnection.SetValue <float>(input > threshold ? 0.0f : 1.0f);
        return(true);
    }
Exemple #28
0
    public override bool Calculate()
    {
        if (controllerChoice.Selected != lastSelected)
        {
            ChooseController();
        }

        if (XCI.GetNumPluggedCtrlrs() > 0 && XCI.IsPluggedIn(boundController))
        {
            var lX = XCI.GetAxis(XboxAxis.LeftStickX, boundController);
            var lY = XCI.GetAxis(XboxAxis.LeftStickY, boundController);
            var rX = XCI.GetAxis(XboxAxis.RightStickX, boundController);
            var rY = XCI.GetAxis(XboxAxis.RightStickY, boundController);
            leftStick  = new Vector2(lX, lY);
            rightStick = new Vector2(rX, rY);

            leftTrigger  = XCI.GetAxis(XboxAxis.LeftTrigger, boundController);
            rightTrigger = XCI.GetAxis(XboxAxis.RightTrigger, boundController);

            dpadUp    = XCI.GetButton(XboxButton.DPadUp, boundController);
            dpadDown  = XCI.GetButton(XboxButton.DPadDown, boundController);
            dpadLeft  = XCI.GetButton(XboxButton.DPadLeft, boundController);
            dpadRight = XCI.GetButton(XboxButton.DPadRight, boundController);

            a = XCI.GetButton(XboxButton.A, boundController);
            b = XCI.GetButton(XboxButton.B, boundController);
            x = XCI.GetButton(XboxButton.X, boundController);
            y = XCI.GetButton(XboxButton.Y, boundController);

            leftBumper  = XCI.GetButton(XboxButton.LeftBumper, boundController);
            rightBumper = XCI.GetButton(XboxButton.LeftBumper, boundController);

            start = XCI.GetButton(XboxButton.Start, boundController);
            back  = XCI.GetButton(XboxButton.Back, boundController);

            LeftStickKnob.SetValue(leftStick);
            RightStickKnob.SetValue(rightStick);
            LeftTriggerKnob.SetValue(leftTrigger);
            RightTriggerKnob.SetValue(rightTrigger);
            dpadUpKnob.SetValue(dpadUp);
            dpadDownKnob.SetValue(dpadDown);
            dpadLeftKnob.SetValue(dpadLeft);
            dpadRightKnob.SetValue(dpadRight);
            aKnob.SetValue(a);
            bKnob.SetValue(b);
            xKnob.SetValue(x);
            yKnob.SetValue(y);
            leftBumperKnob.SetValue(leftBumper);
            rightBumperKnob.SetValue(rightBumper);
            startKnob.SetValue(start);
            backKnob.SetValue(back);
        }
        return(true);
    }
        public override bool Calculate()
        {
            var input = inputKnob.GetValue <ModuleBase>();

            if (input == null)
            {
                outputKnob.ResetValue();
                return(true);
            }
            outputKnob.SetValue(CreateModule(input));
            return(true);
        }
Exemple #30
0
 public override bool Calculate()
 {
     pressedKnob.SetValue(pressed);
     if (pressed)
     {
         pressed = false;
     }
     heldKnob.SetValue(held);
     releasedKnob.SetValue(released);
     valueKnob.SetValue(value);
     return(true);
 }