Esempio n. 1
0
 public virtual void Clear( )
 {
     vecs[0].Fill(0);
     vecs[1].Fill(0);
     flags     = 0;
     numframes = 0;
     next      = null;
     image     = null;
 }
Esempio n. 2
0
        private void RunTest()
        {
            if (refdef == null)
            {
                refdef            = new refdef_t();
                refdef.x          = 0;
                refdef.y          = 0;
                refdef.width      = viddef.GetWidth();
                refdef.height     = viddef.GetHeight();
                refdef.fov_x      = (Globals.fov == null) ? this.fov_x : Globals.fov.value;
                refdef.fov_x      = this.fov_x;
                refdef.fov_y      = Math3D.CalcFov(refdef.fov_x, refdef.width, refdef.height);
                refdef.vieworg    = new float[] { 140, -140, 50 };
                refdef.viewangles = new float[] { 0, 0, 0 };
                refdef.blend      = new float[] { 0F, 0F, 0F, 0F };
                refdef.areabits   = null;
                ent = new entity_t();
                model_t weapon     = re.RegisterModel("models/monsters/soldier/tris.md2");
                image_t weaponSkin = re.RegisterSkin("models/monsters/soldier/skin.pcx");
                ent.model  = weapon;
                ent.skin   = weaponSkin;
                ent.origin = new float[] { -60, 80, 25 };
                Math3D.VectorCopy(ent.origin, ent.oldorigin);
                ent.angles          = new float[] { 0, 300, 0 };
                refdef.entities     = new entity_t[] { ent };
                refdef.num_entities = refdef.entities.Length;
                lightstyle_t light = new lightstyle_t();
                light.rgb          = new float[] { 1F, 1F, 1F };
                light.white        = 3F;
                refdef.lightstyles = new lightstyle_t[Defines.MAX_LIGHTSTYLES];
                for (int i = 0; i < Defines.MAX_LIGHTSTYLES; i++)
                {
                    refdef.lightstyles[i]       = new lightstyle_t();
                    refdef.lightstyles[i].rgb   = new float[] { 1F, 1F, 1F };
                    refdef.lightstyles[i].white = 3F;
                }

                refdef.viewangles[1] = 130;
                refdef.time          = Time() * 0.001F;
            }

            refdef.viewangles[0] += KBD.my * 0.1F;
            refdef.viewangles[1] -= KBD.mx * 0.1F;
            float dt = Time() * 0.001F - refdef.time;

            if (movePlayer != 0)
            {
                float velocity = 150F * dt;
                Math3D.AngleVectors(refdef.viewangles, vpn, vright, vup);
                if ((movePlayer & FORWARD_MASK) != 0)
                {
                    Math3D.VectorMA(refdef.vieworg, -velocity, vpn, refdef.vieworg);
                }
                if ((movePlayer & BACKWARD_MASK) != 0)
                {
                    Math3D.VectorMA(refdef.vieworg, velocity, vpn, refdef.vieworg);
                }
                if ((movePlayer & LEFT_MASK) != 0)
                {
                    Math3D.VectorMA(refdef.vieworg, velocity, vright, refdef.vieworg);
                }
                if ((movePlayer & RIGHT_MASK) != 0)
                {
                    Math3D.VectorMA(refdef.vieworg, -velocity, vright, refdef.vieworg);
                }
                refdef.vieworg[0] += 1F / 16;
                refdef.vieworg[1] += 1F / 16;
                refdef.vieworg[2] += 1F / 16;
            }

            refdef.time    = Time() * 0.001F;
            r_numparticles = 0;
            float[] diff = new float[] { 0, 0, 0 };
            Math3D.VectorSubtract(refdef.vieworg, ent.origin, diff);
            if (Math3D.VectorLength(diff) < 250 && active_particles.Size() == 0)
            {
                RailTrail(ent.origin, refdef.vieworg);
            }
            else
            {
                if (active_particles.Size() > 0)
                {
                    ent.frame = (int)((Time() * 0.013F) % 15);
                    Math3D.VectorNormalize(diff);
                    Math3D.Vectoangles(diff, ent.angles);
                    AnimateParticles();
                    refdef.num_particles = r_numparticles;
                }
                else
                {
                    ent.frame            = 0;
                    refdef.num_particles = 0;
                }
            }

            refdef.num_dlights = 0;
            re.RenderFrame(refdef);
        }