Пример #1
0
        /*
         * ====================
         * R_TimeRefresh_f
         *
         * For program optimization
         * ====================
         */
        static void R_TimeRefresh_f()
        {
            int    i;
            double start, stop, time;
            int    startangle;

            vid.vrect_t vr = new vid.vrect_t();

            startangle = (int)r_refdef.viewangles[1];

            start = sys_linux.Sys_FloatTime();
            for (i = 0; i < 128; i++)
            {
                r_refdef.viewangles[1] = i / 128.0 * 360.0;

                R_RenderView();

                vr.x      = r_refdef.vrect.x;
                vr.y      = r_refdef.vrect.y;
                vr.width  = r_refdef.vrect.width;
                vr.height = r_refdef.vrect.height;
                vr.pnext  = null;
                vid.VID_Update(vr);
            }
            stop = sys_linux.Sys_FloatTime();
            time = stop - start;
            console.Con_Printf(time + " seconds (" + (128 / time) + " fps)\n");

            r_refdef.viewangles[1] = startangle;
        }
Пример #2
0
        /*
         * ============
         * Show
         *
         * Debugging use
         * ============
         */
        void Show()
        {
            vid.vrect_t vr = new vid.vrect_t();

            vr.x      = vr.y = 0;
            vr.width  = (int)screen.vid.width;
            vr.height = (int)screen.vid.height;
            vr.pnext  = null;
            vid.VID_Update(vr);
        }
Пример #3
0
        /*
        ============
        Show

        Debugging use
        ============
        */
        void Show()
        {
            vid.vrect_t	vr = new vid.vrect_t();

            vr.x = vr.y = 0;
            vr.width = (int)screen.vid.width;
            vr.height = (int)screen.vid.height;
            vr.pnext = null;
            vid.VID_Update (vr);
        }
Пример #4
0
        /*
        ====================
        R_TimeRefresh_f

        For program optimization
        ====================
        */
        static void R_TimeRefresh_f()
        {
            int			    i;
            double		    start, stop, time;
            int			    startangle;
            vid.vrect_t		vr = new vid.vrect_t();

            startangle = (int)r_refdef.viewangles[1];

            start = sys_linux.Sys_FloatTime ();
            for (i=0 ; i<128 ; i++)
            {
                r_refdef.viewangles[1] = i / 128.0 * 360.0;

                R_RenderView ();

                vr.x = r_refdef.vrect.x;
                vr.y = r_refdef.vrect.y;
                vr.width = r_refdef.vrect.width;
                vr.height = r_refdef.vrect.height;
                vr.pnext = null;
                vid.VID_Update (vr);
            }
            stop = sys_linux.Sys_FloatTime ();
            time = stop-start;
            console.Con_Printf (time + " seconds (" + (128/time) + " fps)\n");

            r_refdef.viewangles[1] = startangle;
        }
Пример #5
0
        /*
        ===============
        R_SetupFrame
        ===============
        */
        static void R_SetupFrame()
        {
            int				edgecount;
            vid.vrect_t		vrect = new vid.vrect_t();
            double			w, h;

            // don't allow cheats in multiplayer
            if (client.cl.maxclients > 1)
            {
                cvar_t.Cvar_Set ("r_draworder", "0");
                cvar_t.Cvar_Set("r_fullbright", "0");
                cvar_t.Cvar_Set("r_ambient", "0");
                cvar_t.Cvar_Set("r_drawflat", "0");
            }

            if (r_numsurfs.value != 0)
            {
            }

            if (r_numedges.value != 0)
            {
            }

            r_refdef.ambientlight = (int)r_ambient.value;

            if (r_refdef.ambientlight < 0)
                r_refdef.ambientlight = 0;

            if (!server.sv.active)
                r_draworder.value = 0;	// don't let cheaters look behind walls

            R_CheckVariables ();

            R_AnimateLight ();

            r_framecount++;

            numbtofpolys = 0;

            // build the transformation matrix for the given view angles
            mathlib.VectorCopy(r_refdef.vieworg, ref modelorg);
            mathlib.VectorCopy (r_refdef.vieworg, ref r_origin);

            mathlib.AngleVectors (r_refdef.viewangles, ref vpn, ref vright, ref vup);

            // current viewleaf
            r_oldviewleaf = r_viewleaf;
            r_viewleaf = model.Mod_PointInLeaf (r_origin, client.cl.worldmodel);

            r_dowarpold = r_dowarp;
            r_dowarp = r_waterwarp.value != 0 && (r_viewleaf.contents <= bspfile.CONTENTS_WATER);

            if ((r_dowarp != r_dowarpold) || r_viewchanged || view.lcd_x.value != 0)
            {
                if (r_dowarp)
                {
                    if ((screen.vid.width <= screen.vid.maxwarpwidth) &&
                        (screen.vid.height <= screen.vid.maxwarpheight))
                    {
                        vrect.x = 0;
                        vrect.y = 0;
                        vrect.width = (int)screen.vid.width;
                        vrect.height = (int)screen.vid.height;

                        R_ViewChanged (vrect, sbar.sb_lines, screen.vid.aspect);
                    }
                    else
                    {
                        w = screen.vid.width;
                        h = screen.vid.height;

                        if (w > screen.vid.maxwarpwidth)
                        {
                            h *= (double)screen.vid.maxwarpwidth / w;
                            w = screen.vid.maxwarpwidth;
                        }

                        if (h > screen.vid.maxwarpheight)
                        {
                            h = screen.vid.maxwarpheight;
                            w *= (double)screen.vid.maxwarpheight / h;
                        }

                        vrect.x = 0;
                        vrect.y = 0;
                        vrect.width = (int)w;
                        vrect.height = (int)h;

                        R_ViewChanged (vrect,
                                       (int)((double)sbar.sb_lines * (h/(double)screen.vid.height)),
                                       screen.vid.aspect * (h / w) *
                                         ((double)screen.vid.width / (double)screen.vid.height));
                    }
                }
                else
                {
                    vrect.x = 0;
                    vrect.y = 0;
                    vrect.width = (int)screen.vid.width;
                    vrect.height = (int)screen.vid.height;

                    R_ViewChanged (vrect, sbar.sb_lines, screen.vid.aspect);
                }

                r_viewchanged = false;
            }

            // start off with just the four screen edge clip planes
            R_TransformFrustum ();

            // save base values
            mathlib.VectorCopy (vpn, ref base_vpn);
            mathlib.VectorCopy(vright, ref base_vright);
            mathlib.VectorCopy(vup, ref base_vup);
            mathlib.VectorCopy(modelorg, ref base_modelorg);

            R_SetSkyFrame ();

            R_SetUpFrustumIndexes ();

            //r_cache_thrash = false;

            // clear frame counts
            c_faceclip = 0;
            d_spanpixcount = 0;
            r_polycount = 0;
            r_drawnpolycount = 0;
            r_wholepolycount = 0;
            //r_amodels_drawn = 0;
            r_outofsurfaces = 0;
            r_outofedges = 0;

            draw.D_SetupFrame ();
        }
Пример #6
0
        /*
         * ===============
         * R_SetupFrame
         * ===============
         */
        static void R_SetupFrame()
        {
            int edgecount;

            vid.vrect_t vrect = new vid.vrect_t();
            double      w, h;

            // don't allow cheats in multiplayer
            if (client.cl.maxclients > 1)
            {
                cvar_t.Cvar_Set("r_draworder", "0");
                cvar_t.Cvar_Set("r_fullbright", "0");
                cvar_t.Cvar_Set("r_ambient", "0");
                cvar_t.Cvar_Set("r_drawflat", "0");
            }

            if (r_numsurfs.value != 0)
            {
            }

            if (r_numedges.value != 0)
            {
            }

            r_refdef.ambientlight = (int)r_ambient.value;

            if (r_refdef.ambientlight < 0)
            {
                r_refdef.ambientlight = 0;
            }

            if (!server.sv.active)
            {
                r_draworder.value = 0;          // don't let cheaters look behind walls
            }
            R_CheckVariables();

            R_AnimateLight();

            r_framecount++;

            numbtofpolys = 0;

            // build the transformation matrix for the given view angles
            mathlib.VectorCopy(r_refdef.vieworg, ref modelorg);
            mathlib.VectorCopy(r_refdef.vieworg, ref r_origin);

            mathlib.AngleVectors(r_refdef.viewangles, ref vpn, ref vright, ref vup);

            // current viewleaf
            r_oldviewleaf = r_viewleaf;
            r_viewleaf    = model.Mod_PointInLeaf(r_origin, client.cl.worldmodel);

            r_dowarpold = r_dowarp;
            r_dowarp    = r_waterwarp.value != 0 && (r_viewleaf.contents <= bspfile.CONTENTS_WATER);

            if ((r_dowarp != r_dowarpold) || r_viewchanged || view.lcd_x.value != 0)
            {
                if (r_dowarp)
                {
                    if ((screen.vid.width <= screen.vid.maxwarpwidth) &&
                        (screen.vid.height <= screen.vid.maxwarpheight))
                    {
                        vrect.x      = 0;
                        vrect.y      = 0;
                        vrect.width  = (int)screen.vid.width;
                        vrect.height = (int)screen.vid.height;

                        R_ViewChanged(vrect, sbar.sb_lines, screen.vid.aspect);
                    }
                    else
                    {
                        w = screen.vid.width;
                        h = screen.vid.height;

                        if (w > screen.vid.maxwarpwidth)
                        {
                            h *= (double)screen.vid.maxwarpwidth / w;
                            w  = screen.vid.maxwarpwidth;
                        }

                        if (h > screen.vid.maxwarpheight)
                        {
                            h  = screen.vid.maxwarpheight;
                            w *= (double)screen.vid.maxwarpheight / h;
                        }

                        vrect.x      = 0;
                        vrect.y      = 0;
                        vrect.width  = (int)w;
                        vrect.height = (int)h;

                        R_ViewChanged(vrect,
                                      (int)((double)sbar.sb_lines * (h / (double)screen.vid.height)),
                                      screen.vid.aspect * (h / w) *
                                      ((double)screen.vid.width / (double)screen.vid.height));
                    }
                }
                else
                {
                    vrect.x      = 0;
                    vrect.y      = 0;
                    vrect.width  = (int)screen.vid.width;
                    vrect.height = (int)screen.vid.height;

                    R_ViewChanged(vrect, sbar.sb_lines, screen.vid.aspect);
                }

                r_viewchanged = false;
            }

            // start off with just the four screen edge clip planes
            R_TransformFrustum();

            // save base values
            mathlib.VectorCopy(vpn, ref base_vpn);
            mathlib.VectorCopy(vright, ref base_vright);
            mathlib.VectorCopy(vup, ref base_vup);
            mathlib.VectorCopy(modelorg, ref base_modelorg);

            R_SetSkyFrame();

            R_SetUpFrustumIndexes();

            //r_cache_thrash = false;

            // clear frame counts
            c_faceclip       = 0;
            d_spanpixcount   = 0;
            r_polycount      = 0;
            r_drawnpolycount = 0;
            r_wholepolycount = 0;
            //r_amodels_drawn = 0;
            r_outofsurfaces = 0;
            r_outofedges    = 0;

            draw.D_SetupFrame();
        }