private void TestModel() { refdef_t refdef = new refdef_t(); refdef.x = viddef.GetWidth() / 2; refdef.y = viddef.GetHeight() / 2 - 72; refdef.width = 144 * 2; refdef.height = 168 * 2; refdef.fov_x = 40; refdef.fov_y = Math3D.CalcFov(refdef.fov_x, refdef.width, refdef.height); refdef.time = 1F * 0.001F; entity_t entity = new entity_t(); string modelName = "players/female/tris.md2"; string modelSkin = "players/female/athena.pcx"; string modelImage = "/players/female/athena_i.pcx"; string modelImage1 = "/players/female/brianna_i.pcx"; string modelImage2 = "/players/female/cobalt_i.pcx"; string modelImage3 = "/players/female/lotus_i.pcx"; entity.model = re.RegisterModel(modelName); DrawString(refdef.x, refdef.y - 20, (entity.model != null) ? modelName : "DEBUG: NullModel"); entity.skin = re.RegisterSkin(modelSkin); entity.flags = Defines.RF_FULLBRIGHT; entity.origin[0] = 80; entity.origin[1] = 0; entity.origin[2] = 0; Math3D.VectorCopy(entity.origin, entity.oldorigin); entity.frame = (framecount / 3) % ((qfiles.dmdl_t)entity.model.extradata).num_frames; entity.oldframe = 0; entity.backlerp = 0F; yaw += KBD.mx; KBD.mx = 0; if (yaw > 360) { yaw -= 360; } if (yaw < 0) { yaw += 360; } entity.angles[1] = yaw; refdef.areabits = null; refdef.num_entities = 1; refdef.entities = new entity_t[] { entity }; refdef.lightstyles = null; refdef.rdflags = Defines.RDF_NOWORLDMODEL; M_DrawTextBox((int)((refdef.x) * (320F / viddef.GetWidth()) - 8), (int)((viddef.GetHeight() / 2) * (240F / viddef.GetHeight()) - 77), refdef.width / 8, refdef.height / 8); refdef.height += 4; re.RenderFrame(refdef); re.DrawPic(refdef.x - 80, refdef.y, modelImage); re.DrawPic(refdef.x - 80, refdef.y + 47, modelImage1); re.DrawPic(refdef.x - 80, refdef.y + 94, modelImage2); re.DrawPic(refdef.x - 80, refdef.y + 141, modelImage3); }
private void TestMap() { if (refdef == null) { refdef = new refdef_t(); refdef.x = 0; refdef.y = 0; refdef.width = viddef.GetWidth(); refdef.height = viddef.GetHeight(); refdef.fov_x = fov_x; refdef.fov_y = CalcFov(fov_x, refdef.width - 10, refdef.height - 10); refdef.vieworg = new float[] { 0, 0, 0 }; refdef.viewangles[0] = 0; refdef.viewangles[1] = 90; refdef.viewangles[2] = 0; refdef.blend = new float[] { 0F, 0F, 0F, 0F }; refdef.areabits = null; refdef.num_entities = 0; refdef.entities = null; 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.time = Time() * 0.001F; refdef.viewangles[0] += KBD.my * 0.1F; refdef.viewangles[1] -= KBD.mx * 0.1F; refdef.vieworg[0] = 0; refdef.vieworg[1] = -79; refdef.vieworg[2] = -131; refdef.vieworg[0] += 1F / 16; refdef.vieworg[1] += 1F / 16; refdef.vieworg[2] += 1F / 16; re.RenderFrame(refdef); }
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); }