private static void UpdateRect(msurface_t fa, ref glRect_t theRect) { if (fa.light_t < theRect.t) { if (theRect.h != 0) { theRect.h += (byte)(theRect.t - fa.light_t); } theRect.t = (byte)fa.light_t; } if (fa.light_s < theRect.l) { if (theRect.w != 0) { theRect.w += (byte)(theRect.l - fa.light_s); } theRect.l = (byte)fa.light_s; } int smax = (fa.extents[0] >> 4) + 1; int tmax = (fa.extents[1] >> 4) + 1; if ((theRect.w + theRect.l) < (fa.light_s + smax)) { theRect.w = (byte)((fa.light_s - theRect.l) + smax); } if ((theRect.h + theRect.t) < (fa.light_t + tmax)) { theRect.h = (byte)((fa.light_t - theRect.t) + tmax); } }
private void UpdateRect(MemorySurface fa, ref glRect_t theRect) { if (fa.light_t < theRect.t) { if (theRect.h != 0) { theRect.h += ( Byte )(theRect.t - fa.light_t); } theRect.t = ( Byte )fa.light_t; } if (fa.light_s < theRect.l) { if (theRect.w != 0) { theRect.w += ( Byte )(theRect.l - fa.light_s); } theRect.l = ( Byte )fa.light_s; } var smax = (fa.extents[0] >> 4) + 1; var tmax = (fa.extents[1] >> 4) + 1; if ((theRect.w + theRect.l) < (fa.light_s + smax)) { theRect.w = ( Byte )((fa.light_s - theRect.l) + smax); } if ((theRect.h + theRect.t) < (fa.light_t + tmax)) { theRect.h = ( Byte )((fa.light_t - theRect.t) + tmax); } }
private static void CommitLightmap(int i) { _LightMapModified[i] = false; glRect_t theRect = _LightMapRectChange[i]; GCHandle handle = GCHandle.Alloc(_LightMaps, GCHandleType.Pinned); try { long addr = handle.AddrOfPinnedObject().ToInt64() + (i * BLOCK_HEIGHT + theRect.t) * BLOCK_WIDTH * _LightMapBytes; GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, theRect.t, BLOCK_WIDTH, theRect.h, Drawer.LightMapFormat, PixelType.UnsignedByte, new IntPtr(addr)); } finally { handle.Free(); } theRect.l = BLOCK_WIDTH; theRect.t = BLOCK_HEIGHT; theRect.h = 0; theRect.w = 0; _LightMapRectChange[i] = theRect; }
private static void UpdateRect(msurface_t fa, ref glRect_t theRect) { if (fa.light_t < theRect.t) { if (theRect.h != 0) theRect.h += (byte)(theRect.t - fa.light_t); theRect.t = (byte)fa.light_t; } if (fa.light_s < theRect.l) { if (theRect.w != 0) theRect.w += (byte)(theRect.l - fa.light_s); theRect.l = (byte)fa.light_s; } int smax = (fa.extents[0] >> 4) + 1; int tmax = (fa.extents[1] >> 4) + 1; if ((theRect.w + theRect.l) < (fa.light_s + smax)) theRect.w = (byte)((fa.light_s - theRect.l) + smax); if ((theRect.h + theRect.t) < (fa.light_t + tmax)) theRect.h = (byte)((fa.light_t - theRect.t) + tmax); }