コード例 #1
0
ファイル: Renderer.cs プロジェクト: maesse/CubeHags
        /*
        ================
        R_RenderView

        A view may be either the actual camera view,
        or a mirror / remote location
        ================
        */
        void RenderView(ViewParams view)
        {
            if (view.viewportWidth <= 0 || view.viewportHeight <= 0)
            {
                return;
            }
            view.SetupProjection(10000f, true);

            if (SourceMap != null)
                SourceMap.Render(device);

            // SetFarClip()

            view.SetupProjectionZ();
            Camera.RotateForViewer();
        }
コード例 #2
0
ファイル: Renderer.cs プロジェクト: maesse/CubeHags
        public void Render(ViewParams view)
        {
            view.Origin = new render.Orientation();
            view.Origin.axis[0] = view.viewaxis[0];
            view.Origin.axis[1] = view.viewaxis[1];
            view.Origin.axis[2] = view.viewaxis[2];
            view.Origin.origin = view.vieworg;
            view.PVSOrigin = view.vieworg;

            viewParams = view;
            RenderView(view);
        }
コード例 #3
0
ファイル: CGame.cs プロジェクト: maesse/CubeHags
        ViewParams CalcViewValues()
        {
            ViewParams view = new ViewParams();
            view.viewportWidth = Renderer.Instance.RenderSize.Width;
            view.viewportHeight = Renderer.Instance.RenderSize.Height;
            view.fovX = cg_fov.Value;
            float x = (float)(view.viewportWidth / Math.Tan(view.fovX / 360 * Math.PI));
            float fovY = (float)Math.Atan2(view.viewportHeight, x);
            fovY = (float)(fovY * 360 / Math.PI);
            view.fovY = fovY;

            Common.PlayerState ps = cg.predictedPlayerState;

            cg.bobcycle = (ps.bobCycle & 127)>>7; // FIX
            cg.bobfracsin = (float)Math.Abs(Math.Sin(ps.bobCycle & 127) / 127.0f * Math.PI);
            cg.xyspeed = (float)Math.Sqrt(ps.velocity[0] * ps.velocity[0] + ps.velocity[1] * ps.velocity[1]);
            view.vieworg = ps.origin;
            cg.refdef = view;
            cg.refdefViewAngles = ps.viewangles;
            view.viewangles = ps.viewangles;
            //if (cg.renderingThirdPerson)
            //{
            //}
            //else
            {
                AnglesToAxis(cg.refdefViewAngles, out view.viewaxis);
                OffsetFirstPersonView();
            }

            if (cg_errorDecay.Value > 0)
            {
                int t = cg.time - cg.predictedErrorTime;
                float f = (cg_errorDecay.Value - t) / cg_errorDecay.Value;
                if (f > 0 && f < 1)
                    view.vieworg = ViewParams.VectorMA(view.vieworg, f, cg.predictedError);
                else
                    cg.predictedErrorTime = 0;
            }

            // position eye reletive to origin
            AnglesToAxis(cg.refdefViewAngles, out view.viewaxis);

            return view;
        }