Example #1
0
        public cAABB getBoundingBox()
        {
            cAABB b = new cAABB();

            b.SetDims(Dims);
            b.SetPosByCenter(Pos);
            return(b);
        }
Example #2
0
        private void PreRender(RenderTarget destination, float alpha)
        {
            m_Player.CalculateViewPos(alpha);

            Vector2f pcenter = m_Player.GetCenterViewPos();

            m_View.Center = pcenter;

            //játékoshoz viszonyított view rect

            //viewRect.SetDims(m_View.Size);
            viewRect.SetPosByCenter(m_View.Center);

            if (viewRect.topLeft.X < 0.0f)
            {
                m_View.Center = new Vector2f(m_World.WorldBounds.topLeft.X + m_View.Size.X / 2.0f, m_View.Center.Y);
            }
            else
            if (viewRect.rightBottom.X > m_World.WorldBounds.rightBottom.X)
            {
                m_View.Center = new Vector2f(m_World.WorldBounds.rightBottom.X - m_View.Size.X / 2.0f, m_View.Center.Y);
            }


            if (viewRect.topLeft.Y < 0.0f)
            {
                m_View.Center = new Vector2f(m_View.Center.X, m_World.WorldBounds.topLeft.Y + m_View.Size.Y / 2.0f);
            }
            else
            if (viewRect.rightBottom.Y > m_World.WorldBounds.rightBottom.Y)
            {
                m_View.Center = new Vector2f(m_View.Center.X, m_World.WorldBounds.rightBottom.Y - m_View.Size.Y / 2.0f);
            }

            viewRect.SetPosByCenter(m_View.Center);

            destination.SetView(m_View);

            this.lightMap.separateVisibleLights(viewRect);

            this.particleManager.PreRender(alpha);
            //TODO: Entity pool PreRender, filter visible objects
        }