public Ilm(IlmHeader h, byte[] bytes, float scale) { Header = h; Scale = scale; int textureBase = (int)(Header.TexturePointer - Header.BaseAddress); int textureByteCount = sizeof(int) * 6; for (int i = 0; i < Header.TextureCount; i++) { int offset = textureBase + (textureByteCount * i); var utf = new UTF8Encoding(); string raw = utf.GetString(bytes, offset, textureByteCount); // Each texture listing is 6 32-bit words, and though they start // out padded with zeroes in their file on disk, once loaded in // RAM they have other, as yet undeciphered data after the name. int nullIndex = raw.IndexOf('\0'); if (nullIndex >= 0) { raw = raw.Remove(nullIndex); } Textures.Add(raw); } int submeshStartOffset = textureBase + (textureByteCount * Header.TextureCount); int submeshListingByteCount = 16; for (int i = 0; i < Header.SubmeshCount; i++) { int offset = submeshStartOffset + (submeshListingByteCount * i); var mesh = new Submesh(bytes.Skip(offset).ToArray(), Header.BaseAddress + offset, Scale); Submeshes.Add(mesh); } }
public Ilm(IlmHeader h, List <byte> bytes, float scale) : this(h, bytes.ToArray(), scale) { }
public Ilm(IlmHeader h, byte[] bytes) : this(h, bytes.ToArray(), 1.0f) { }
public Ilm(IlmHeader h, List <byte> bytes) : this(h, bytes.ToArray()) { }