public override void GL_Strings_f() { VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\\'); VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\\'); VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\\'); VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\\'); }
/* ** GL_Strings_f */ protected void GL_Strings_f() { VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + this.gl_config.vendor_string + '\n'); VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + this.gl_config.renderer_string + '\n'); VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + this.gl_config.version_string + '\n'); VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + this.gl_config.extensions_string + '\n'); }
public override void Draw_StretchPic(Int32 x, Int32 y, Int32 w, Int32 h, String pic) { image_t image; image = Draw_FindPic(pic); if (image == null) { VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\\'); return; } if (scrap_dirty) { Scrap_Upload(); } if (((gl_config.renderer == GL_RENDERER_MCD) || ((gl_config.renderer & GL_RENDERER_RENDITION) != 0)) && !image.has_alpha) { GL.Disable(EnableCap.AlphaTest); } GL_Bind(image.texnum); GL.Begin(PrimitiveType.Quads); GL.TexCoord2(image.sl, image.tl); GL.Vertex2(x, y); GL.TexCoord2(image.sh, image.tl); GL.Vertex2(x + w, y); GL.TexCoord2(image.sh, image.th); GL.Vertex2(x + w, y + h); GL.TexCoord2(image.sl, image.th); GL.Vertex2(x, y + h); GL.End(); if (((gl_config.renderer == GL_RENDERER_MCD) || ((gl_config.renderer & GL_RENDERER_RENDITION) != 0)) && !image.has_alpha) { GL.Enable(EnableCap.AlphaTest); } }
public virtual void Init() { Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); Program.Q2Dialog = new Q2DataDialog(); Locale.SetDefault(Locale.US); Program.Q2Dialog.SetVisible(true); string DRIVER = "lwjgl"; Qcommon.Init(new string { "DancingQueens", "+set", "gl_mode", "4", "+set", "vid_fullscreen", "0", "+set", "vid_ref", DRIVER }); VID.Shutdown(); String[] names = Renderer.GetDriverNames(); System.Diagnostics.Debug.WriteLine("Registered Drivers: " + Arrays.AsList(names)); this.re = Renderer.GetDriver(DRIVER); Globals.re = this.re; System.Diagnostics.Debug.WriteLine("Use driver: " + re); System.out_renamed.Flush(); re.Init(0, 0); kbd = re.GetKeyboardHandler(); kbd.Init(); Cbuf.AddText("unbind t"); Cbuf.Execute(); Cmd.AddCommand("togglemouse", togglemouse); Cbuf.AddText("bind t togglemouse"); Cbuf.Execute(); Globals.cls.key_dest = Defines.key_game; Globals.cls.state = Defines.ca_active; viddef = Globals.viddef; fov_y = Math3D.CalcFov(fov_x, viddef.GetWidth(), viddef.GetHeight()); }
public virtual void Init() { Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); Program.Q2Dialog = new Q2DataDialog(); Locale.SetDefault(Locale.US); Program.Q2Dialog.SetVisible(true); string DRIVER = "jsr231"; Qcommon.Init(new string [] { "TestRenderer", "+set", "gl_mode", "6", "+set", "vid_fullscreen", "0", "+set", "vid_ref", DRIVER }); VID.Shutdown(); String[] names = Renderer.GetDriverNames(); System.Diagnostics.Debug.WriteLine("Registered Drivers: " + Arrays.AsList(names)); this.re = Renderer.GetDriver(DRIVER); Globals.re = this.re; System.Diagnostics.Debug.WriteLine("Use driver: " + re); System.out_renamed.Flush(); re.Init(0, 0); kbd = re.GetKeyboardHandler(); kbd.Init(); Cmd.AddCommand("nexttest", nexttest); Cbuf.AddText("bind n nexttest"); Cbuf.Execute(); Globals.cls.key_dest = Defines.key_game; Globals.cls.state = Defines.ca_active; }
/// <summary> /// Add new Vid /// </summary> /// <param name="vidModel">This consists of all the required information need to form VID object which is further inserted into the database</param> /// <returns>SaveResult</returns> public SaveResult AddVid(VIDModel vidModel) { VID isVidExist = _repository.GetVidByVVID(vidModel.VideoVersion, vidModel.VendorId); var listVid = _repository.GetVIDByVideoVersion(vidModel.VideoVersion); if (isVidExist != null) { string existLocalEdit = string.IsNullOrEmpty(isVidExist.EditName) || isVidExist.EditName == "No" ? "No" : "Yes"; string PresentLocalEdit = string.IsNullOrEmpty(vidModel.EditName) || vidModel.EditName == "No" ? "No" : "Yes"; if (existLocalEdit.Equals(PresentLocalEdit)) { return(SaveResult.FailureResult("Combination of Video Version, VendorId, LocalEdit is already present")); } } if (listVid != null && listVid.Count > 0) { var titles = listVid.Select(x => x.TitleName).ToList(); if (!titles.Contains(vidModel.TitleName)) { return(SaveResult.FailureResult("Entered video version is already present with titlename" + " " + "'" + titles.FirstOrDefault() + "'")); } } VID vid = Mapper.CreateVidEntity(vidModel); _repository.Save(vid); return(new SaveResult() { Success = true, Message = "VID Added successfully" }); }
public virtual void Init() { Qcommon.Init(new string { "$Id: DebugCulling.java,v 1.6 2008-03-02 14:56:21 cawe Exp $" }); VID.Shutdown(); this.re = Renderer.GetDriver("jogl"); re.Init(0, 0); viddef = Globals.viddef; }
public virtual void Mod_LoadTexinfo(lump_t l) { texinfo_t in_renamed; mtexinfo_t[] out_renamed; mtexinfo_t step; Int32 i, count; Int32 next; String name; if ((l.filelen % texinfo_t.SIZE) != 0) { Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); } count = l.filelen / texinfo_t.SIZE; out_renamed = new mtexinfo_t[count]; for (i = 0; i < count; i++) { out_renamed[i] = new mtexinfo_t(); } loadmodel.texinfo = out_renamed; loadmodel.numtexinfo = count; ByteBuffer bb = ByteBuffer.Wrap(mod_base, l.fileofs, l.filelen); bb.Order = ByteOrder.LittleEndian; for (i = 0; i < count; i++) { in_renamed = new texinfo_t(bb); out_renamed[i].vecs = in_renamed.vecs; out_renamed[i].flags = in_renamed.flags; next = in_renamed.nexttexinfo; if (next > 0) { out_renamed[i].next = loadmodel.texinfo[next]; } else { out_renamed[i].next = null; } name = "textures/" + in_renamed.texture + ".wal"; out_renamed[i].image = GL_FindImage(name, it_wall); if (out_renamed[i].image == null) { VID.Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\\'); out_renamed[i].image = r_notexture; } } for (i = 0; i < count; i++) { out_renamed[i].numframes = 1; for (step = out_renamed[i].next; (step != null) && (step != out_renamed[i]); step = step.next) { out_renamed[i].numframes++; } } }
/// <summary> /// 创建fieldtype,如CE,XCN等 /// </summary> /// <param name="parent"></param> /// <param name="product"></param> /// <param name="name"></param> /// <returns></returns> public override abstractType Create(compositeType parent, Enum product, string name) { abstractType tmp = null; switch (product) { case enumField.CE: tmp = new CE(parent, name); break; case enumField.CM: tmp = new CM(parent, name); break; case enumField.CWE: tmp = new CWE(parent, name); break; case enumField.CX: tmp = new CX(parent, name); break; case enumField.DLN: tmp = new DLN(parent, name); break; case enumField.EI: tmp = new EI(parent, name); break; case enumField.ELD: tmp = new ELD(parent, name); break; case enumField.FN: tmp = new FN(parent, name); break; case enumField.HD: tmp = new HD(parent, name); break; case enumField.MSG: tmp = new MSG(parent, name); break; case enumField.PT: tmp = new PT(parent, name); break; case enumField.VID: tmp = new VID(parent, name); break; case enumField.XAD: tmp = new XAD(parent, name); break; case enumField.XCN: tmp = new XCN(parent, name); break; case enumField.XPN: tmp = new XPN(parent, name); break; case enumField.XTN: tmp = new XTN(parent, name); break; case enumField.ERL: tmp = new ERL(parent, name); break; case enumField.FC: tmp = new FC(parent, name); break; case enumField.XON: tmp = new XON(parent, name); break; case enumField.PL: tmp = new PL(parent, name); break; case enumField.CP: tmp = new CP(parent, name); break; case enumField.JCC: tmp = new JCC(parent, name); break; case enumField.TQ: tmp = new TQ(parent, name); break; case enumField.CQ: tmp = new CQ(parent, name); break; default: throw new NotSupportedException(); } return(tmp); }
public MSH() { SendingApplication = new EI(); SendingFacility = new EI(); ReceivingApplication = new EI(); ReceivingFacility = new EI(); MessageType = new MSG(); ProcessingID = new PT(); VersionID = new VID(); }
public override void Execute() { GL.ClearColor(0f, 0f, 0f, 0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); if (!parent.post_init) { VID.Printf(Defines.PRINT_ALL, "Missing multi-texturing for FastJOGL renderer\\n"); } parent.EndFrame(); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hash = (int)2166136261; hash = hash * 486187739 + VID.GetHashCode(); hash = hash * 486187739 + PID.GetHashCode(); hash = hash * 486187739 + Revision.GetHashCode(); return(hash); } }
/// <summary> /// constructor /// </summary> public VariantFeature(VcfVariant variant, ChromosomeRenamer renamer, VID vid) { _renamer = renamer; _vid = vid; AlternateAlleles = new List <VariantAlternateAllele>(); if (variant.IsGatkGenomeVcf) { EnableGatkGenomeVcfFix(); } ParseVcfLine(variant.Fields); }
public bool init(int xpos, int ypos) { if (this.window == null) { return(true); } Base.setVid(this.window.ClientSize.X, this.window.ClientSize.Y); VID.NewWindow(this.window.ClientSize.X, this.window.ClientSize.Y); return(true); }
public virtual void SetBounds(int x, int y, int width, int height) { int mask = ~0x03; if ((width & 0x03) != 0) { width &= mask; width += 4; } base.SetBounds(x, y, width, height); Base.SetVid(width, height); VID.NewWindow(width, height); }
/// <summary> /// constructor /// </summary> public PianoAnnotationSource(Stream transcriptCacheStream, CompressedSequenceReader compressedSequenceReader) { OverlappingTranscripts = new List <Transcript>(); _performanceMetrics = PerformanceMetrics.Instance; _compressedSequence = new CompressedSequence(); _dataFileManager = new DataFileManager(compressedSequenceReader, _compressedSequence); _dataFileManager.Changed += LoadData; _renamer = _compressedSequence.Renamer; _aminoAcids = new AminoAcids(); _vid = new VID(); LoadTranscriptCache(transcriptCacheStream, _renamer.NumRefSeqs, out _transcriptIntervalForest); }
public override System.Boolean R_Init(Int32 vid_xpos, Int32 vid_ypos) { for (var j = 0; j < 256; j++) { r_turbsin[j] = Warp.SIN[j] * 0.5F; } VID.Printf(Defines.PRINT_ALL, "ref_gl version: " + REF_VERSION + '\\'); Draw_GetPalette(); R_Register(); gl_state.prev_mode = 3; if (!R_SetMode()) { VID.Printf(Defines.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\\n"); return(false); } return(true); }
public override int GetHashCode() { unchecked { return(base.GetHashCode() + (Callsign.ToUpper().GetHashCode() * 3) + (VID.ToUpper().GetHashCode() * 3) + (Name.ToUpper().GetHashCode() * 3) + (ClientType.GetHashCode() * 3) + (GetItemHashCode(Location) * 3) + (Server.ToUpper().GetHashCode() * 3) + (Protocol.ToUpper().GetHashCode() * 3) + (ConnectionTime.GetHashCode() * 3) + (SoftwareName.ToUpper().GetHashCode() * 3) + (SoftwareVersion.ToUpper().GetHashCode() * 3) + (AdministrativeVersion.GetHashCode() * 3) + (ClientRating.GetHashCode() * 3) * 17); } }
public virtual void R_RenderView(refdef_t fd) { if (r_norefresh.value != 0F) { return; } r_newrefdef = fd; if (r_newrefdef == null) { Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); } if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) { Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); } if (r_speeds.value != 0F) { c_brush_polys = 0; c_alias_polys = 0; } R_PushDlights(); if (gl_finish.value != 0F) { GL.Finish(); } R_SetupFrame(); R_SetFrustum(); R_SetupGL(); R_MarkLeaves(); R_DrawWorld(); R_DrawEntitiesOnList(); R_RenderDlights(); R_DrawParticles(); R_DrawAlphaSurfaces(); R_Flash(); if (r_speeds.value != 0F) { VID.Printf(Defines.PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\\n", c_brush_polys, c_alias_polys, c_visible_textures, c_visible_lightmaps); } }
protected virtual System.Boolean R_SetMode( ) { var fullscreen = (vid_fullscreen.value > 0F); vid_fullscreen.modified = false; gl_mode.modified = false; Size dim = new Size(vid.GetWidth(), vid.GetHeight()); Int32 err; if ((err = glImpl.SetMode(dim, ( Int32 )gl_mode.value, fullscreen)) == rserr_ok) { gl_state.prev_mode = ( Int32 )gl_mode.value; } else { if (err == rserr_invalid_fullscreen) { Cvar.SetValue("vid_fullscreen", 0); vid_fullscreen.modified = false; VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\\n"); if ((err = glImpl.SetMode(dim, ( Int32 )gl_mode.value, false)) == rserr_ok) { return(true); } } else if (err == rserr_invalid_mode) { Cvar.SetValue("gl_mode", gl_state.prev_mode); gl_mode.modified = false; VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\\n"); } if ((err = glImpl.SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) { VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\\n"); return(false); } } return(true); }
public override void Mod_Modellist_f( ) { Int32 i; model_t mod; Int32 total; total = 0; VID.Printf(Defines.PRINT_ALL, "Loaded models:\\n"); for (i = 0; i < mod_numknown; i++) { mod = mod_known[i]; if (mod.name.Length == 0) { continue; } VID.Printf(Defines.PRINT_ALL, "%8i : %s\\n", mod.extradatasize, mod.name); total += mod.extradatasize; } VID.Printf(Defines.PRINT_ALL, "Total resident: " + total + '\\'); }
public virtual void Init() { Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); if (Globals.dedicated.value != 1F) { Program.Q2Dialog = new Q2DataDialog(); Locale.SetDefault(Locale.US); Program.Q2Dialog.SetVisible(true); } Qcommon.Init(new string[] { "TestMap" }); VID.Shutdown(); Globals.re = this.re = Renderer.GetDriver("jsr231", true); re.Init(0, 0); Cmd.AddCommand("+tforward", forward_down); Cmd.AddCommand("-tforward", forward_up); Cbuf.AddText("bind UPARROW +tforward"); Cbuf.Execute(); Cmd.AddCommand("+tbackward", backward_down); Cmd.AddCommand("-tbackward", backward_up); Cbuf.AddText("bind DOWNARROW +tbackward"); Cbuf.Execute(); Cmd.AddCommand("+tleft", left_down); Cmd.AddCommand("-tleft", left_up); Cbuf.AddText("bind LEFTARROW +tleft"); Cbuf.Execute(); Cmd.AddCommand("+tright", right_down); Cmd.AddCommand("-tright", right_up); Cbuf.AddText("bind RIGHTARROW +tright"); Cbuf.Execute(); Cmd.AddCommand("togglemouse", togglemouse); Cbuf.AddText("bind t togglemouse"); Cbuf.Execute(); Globals.cls.key_dest = Defines.key_game; Globals.cls.state = Defines.ca_active; viddef = Globals.viddef; }
public override void GL_ScreenShot_f() { var screnshotIndex = Directory.GetFiles(FS.Gamedir() + "/scrshot/", "jake*.tga") .Select(s => Path.GetFileNameWithoutExtension(s).Replace("jake", "")) .Max(s => int.Parse(s)) + 1; FileStream file = File.OpenWrite(FS.Gamedir() + $"/scrshot/jake{screnshotIndex:00}.tga"); try { using (var bmp = new Bitmap(vid.GetWidth(), vid.GetHeight())) { var data = bmp.LockBits(new Rectangle(0, 0, vid.GetWidth(), vid.GetHeight()), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); GL.ReadPixels(0, 0, vid.GetWidth(), vid.GetHeight(), PixelFormat.Bgr, PixelType.UnsignedByte, data.Scan0); bmp.UnlockBits(data); bmp.RotateFlip(RotateFlipType.RotateNoneFlipY); var encoder = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders().First(c => c.FormatID == System.Drawing.Imaging.ImageFormat.Jpeg.Guid); var encParams = new System.Drawing.Imaging.EncoderParameters() { Param = new[] { new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L) } }; bmp.Save(file, encoder, encParams); } file.Dispose(); } catch (Exception e) { VID.Printf(Defines.PRINT_ALL, e.Message + '\\'); } VID.Printf(Defines.PRINT_ALL, "Wrote " + file.Name + '\\'); }
// =============================================================================== /* * ================ * Mod_Modellist_f * ================ */ protected void Mod_Modellist_f() { int i; model_t mod; int total; total = 0; VID.Printf(Defines.PRINT_ALL, "Loaded models:\n"); for (i = 0; i < this.mod_numknown; i++) { mod = this.mod_known[i]; if (mod.name.Length == 0) { continue; } VID.Printf(Defines.PRINT_ALL, "%8i : %s\n", mod.extradatasize, mod.name); total += mod.extradatasize; } VID.Printf(Defines.PRINT_ALL, "Total resident: " + total + '\n'); }
// /* // ============================================================================== // // SCREEN SHOTS // // ============================================================================== // */ // // typedef struct _TargaHeader { // unsigned char id_length, colormap_type, image_type; // unsigned short colormap_index, colormap_length; // unsigned char colormap_size; // unsigned short x_origin, y_origin, width, height; // unsigned char pixel_size, attributes; // } TargaHeader; /** * GL_ScreenShot_f */ public override void GL_ScreenShot_f() { StringBuilder sb = new(FS.Gamedir() + "/scrshot/screenshot00.tga"); FS.CreatePath(sb.ToString()); var file = sb.ToString(); // find a valid file name var i = 0; var offset = sb.Length - 6; while (File.Exists(file) && i++ < 100) { sb[offset] = (char)(i / 10 + '0'); sb[offset + 1] = (char)(i % 10 + '0'); file = sb.ToString(); } if (i == 100) { VID.Printf(Defines.PRINT_ALL, "Clean up your screenshots\n"); return; } try { Stream @out = File.OpenWrite(file); BinaryWriter image = new(@out); // write the TGA header image.Write((byte)0); image.Write((byte)0); image.Write((byte)2); // uncompressed type image.Write(new byte[9]); image.Write((short)Base.vid.getWidth()); // vid.getWidth() image.Write((short)Base.vid.getHeight()); // vid.getHeight() image.Write((byte)24); // pixel size image.Write(new byte[1]); var rgb = new byte[Base.vid.getWidth() * Base.vid.getHeight() * 3]; // change pixel alignment for reading if (Base.vid.getWidth() % 4 != 0) { this.gl.glPixelStorei(OpenGL.GL_PACK_ALIGNMENT, 1); } // OpenGL 1.2+ supports the GL_BGR color format // check the GL_VERSION to use the TARGA BGR order if possible // e.g.: 1.5.2 NVIDIA 66.29 if (this.gl_config.getOpenGLVersion() >= 1.2f) { // read the BGR values into the image buffer this.gl.glReadPixels(0, 0, Base.vid.getWidth(), Base.vid.getHeight(), OpenGL.GL_BGR, OpenGL.GL_UNSIGNED_BYTE, rgb); } else { // read the RGB values into the image buffer this.gl.glReadPixels(0, 0, Base.vid.getWidth(), Base.vid.getHeight(), OpenGL.GL_RGB, OpenGL.GL_UNSIGNED_BYTE, rgb); // flip RGB to BGR for (i = 0; i < rgb.Length; i += 3) { image.Write(rgb[i + 2]); image.Write(rgb[i + 1]); image.Write(rgb[i + 0]); } } // reset to default alignment this.gl.glPixelStorei(OpenGL.GL_PACK_ALIGNMENT, 4); // close the file channel @out.Close(); } catch (Exception e) { VID.Printf(Defines.PRINT_ALL, e.Message + '\n'); } VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); }
public unsafe int setMode(Size dim, int mode, bool fullscreen) { var windowSize = new Size(); VID.Printf(Defines.PRINT_ALL, "Initializing OpenGL display\n"); VID.Printf(Defines.PRINT_ALL, $"...setting mode {mode}:"); if (this.oldDisplayMode == null) { GLFW.Init(); var videoMode = GLFW.GetVideoMode(GLFW.GetPrimaryMonitor())[0]; this.oldDisplayMode = new(videoMode.Width, videoMode.Height, videoMode.RefreshRate, videoMode.RedBits + videoMode.GreenBits + videoMode.BlueBits); } if (!VID.GetModeInfo(ref windowSize, mode)) { VID.Printf(Defines.PRINT_ALL, " invalid mode\n"); return(Base.rserr_invalid_mode); } VID.Printf(Defines.PRINT_ALL, $" {windowSize.Width} {windowSize.Height}{'\n'}"); if (this.window != null) { this.shutdown(); } if (fullscreen) { var displayMode = this.getModeList().FirstOrDefault(displayMode => displayMode.Width == windowSize.Width && displayMode.Height == windowSize.Height) ?? this.oldDisplayMode; this.window = new(GameWindowSettings.Default, new() { Profile = ContextProfile.Compatability, Size = new(displayMode.Width, displayMode.Height), IsFullscreen = true }); VID.Printf( Defines.PRINT_ALL, $"...setting fullscreen {displayMode.Width}x{displayMode.Height}x{displayMode.BitDepth}@{displayMode.RefreshRate}Hz\n" ); } else { this.window = new(GameWindowSettings.Default, new() { Profile = ContextProfile.Compatability, Size = new(windowSize.Width, windowSize.Height) }); VID.Printf(Defines.PRINT_ALL, $"...setting window {windowSize.Width}x{windowSize.Height}\n"); } this.window.Focus(); this.window.Closed += OpenTkDriver.QuitOnClose; OpenTkKBD.Window = this.window; this.window.KeyDown += OpenTkKBD.Listener.KeyDown; this.window.KeyUp += OpenTkKBD.Listener.KeyUp; this.window.MouseDown += OpenTkKBD.Listener.MouseDown; this.window.MouseUp += OpenTkKBD.Listener.MouseUp; this.window.MouseMove += OpenTkKBD.Listener.MouseMove; this.window.MouseWheel += OpenTkKBD.Listener.MouseWheel; Program.UpdateLoop = _ => this.window.Run(); var initialized = false; var updateAccumulator = 0.0; var renderAccumulator = 0.0; this.window.UpdateFrame += args => { updateAccumulator += args.Time * 1000; var elapsed = (int)updateAccumulator; if (elapsed <= 0) { return; } Qcommon.FrameUpdate(elapsed); updateAccumulator -= elapsed; }; this.window.RenderFrame += args => { if (!initialized) { this.init(0, 0); initialized = true; } renderAccumulator += args.Time * 1000; var elapsed = (int)renderAccumulator; if (elapsed <= 0) { return; } Qcommon.FrameRender(elapsed); renderAccumulator -= elapsed; }; this.window.Resize += args => { Base.setVid(this.window.ClientSize.X, this.window.ClientSize.Y); VID.NewWindow(this.window.ClientSize.X, this.window.ClientSize.Y); }; return(Base.rserr_ok); }
public override void R_DrawAliasModel(entity_t e) { Int32 i; qfiles.dmdl_t paliashdr; Single an; Single[][] bbox = new Single[][] { new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 } }; image_t skin; if ((e.flags & Defines.RF_WEAPONMODEL) == 0) { if (R_CullAliasModel(bbox, e)) { return; } } if ((e.flags & Defines.RF_WEAPONMODEL) != 0) { if (r_lefthand.value == 2F) { return; } } paliashdr = (qfiles.dmdl_t)currentmodel.extradata; if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56F; shadelight[1] = 0.59F; shadelight[2] = 0.45F; } if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) { shadelight[0] = 0.9F; shadelight[1] = 0.7F; } if ((currententity.flags & Defines.RF_SHELL_RED) != 0) { shadelight[0] = 1F; } if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0) { shadelight[1] = 1F; } if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0) { shadelight[2] = 1F; } } else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { for (i = 0; i < 3; i++) { shadelight[i] = 1F; } } else { R_LightPoint(currententity.origin, shadelight); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) { if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) { r_lightlevel.value = 150 * shadelight[0]; } else { r_lightlevel.value = 150 * shadelight[2]; } } else { if (shadelight[1] > shadelight[2]) { r_lightlevel.value = 150 * shadelight[1]; } else { r_lightlevel.value = 150 * shadelight[2]; } } } if (gl_monolightmap.string_renamed[0] != '0') { var s = shadelight[0]; if (s < shadelight[1]) { s = shadelight[1]; } if (s < shadelight[2]) { s = shadelight[2]; } shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ((currententity.flags & Defines.RF_MINLIGHT) != 0) { for (i = 0; i < 3; i++) { if (shadelight[i] > 0.1F) { break; } } if (i == 3) { shadelight[0] = 0.1F; shadelight[1] = 0.1F; shadelight[2] = 0.1F; } } if ((currententity.flags & Defines.RF_GLOW) != 0) { Single scale; Single min; scale = ( Single )(0.1F * Math.Sin(r_newrefdef.time * 7)); for (i = 0; i < 3; i++) { min = shadelight[i] * 0.8F; shadelight[i] += scale; if (shadelight[i] < min) { shadelight[i] = min; } } } if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1F; shadelight[1] = 0F; shadelight[2] = 0F; } shadedots = r_avertexnormal_dots[(( Int32 )(currententity.angles[1] * (SHADEDOT_QUANT / 360))) & (SHADEDOT_QUANT - 1)]; an = ( Single )(currententity.angles[1] / 180 * Math.PI); shadevector[0] = ( Single )Math.Cos(-an); shadevector[1] = ( Single )Math.Sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); c_alias_polys += paliashdr.num_tris; if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) { GL.DepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); } if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1F)) { GL.MatrixMode(MatrixMode.Projection); GL.PushMatrix(); GL.LoadIdentity(); GL.Scale(-1, 1, 1); MYgluPerspective(r_newrefdef.fov_y, ( Single )r_newrefdef.width / r_newrefdef.height, 4, 4096); GL.MatrixMode(MatrixMode.Modelview); GL.CullFace(CullFaceMode.Back); } GL.PushMatrix(); e.angles[PITCH] = -e.angles[PITCH]; R_RotateForEntity(e); e.angles[PITCH] = -e.angles[PITCH]; if (currententity.skin != null) { skin = currententity.skin; } else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) { skin = currentmodel.skins[0]; } else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) { skin = currentmodel.skins[0]; } } } if (skin == null) { skin = r_notexture; } GL_Bind(skin.texnum); GL.ShadeModel(ShadingModel.Smooth); GL_TexEnv(( Int32 )All.Modulate); if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { GL.Enable(EnableCap.Blend); } if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\\'); currententity.frame = 0; currententity.oldframe = 0; } if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe " + currententity.oldframe + '\\'); currententity.frame = 0; currententity.oldframe = 0; } if (r_lerpmodels.value == 0F) { currententity.backlerp = 0; } GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv(( Int32 )All.Replace); GL.ShadeModel(ShadingModel.Flat); GL.PopMatrix(); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1F)) { GL.MatrixMode(MatrixMode.Projection); GL.PopMatrix(); GL.MatrixMode(MatrixMode.Modelview); GL.CullFace(CullFaceMode.Front); } if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { GL.Disable(EnableCap.Blend); } if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) { GL.DepthRange(gldepthmin, gldepthmax); } if (gl_shadows.value != 0F && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { GL.PushMatrix(); R_RotateForEntity(e); GL.Disable(EnableCap.Texture2D); GL.Enable(EnableCap.Blend); GL.Color4(0, 0, 0, 0.5F); GL_DrawAliasShadow(paliashdr, currententity.frame); GL.Enable(EnableCap.Texture2D); GL.Disable(EnableCap.Blend); GL.PopMatrix(); } GL.Color4(1, 1, 1, 1); }
public virtual System.Boolean R_CullAliasModel(Single[][] bbox, entity_t e) { Int32 i; Single[] mins = new Single[] { 0, 0, 0 }; Single[] maxs = new Single[] { 0, 0, 0 }; qfiles.dmdl_t paliashdr; Single[][] vectors = new Single[][] { new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 }, new Single[] { 0, 0, 0 } }; Single[] thismins = new Single[] { 0, 0, 0 }; Single[] oldmins = new Single[] { 0, 0, 0 }; Single[] thismaxs = new Single[] { 0, 0, 0 }; Single[] oldmaxs = new Single[] { 0, 0, 0 }; qfiles.daliasframe_t pframe, poldframe; Single[] angles = new Single[] { 0, 0, 0 }; paliashdr = (qfiles.dmdl_t)currentmodel.extradata; if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\\'); e.frame = 0; } if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\\'); e.oldframe = 0; } pframe = paliashdr.aliasFrames[e.frame]; poldframe = paliashdr.aliasFrames[e.oldframe]; if (pframe == poldframe) { for (i = 0; i < 3; i++) { mins[i] = pframe.translate[i]; maxs[i] = mins[i] + pframe.scale[i] * 255; } } else { for (i = 0; i < 3; i++) { thismins[i] = pframe.translate[i]; thismaxs[i] = thismins[i] + pframe.scale[i] * 255; oldmins[i] = poldframe.translate[i]; oldmaxs[i] = oldmins[i] + poldframe.scale[i] * 255; if (thismins[i] < oldmins[i]) { mins[i] = thismins[i]; } else { mins[i] = oldmins[i]; } if (thismaxs[i] > oldmaxs[i]) { maxs[i] = thismaxs[i]; } else { maxs[i] = oldmaxs[i]; } } } for (i = 0; i < 8; i++) { Single[] tmp = new Single[] { 0, 0, 0 }; if ((i & 1) != 0) { tmp[0] = mins[0]; } else { tmp[0] = maxs[0]; } if ((i & 2) != 0) { tmp[1] = mins[1]; } else { tmp[1] = maxs[1]; } if ((i & 4) != 0) { tmp[2] = mins[2]; } else { tmp[2] = maxs[2]; } Math3D.VectorCopy(tmp, bbox[i]); } Math3D.VectorCopy(e.angles, angles); angles[YAW] = -angles[YAW]; Math3D.AngleVectors(angles, vectors[0], vectors[1], vectors[2]); for (i = 0; i < 8; i++) { Single[] tmp = new Single[] { 0, 0, 0 }; Math3D.VectorCopy(bbox[i], tmp); bbox[i][0] = Math3D.DotProduct(vectors[0], tmp); bbox[i][1] = -Math3D.DotProduct(vectors[1], tmp); bbox[i][2] = Math3D.DotProduct(vectors[2], tmp); Math3D.VectorAdd(e.origin, bbox[i], bbox[i]); } { Int32 p, f; var aggregatemask = ~0; for (p = 0; p < 8; p++) { var mask = 0; for (f = 0; f < 4; f++) { var dp = Math3D.DotProduct(frustum[f].normal, bbox[p]); if ((dp - frustum[f].dist) < 0) { mask |= (1 << f); } } aggregatemask &= mask; } if (aggregatemask != 0) { return(true); } return(false); } }
public override System.Boolean R_Init2( ) { VID.MenuInit(); gl_config.vendor_string = GL.GetString(StringName.Vendor); VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\\'); gl_config.renderer_string = GL.GetString(StringName.Renderer); VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\\'); gl_config.version_string = GL.GetString(StringName.Version); VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\\'); gl_config.extensions_string = GL.GetString(StringName.Extensions); VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\\'); gl_config.ParseOpenGLVersion(); var renderer_buffer = gl_config.renderer_string.ToLower(); var vendor_buffer = gl_config.vendor_string.ToLower(); if (renderer_buffer.IndexOf("voodoo") >= 0) { if (renderer_buffer.IndexOf("rush") < 0) { gl_config.renderer = GL_RENDERER_VOODOO; } else { gl_config.renderer = GL_RENDERER_VOODOO_RUSH; } } else if (vendor_buffer.IndexOf("sgi") >= 0) { gl_config.renderer = GL_RENDERER_SGI; } else if (renderer_buffer.IndexOf("permedia") >= 0) { gl_config.renderer = GL_RENDERER_PERMEDIA2; } else if (renderer_buffer.IndexOf("glint") >= 0) { gl_config.renderer = GL_RENDERER_GLINT_MX; } else if (renderer_buffer.IndexOf("glzicd") >= 0) { gl_config.renderer = GL_RENDERER_REALIZM; } else if (renderer_buffer.IndexOf("gdi") >= 0) { gl_config.renderer = GL_RENDERER_MCD; } else if (renderer_buffer.IndexOf("pcx2") >= 0) { gl_config.renderer = GL_RENDERER_PCX2; } else if (renderer_buffer.IndexOf("verite") >= 0) { gl_config.renderer = GL_RENDERER_RENDITION; } else { gl_config.renderer = unchecked (( Int32 )GL_RENDERER_OTHER); } var monolightmap = gl_monolightmap.string_renamed.ToUpper(); if (monolightmap.Length < 2 || monolightmap[1] != 'F') { if (gl_config.renderer == GL_RENDERER_PERMEDIA2) { Cvar.Set("gl_monolightmap", "A"); VID.Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\\n"); } else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { Cvar.Set("gl_monolightmap", "0"); } else { Cvar.Set("gl_monolightmap", "0"); } } if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { Cvar.Set("scr_drawall", "1"); } else { Cvar.Set("scr_drawall", "0"); } if (gl_config.renderer == GL_RENDERER_MCD) { Cvar.SetValue("gl_finish", 1); } if ((gl_config.renderer & GL_RENDERER_3DLABS) != 0) { if (gl_3dlabs_broken.value != 0F) { gl_config.allow_cds = false; } else { gl_config.allow_cds = true; } } else { gl_config.allow_cds = true; } if (gl_config.allow_cds) { VID.Printf(Defines.PRINT_ALL, "...allowing CDS\\n"); } else { VID.Printf(Defines.PRINT_ALL, "...disabling CDS\\n"); } if (gl_config.extensions_string.IndexOf("GL_EXT_compiled_vertex_array") >= 0 || gl_config.extensions_string.IndexOf("GL_SGI_compiled_vertex_array") >= 0) { VID.Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\\n"); if (gl_ext_compiled_vertex_array.value != 0F) { qglLockArraysEXT = true; } else { qglLockArraysEXT = false; } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\\n"); qglLockArraysEXT = false; } if (gl_config.extensions_string.IndexOf("WGL_EXT_swap_control") >= 0) { qwglSwapIntervalEXT = true; VID.Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\\n"); } else { qwglSwapIntervalEXT = false; VID.Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\\n"); } if (gl_config.extensions_string.IndexOf("GL_EXT_point_parameters") >= 0) { if (gl_ext_pointparameters.value != 0F) { qglPointParameterfEXT = true; VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\\n"); } else { VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\\n"); } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\\n"); } if (!qglColorTableEXT && gl_config.extensions_string.IndexOf("GL_EXT_paletted_texture") >= 0 && gl_config.extensions_string.IndexOf("GL_EXT_shared_texture_palette") >= 0) { if (gl_ext_palettedtexture.value != 0F) { VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\\n"); qglColorTableEXT = false; } else { VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\\n"); qglColorTableEXT = false; } } else { VID.Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\\n"); } if (gl_config.extensions_string.IndexOf("GL_ARB_multitexture") >= 0) { try { GL.ClientActiveTexture(TextureUnit.Texture0); VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\\n"); qglActiveTextureARB = true; TEXTURE0 = ( Int32 )TextureUnit.Texture0; TEXTURE1 = ( Int32 )TextureUnit.Texture1; } catch (Exception e) { qglActiveTextureARB = false; } } else { qglActiveTextureARB = false; VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\\n"); } if (!(qglActiveTextureARB)) { VID.Printf(Defines.PRINT_ALL, "Missing multi-texturing!\\n"); return(false); } GL_SetDefaultState(); GL_InitImages(); Mod_Init(); R_InitParticleTexture(); Draw_InitLocal(); ErrorCode err = GL.GetError(); if (err != ErrorCode.NoError) { VID.Printf(Defines.PRINT_ALL, "GL.GetError() = 0x%x\\n\\t%s\\n", err, "" + Enum.GetName(typeof(ErrorCode), err)); } glImpl.EndFrame(); return(true); }
public override void R_BeginFrame(Single camera_separation) { vid.Update(); gl_state.camera_separation = camera_separation; if (gl_mode.modified || vid_fullscreen.modified) { cvar_t ref_renamed; ref_renamed = Cvar.Get("vid_ref", "lwjgl", 0); ref_renamed.modified = true; } if (gl_log.modified) { glImpl.EnableLogging((gl_log.value != 0F)); gl_log.modified = false; } if (gl_log.value != 0F) { glImpl.LogNewFrame(); } if (vid_gamma.modified) { vid_gamma.modified = false; if ((gl_config.renderer & GL_RENDERER_VOODOO) != 0) { VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); } } glImpl.BeginFrame(camera_separation); GL.Viewport(0, 0, vid.GetWidth(), vid.GetHeight()); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(0, vid.GetWidth(), vid.GetHeight(), 0, -99999, 99999); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); GL.Disable(EnableCap.DepthTest); GL.Disable(EnableCap.CullFace); GL.Disable(EnableCap.Blend); GL.Enable(EnableCap.AlphaTest); GL.Color4(1, 1, 1, 1); if (gl_drawbuffer.modified) { gl_drawbuffer.modified = false; if (gl_state.camera_separation == 0 || !gl_state.stereo_enabled) { if (gl_drawbuffer.string_renamed.EqualsIgnoreCase("GL_FRONT")) { GL.DrawBuffer(DrawBufferMode.Front); } else { GL.DrawBuffer(DrawBufferMode.Back); } } } if (gl_texturemode.modified) { GL_TextureMode(gl_texturemode.string_renamed); gl_texturemode.modified = false; } if (gl_texturealphamode.modified) { GL_TextureAlphaMode(gl_texturealphamode.string_renamed); gl_texturealphamode.modified = false; } if (gl_texturesolidmode.modified) { GL_TextureSolidMode(gl_texturesolidmode.string_renamed); gl_texturesolidmode.modified = false; } GL_UpdateSwapInterval(); R_Clear(); }