Example #1
0
        protected override void Execute()
        {
            if (m_qMatrix != null)
            {
                m_kernel.SetupExecution(TextureWidth * TextureHeight);
                m_kernel.Run(m_plotValues.DevicePointer, m_actionIndices.DevicePointer, m_actionLabels.DevicePointer, numOfActions, LABEL_PIXEL_WIDTH, LABEL_PIXEL_WIDTH, 0f, MaxQValue, m_qMatrix.GetLength(0), m_qMatrix.GetLength(1), VBODevicePointer);

                if (ViewMode == ViewMethod.Orbit_3D)
                {
                    m_vertexKernel.SetupExecution(m_qMatrix.Length);
                    m_vertexKernel.Run(m_plotValues.DevicePointer, 0.1f, m_qMatrix.GetLength(0), m_qMatrix.GetLength(1), MaxQValue, VertexVBODevicePointer);
                }
            }

            float[,] lastQMatrix = m_qMatrix;

            MyStochasticReturnPredictor srp = null;

            if (AbstractActionIndex < Target.Rds.VarManager.MAX_VARIABLES)
            {
                srp = (MyStochasticReturnPredictor)Target.Vis.GetPredictorNo(AbstractActionIndex);
            }

            if (srp != null)
            {
                Target.Vis.ReadTwoDimensions(ref m_qMatrix, ref m_qMatrixActions, srp, XAxisVariableIndex, YAxisVariableIndex, ShowCurrentMotivations);
            }

            if (lastQMatrix != m_qMatrix)
            {
                TriggerReset();
            }
            else if (m_qMatrix != null && MatrixSizeOK())
            {
                m_plotValues.CopyToDevice(m_qMatrix);
                m_actionIndices.CopyToDevice(m_qMatrixActions);

                if (ShowSRPNames && srp != null)
                {
                    //Set texture size, it will trigger texture buffer reallocation
                    TextureWidth  = LABEL_PIXEL_WIDTH * m_qMatrix.GetLength(0);
                    TextureHeight = LABEL_PIXEL_WIDTH * m_qMatrix.GetLength(1);

                    String label = srp.GetLabel() + " M:" + srp.GetMyTotalMotivation();

                    MyDrawStringHelper.DrawString(label, 0, 0, 0, 0x999999, VBODevicePointer, TextureWidth, TextureHeight);
                }
            }
        }