public virtual void Draw_GetPicSize(Size dim, String pic) { image_t image = Draw_FindPic(pic); dim.Width = (image != null) ? image.width : -1; dim.Height = (image != null) ? image.height : -1; }
public override void Draw_GetPicSize(out Size dim, String pic) { image_t image = Draw_FindPic(pic); dim = new Size(); dim.Width = (image != null) ? image.width : -1; dim.Height = (image != null) ? image.height : -1; }
public virtual void Set(clientinfo_t from) { name = from.name; cinfo = from.cinfo; skin = from.skin; icon = from.icon; iconname = from.iconname; model = from.model; System.Array.Copy(from.weaponmodel, 0, weaponmodel, 0, Defines.MAX_CLIENTWEAPONMODELS); }
public model_t[] weaponmodel = new model_t[Defines.MAX_CLIENTWEAPONMODELS]; // arary of references // public void reset() // { // set(new clientinfo_t()); // } public void set(clientinfo_t from) { this.name = from.name; this.cinfo = from.cinfo; this.skin = from.skin; this.icon = from.icon; this.iconname = from.iconname; this.model = from.model; Array.Copy(from.weaponmodel, 0, this.weaponmodel, 0, Defines.MAX_CLIENTWEAPONMODELS); }
public bbox_t[] Detect(image_t data, float threshold) { var container = new BboxContainer(); fixed(float *pData = data.data) { var internalData = new internal_image_t { w = data.w, h = data.h, c = data.c, data = pData }; var count = DetectTensor(internalData, threshold, ref container); return(container.candidates.Take(count).ToArray()); } }
public void clear() { this.model = null; Math3D.VectorClear(this.angles); Math3D.VectorClear(this.origin); this.frame = 0; Math3D.VectorClear(this.oldorigin); this.oldframe = 0; this.backlerp = 0; this.skinnum = 0; this.lightstyle = 0; this.alpha = 0; this.skin = null; this.flags = 0; }
public void set(entity_t src) { this.model = src.model; Math3D.VectorCopy(src.angles, this.angles); Math3D.VectorCopy(src.origin, this.origin); this.frame = src.frame; Math3D.VectorCopy(src.oldorigin, this.oldorigin); this.oldframe = src.oldframe; this.backlerp = src.backlerp; this.skinnum = src.skinnum; this.lightstyle = src.lightstyle; this.alpha = src.alpha; this.skin = src.skin; this.flags = src.flags; }
public virtual void Clear() { model = null; Math3D.VectorClear(angles); Math3D.VectorClear(origin); frame = 0; Math3D.VectorClear(oldorigin); oldframe = 0; backlerp = 0; skinnum = 0; lightstyle = 0; alpha = 0; skin = null; flags = 0; }
public override image_t Draw_FindPic(String name) { image_t image = null; String fullname; if (!name.StartsWith("/") && !name.StartsWith("\\\\")) { fullname = "pics/" + name + ".pcx"; image = GL_FindImage(fullname, it_pic); } else { image = GL_FindImage(name.Substring(1), it_pic); } return(image); }
public virtual void GL_RenderLightmappedPoly(msurface_t surf) { var gotoDynamic = false; Int32 map; for (map = 0; map < Defines.MAXLIGHTMAPS && (surf.styles[map] != ( Byte )255); map++) { if (r_newrefdef.lightstyles[surf.styles[map] & 0xFF].white != surf.cached_light[map]) { gotoDynamic = true; break; } } if (map == 4) { map--; } var is_dynamic = false; if (gotoDynamic || (surf.dlightframe == r_framecount)) { if (gl_dynamic.value != 0) { if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) == 0) { is_dynamic = true; } } } glpoly_t p; image_t image = R_TextureAnimation(surf.texinfo); var lmtex = surf.lightmaptexturenum; if (is_dynamic) { Int32 smax, tmax; if (((surf.styles[map] & 0xFF) >= 32 || surf.styles[map] == 0) && (surf.dlightframe != r_framecount)) { smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; R_BuildLightMap(surf, temp, smax); R_SetCacheState(surf); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + surf.lightmaptexturenum); lmtex = surf.lightmaptexturenum; new Pinnable(temp, (ptr) => { GL.TexSubImage2D(TextureTarget.Texture2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, PixelType.UnsignedByte, ptr); }); } else { smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; R_BuildLightMap(surf, temp, smax); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + 0); lmtex = 0; new Pinnable(temp, (ptr) => { GL.TexSubImage2D(TextureTarget.Texture2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, PixelType.UnsignedByte, ptr); }); } c_brush_polys++; GL_MBind(TextureUnit.Texture0, image.texnum); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + lmtex); if ((surf.texinfo.flags & Defines.SURF_FLOWING) != 0) { Single scroll; scroll = -64 * ((r_newrefdef.time / 40F) - ( Int32 )(r_newrefdef.time / 40F)); if (scroll == 0F) { scroll = -64F; } for (p = surf.polys; p != null; p = p.chain) { p.BeginScrolling(scroll); GL.DrawArrays(PrimitiveType.Polygon, p.pos, p.numverts); p.EndScrolling(); } } else { for (p = surf.polys; p != null; p = p.chain) { GL.DrawArrays(PrimitiveType.Polygon, p.pos, p.numverts); } } } else { c_brush_polys++; GL_MBind(TextureUnit.Texture0, image.texnum); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + lmtex); if ((surf.texinfo.flags & Defines.SURF_FLOWING) != 0) { Single scroll; scroll = -64 * ((r_newrefdef.time / 40F) - ( Int32 )(r_newrefdef.time / 40F)); if (scroll == 0) { scroll = -64F; } for (p = surf.polys; p != null; p = p.chain) { p.BeginScrolling(scroll); GL.DrawArrays(PrimitiveType.Polygon, p.pos, p.numverts); p.EndScrolling(); } } else { for (p = surf.polys; p != null; p = p.chain) { GL.DrawArrays(PrimitiveType.Polygon, p.pos, p.numverts); } } } }
public virtual void R_RenderBrushPoly(msurface_t fa) { c_brush_polys++; image_t image = R_TextureAnimation(fa.texinfo); if ((fa.flags & Defines.SURF_DRAWTURB) != 0) { GL_Bind(image.texnum); GL_TexEnv(( Int32 )All.Modulate); GL.Color4(gl_state.inverse_intensity, gl_state.inverse_intensity, gl_state.inverse_intensity, 1F); EmitWaterPolys(fa); GL_TexEnv(( Int32 )All.Replace); return; } else { GL_Bind(image.texnum); GL_TexEnv(( Int32 )All.Replace); } if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) { DrawGLFlowingPoly(fa.polys); } else { DrawGLPoly(fa.polys); } var gotoDynamic = false; Int32 maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && fa.styles[maps] != ( Byte )255; maps++) { if (r_newrefdef.lightstyles[fa.styles[maps] & 0xFF].white != fa.cached_light[maps]) { gotoDynamic = true; break; } } if (maps == 4) { maps--; } var is_dynamic = false; if (gotoDynamic || (fa.dlightframe == r_framecount)) { if (gl_dynamic.value != 0) { if ((fa.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) == 0) { is_dynamic = true; } } } if (is_dynamic) { if (((fa.styles[maps] & 0xFF) >= 32 || fa.styles[maps] == 0) && (fa.dlightframe != r_framecount)) { Int32 smax, tmax; smax = (fa.extents[0] >> 4) + 1; tmax = (fa.extents[1] >> 4) + 1; R_BuildLightMap(fa, temp2, smax); R_SetCacheState(fa); GL_Bind(gl_state.lightmap_textures + fa.lightmaptexturenum); new Pinnable(temp2, (ptr) => { GL.TexSubImage2D(TextureTarget.Texture2D, 0, fa.light_s, fa.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, PixelType.UnsignedByte, ptr); }); fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum]; gl_lms.lightmap_surfaces[fa.lightmaptexturenum] = fa; } else { fa.lightmapchain = gl_lms.lightmap_surfaces[0]; gl_lms.lightmap_surfaces[0] = fa; } } else { fa.lightmapchain = gl_lms.lightmap_surfaces[fa.lightmaptexturenum]; gl_lms.lightmap_surfaces[fa.lightmaptexturenum] = fa; } }
public virtual void GL_RenderLightmappedPoly(msurface_t surf) { var nv = surf.polys.numverts; Int32 map; image_t image = R_TextureAnimation(surf.texinfo); var is_dynamic = false; var lmtex = surf.lightmaptexturenum; glpoly_t p; var gotoDynamic = false; for (map = 0; map < Defines.MAXLIGHTMAPS && (surf.styles[map] != ( Byte )255); map++) { if (r_newrefdef.lightstyles[surf.styles[map] & 0xFF].white != surf.cached_light[map]) { gotoDynamic = true; break; } } if (map == 4) { map--; } if (gotoDynamic || (surf.dlightframe == r_framecount)) { if (gl_dynamic.value != 0) { if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) == 0) { is_dynamic = true; } } } if (is_dynamic) { Int32 smax, tmax; var handle = GCHandle.Alloc(temp, GCHandleType.Pinned); try { var ptr = handle.AddrOfPinnedObject(); var addr = ptr.ToInt64(); if (((surf.styles[map] & 0xFF) >= 32 || surf.styles[map] == 0) && (surf.dlightframe != r_framecount)) { smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; R_BuildLightMap(surf, temp, smax); R_SetCacheState(surf); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + surf.lightmaptexturenum); lmtex = surf.lightmaptexturenum; GL.TexSubImage2D(TextureTarget.Texture2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, PixelType.UnsignedByte, new IntPtr(addr)); } else { smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; R_BuildLightMap(surf, temp, smax); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + 0); lmtex = 0; GL.TexSubImage2D(TextureTarget.Texture2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, PixelType.UnsignedByte, new IntPtr(addr)); } } finally { handle.Free(); } c_brush_polys++; GL_MBind(TextureUnit.Texture0, image.texnum); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + lmtex); if ((surf.texinfo.flags & Defines.SURF_FLOWING) != 0) { Single scroll; scroll = -64 * ((r_newrefdef.time / 40F) - ( Int32 )(r_newrefdef.time / 40F)); if (scroll == 0F) { scroll = -64F; } for (p = surf.polys; p != null; p = p.chain) { GL.Begin(PrimitiveType.Polygon); for (var i = 0; i < nv; i++) { GL.MultiTexCoord2(TextureUnit.Texture0, p.S1(i) + scroll, p.T1(i)); GL.MultiTexCoord2(TextureUnit.Texture1, p.S2(i), p.T2(i)); GL.Vertex3(p.X(i), p.Y(i), p.Z(i)); } GL.End(); } } else { for (p = surf.polys; p != null; p = p.chain) { GL.Begin(PrimitiveType.Polygon); for (var i = 0; i < nv; i++) { GL.MultiTexCoord2(TextureUnit.Texture0, p.S1(i), p.T1(i)); GL.MultiTexCoord2(TextureUnit.Texture1, p.S2(i), p.T2(i)); GL.Vertex3(p.X(i), p.Y(i), p.Z(i)); } GL.End(); } } } else { c_brush_polys++; GL_MBind(TextureUnit.Texture0, image.texnum); GL_MBind(TextureUnit.Texture1, gl_state.lightmap_textures + lmtex); if ((surf.texinfo.flags & Defines.SURF_FLOWING) != 0) { Single scroll; scroll = -64 * ((r_newrefdef.time / 40F) - ( Int32 )(r_newrefdef.time / 40F)); if (scroll == 0) { scroll = -64F; } for (p = surf.polys; p != null; p = p.chain) { GL.Begin(PrimitiveType.Polygon); for (var i = 0; i < nv; i++) { GL.MultiTexCoord2(TextureUnit.Texture0, p.S1(i) + scroll, p.T1(i)); GL.MultiTexCoord2(TextureUnit.Texture1, p.S2(i), p.T2(i)); GL.Vertex3(p.X(i), p.Y(i), p.Z(i)); } GL.End(); } } else { for (p = surf.polys; p != null; p = p.chain) { GL.Begin(PrimitiveType.Polygon); for (var i = 0; i < nv; i++) { GL.MultiTexCoord2(TextureUnit.Texture0, p.S1(i), p.T1(i)); GL.MultiTexCoord2(TextureUnit.Texture1, p.S2(i), p.T2(i)); GL.Vertex3(p.X(i), p.Y(i), p.Z(i)); } GL.End(); } } } }