public override void BindTexture(int texId) { curTexture = textures[texId]; curTexPixels = curTexture.Pixels; curTexWidth = curTexture.Width; curTexHeight = curTexture.Height; }
public override void UpdateTexturePart(int texId, int texX, int texY, FastBitmap part, bool mipmaps) { TexObject tex = textures[texId]; fixed(int *texPtr = tex.Pixels) { int *dst = texPtr + (texY * tex.Width) + texX; for (int y = 0; y < part.Height; y++) { memcpy((IntPtr)part.GetRowPtr(y), (IntPtr)dst, part.Width * 4); dst += part.Width; } } }
protected unsafe override int CreateTexture(int width, int height, IntPtr scan0, bool managedPool, bool mipmaps) { int[] pixels = new int[width * height]; fixed(int *texPtr = pixels) { memcpy(scan0, (IntPtr)texPtr, width * height * 4); } TexObject obj = new TexObject(); obj.Pixels = pixels; obj.Width = width; obj.Height = height; return(GetOrExpand(ref textures, obj, texBufferSize)); }