Beispiel #1
0
        public static void CreateContext(RasterBuffer renderingBuffer)
        {
            // set the rendering buffer and all the GL default states (this is also where you can new anything you need)
            s_RenderingBuffer = renderingBuffer;
            s_Rasterizer.SetVectorClipBox(M.Zero <T>(), M.Zero <T>(), M.New <T>(s_RenderingBuffer.Width), M.New <T>(s_RenderingBuffer.Height));
            s_PixelFormt = new FormatRGBA(s_RenderingBuffer, new BlenderBGRA());
            s_ClippingPixelFormatProxy = new FormatClippingProxy(s_PixelFormt);
            //s_ClippingPixelFormatProxy = s_PixelFormt;

            m_CurAccumulatedMatrix = MatrixFactory <T> .NewIdentity(VectorDimension.Three); // new Matrix4X4();

            m_ModelviewMatrix = MatrixFactory <T> .NewIdentity(VectorDimension.Three);      // new Matrix4X4();

            m_ProjectionMatrix = MatrixFactory <T> .NewIdentity(VectorDimension.Three);     //new Matrix4X4();

            m_pVertexCache = new VertexCachItem[m_MaxVertexCacheItems];
            for (int i = 0; i < m_MaxVertexCacheItems; i++)
            {
                m_pVertexCache[i] = new VertexCachItem();
            }

            m_LastSetColor  = new RGBA_Doubles(1, 1, 1, 1);
            m_LastSetNormal = MatrixFactory <T> .CreateZeroVector(VectorDimension.Three);          // new Vector3D();

            m_LastSetTextureCoordinate = MatrixFactory <T> .CreateZeroVector(VectorDimension.Two); // new Vector2D();
        }
Beispiel #2
0
        //returns a List to the closest mine
        public IVector <T> GetClosestMine(List <IVector <T> > mines)
        {
            T closest_so_far = M.New <T>(99999);

            IVector <T> vClosestObject = MatrixFactory <T> .CreateZeroVector(VectorDimension.Three);

            //cycle through mines to find closest
            for (int i = 0; i < mines.Count; i++)
            {
                T len_to_object = mines[i].Subtract(m_vPosition).GetMagnitude();

                if (len_to_object.LessThan(closest_so_far))
                {
                    closest_so_far = len_to_object;

                    vClosestObject = m_vPosition.Subtract(mines[i]);

                    m_iClosestMine = i;
                }
            }

            return(vClosestObject);
        }