Пример #1
0
        public Camera(IDataReader state, RenderManager renderManager)
            : base(state)
        {
            addInterface(typeof(ICamera));
            m_renderManager = renderManager;

            m_renderTargetId = new XnaScrapId(state);
            IRenderTarget renderTarget = m_renderManager.getRenderTarget(m_renderTargetId);
            if (renderTarget != null)
            {
                renderTarget.Cameras.Add(this);
            }
            m_fovy = state.ReadSingle();
            m_near = state.ReadSingle();
            m_far = state.ReadSingle();
            m_aspect = state.ReadSingle();

            float f = m_fovy * (float)Math.PI / 180.0f;

            m_projection = Matrix.CreatePerspectiveFieldOfView(f, m_aspect, m_near, m_far);

            m_viewport = new _Viewport(state);

            m_renderManager.Cameras.Add(new XnaScrapId("ImplementCameraNamingYouJerk!"), this);
        }