Esempio n. 1
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FPositionInput.PinIsChanged || FVectorSizeInput.PinIsChanged ||
                FV010Input.PinIsChanged || FV110Input.PinIsChanged || FV100Input.PinIsChanged || FV000Input.PinIsChanged ||
                FV011Input.PinIsChanged || FV111Input.PinIsChanged || FV101Input.PinIsChanged || FV001Input.PinIsChanged)
            {
                //get vector size
                double vs;
                FVectorSizeInput.GetValue(0, out vs);
                int vectorSize = (int)vs;

                SpreadMax = Math.Max(SpreadMax, FPositionInput.SliceCount * vectorSize);

                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FPositionOutput.SliceCount = SpreadMax;


                //the variables to fill with the input data
                Vector3D vectorSlice;
                double   V010Slice;
                double   V110Slice;
                double   V100Slice;
                double   V000Slice;
                double   V011Slice;
                double   V111Slice;
                double   V101Slice;
                double   V001Slice;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FPositionInput.GetValue3D(i / vectorSize, out vectorSlice.x, out vectorSlice.y, out vectorSlice.z);
                    FV010Input.GetValue(i, out V010Slice);
                    FV110Input.GetValue(i, out V110Slice);
                    FV100Input.GetValue(i, out V100Slice);
                    FV000Input.GetValue(i, out V000Slice);
                    FV011Input.GetValue(i, out V011Slice);
                    FV111Input.GetValue(i, out V111Slice);
                    FV101Input.GetValue(i, out V101Slice);
                    FV001Input.GetValue(i, out V001Slice);

                    //function per slice
                    V000Slice = VMath.Trilerp(vectorSlice, V010Slice, V110Slice, V100Slice, V000Slice,
                                              V011Slice, V111Slice, V101Slice, V001Slice);

                    //write data to outputs
                    FPositionOutput.SetValue(i, V000Slice);
                }
            }
        }
Esempio n. 2
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            if (FInput.PinIsChanged ||
                FGamma.PinIsChanged ||
                FBinSize.PinIsChanged)
            {
                double    curIn, curGamma, tmpBin;
                int       curBin;
                ArrayList outList = new ArrayList();
                ArrayList curList;
                for (int i = 0; i < SpreadMax; i++)
                {
                    FInput.GetValue(i, out curIn);
                    FGamma.GetValue(i, out curGamma);
                    FBinSize.GetValue(i, out tmpBin);
                    curBin  = (int)Math.Round(tmpBin);
                    curList = new ArrayList(curBin);
                    for (int j = 0; j < curBin; j++)
                    {
                        double start = j / (double)curBin / curGamma;
                        double end   = (curBin - 1.0) / (double)curBin / curGamma;
                        end = start + 1.0 - end;
                        curList.Add(VMath.Map(curIn, start, end, 0.0, 1.0, TMapMode.Clamp));
                    }
                    outList.AddRange(curList);
                }

                FOut.SliceCount = outList.Count;
                for (int i = 0; i < outList.Count; i++)
                {
                    FOut.SetValue(i, (double)outList[i]);
                }
            }
        }
Esempio n. 3
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            FCurrentDate.SliceCount = SpreadMax;
            FUTC.SliceCount         = SpreadMax;

            for (int i = 0; i < SpreadMax; i++)
            {
                if (FUpdate.PinIsChanged)
                {
                    FUpdate.GetValue(i, out FUpdateSlice);
                }

                DateTime CurrentDate = System.DateTime.Now;
                DateTime CurrentUTC  = System.DateTime.UtcNow;

                try
                {
                    if (FUpdateSlice > 0.5 || FFormate.PinIsChanged || FCulturInfo.PinIsChanged)
                    {
                        string currentFormatSlice;
                        string currentCultureInfo;
                        string currentDate = "";
                        string currentUTC  = "";

                        FFormate.GetString(i, out currentFormatSlice);
                        FCulturInfo.GetString(i, out currentCultureInfo);

                        if (currentFormatSlice != null && currentCultureInfo != null)
                        {
                            CultureInfo culture = new CultureInfo(currentCultureInfo);
                            currentDate = CurrentDate.ToString(currentFormatSlice, culture);
                            currentUTC  = CurrentUTC.ToString(currentFormatSlice, culture);
                        }
                        else if (currentFormatSlice != null)
                        {
                            currentDate = CurrentDate.ToString(currentFormatSlice);
                            currentUTC  = CurrentUTC.ToString(currentFormatSlice);
                        }
                        else if (currentCultureInfo != null)
                        {
                            CultureInfo culture = new CultureInfo(currentCultureInfo);
                            currentDate = CurrentDate.ToString(culture);
                            currentUTC  = CurrentUTC.ToString(culture);
                        }
                        else
                        {
                            currentDate = CurrentDate.ToString();
                            currentUTC  = CurrentUTC.ToString();
                        }

                        FCurrentDate.SetString(i, currentDate);
                        FUTC.SetString(i, currentUTC);
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, ex.Message);
                }
            }
        }
Esempio n. 4
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FValueInput.PinIsChanged || FDigitInput.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FValueOutput.SliceCount = SpreadMax;


                //the variables to fill with the input data
                double currentValueSlice;
                double currentDigitSlice;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FValueInput.GetValue(i, out currentValueSlice);
                    FDigitInput.GetValue(i, out currentDigitSlice);

                    FValueOutput.SetValue(i, Math.Round(currentValueSlice, (int)Math.Round(currentDigitSlice)));
                }
            }
        }
Esempio n. 5
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //the variables to fill with the input data

            // speed vector
            double currentValueSliceV1;
            double currentValueSliceV2;

            if (FValueInputDeltaT.PinIsChanged)
            {
                FValueInputDeltaT.GetValue(0, out deltaT);
            }

            if (FValueInputU.PinIsChanged)
            {
                FValueInputU.GetValue(0, out U);
            }

            //if any of the inputs has changed
            //recompute the outputs
            if (FValueInputX.PinIsChanged || FValueInputY.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FValueOutputX.SliceCount = SpreadMax;
                FValueOutputY.SliceCount = SpreadMax;

                previousValueSliceX = new double[SpreadMax];
                previousValueSliceY = new double[SpreadMax];

                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FValueInputX.GetValue(i, out previousValueSliceX[i]);
                    FValueInputY.GetValue(i, out previousValueSliceY[i]);
                }
            }

            //loop for all slices
            for (int i = 0; i < SpreadMax; i++)
            {
                //compute Ikeda map

                double t = 0.4 - 6 / (previousValueSliceX[i] * previousValueSliceX[i] + previousValueSliceX[i] * previousValueSliceY[i] + 1);

                currentValueSliceV1 = 1 + U * (previousValueSliceX[i] * Math.Cos(t) - previousValueSliceY[i] * Math.Sin(t));
                currentValueSliceV2 = U * (previousValueSliceX[i] * Math.Cos(t) + previousValueSliceY[i] * Math.Sin(t));

                currentValueSliceV1 *= deltaT;
                currentValueSliceV2 *= deltaT;

                //update values
                previousValueSliceX[i] = previousValueSliceX[i] + currentValueSliceV1;
                previousValueSliceY[i] = previousValueSliceY[i] + currentValueSliceV2;

                //write data to outputs
                FValueOutputX.SetValue(i, previousValueSliceX[i]);
                FValueOutputY.SetValue(i, previousValueSliceY[i]);
            }
        }
Esempio n. 6
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (
                FInput.PinIsChanged ||
                FRadius.PinIsChanged ||
                FFactor.PinIsChanged ||
                FSpreadCount.PinIsChanged
                )
            {
                List <Vector3D> outVec = new List <Vector3D>();
                double          curXSlice, curYSlice, curZSlice, xPos, yPos, zPos;
                double          tmpSize, currentRadius, currentFactor;
                int             currentBinSize = 0, myIncrement = 0;

                double dlong, l, dz, z, r;                  //part of the formula

                dlong = Math.PI * (3 - Math.Sqrt(5.0));     //part of the formula


                FOutput.SliceCount = 0;

                //loop for maximal spread count
                for (int i = 0; i < SpreadMax; i++)
                {
                    FInput.GetValue3D(i, out curXSlice, out curYSlice, out curZSlice);
                    FRadius.GetValue(i, out currentRadius);
                    FFactor.GetValue(i, out currentFactor);
                    FSpreadCount.GetValue(i, out tmpSize);

                    currentBinSize = (int)Math.Round(tmpSize);                  //use spreadcount as an integer

                    dz = (currentFactor * 2.0) / currentBinSize;                //part of the formula
                    z  = 1.0 - dz / 2.0;                                        //part of the formula
                    l  = 0.0;                                                   //part of the formula

                    //loop for each bin size
                    for (int j = 0; j < currentBinSize; j++)
                    {
                        r    = Math.Sqrt(1.0 - z * z);
                        xPos = Math.Cos(l) * r * currentRadius;
                        yPos = Math.Sin(l) * r * currentRadius;
                        zPos = z * currentRadius;

                        z = z - dz;
                        l = l + dlong;

                        //set output
                        outVec.Add(new Vector3D(xPos + curXSlice, yPos + curYSlice, zPos + curZSlice));
                    }
                    myIncrement += currentBinSize;
                }
                FOutput.SliceCount = outVec.Count;
                for (int i = 0; i < outVec.Count; i++)
                {
                    FOutput.SetValue3D(i, outVec[i].x, outVec[i].y, outVec[i].z);
                }
            }
        }
Esempio n. 7
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FMyValueInputX.PinIsChanged | FMyValueInputY.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FMyValueOutputX.SliceCount = SpreadMax;
                FMyValueOutputY.SliceCount = SpreadMax;
                FMyValueOutputZ.SliceCount = SpreadMax;

                //the variables to fill with the input data
                double currentValueSliceX;
                double currentValueSliceY;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FMyValueInputX.GetValue(i, out currentValueSliceX);
                    FMyValueInputY.GetValue(i, out currentValueSliceY);

                    //write data to outputs
                    FMyValueOutputX.SetValue(i, 2 * currentValueSliceX / (1 + currentValueSliceX * currentValueSliceX + currentValueSliceY * currentValueSliceY));
                    FMyValueOutputY.SetValue(i, 2 * currentValueSliceY / (1 + currentValueSliceX * currentValueSliceX + currentValueSliceY * currentValueSliceY));
                    FMyValueOutputZ.SetValue(i, (-1 + currentValueSliceX * currentValueSliceX + currentValueSliceY * currentValueSliceY) / (1 + currentValueSliceX * currentValueSliceX + currentValueSliceY * currentValueSliceY));
                }
            }
        }
Esempio n. 8
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FMyValueInput.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FMyValueOutput.SliceCount = SpreadMax;

                //the variables to fill with the input data
                double currentValueSlice;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FMyValueInput.GetValue(i, out currentValueSlice);

                    //your function per slice

                    //write data to outputs
                    FMyValueOutput.SetValue(i, currentValueSlice);
                }
            }
        }
Esempio n. 9
0
        private List <int> ConstructBinOffsets()
        {
            int        coffs = 0;
            List <int> res   = new List <int>();

            for (int i = 0; i < BinSizePin.SliceCount; i++)
            {
                double temp = 0;
                BinSizePin.GetValue(i, out temp);
                if (temp < 0)
                {
                    res.Add(0);
                }
                else
                {
                    res.Add(coffs);
                    coffs += (int)temp;
                }
            }
            return(res);
        }
Esempio n. 10
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            FMyMeshOutput.SliceCount = SpreadMax;             // by now, this node is not spreadable so it should always be 1.

            if (Radius.PinIsChanged || Perspective.PinIsChanged || QuaternionTransform.PinIsChanged)
            {
                Radius.GetValue(0, out radius);
                Perspective.GetValue(0, out p);
                QuaternionTransform.GetValue4D(0, out a, out b, out c, out d);
                FDeviceMeshes.Clear();
            }
        }
Esempio n. 11
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable;

            FEnable.GetValue(0, out Enable);
            //if any of the inputs has changed
            //recompute the outputs
            if (FEnable.PinIsChanged)
            {
                if (Enable == 1)
                {
                    m_PhidgetManager.Enable();
                }
                else
                {
                    m_PhidgetManager.Disable();
                }
            }

            if (Enable == 1 || FEnable.PinIsChanged)
            {
                int SliceCount = m_PhidgetManager.Devices.Count;
                FLibraryVersion.SliceCount = 1;
                FLibraryVersion.SetString(0, m_PhidgetManager.LibaryVersion);

                FDevice.SliceCount  = SliceCount;
                FSerial.SliceCount  = SliceCount;
                FVersion.SliceCount = SliceCount;

                for (int i = 0; i <= SliceCount; i++)
                {
                    FDevice.SetString(i, m_PhidgetManager.Devices.ToArray()[i].Name);
                    FSerial.SetValue(i, m_PhidgetManager.Devices.ToArray()[i].SerialNumber);
                    FVersion.SetValue(i, m_PhidgetManager.Devices.ToArray()[i].Version);
                }
            }
            else if (Enable == 0 || FEnable.PinIsChanged)
            {
                //int SliceCount = 1;
                //FDevice.SliceCount = SliceCount;
                //FSerial.SliceCount = SliceCount;
                //FVersion.SliceCount = SliceCount;

                //FDevice.SetString(0, "");
                //FSerial.SetValue(0, -1);
                //FVersion.SetValue(0, -1);
            }
            else
            {
            }
        }
Esempio n. 12
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            int diff = FStart.Count - SpreadMax;

            if (diff > 0)
            {
                FStart.RemoveRange(SpreadMax, diff);
            }

            for (int i = 0; i > diff; i--)
            {
                FStart.Add(DateTime.Now);
            }

            FOutput.SliceCount  = SpreadMax;
            FRunning.SliceCount = SpreadMax;
            FActive.SliceCount  = SpreadMax;

            double curSet, curReset, curTime, curActive, curRunning, curOut;

            for (int i = 0; i < SpreadMax; i++)
            {
                curActive  = 0;
                curRunning = 0;
                curOut     = 0;

                FReset.GetValue(i, out curReset);
                FSet.GetValue(i, out curSet);
                if (curSet < 0.5 || curReset > 0.5)
                {
                    FStart[i] = DateTime.Now;
                }
                else
                {
                    curActive = 1;
                    FTime.GetValue(i, out curTime);
                    TimeSpan span    = DateTime.Now - FStart[i];
                    double   elapsed = ((double)span.TotalMilliseconds / 1000.0);
                    curRunning = Math.Min(elapsed / curTime, 1.0);
                    if (elapsed >= curTime)
                    {
                        curOut = 1;
                    }
                }
                FOutput.SetValue(i, curOut);
                FRunning.SetValue(i, curRunning);
                FActive.SetValue(i, curActive);
            }
        }
Esempio n. 13
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable = 0;

            FSerial.GetValue(0, out m_Serial);
            FEnable.GetValue(0, out Enable);


            if (FEnable.PinIsChanged || FSerial.PinIsChanged)
            {
                if (Enable == 1)
                {
                    m_CTouchData.Enable(m_Serial);
                }
                else
                {
                    m_CTouchData.Close();
                }
            }

            if (true)
            {
                FPress.SliceCount    = 1;
                FPosition.SliceCount = 1;

                FPosition.SetValue(0, m_CTouchData.Position);


                if (FSensitivity.PinIsChanged)
                {
                    double Sense;
                    FSensitivity.GetValue(0, out Sense);
                    m_CTouchData.SetSense(Sense);
                }

                for (int i = 0; i < m_CTouchData.Press.Length; i++)
                {
                    FPress.SliceCount = m_CTouchData.Press.Length;
                    FPress.SetValue(i, m_CTouchData.Press[i]);
                }

                FInfo.SliceCount = m_CTouchData.Info.Length;
                for (int i = 0; i < m_CTouchData.Info.Length; i++)
                {
                    FInfo.SetString(i, m_CTouchData.Info[i]);
                }
            }
        }
Esempio n. 14
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FPinInVertices.PinIsChanged || FPinInCenter.PinIsChanged || FPinInRadius.PinIsChanged)
            {
                /*
                 * FHost.Log(TLogType.Debug, "FPinInVertices.SliceCount " + FPinInVertices.SliceCount);
                 * FHost.Log(TLogType.Debug, "FPinInCenter.SliceCount " + FPinInCenter.SliceCount);
                 * FHost.Log(TLogType.Debug, "FPinInRadius.SliceCount " + FPinInRadius.SliceCount);
                 */
                FPinOutVertices.SliceCount = FPinInVertices.SliceCount * FPinInCenter.SliceCount * FPinInRadius.SliceCount;
                int    index = 0;
                double pointX, pointY, pointZ;
                double radius;
                double centerX, centerY, centerZ;
                double inversionFactor;

                //loop for all slices
                for (int i = 0; i < FPinInVertices.SliceCount; i++)
                {
                    FPinInVertices.GetValue3D(i, out pointX, out pointY, out pointZ);
                    for (int j = 0; j < FPinInCenter.SliceCount; j++)
                    {
                        FPinInCenter.GetValue3D(j, out centerX, out centerY, out centerZ);
                        pointX -= centerX;
                        pointY -= centerY;
                        pointZ -= centerZ;

                        for (int k = 0; k < FPinInRadius.SliceCount; k++)
                        {
                            FPinInRadius.GetValue(k, out radius);
                            inversionFactor = radius * radius / (pointX * pointX + pointY * pointY + pointZ * pointZ);
                            pointX         *= inversionFactor;
                            pointY         *= inversionFactor;
                            pointZ         *= inversionFactor;

                            pointX += centerX;
                            pointY += centerY;
                            pointZ += centerZ;

                            FPinOutVertices.SetValue3D(index, pointX, pointY, pointZ);
                            index++;
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FInput.PinIsChanged || FVecSize.PinIsChanged || FBinSize.PinIsChanged)
            {
                double tmpVec;
                FVecSize.GetValue(0, out tmpVec);
                int vecSize = (int)Math.Round(tmpVec);

                VecBin        spread    = new VecBin(FInput, FBinSize, vecSize);
                List <double> outSpread = new List <double>();
//	            List<double> binId = new List<double>();


                for (int i = 0; i < spread.BinCount; i++)
                {
                    List <double> curBin   = new List <double>(spread.GetBin(i));
                    int           binCount = (int)(curBin.Count / (double)vecSize);
                    for (int b = 0; b < Math.Pow(binCount, (double)vecSize); b++)
                    {
                        for (int v = 0; v < vecSize; v++)
                        {
                            int id = (int)Math.Floor(b / Math.Pow(binCount, v));
                            id  = id % binCount;
                            id *= vecSize;
                            id += v;
                            outSpread.Add(curBin[id]);
                        }
                    }
                }

                FOut.SliceCount = outSpread.Count;
                for (int i = 0; i < outSpread.Count; i++)
                {
                    FOut.SetValue(i, outSpread[i]);
                }

//	            FBinId.SliceCount=binId.Count;
//	            for (int i=0; i<binId.Count; i++)
//	            {
//	                FBinId.SetValue(i, binId[i]);
//	            }
            }
        }
Esempio n. 16
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FPositionInput.PinIsChanged || FVectorSizeInput.PinIsChanged || FP1Input.PinIsChanged ||
                FP2Input.PinIsChanged || FP3Input.PinIsChanged || FP4Input.PinIsChanged)
            {
                //get vector size
                double vs;
                FVectorSizeInput.GetValue(0, out vs);
                int vectorSize = (int)vs;

                SpreadMax = Math.Max(SpreadMax, FPositionInput.SliceCount * vectorSize);

                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FValueOutput.SliceCount = SpreadMax;

                //the variables to fill with the input data
                Vector2D vectorSlice;
                double   p1Slice;
                double   p2Slice;
                double   p3Slice;
                double   p4Slice;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FPositionInput.GetValue2D(i / vectorSize, out vectorSlice.x, out vectorSlice.y);
                    FP1Input.GetValue(i, out p1Slice);
                    FP2Input.GetValue(i, out p2Slice);
                    FP3Input.GetValue(i, out p3Slice);
                    FP4Input.GetValue(i, out p4Slice);

                    //function per slice
                    p1Slice = VMath.Bilerp(vectorSlice, p1Slice, p2Slice, p3Slice, p4Slice);

                    //write data to outputs
                    FValueOutput.SetValue(i, p1Slice);
                }
            }
        }
Esempio n. 17
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FMyValueInputA.PinIsChanged || FMyValueInputB.PinIsChanged || FMyValueInputC.PinIsChanged || FMyValueInputD.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FMyStringOutput.SliceCount = FMyValueInputA.SliceCount * FMyValueInputB.SliceCount * FMyValueInputC.SliceCount * FMyValueInputD.SliceCount;

                //the variables to fill with the input data
                double currentValueSliceA, currentValueSliceB, currentValueSliceC, currentValueSliceD;
                int    index = 0;

                //loop for all slices
                for (int i = 0; i < FMyValueInputA.SliceCount; i++)
                {
                    //read data from inputs
                    FMyValueInputA.GetValue(i, out currentValueSliceA);

                    for (int j = 0; j < FMyValueInputB.SliceCount; j++)
                    {
                        FMyValueInputB.GetValue(j, out currentValueSliceB);

                        for (int k = 0; k < FMyValueInputC.SliceCount; k++)
                        {
                            FMyValueInputC.GetValue(k, out currentValueSliceC);

                            for (int l = 0; l < FMyValueInputD.SliceCount; l++)
                            {
                                FMyValueInputD.GetValue(l, out currentValueSliceD);

                                //write data to outputs
                                FMyStringOutput.SetString(index, Convert.ToString(currentValueSliceA) + "." + Convert.ToString(currentValueSliceB) + "." + Convert.ToString(currentValueSliceC) + "." + Convert.ToString(currentValueSliceD));
                                index++;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 18
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FSource.PinIsChanged ||
                FDestination.PinIsChanged ||
                FDo.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FDone.SliceCount = SpreadMax;

                //the variables to fill with the input data
                double curDo;
                string curSource, curDest;


                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FSource.GetString(i, out curSource);
                    FDestination.GetString(i, out curDest);
                    FDo.GetValue(i, out curDo);

                    double curDone = 0;
                    if (curDo == 1)
                    {
                        IWshShell    wsh         = new WshShellClass();
                        IWshShortcut curShortcut = (IWshShortcut)wsh.CreateShortcut(curDest + ".lnk");
                        curShortcut.WindowStyle = 1;                 //for default window, 3 for maximize, 7 for minimize
                        curShortcut.TargetPath  = curSource;         //for me, or any valid Path string
                        curShortcut.Save();
                        curDone = 1;
                    }

                    //write data to outputs
                    FDone.SetValue(i, curDone);
                }
            }
        }
Esempio n. 19
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            if (FMyValueInputX.PinIsChanged || FMyValueInputY.PinIsChanged || FMyValueInputZ.PinIsChanged)
            {
                //the variables to fill with the input data
                double x, y, z, w;

                FMyValueOutputX.SliceCount = SpreadMax;
                FMyValueOutputY.SliceCount = SpreadMax;
                FMyValueOutputZ.SliceCount = SpreadMax;
                FMyValueOutputW.SliceCount = SpreadMax;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FMyValueInputX.GetValue(i, out x);
                    FMyValueInputY.GetValue(i, out y);
                    FMyValueInputZ.GetValue(i, out z);

                    // If q = A*(x*i+y*j+z*k) where (x,y,z) is unit length, then
                    // exp(q) = cos(A)+sin(A)*(x*i+y*j+z*k).  If sin(A) is near zero,
                    // use exp(q) = cos(A)+A*(x*i+y*j+z*k) since A/sin(A) has limit 1.

                    w = Math.Sqrt(x * x + y * y + z * z);

                    if (Math.Sin(w) < epsilon || Math.Sin(w) > epsilon)
                    {
                        x *= Math.Sin(w) / w;
                        y *= Math.Sin(w) / w;
                        z *= Math.Sin(w) / w;
                    }

                    //write data to outputs
                    FMyValueOutputX.SetValue(i, x);
                    FMyValueOutputY.SetValue(i, y);
                    FMyValueOutputZ.SetValue(i, z);
                    FMyValueOutputW.SetValue(i, Math.Cos(w));
                }
            }
        }
Esempio n. 20
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FPositionInput.PinIsChanged || FOctavesInput.PinIsChanged ||
                FFrequencyInput.PinIsChanged || FPersistanceInput.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FOutput.SliceCount = SpreadMax;

                double octaves, freq, pers;
                FOctavesInput.GetValue(0, out octaves);
                FFrequencyInput.GetValue(0, out freq);
                FPersistanceInput.GetValue(0, out pers);

                //the variable to fill with the input position
                Vector4D pos;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read position from inputs
                    FPositionInput.GetValue4D(i, out pos.x, out pos.y, out pos.z, out pos.w);

                    //noise function per slice
                    double noiseVal = 0;

                    for (int o = 0; o <= (int)octaves; o++)
                    {
                        double comul = Math.Pow(freq, o);
                        noiseVal += SimplexNoise.noise(pos.x * comul, pos.y * comul, pos.z * comul, pos.w * comul) * Math.Pow(pers, o);
                    }

                    //write data to outputs
                    FOutput.SetValue(i, noiseVal);
                }
            }
        }
Esempio n. 21
0
        protected override void SetData(float[] samples)
        {
            int    len = this.DataLength;
            double doScaling;

            FPinInScaling.GetValue(0, out doScaling);

            BASS_CHANNELINFO info = Bass.BASS_ChannelGetInfo(this.FChannel.BassHandle.Value);

            if (info.chans == 1 || !this.Individual)
            {
                this.FPinOutLeft.SliceCount  = len;
                this.FPinOutRight.SliceCount = len;
                for (int i = 0; i < len; i++)
                {
                    this.FPinOutLeft.SetValue(i, (double)samples[i] * (i * doScaling + 1));
                    //this.FPinOutLeft.SetValue(i, (double)samples[i]);
                    this.FPinOutRight.SetValue(i, (double)samples[i] * (i * doScaling + 1));
                }
            }
            else
            {
                this.FPinOutLeft.SliceCount  = len / 2;
                this.FPinOutRight.SliceCount = len / 2;
                for (int i = 0; i < len; i++)
                {
                    var slice = i / 2;
                    if (i % 2 == 0)
                    {
                        this.FPinOutLeft.SetValue(slice, (double)samples[i] * (slice * doScaling + 1));
                    }
                    else
                    {
                        this.FPinOutRight.SetValue(slice, (double)samples[i] * (slice * doScaling + 1));
                    }
                }
            }
        }
Esempio n. 22
0
 //here we go, thats the method called by vvvv each frame
 //all data handling should be in here
 public void Evaluate(int SpreadMax)
 {
     if (FSpeedInput.PinIsChanged || FNarratorInput.PinIsChanged || FStringInput.PinIsChanged)
     {
         //loop for all slices
         for (int i = 0; i < SpreadMax; i++)
         {
             //read data from inputs
             double rate = 5.0;
             FSpeedInput.GetValue(i, out rate);
             vox.Rate = (int)rate;
             int voiceindex = 0;
             FNarratorInput.GetOrd(i, out voiceindex);
             vox.Voice = vox.GetVoices(string.Empty, string.Empty).Item(voiceindex);
             FStringInput.GetString(i, out input_string);
         }
     }
     if (FSpeakInput.PinIsChanged)
     {
         double speak = 0.0;
         FSpeakInput.GetValue(0, out speak);
         if (speak > 0.5)
         {
             vox.Speak(input_string, SpeechVoiceSpeakFlags.SVSFlagsAsync | SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
         }
     }
     //remember that we are running with autoevaluate == true
     if (done == true)   //endstream was fired
     {
         done = false;
         FDoneOutput.SetValue(0, 1.0);
     }
     else
     {
         FDoneOutput.SetValue(0, 0.0);
     }
 }
Esempio n. 23
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FirstValue.PinIsChanged || SecondValue.PinIsChanged || SpreadCount.PinIsChanged)
            {
                double currentSpreadCount;
                double outSpreadCount = 0;
                double firstValue, secondValue;

                //for (int k = 0; k < SpreadCount.SliceCount; k++)
                for (int k = 0; k < SpreadMax; k++)
                {
                    FirstValue.GetValue(k, out firstValue);
                    SecondValue.GetValue(k, out secondValue);

                    SpreadCount.GetValue(k, out currentSpreadCount);
                    currentSpreadCount = Math.Max(1, currentSpreadCount);

                    outSpreadCount           += currentSpreadCount;
                    FMyValueOutput.SliceCount = (int)outSpreadCount;

                    double[] f = new double[(int)currentSpreadCount];

                    f[0] = firstValue;
                    FMyValueOutput.SetValue(0, f[0]);
                    f[1] = secondValue;
                    FMyValueOutput.SetValue(1, f[1]);

                    for (int i = 2; i < currentSpreadCount; i++)
                    {
                        f[i] = f[i - 1] + f[i - 2];
                        FMyValueOutput.SetValue(i, f[i]);
                    }
                }
            }
        }
Esempio n. 24
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FMyValueInputM.PinIsChanged || FMyValueInputN.PinIsChanged || FMyValuePhaseM.PinIsChanged || FMyValuePhaseN.PinIsChanged)
            {
                double m, n;
                FMyValueInputM.GetValue(0, out m);
                FMyValueInputN.GetValue(0, out n);

                double phaseM, phaseN;
                FMyValuePhaseM.GetValue(0, out phaseM);
                FMyValuePhaseN.GetValue(0, out phaseN);

                int index;
                int sliceCount = (int)(m * n);

                FMyValueOutputX.SliceCount       = sliceCount;
                FMyValueOutputY.SliceCount       = sliceCount;
                FMyValueOutputIsPrime.SliceCount = sliceCount;

                for (int j = 0; j < n; j++)
                {
                    for (int i = 0; i < m; i++)
                    {
                        index = (int)(m * j + i);
                        //write data to outputs
                        double x = Convert.ToDouble(i) - Convert.ToDouble(j) / 2;
                        double y = Convert.ToDouble(j) * Math.Sqrt(3) / 2;
                        FMyValueOutputX.SetValue(index, x);
                        FMyValueOutputY.SetValue(index, y);
                        FMyValueOutputIsPrime.SetValue(index, isprime(i + Convert.ToInt32(phaseM), j + Convert.ToInt32(phaseN)));
                    }
                }
            }
        }
Esempio n. 25
0
        public override void Evaluate(int SpreadMax)
        {
            //calc input spreadcount
            int inputSpreadCount = GetSpreadMax();

            //create or delete button groups
            int diff = inputSpreadCount - FControllerGroups.Count;

            if (diff > 0)
            {
                for (int i = 0; i < diff; i++)
                {
                    FControllerGroups.Add(new SliderGroup());
                }
            }
            else if (diff < 0)
            {
                for (int i = 0; i < -diff; i++)
                {
                    FControllerGroups.RemoveAt(FControllerGroups.Count - 1 - i);
                }
            }

            //update parameters
            int slice;

            if (FCountXIn.PinIsChanged ||
                FCountYIn.PinIsChanged ||
                FSizeXIn.PinIsChanged ||
                FSizeYIn.PinIsChanged ||
                FIsXSliderIn.PinIsChanged ||
                FSizeSliderIn.PinIsChanged ||
                FTransformIn.PinIsChanged ||
                FColorIn.PinIsChanged ||
                FOverColorIn.PinIsChanged ||
                FActiveColorIn.PinIsChanged ||
                FSliderColorIn.PinIsChanged ||
                FSliderSpeedIn.PinIsChanged)
            {
                for (slice = 0; slice < inputSpreadCount; slice++)
                {
                    SliderGroup group = (SliderGroup)FControllerGroups[slice];

                    Matrix4x4 trans;
                    Vector2D  count, size;
                    double    sizeSlider, sliderSpeed, isX;
                    RGBAColor col, over, active, slider;

                    FTransformIn.GetMatrix(slice, out trans);
                    FCountXIn.GetValue(slice, out count.x);
                    FCountYIn.GetValue(slice, out count.y);
                    FSizeXIn.GetValue(slice, out size.x);
                    FSizeYIn.GetValue(slice, out size.y);
                    FSizeSliderIn.GetValue(slice, out sizeSlider);
                    FColorIn.GetColor(slice, out col);
                    FOverColorIn.GetColor(slice, out over);
                    FActiveColorIn.GetColor(slice, out active);
                    FSliderColorIn.GetColor(slice, out slider);
                    FSliderSpeedIn.GetValue(slice, out sliderSpeed);
                    FIsXSliderIn.GetValue(slice, out isX);

                    group.UpdateTransform(trans, count, size, sizeSlider, col, over, active, slider, sliderSpeed, isX >= 0.5);
                }
            }

            //get spread counts
            int outcount = 0;

            FSpreadCountsOut.SliceCount = inputSpreadCount;

            for (slice = 0; slice < inputSpreadCount; slice++)
            {
                SliderGroup group = (SliderGroup)FControllerGroups[slice];

                outcount += group.FControllers.Length;
                FSpreadCountsOut.SetValue(slice, group.FControllers.Length);
            }

            //update mouse and colors
            bool valueSet = false;

            if (FMouseXIn.PinIsChanged ||
                FMouseYIn.PinIsChanged ||
                FLeftButtonIn.PinIsChanged ||
                FColorIn.PinIsChanged ||
                FOverColorIn.PinIsChanged ||
                FActiveColorIn.PinIsChanged ||
                FSliderColorIn.PinIsChanged ||
                FCountXIn.PinIsChanged ||
                FCountYIn.PinIsChanged ||
                FLastMouseLeft)
            {
                Vector2D mouse;
                double   mouseLeft;

                FMouseXIn.GetValue(0, out mouse.x);
                FMouseYIn.GetValue(0, out mouse.y);
                FLeftButtonIn.GetValue(0, out mouseLeft);

                bool mouseDown    = mouseLeft >= 0.5;
                bool mousDownEdge = mouseDown && !FLastMouseLeft;

                for (slice = 0; slice < inputSpreadCount; slice++)
                {
                    SliderGroup group = (SliderGroup)FControllerGroups[slice];
                    valueSet |= group.UpdateMouse(mouse, mousDownEdge, mouseDown);
                }

                FLastMouseLeft = mouseDown;
            }

            //set value
            slice = 0;
            if (FValueIn.PinIsChanged ||
                FSetValueIn.PinIsChanged)
            {
                for (int i = 0; i < inputSpreadCount; i++)
                {
                    SliderGroup group  = (SliderGroup)FControllerGroups[i];
                    int         pcount = group.FControllers.Length;

                    for (int j = 0; j < pcount; j++)
                    {
                        double val;

                        FSetValueIn.GetValue(slice, out val);

                        if (val >= 0.5)
                        {
                            //update value
                            FValueIn.GetValue(slice, out val);
                            group.UpdateValue((Slider)group.FControllers[j], val);

                            valueSet = true;
                        }
                        else if (FFirstframe)
                        {
                            //load from config pin on first frame
                            FInternalValueConfig.GetValue(slice, out val);
                            group.UpdateValue((Slider)group.FControllers[j], val);
                        }

                        slice++;
                    }
                }
            }


            //write output to pins
            FValueOut.SliceCount = outcount;
            if (outcount != FInternalValueConfig.SliceCount)
            {
                FInternalValueConfig.SliceCount = outcount;
            }
            FTransformOut.SliceCount = outcount * 2;
            FColorOut.SliceCount     = outcount * 2;
            FHitOut.SliceCount       = outcount;
            FActiveOut.SliceCount    = outcount;
            FMouseOverOut.SliceCount = outcount;

            slice = 0;
            for (int i = 0; i < inputSpreadCount; i++)
            {
                SliderGroup group  = (SliderGroup)FControllerGroups[i];
                int         pcount = group.FControllers.Length;

                for (int j = 0; j < pcount; j++)
                {
                    Slider s = (Slider)group.FControllers[j];

                    FTransformOut.SetMatrix(slice * 2, s.Transform);
                    FTransformOut.SetMatrix(slice * 2 + 1, s.SliderTransform);
                    FColorOut.SetColor(slice * 2, s.CurrentCol);
                    FColorOut.SetColor(slice * 2 + 1, s.ColorSlider);
                    FValueOut.SetValue(slice, s.Value);
                    FMouseOverOut.SetValue(slice, s.MouseOver ? 1 : 0);
                    FHitOut.SetValue(slice, s.Hit ? 1 : 0);
                    FActiveOut.SetValue(slice, s.Active ? 1 : 0);

                    //update config pin
                    if (valueSet)
                    {
                        double val;
                        FInternalValueConfig.GetValue(slice, out val);

                        if (Math.Abs(s.Value - val) > 0.00000001)
                        {
                            FInternalValueConfig.SetValue(slice, s.Value);
                        }
                    }

                    slice++;
                }
            }

            //end of frame
            FFirstframe = false;
        }
Esempio n. 26
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable;
            double Serial;

            //FConnected.SliceCount = 1;

            FSerial.GetValue(0, out Serial);
            FEnable.GetValue(0, out Enable);

            try
            {
                if (FSerial.PinIsChanged || FEnable.PinIsChanged)
                {
                    if (FSerial.PinIsChanged)
                    {
                        if (m_IKitData != null)
                        {
                            m_IKitData.Close();
                            m_IKitData = null;
                        }
                    }

                    if (Enable > 0.5)
                    {
                        if (m_IKitData == null)
                        {
                            m_IKitData = new GetEncoderHSData();
                            m_IKitData.Open(Serial);
                        }
                    }
                    else
                    {
                        if (m_IKitData != null)
                        {
                            FInfo.SliceCount = 1;
                            FInfo.SetString(0, "Disabled");
                            m_IKitData.Close();
                            m_IKitData = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FHost.Log(TLogType.Error, "Error by initialising Phidget");
                FHost.Log(TLogType.Error, ex.Message.ToString());
            }



            if (Enable == 1 && m_IKitData.Attached)
            {
                //

                int SliceCountAnalogIn = m_IKitData.InfoDevice.ToArray()[0].EncoderInputs;
                try
                {
                    try
                    {
                        //getting Encoder Position
                        if (m_IKitData.InfoDevice.ToArray()[0].EncoderInputs != 0)
                        {
                            FPositionOut.SliceCount = SliceCountAnalogIn;
                            for (int i = 0; i < SliceCountAnalogIn; i++)
                            {
                                FPositionOut.SetValue(i, m_IKitData.EncoderInputs[i]);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in " + m_IKitData.InfoDevice.ToArray()[0].Name + " getting encoder Position");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }


                    try
                    {
                        // set Position
                        if (FSetPosition.PinIsChanged)
                        {
                            double setPosition;
                            FSetPosition.GetValue(0, out setPosition);

                            if (setPosition > 0.5)
                            {
                                double   SliceCountSense = FPositionIn.SliceCount;
                                double[] tPosition       = new double[SliceCountAnalogIn];
                                for (int i = 0; i < SliceCountAnalogIn; i++)
                                {
                                    double sense;
                                    FPositionIn.GetValue(i, out sense);
                                    tPosition[i] = sense;
                                }
                                m_IKitData.SetPosition(tPosition);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting encoder Position");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }


                    //setting Phidget Infos
                    try
                    {
                        int SpreadSizeInfo = 3;
                        for (int i = 0; i < SpreadSizeInfo; i++)
                        {
                            FInfo.SliceCount = 3;
                            switch (i)
                            {
                            case 0:
                                FInfo.SetString(i, "Name: " + m_IKitData.InfoDevice.ToArray()[0].Name);
                                break;

                            case 1:
                                FInfo.SetString(i, "Serial: " + m_IKitData.InfoDevice.ToArray()[0].SerialNumber.ToString());
                                break;

                            case 2:
                                FInfo.SetString(i, "Version: " + m_IKitData.InfoDevice.ToArray()[0].Version.ToString());
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting Phidget Infos");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name);
                    FHost.Log(TLogType.Error, ex.Message.ToString());
                }
            }
        }
Esempio n. 27
0
        public void Evaluate(int SpreadMax)
        {
            //calc input spreadcount
            int inputSpreadCount = SpreadMax;

            //create or delete systems
            int diff = inputSpreadCount - FParticleSystemsList.Count;

            if (diff > 0)
            {
                for (int i = 0; i < diff; i++)
                {
                    FParticleSystemsList.Add(new ParticleSystem());
                }
            }
            else if (diff < 0)
            {
                for (int i = 0; i < -diff; i++)
                {
                    FParticleSystemsList.RemoveAt(FParticleSystemsList.Count - 1 - i);
                }
            }

            //update 3D parameters
            int slice;

            if (FInitPositionsIn.PinIsChanged ||
                FVelDirectionIn.PinIsChanged ||
                FVelDeviationIn.PinIsChanged ||
                FAccDirectionIn.PinIsChanged ||
                FAccDeviationIn.PinIsChanged)
            {
                for (slice = 0; slice < inputSpreadCount; slice++)
                {
                    ParticleSystem ps = (ParticleSystem)FParticleSystemsList[slice];

                    double x, y, z;

                    //update origins
                    FInitPositionsIn.GetValue3D(slice, out x, out y, out z);
                    ps.origin = new Vector3D(x, y, z);

                    //update directions
                    FVelDirectionIn.GetValue3D(slice, out x, out y, out z);
                    ps.direction = new Vector3D(x, y, z);

                    //update deviation
                    FVelDeviationIn.GetValue3D(slice, out x, out y, out z);
                    ps.deviation = new Vector3D(x, y, z);

                    //update acceleration deviation
                    FAccDirectionIn.GetValue3D(slice, out x, out y, out z);
                    ps.accDirection = new Vector3D(x, y, z);

                    //update acceleration deviation
                    FAccDeviationIn.GetValue3D(slice, out x, out y, out z);
                    ps.accDeviation = new Vector3D(x, y, z);
                }
            }

            //update single parameters
            if (FMassIn.PinIsChanged ||
                FMassDeviationIn.PinIsChanged ||
                FLifetimeIn.PinIsChanged ||
                FLifetimeDeviationIn.PinIsChanged ||
                FIsInfluencedIn.PinIsChanged ||
                FInfluenceIn.PinIsChanged ||
                FInfluenceAmountIn.PinIsChanged ||
                FdtIn.PinIsChanged)
            {
                for (slice = 0; slice < inputSpreadCount; slice++)
                {
                    ParticleSystem ps = (ParticleSystem)FParticleSystemsList[slice];

                    double mass, massDeviation;
                    double lifetimeIn, lifetimeDeviation;
                    double isInfluenced, influenceAmount, influences;
                    double dt;

                    FMassIn.GetValue(slice, out mass);
                    FMassDeviationIn.GetValue(slice, out massDeviation);
                    FLifetimeIn.GetValue(slice, out lifetimeIn);
                    FLifetimeDeviationIn.GetValue(slice, out lifetimeDeviation);
                    FIsInfluencedIn.GetValue(slice, out isInfluenced);
                    FInfluenceAmountIn.GetValue(slice, out influenceAmount);
                    FInfluenceIn.GetValue(slice, out influences);
                    FdtIn.GetValue(slice, out dt);

                    ps.mass              = mass;
                    ps.massDeviation     = massDeviation;
                    ps.lifetime          = lifetimeIn;
                    ps.lifetimeDeviation = lifetimeDeviation;
                    ps.influences        = (influences >= 0.5);
                    ps.isInfluenced      = (isInfluenced >= 0.5);
                    ps.influenceAmount   = influenceAmount;
                    ps.dt = dt;
                }
            }

            //force calculation
            UpdateForce();


            // Cycle through all particle systems, run them and get particle counts
            FSpreadCountsOut.SliceCount = FParticleSystemsList.Count;
            int outcount = 0;

            slice = 0;
            for (slice = 0; slice < inputSpreadCount; slice++)
            {
                ParticleSystem ps = (ParticleSystem)FParticleSystemsList[slice];

                //add new particle ?
                double emit;
                FEmitIn.GetValue(slice, out emit);

                if (emit >= 0.5)
                {
                    ps.addParticle();
                }

                //update system
                double time;
                FHost.GetCurrentTime(out time);
                ps.run(0.1);
                FLastTime = time;

                //check particle count
                outcount += ps.particles.Count;
                FSpreadCountsOut.SetValue(slice, ps.particles.Count);
            }


            //write output to pins
            FPosOut.SliceCount     = outcount;
            FAgeOut.SliceCount     = outcount;
            FHeadingOut.SliceCount = outcount;

            slice = 0;
            for (int i = 0; i < inputSpreadCount; i++)
            {
                ParticleSystem ps     = (ParticleSystem)FParticleSystemsList[i];
                int            pcount = ps.particles.Count;

                for (int j = 0; j < pcount; j++)
                {
                    Particle p = (Particle)ps.particles[j];

                    FPosOut.SetValue3D(slice, p.loc.x, p.loc.y, p.loc.z);
                    FHeadingOut.SetValue3D(slice, p.vel.x, p.vel.y, p.vel.z);
                    FAgeOut.SetValue(slice, 1 - p.age());
                    slice++;
                }
            }
        }
Esempio n. 28
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double pinInputEnable, pinInputDigitizing;

            FPinInputEnable.GetValue(0, out pinInputEnable);
            FPinInputDigitizing.GetValue(0, out pinInputDigitizing);
            if (FPinInputEnable.PinIsChanged)
            {
                if (pinInputEnable == 1d)
                {
                    Enable();
                }
                else
                {
                    Disable();
                }
            }
            if (Tablet == null)
            {
                return;
            }
            if (FPinInputDigitizing.PinIsChanged)
            {
                digitizing = (pinInputDigitizing == 1d);
                if (pinInputEnable == 1d)
                {
                    Disable();
                }
                Disconnect();
                Connect();
                if (pinInputEnable == 1d)
                {
                    Enable();
                }
            }
            if ((pinInputEnable == 1d))
            {
                FPinOutputProximity.SetValue(0, InContext ? 1 : 0);
                FPinOutputX.SetValue(0, X);
                FPinOutputY.SetValue(0, Y);
                FPinOutputPressure.SetValue(0, NormalPressure);
                FPinOutputCursor.SetValue(0, CursorNum);
                FPinOutputSerialNo.SetValue(0, SerialNo);
                FPinOutputCursorType.SetValue(0, CursorType);
                FPinOutputCursorSubtype.SetValue(0, CursorSubtype);
                FPinOutputButtons.SliceCount = NumButtons;
                for (int i = 0; i < NumButtons; i++)
                {
                    FPinOutputButtons.SetValue(i, ((Buttons & (1 << i)) != 0) ? 1 : 0);
                }
                FPinOutputAzimuth.SetValue(0, Azimuth);
                FPinOutputTilt.SetValue(0, Tilt);
                if (FPinDebugButtons != null)
                {
                    FPinDebugButtons.SetValue(0, NumButtons);
                }
                FPinOutputDimensions.SliceCount = 2;
                FPinOutputDimensions.SetValue(0, Tablet.Context.InputExtentX);
                FPinOutputDimensions.SetValue(1, Tablet.Context.InputExtentY);
                FPinOutputCursorName.SetString(0, CursorName);
            }
        }
Esempio n. 29
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //compute only on refresh
            if (FFile.PinIsChanged ||
                FCustomRoot.PinIsChanged ||
                FUpdate.PinIsChanged)
            {
                string currentFile;
                string curCustomRoot;
                double currentUpdate;

                FExists.SliceCount   = SpreadMax;
                FFileSize.SliceCount = SpreadMax;
                FReadOnly.SliceCount = SpreadMax;
                FHidden.SliceCount   = SpreadMax;

                string hostPath;
                FHost.GetHostPath(out hostPath);

                //loop for all slices
                for (int i = 0; i <= SpreadMax; i++)
                {
                    FFile.GetString(i, out currentFile);
                    FCustomRoot.GetString(i, out curCustomRoot);
                    FUpdate.GetValue(i, out currentUpdate);

                    int    exist    = 0;
                    double fileSize = 0;
                    int    readOnly = 0;
                    int    hidden   = 0;



                    if (!Path.IsPathRooted(currentFile))
                    {
                        if (curCustomRoot == string.Empty)
                        {
                            curCustomRoot = hostPath;
                        }
                        else
                        {
                            if (!Path.IsPathRooted(curCustomRoot))
                            {
                                string message = "\'";
                                message += curCustomRoot;
                                message += "\' is not a valid root-path";
                                FHost.Log(TLogType.Warning, message);
                                curCustomRoot = hostPath;
                            }
                        }
                        currentFile = Path.Combine(curCustomRoot, currentFile);
                    }

                    if (File.Exists(currentFile))
                    {
                        exist = 1;

                        FileInfo curFileInfo = new FileInfo(currentFile);
                        fileSize = (double)curFileInfo.Length;

                        if ((File.GetAttributes(currentFile) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                        {
                            readOnly = 1;
                        }
                        if ((File.GetAttributes(currentFile) & FileAttributes.Hidden) == FileAttributes.Hidden)
                        {
                            hidden = 1;
                        }
                    }
                    FExists.SetValue(i, (double)exist);
                    FFileSize.SetValue(i, fileSize);
                    FReadOnly.SetValue(i, (double)readOnly);
                    FHidden.SetValue(i, (double)hidden);
                }
            }
        }
Esempio n. 30
0
        public override void Evaluate(int SpreadMax)
        {
            //calc input spreadcount
            int inputSpreadCount = GetSpreadMax();

            //create or delete button groups
            int diff = inputSpreadCount - FControllerGroups.Count;

            if (diff > 0)
            {
                for (int i = 0; i < diff; i++)
                {
                    FControllerGroups.Add(new RotarySliderGroup());
                }
            }
            else if (diff < 0)
            {
                for (int i = 0; i < -diff; i++)
                {
                    FControllerGroups.RemoveAt(FControllerGroups.Count - 1 - i);
                }
            }

            //update parameters
            int slice;

            if (FCountXIn.PinIsChanged ||
                FCountYIn.PinIsChanged ||
                FSizeXIn.PinIsChanged ||
                FSizeYIn.PinIsChanged ||
                FTransformIn.PinIsChanged ||
                FSliderSpeedIn.PinIsChanged)
            {
                for (slice = 0; slice < inputSpreadCount; slice++)
                {
                    RotarySliderGroup group = (RotarySliderGroup)FControllerGroups[slice];

                    Matrix4x4 trans;
                    Vector2D  count, size;
                    double    sliderSpeed;

                    FTransformIn.GetMatrix(slice, out trans);
                    FCountXIn.GetValue(slice, out count.x);
                    FCountYIn.GetValue(slice, out count.y);
                    FSizeXIn.GetValue(slice, out size.x);
                    FSizeYIn.GetValue(slice, out size.y);
                    FSliderSpeedIn.GetValue(slice, out sliderSpeed);

                    group.UpdateTransform(trans, count, size, sliderSpeed);
                }
            }

            //get spread counts
            int outcount = 0;

            FSpreadCountsOut.SliceCount = inputSpreadCount;

            for (slice = 0; slice < inputSpreadCount; slice++)
            {
                RotarySliderGroup group = (RotarySliderGroup)FControllerGroups[slice];

                outcount += group.FControllers.Length;
                FSpreadCountsOut.SetValue(slice, group.FControllers.Length);
            }

            this.UpdateTouches(inputSpreadCount);

            //set value
            slice = 0;
            if (FValueIn.PinIsChanged ||
                FSetValueIn.PinIsChanged)
            {
                for (int i = 0; i < inputSpreadCount; i++)
                {
                    RotarySliderGroup group = (RotarySliderGroup)FControllerGroups[i];
                    int pcount = group.FControllers.Length;

                    for (int j = 0; j < pcount; j++)
                    {
                        double val;

                        FSetValueIn.GetValue(slice, out val);

                        if (val >= 0.5 || this.FFirstframe)
                        {
                            //update value
                            FValueIn.GetValue(slice, out val);
                            group.UpdateValue((RotarySlider)group.FControllers[j], val);
                        }
                        slice++;
                    }
                }
            }


            //write output to pins
            FValueOut.SliceCount              = outcount;
            FTransformOut.SliceCount          = outcount;
            FPinOutSliderTransform.SliceCount = outcount;
            FHitOut.SliceCount = outcount;

            slice = 0;
            for (int i = 0; i < inputSpreadCount; i++)
            {
                RotarySliderGroup group = (RotarySliderGroup)FControllerGroups[i];
                int pcount = group.FControllers.Length;

                for (int j = 0; j < pcount; j++)
                {
                    RotarySlider s = (RotarySlider)group.FControllers[j];

                    FTransformOut.SetMatrix(slice, s.Transform);
                    FPinOutSliderTransform.SetMatrix(slice, s.Transform);
                    FValueOut.SetValue(slice, s.Value);
                    FHitOut.SetValue(slice, s.Hit ? 1 : 0);

                    slice++;
                }
            }

            //end of frame
            FFirstframe = false;
        }