Ejemplo n.º 1
0
    /// <summary>
    /// Calculates the list of post processing data to be written
    /// </summary>
    /// <returns></returns> The list of rows of postprocessing data to write
    private List <PostProcessingData> CalculatePostProcessingData()
    {
        List <PostProcessingData> result = new List <PostProcessingData>();

        // The time that the target was hit in the previous trial
        float prevTouchTime = 0f;

        foreach (Data d in data)
        {
            // The time that the target was hit this trial
            float touchTime = d.time;

            itemGreenTime  = 0f;
            itemYellowTime = 0f;
            itemRedTime    = 0f;

            IncrementPrecedingTimes(touchTime, prevTouchTime);

            PostProcessingData resultItem = new PostProcessingData(itemGreenTime, itemYellowTime, itemRedTime);
            result.Add(resultItem);

            prevTouchTime = d.time;
        }

        return(result);
    }
        public void Update()
        {
            float   fov        = (float)screenForm.ClientSize.Width / (float)screenForm.ClientSize.Height;
            Matrix  projection = Matrix.PerspectiveFovLH((float)Math.PI / 3.0F, fov, 1, 10000);
            Vector3 eye        = new Vector3(0, 10, 22);
            Vector3 target     = new Vector3(0, 10, 0);
            Matrix  view       = Matrix.LookAtLH(eye, target, Vector3.UnitY);
            Matrix  world      = Matrix.Scaling(10, 10, 10) * Matrix.RotationY(Environment.TickCount / 1000.0F);
            Vector3 L          = new Vector3(10, 10, 30);

            L.Normalize();

            Transform transform = new Transform
            {
                WVP            = world * view * projection,
                world          = world,
                lightDirection = new Vector4(L, 0),
                camera         = new Vector4(eye - target, 30)
            };

            IntPtr pointer = constantBuffer.Map(0);

            Utilities.Write <Transform>(pointer, ref transform);
            constantBuffer.Unmap(0);

            //Set second buffer

            PostProcessingData data = new PostProcessingData();

            data.data = new Vector4(effectType, 0, TargetSize, TargetSize);

            pointer = postProcessingConstantBuffer.Map(0);
            Utilities.Write <PostProcessingData>(pointer, ref data);
            postProcessingConstantBuffer.Unmap(0);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the post processing data for preceding color touching to the trial data
 /// </summary>
 /// <param name="ppData"></param> the post processing info to add to trial data
 private void AddPostProcessingToTrialData(List <PostProcessingData> ppData)
 {
     for (int i = 0; i < data.Count; i++)
     {
         // For each line of trial data, add the appropriate preceding color times
         PostProcessingData cur = ppData[i];
         data[i].AddPrecedingTimes(cur.precedingGreenTime, cur.precedingYellowTime, cur.precedingRedTime);
     }
 }