public void TestExportTextureToBitmap() { // Given var fileName = @"C:\Sierra\Half-Life\valve\maps\hldemo1.bsp"; var wadFileNames = new string[] { @"C:\Sierra\Half-Life\valve\halflife.wad" }; var loader = new BspLoader(fileName); var map = loader.Load(); var wadLoader = new WadLoader(map, fileName, wadFileNames); var textures = wadLoader.Load(); if (!Directory.Exists("Textures")) { Directory.CreateDirectory("Textures"); } // When foreach (var texture in textures) { using (var bitmap = TexUtil.PixelsToTexture(texture.TextureData, texture.Width, texture.Height, 4)) { bitmap.Save("Textures\\" + texture.Name + ".bmp"); } } // Then foreach (var texture in textures) { var isExisting = File.Exists("Textures\\" + texture.Name + ".bmp"); Assert.IsTrue(isExisting); } }
public static void Initialize() { RAM = new RAMSegmentStruct[16]; byte[] TextureBuffer = new byte[32 * 32 * 4]; TextureBuffer.Fill(new byte[] { 0xFF, 0x00, 0xFF, 0xFF }); InvalidTextureID = TexUtil.CreateRGBATexture(32, 32, TextureBuffer); }
private Sprite CreateTravelatorSprite(int roomID, int index) { var srcRect = new Rect((7 + index) * 8, (19 - roomID) * 8, 8, 8); var tex = SpriteUtil.CreateTexture(8, 8); TexUtil.Blit(_roomProvider._blocks, tex, srcRect, Vector2.zero); return(Sprite.Create(tex, new Rect(0, 0, 8, 8), new Vector2(0, 1), 1)); }
public Texture(Bitmap Bmp) { Width = Bmp.Width; Height = Bmp.Height; Id = TexUtil.CreateTextureFromBitmap(Bmp); Animated = false; }
public ObjFile(string Filename, bool IgnoreMats) { _IgnoreMaterials = IgnoreMats; TexUtil.InitTexturing(); if (Filename != string.Empty) { ParseObj(Filename); } }
public Texture(Bitmap Bmp, int Frames) { Width = Bmp.Width / Frames; Height = Bmp.Height; Id = TexUtil.CreateTextureFromBitmap(Bmp); this.Frames = Frames; Animated = true; }
public Texture(string Path) { var Bmp = new Bitmap(Path); Width = Bmp.Width; Height = Bmp.Height; Id = TexUtil.CreateTextureFromBitmap(Bmp); Animated = false; }
public Texture(string Path, int Frames) { var Bmp = new Bitmap(Path); Width = Bmp.Width / Frames; Height = Bmp.Height; Id = TexUtil.CreateTextureFromBitmap(Bmp); this.Frames = Frames; Animated = true; }
public Image(String path) { if (!System.IO.File.Exists(path)) { Console.Error.Write("File not found:" + path); return; } _path = path; _id = TexUtil.CreateTextureFromFile(path, out _width, out _height); color = new Color4(255, 255, 255, 255); }
private void ApplyText(TextData text) { text.Texture.Clear(Color.clear); var topY = 184; // Font image is 192px tall, -8 for the actual row for (int i = 0; i < text.Text.Length || i == 31; i++) { var ord = (text.Text[i] - ' '); var x = 8 * (ord % 32); var y = topY - (text.FontColour * 24) - (8 * (ord / 32)); TexUtil.Blit(_font, text.Texture, new Rect(x, y, 8, 8), new Vector2(i * 8, 0)); } }
/// <summary> /// [Re-]generate the terrain data. /// </summary> /// <param name="iterations">Number of subdivision iteratons.</param> /// <param name="roughness">Roughness parameter.</param> /// <param name="param">Optional text parameter.</param> private void Regenerate(int iterations, float roughness, string param) { // !!!{{ TODO: add terrain regeneration code here (to reflect the given terrain parameters) scene.Reset(); // dummy rectangle, facing to the camera // notice that your terrain is supposed to be placed // in the XZ plane (elevation increases along the positive Y axis) scene.AddVertex(new Vector3(-0.5f, roughness, -0.5f)); // 0 scene.AddVertex(new Vector3(-0.5f, 0.0f, +0.5f)); // 1 scene.AddVertex(new Vector3(+0.5f, 0.0f, -0.5f)); // 2 scene.AddVertex(new Vector3(+0.5f, 0.0f, +0.5f)); // 3 scene.SetNormal(0, (Vector3.UnitY + roughness * (Vector3.UnitX + Vector3.UnitZ)).Normalized()); scene.SetNormal(1, (Vector3.UnitY + roughness * 0.5f * (Vector3.UnitX + Vector3.UnitZ)).Normalized()); scene.SetNormal(2, (Vector3.UnitY + roughness * 0.5f * (Vector3.UnitX + Vector3.UnitZ)).Normalized()); scene.SetNormal(3, Vector3.UnitY); float txtExtreme = 1.0f + iterations; scene.SetTxtCoord(0, new Vector2(0.0f, 0.0f)); scene.SetTxtCoord(1, new Vector2(0.0f, txtExtreme)); scene.SetTxtCoord(2, new Vector2(txtExtreme, 0.0f)); scene.SetTxtCoord(3, new Vector2(txtExtreme, txtExtreme)); scene.SetColor(0, Vector3.UnitX); // red scene.SetColor(1, Vector3.UnitY); // green scene.SetColor(2, Vector3.UnitZ); // blue scene.SetColor(3, new Vector3(1.0f, 1.0f, 1.0f)); // white scene.AddTriangle(1, 2, 0); // last vertex is red scene.AddTriangle(2, 1, 3); // last vertex is white // this function uploads the data to the graphics card PrepareData(); // load a texture if (textureId > 0) { GL.DeleteTexture(textureId); textureId = 0; } textureId = TexUtil.CreateTextureFromFile("cgg256.png", "../../cgg256.png"); // simulation / hovercraft [re]initialization? InitSimulation(false); // !!!}} }
public void Generate_Blank_Tile_Texture() { byte[] singleTileImage = new byte[32 * 32 * 4]; var pixel = new byte[4] { Tile0Color.R, Tile0Color.G, Tile0Color.B, 255 }; for (ushort i = 0; i < singleTileImage.Length; i++) { singleTileImage[i] = pixel[i % 4]; } ImageAtlas = TexUtil.CreateRGBATexture(32, 32, singleTileImage); AtlasLength = 1; AtlasFraction = 1; }
private void LoadTextures() { string LoadPath = string.Empty; for (int i = 0; i < _Mats.Count; i++) { if (_Mats[i].map_Ka != null) { try { if (GL.IsTexture(_Mats[i].GLID) == true) { GL.DeleteTexture(_Mats[i].GLID); } if (_Mats[i].TexImage != null) { _Mats[i].TexImage.Dispose(); } LoadPath = Path.IsPathRooted(_Mats[i].map_Ka) == true ? _Mats[i].map_Ka : _BasePath + _Mats[i].map_Ka; if (ValidImageTypes.IndexOf(Path.GetExtension(LoadPath).ToLowerInvariant()) == -1) { throw new Exception(); } _Mats[i].TexImage = new Bitmap(Bitmap.FromFile(LoadPath)); _Mats[i].GLID = TexUtil.CreateTextureFromBitmap(_Mats[i].TexImage); _Mats[i].Width = _Mats[i].TexImage.Width; _Mats[i].Height = _Mats[i].TexImage.Height; } catch (FileNotFoundException) { MessageBox.Show("Texture image " + LoadPath + " not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); continue; } catch (Exception) { MessageBox.Show("Texture image " + LoadPath + " is in " + Path.GetExtension(LoadPath).ToUpperInvariant().Substring(1) + " format and cannot be loaded!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); continue; } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); GL.Enable(EnableCap.DepthTest); TexUtil.InitTexturing(); GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); GL.DepthFunc(DepthFunction.Lequal); GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse); GL.Enable(EnableCap.ColorMaterial); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Ext.BindFramebuffer(FramebufferTarget.FramebufferExt, 0); // render per default onto screen, not some FBO OpenVideoStream(); }
private void AddCrumbleBlock(object sender, PositionalWithSourceEventArgs e) { var tex = SpriteUtil.CreateTexture(8, 8); TexUtil.Blit(_roomProvider._blocks, tex, new Rect(e.SrcX, e.SrcY, 8, 8), Vector2.zero); var go = new GameObject("CrumbleBlock"); go.tag = "Crumble"; go.transform.SetParent(gameObject.transform); go.transform.localPosition = new Vector3(e.X, e.Y); var boxCollider = go.AddComponent <BoxCollider2D>(); boxCollider.size = new Vector2(8, 8); boxCollider.isTrigger = true; boxCollider.offset = new Vector2(4, -4); var sr = go.AddComponent <SpriteRenderer>(); sr.sprite = Sprite.Create(tex, new Rect(0, 0, 8, 8), new Vector2(0, 1), 1); }
public static void ProduceEventIcons(Version version, string[][] StringList, bool overwriteOldImage = false) { if (!overwriteOldImage && EventAtlas[version] != 0) { return; } RectangleF rectE = new RectangleF(-16, 0, 64, 32); using (SolidBrush white = new SolidBrush(Color.White)) using (Font arial = new Font(new FontFamily("Arial"), 8)) using (Bitmap text_bmp = new Bitmap(512, 512)) using (Graphics totalgfx = Graphics.FromImage(text_bmp)) using (StringFormat formatEvent = new StringFormat()) { formatEvent.Alignment = formatEvent.LineAlignment = StringAlignment.Center; totalgfx.Clear(Color.FromArgb(128, 0, 0, 0)); for (int i = 1; i < 256; i++) { using (Bitmap single_bmp = new Bitmap(32, 32)) using (Graphics gfx = Graphics.FromImage(single_bmp)) { if (StringList[i].Length > 4 && StringList[i][4].TrimEnd() != "") { gfx.DrawString(StringList[i][3] + "\n" + StringList[i][4], arial, white, rectE, formatEvent); } else { gfx.DrawString(StringList[i][3], arial, white, rectE, formatEvent); } totalgfx.DrawImage(single_bmp, i % 16 * 32, i / 16 * 32); } } if (EventAtlas[version] != 0) { GL.DeleteTexture(EventAtlas[version]); } EventAtlas[version] = TexUtil.CreateTextureFromBitmap(text_bmp); } }
private void RenderBackground(MMRoom room) { var spriteRenderer = GetComponent <SpriteRenderer>(); var texture = SpriteUtil.CreateTexture(256, 128); texture.filterMode = FilterMode.Point; var roomBlockOffsetY = (19 - _controller._roomID) * 8; for (int y = 0; y < 16; y++) { for (int x = 0; x < 32; x++) { var block = room.blocks[(y * 32) + x]; if (Array.IndexOf(IGNORE_BLOCKS, block) > -1) { // If it's a travelator or a crumble block // we don't want to show it. Those are handled separately. if (block == CRUMBLE_BLOCK) { AddCrumbleBlock?.Invoke(this, new PositionalWithSourceEventArgs(x * 8, (-y) * 8, 8 * block, roomBlockOffsetY)); } block = 0; } var roomBlockOffsetX = 8 * block; var srcRect = new Rect(roomBlockOffsetX, roomBlockOffsetY, 8, 8); var pos = new Vector2(x * 8, (15 - y) * 8); if (Array.IndexOf(KILLY_BLOCKS, block) > -1) { AddKillBlock?.Invoke(this, new PositionalEventArgs(x * 8, (-y) * 8)); } TexUtil.Blit(_blocks, texture, srcRect, pos); } } spriteRenderer.sprite = Sprite.Create(texture, new Rect(0, 0, 256, 128), new Vector2(0, 1), 1); }
public static void ProduceTypeIcons(Version version, IniFile typeIni, bool overwriteOldImage = false) { if (!overwriteOldImage && TileTypeAtlas[version] != 0) { return; } RectangleF rectT = new RectangleF(-2, 0, 256, 32); using (SolidBrush white = new SolidBrush(Color.White)) using (Font arial = new Font(new FontFamily("Arial"), 8)) using (Bitmap type_bmp = new Bitmap(128, 128)) using (Graphics totalgfx = Graphics.FromImage(type_bmp)) using (StringFormat formatType = new StringFormat()) { formatType.LineAlignment = StringAlignment.Center; formatType.Alignment = StringAlignment.Near; totalgfx.Clear(Color.FromArgb(128, 0, 0, 0)); TileTypeNames[version] = new string[16]; for (int i = 1; i < 16; i++) { if ((TileTypeNames[version][i] = typeIni.IniReadValue("Tiles", i.ToString()) ?? "") != "") { using (Bitmap single_bmp = new Bitmap(32, 32)) using (Graphics gfx = Graphics.FromImage(single_bmp)) { gfx.DrawString(typeIni.IniReadValue("Tiles", i.ToString()), arial, white, rectT, formatType); totalgfx.DrawImage(single_bmp, i % 4 * 32, i / 4 * 32); } } } if (TileTypeAtlas[version] != 0) { GL.DeleteTexture(TileTypeAtlas[version]); } TileTypeAtlas[version] = TexUtil.CreateTextureFromBitmap(type_bmp); } }
/** * Dessine le joueur en OpenGl. * La position du mur est nécessaire afin de positionner correctement le joueur, qui suit le mur. */ public void draw(double wallPosition) { wallPosition -= 5; if (bitmapSource != null) { playerTextureId = TexUtil.CreateTextureFromBitmap(Util.GetBitmap(bitmapSource)); //La silhouette du joueur GL.BindTexture(TextureTarget.Texture2D, playerTextureId); GL.Begin(BeginMode.Quads); GL.TexCoord2(0, 0); GL.Vertex3(-Wall.wallWidth, wallPosition, Wall.wallHeight); GL.TexCoord2(1, 0); GL.Vertex3(Wall.wallWidth, wallPosition, Wall.wallHeight); GL.TexCoord2(1, 1); GL.Vertex3(Wall.wallWidth, wallPosition, 0); GL.TexCoord2(0, 1); GL.Vertex3(-Wall.wallWidth, wallPosition, 0); GL.Color3(System.Drawing.Color.White); GL.End(); //Nettoyer la texture du joueur (pour éviter une fuite mémoire) GL.DeleteTexture(playerTextureId); } }
protected override void OnRenderFrame(FrameEventArgs e) { base.OnRenderFrame(e); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); // use the visible framebuffer GL.ClearColor(0.5f, 0.5f, 0.55f, 0.0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height); Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, -1 * Vector3.UnitZ, Vector3.UnitY); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref modelview); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(-1, 1, -1, 1, -1, 1.1); if (videoFrame != null) { lock (videoFrame) { if (videoTexture != -1) { GL.DeleteTextures(1, ref videoTexture); } videoTexture = TexUtil.CreateTextureFromBitmap(videoFrame); GL.BindTexture(TextureTarget.Texture2D, videoTexture); videoFrame.Dispose(); videoFrame = null; } } GC.Collect(); fullscreenQuad.Draw(); SwapBuffers(); }
public void Generate_Textures(TransparencySource source = TransparencySource.JJ2_Style, bool includeMasks = false, Palette palette = null) { Color usedColor = Tile0Color; var transformation = TileTypeColorTransformations[VersionType]; if (palette == null) { palette = Palette; } byte[][] workingAtlases = new byte[2][]; for (byte i = 0; i < 5; i++) { if (TileCount < 16 << (i * 2)) { AtlasLength = 128 << i; workingAtlases[0] = new byte[AtlasLength * AtlasLength * 4]; if (includeMasks) { workingAtlases[1] = new byte[AtlasLength * AtlasLength * 4]; } AtlasLength /= 32; AtlasFraction = 1.0d / AtlasLength; break; } } for (ushort tileInLevelID = 0; tileInLevelID < TileCount; tileInLevelID++) { J2TFile J2T; uint tileInTilesetID = getTileInTilesetID(tileInLevelID, out J2T); bool customTileImage; byte[] tileTrans; byte[] tile = PlusPropertyList.TileImages[tileInLevelID]; if (!(customTileImage = (tile != null))) { tile = J2T.Images[J2T.ImageAddress[tileInTilesetID]]; tileTrans = ((source == TransparencySource.JJ2_Style) ? J2T.TransparencyMaskJJ2_Style : J2T.TransparencyMaskJCS_Style)[Array.BinarySearch(J2T.TransparencyMaskOffset, 0, (int)J2T.data3Counter, J2T.TransparencyMaskAddress[tileInTilesetID])]; } else { tileTrans = tile; } var colorRemapping = (J2T.ColorRemapping == null || customTileImage) ? J2TFile.DefaultColorRemapping : J2T.ColorRemapping; var mask = PlusPropertyList.TileMasks[tileInLevelID] ?? J2T.Masks[J2T.MaskAddress[tileInTilesetID]]; for (short j = 0; j < 32 * 32 * 4; j += 4) { bool transparentPixel = tileTrans[j / 4] == 0; var color = Palette.Convert(!transparentPixel ? transformation(palette[colorRemapping[tile[j / 4]]], TileTypes[tileInLevelID]) : usedColor, true); if (transparentPixel) { color[3] = 0; } for (byte k = 0; k < 4; k++) { int atlasDrawingLocation = tileInLevelID % AtlasLength * 128 + tileInLevelID / AtlasLength * AtlasLength * 4096 + j % 128 + j / 128 * AtlasLength * 128 + k; workingAtlases[0][atlasDrawingLocation] = color[k]; if (includeMasks) { workingAtlases[1][atlasDrawingLocation] = (k == 3) ? (mask[j / 4] == 1) ? (byte)196 : (byte)0 : (mask[j / 4] == 1) ? (byte)0 : GetLevelFromColor(usedColor, k); } } } if (tileInLevelID == 0) { usedColor = TranspColor; } } ImageAtlas = TexUtil.CreateRGBATexture(AtlasLength * 32, AtlasLength * 32, workingAtlases[0]); if (includeMasks) { MaskAtlas = TexUtil.CreateRGBATexture(AtlasLength * 32, AtlasLength * 32, workingAtlases[1]); } }
public static Texex2 Load(Stream fs) { var texex = new Texex2(); var binaryReader = new BinaryReader(fs); fs.Position = 8L; binaryReader.ReadInt32(); int num = binaryReader.ReadInt32(); int num2 = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); int num4 = binaryReader.ReadInt32(); fs.Position = num2; byte[] array = binaryReader.ReadBytes(num); fs.Position = 28L; int num5 = binaryReader.ReadInt32(); int num6 = binaryReader.ReadInt32(); fs.Position = num3; binaryReader.ReadBytes(num4 - num3); fs.Position = num4; binaryReader.ReadBytes(num5 - num4); fs.Position = num5; binaryReader.ReadBytes(num6 - num5); binaryReader.ReadBytes(Convert.ToInt32(fs.Length) - 4 - num6); var array2 = new byte[4194304]; for (int i = 0; i < num; i++) { for (int j = 0; j < 2; j++) { int num7 = (j == 0) ? 0 : (1 + array[i]); fs.Position = num3 + 144 * num7 + 32; ulong num8 = binaryReader.ReadUInt64(); int num9 = (int)(num8 >> 32) & 16383; int num10 = (int)(num8 >> 48) & 63; int num11 = (int)(num8 >> 56) & 63; Trace.Assert(binaryReader.ReadUInt64() == 80uL, "Unexpected texture format"); fs.Position = num3 + 144 * num7 + 64; ulong num12 = binaryReader.ReadUInt64(); Trace.Assert(binaryReader.ReadUInt64() == 82uL, "Unexpected texture format"); fs.Position = num3 + 144 * num7 + 96; ulong num13 = binaryReader.ReadUInt64(); int num14 = (int)num13 & 16383; fs.Position = num3 + 144 * num7 + 112; ulong num15 = binaryReader.ReadUInt64(); int num16 = (int)num15 & 16383; int num17 = (int)(num15 >> 32) & 2147483647; Trace.Assert(num14 == num16, "Unexpected texture format"); fs.Position = num17; var array3 = new byte[16 * num16]; fs.Read(array3, 0, 16 * num16); Trace.Assert(num11 == 0, "Unexpected texture format"); int bh = Convert.ToInt32(array3.Length) / 8192 / num10; array3 = Reform32.Encode32(array3, num10, bh); Array.Copy(array3, 0, array2, 256 * num9, 16 * num16); Console.Write(""); } fs.Position = num4 + 160 * i + 32; ulong num18 = binaryReader.ReadUInt64(); Trace.Assert(num18 == 0uL, "Unexpected texture format"); Trace.Assert(binaryReader.ReadUInt64() == 63uL, "Unexpected texture format"); fs.Position = num4 + 160 * i + 48; ulong num19 = binaryReader.ReadUInt64(); Trace.Assert(num19 == 0uL, "Unexpected texture format"); Trace.Assert(binaryReader.ReadUInt64() == 52uL, "Unexpected texture format"); fs.Position = num4 + 160 * i + 64; ulong num20 = binaryReader.ReadUInt64(); Trace.Assert(num20 == 0uL, "Unexpected texture format"); Trace.Assert(binaryReader.ReadUInt64() == 54uL, "Unexpected texture format"); fs.Position = num4 + 160 * i + 80; ulong num21 = binaryReader.ReadUInt64(); Trace.Assert(binaryReader.ReadUInt64() == 22uL, "Unexpected texture format"); fs.Position = num4 + 160 * i + 112; ulong num22 = binaryReader.ReadUInt64(); int num23 = (int)num22 & 16383; int tbw = (int)(num22 >> 14) & 63; int num24 = (int)(num22 >> 20) & 63; int num25 = (int)(num22 >> 26) & 15; int num26 = (int)(num22 >> 30) & 15; int num27 = (int)(num22 >> 37) & 16383; Trace.Assert(binaryReader.ReadUInt64() == 6uL, "Unexpected texture format"); int num28 = (1 << num25) * (1 << num26); var array4 = new byte[num28]; Array.Copy(array2, 256 * num23, array4, 0, array4.Length); var array5 = new byte[8192]; Array.Copy(array2, 256 * num27, array5, 0, array5.Length); STim item = null; if (num24 == 19) { item = TexUtil.Decode8(array4, array5, tbw, 1 << num25, 1 << num26); } if (num24 == 20) { item = TexUtil.Decode4(array4, array5, tbw, 1 << num25, 1 << num26); } texex.alt.Add(item); } int num29 = 0; while (num29 < fs.Length) { fs.Position = num29; byte[] array6 = binaryReader.ReadBytes(16); if (array6[0] == 95 && array6[1] == 68 && array6[2] == 77 && array6[3] == 89 && array6[8] == 84 && array6[9] == 69 && array6[10] == 88 && array6[11] == 65) { fs.Position = num29 + 16 + 2; int texi = binaryReader.ReadUInt16(); fs.Position = num29 + 16 + 12; binaryReader.ReadUInt16(); int num30 = binaryReader.ReadUInt16(); int px = binaryReader.ReadUInt16(); int py = binaryReader.ReadUInt16(); int num31 = binaryReader.ReadUInt16(); int num32 = binaryReader.ReadUInt16(); int num33 = binaryReader.ReadInt32(); int num34 = binaryReader.ReadInt32(); int num35 = binaryReader.ReadInt32(); fs.Position = num29 + 16 + num35; byte[] bits = binaryReader.ReadBytes(num31 * num32 * num30); Patc patc; texex.alp.Add(patc = new Patc(bits, px, py, num31, num32, num30, texi)); int num36 = num29 + 16; int num37 = (num34 - num33) / 2; var list = new List <Texfac>(); for (int k = 0; k < num37; k++) { fs.Position = num36 + num33 + 2 * k; int num38 = binaryReader.ReadInt16() - 1; if (num38 >= 0) { fs.Position = num36 + num34 + 4 * num38; int num39 = binaryReader.ReadInt32(); fs.Position = num36 + num39; int num40 = 0; Texfac texfac; do { texfac = new Texfac(); texfac.i0 = k; texfac.i1 = num38; texfac.i2 = num40; texfac.v0 = binaryReader.ReadInt16(); texfac.v2 = binaryReader.ReadInt16(); texfac.v4 = binaryReader.ReadInt16(); texfac.v6 = binaryReader.ReadInt16(); list.Add(texfac); num40++; } while (texfac.v0 >= 0); } } patc.altf = list.ToArray(); } num29 += 16; } return(texex); }