public static TextureEntry FromLLSD(LLSD llsd) { LLSDArray array = (LLSDArray)llsd; LLSDMap faceLLSD; if (array.Count > 0) { int faceNumber; faceLLSD = (LLSDMap)array[0]; TextureEntryFace defaultFace = TextureEntryFace.FromLLSD(faceLLSD, null, out faceNumber); TextureEntry te = new TextureEntry(defaultFace); for (int i = 1; i < array.Count; i++) { TextureEntryFace tex = TextureEntryFace.FromLLSD(array[i], defaultFace, out faceNumber); if (faceNumber >= 0 && faceNumber < te.FaceTextures.Length) { te.FaceTextures[faceNumber] = tex; } } return(te); } else { throw new ArgumentException("LLSD contains no elements"); } }
public static TextureEntryFace FromLLSD(LLSD llsd, TextureEntryFace defaultFace, out int faceNumber) { LLSDMap map = (LLSDMap)llsd; TextureEntryFace face = new TextureEntryFace(defaultFace); faceNumber = (map.ContainsKey("face_number")) ? map["face_number"].AsInteger() : -1; LLColor rgba = face.RGBA; rgba.FromLLSD(map["colors"]); face.RGBA = rgba; face.RepeatU = (float)map["scales"].AsReal(); face.RepeatV = (float)map["scalet"].AsReal(); face.OffsetU = (float)map["offsets"].AsReal(); face.OffsetV = (float)map["offsett"].AsReal(); face.Rotation = (float)map["imagerot"].AsReal(); face.Bump = (Bumpiness)map["bump"].AsInteger(); face.Shiny = (Shininess)map["shiny"].AsInteger(); face.Fullbright = map["fullbright"].AsBoolean(); face.MediaFlags = map["media_flags"].AsBoolean(); face.TexMapType = (MappingType)map["mapping"].AsInteger(); face.Glow = (float)map["glow"].AsReal(); face.TextureID = map["imageid"].AsUUID(); return(face); }
/// <summary> /// This will either create a new face if a custom face for the given /// index is not defined, or return the custom face for that index if /// it already exists /// </summary> /// <param name="index">The index number of the face to create or /// retrieve</param> /// <returns>A TextureEntryFace containing all the properties for that /// face</returns> public TextureEntryFace CreateFace(uint index) { if (!FaceTextures.ContainsKey(index)) { FaceTextures[index] = new TextureEntryFace(this.DefaultTexture); } return(FaceTextures[index]); }
/// <summary> /// Contains the definition for individual faces /// </summary> /// <param name="defaultTexture"></param> public TextureEntryFace(TextureEntryFace defaultTexture) { DefaultTexture = defaultTexture; if (DefaultTexture == null) { hasAttribute = TextureAttributes.All; } else { hasAttribute = TextureAttributes.None; } }
/// <summary> /// This will either create a new face if a custom face for the given /// index is not defined, or return the custom face for that index if /// it already exists /// </summary> /// <param name="index">The index number of the face to create or /// retrieve</param> /// <returns>A TextureEntryFace containing all the properties for that /// face</returns> public TextureEntryFace CreateFace(uint index) { if (index >= MAX_FACES) { throw new Exception(index + " is outside the range of MAX_FACES"); } if (FaceTextures[index] == null) { FaceTextures[index] = new TextureEntryFace(this.DefaultTexture); } return(FaceTextures[index]); }
/// <summary> /// Constructor that takes a <code>TextureEntryFace</code> for the /// default face /// </summary> /// <param name="defaultFace">Face to use as the default face</param> public TextureEntry(TextureEntryFace defaultFace) { DefaultTexture = new TextureEntryFace(null); DefaultTexture.Bump = defaultFace.Bump; DefaultTexture.Fullbright = defaultFace.Fullbright; DefaultTexture.MediaFlags = defaultFace.MediaFlags; DefaultTexture.OffsetU = defaultFace.OffsetU; DefaultTexture.OffsetV = defaultFace.OffsetV; DefaultTexture.RepeatU = defaultFace.RepeatU; DefaultTexture.RepeatV = defaultFace.RepeatV; DefaultTexture.RGBA = defaultFace.RGBA; DefaultTexture.Rotation = defaultFace.Rotation; DefaultTexture.Glow = defaultFace.Glow; DefaultTexture.Shiny = defaultFace.Shiny; DefaultTexture.TexMapType = defaultFace.TexMapType; DefaultTexture.TextureID = defaultFace.TextureID; }
private void FromBytes(byte[] data, int pos, int length) { FaceTextures = new SerializableDictionary <uint, TextureEntryFace>(); DefaultTexture = new TextureEntryFace(null); if (length <= 0) { return; // No TextureEntry to process } uint BitfieldSize = 0; uint faceBits = 0; int i = pos; //Read TextureID --------------------------------------- DefaultTexture.TextureID = new LLUUID(data, i); i += 16; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { LLUUID tmpUUID = new LLUUID(data, i); i += 16; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).TextureID = tmpUUID; } } } //Read RGBA -------------------------------------------- DefaultTexture.RGBA = (uint)(data[i] + (data[i + 1] << 8) + (data[i + 2] << 16) + (data[i + 3] << 24)); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { uint tmpUint = (uint)(data[i] + (data[i + 1] << 8) + (data[i + 2] << 16) + (data[i + 3] << 24)); i += 4; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).RGBA = tmpUint; } } } //Read RepeatU ----------------------------------------- DefaultTexture.RepeatU = RepeatFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = RepeatFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).RepeatU = tmpFloat; } } } //Read RepeatV ----------------------------------------- DefaultTexture.RepeatV = RepeatFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = RepeatFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).RepeatV = tmpFloat; } } } //Read OffsetU ----------------------------------------- DefaultTexture.OffsetU = OffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = OffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).OffsetU = tmpFloat; } } } //Read OffsetV ----------------------------------------- DefaultTexture.OffsetV = OffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = OffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).OffsetV = tmpFloat; } } } //Read Rotation ---------------------------------------- DefaultTexture.Rotation = RotationFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = RotationFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).Rotation = tmpFloat; } } } //Read Flags1 ------------------------------------------ DefaultTexture.Flags1 = data[i]; i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).Flags1 = tmpByte; } } } //Read Flags2 ------------------------------------------ DefaultTexture.Flags2 = data[i]; i++; while (i - pos < length && ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).Flags2 = tmpByte; } } } }
/// <summary> /// Constructor that takes a default texture UUID /// </summary> /// <param name="defaultTextureID">Texture UUID to use as the default texture</param> public TextureEntry(LLUUID defaultTextureID) { DefaultTexture = new TextureEntryFace(null); DefaultTexture.TextureID = defaultTextureID; }
/// <summary> /// Default constructor, DefaultTexture will be null /// </summary> //public TextureEntry2() //{ // DefaultTexture = null; // FaceTextures = new TextureEntryFace[0]; //} /// <summary> /// Constructor that takes a default texture UUID /// </summary> /// <param name="defaultTextureID">Texture UUID to use as the default texture</param> public TextureEntry2(LLUUID defaultTextureID) { DefaultTexture = new TextureEntryFace(null); DefaultTexture.TextureID = defaultTextureID; FaceTextures = new TextureEntryFace[MAX_FACES]; }
private void FromBytes(byte[] data, int pos, int length) { FaceTextures = new SerializableDictionary<uint, TextureEntryFace>(); DefaultTexture = new TextureEntryFace(null); if (length <= 0) return; // No TextureEntry to process uint BitfieldSize = 0; uint faceBits = 0; int i = pos; //Read TextureID --------------------------------------- DefaultTexture.TextureID = new LLUUID(data, i); i += 16; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { LLUUID tmpUUID = new LLUUID(data, i); i += 16; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).TextureID = tmpUUID; } //Read RGBA -------------------------------------------- DefaultTexture.RGBA = (uint)(data[i] + (data[i + 1] << 8) + (data[i + 2] << 16) + (data[i + 3] << 24)); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { uint tmpUint = (uint)(data[i] + (data[i + 1] << 8) + (data[i + 2] << 16) + (data[i + 3] << 24)); i += 4; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).RGBA = tmpUint; } //Read RepeatU ----------------------------------------- DefaultTexture.RepeatU = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = Helpers.BytesToFloat(data, i); i += 4; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).RepeatU = tmpFloat; } //Read RepeatV ----------------------------------------- DefaultTexture.RepeatV = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = Helpers.BytesToFloat(data, i); i += 4; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).RepeatV = tmpFloat; } //Read OffsetU ----------------------------------------- DefaultTexture.OffsetU = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = Helpers.TEOffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).OffsetU = tmpFloat; } //Read OffsetV ----------------------------------------- DefaultTexture.OffsetV = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = Helpers.TEOffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).OffsetV = tmpFloat; } //Read Rotation ---------------------------------------- DefaultTexture.Rotation = Helpers.TERotationFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { float tmpFloat = Helpers.TERotationFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).Rotation = tmpFloat; } //Read Material Flags ------------------------------------------ DefaultTexture.material = data[i]; i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).material = tmpByte; } //Read Media Flags ------------------------------------------ DefaultTexture.media = data[i]; i++; while (i - pos < length && ReadFaceBitfield(data, ref i, ref faceBits, ref BitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < BitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).media = tmpByte; } }
/// <summary> /// /// </summary> public TextureEntry() { FaceTextures = new Dictionary <uint, TextureEntryFace>(); DefaultTexture = new TextureEntryFace(null); }
/// <summary> /// Contains the definition for individual faces /// </summary> /// <param name="defaultTexture"></param> public TextureEntryFace(TextureEntryFace defaultTexture) { DefaultTexture = defaultTexture; if (DefaultTexture == null) hasAttribute = TextureAttributes.All; else hasAttribute = TextureAttributes.None; }
/// <summary> /// Constructor that takes a default texture UUID /// </summary> /// <param name="defaultTextureID">Texture UUID to use as the default texture</param> public TextureEntry(LLUUID defaultTextureID) { DefaultTexture = new TextureEntryFace(null); DefaultTexture.TextureID = defaultTextureID; FaceTextures = new SerializableDictionary<uint, TextureEntryFace>(); }
/// <summary> /// Default constructor, DefaultTexture will be null /// </summary> public TextureEntry() { DefaultTexture = null; FaceTextures = new SerializableDictionary<uint, TextureEntryFace>(); }
/// <summary> /// Contains the definition for individual faces /// </summary> /// <param name="defaultTexture"></param> public TextureEntryFace(TextureEntryFace defaultTexture) { repeatU = 1.0f; repeatV = 1.0f; DefaultTexture = defaultTexture; if (DefaultTexture == null) hasAttribute = TextureAttributes.All; else hasAttribute = TextureAttributes.None; }
/// <summary> /// This will either create a new face if a custom face for the given /// index is not defined, or return the custom face for that index if /// it already exists /// </summary> /// <param name="index">The index number of the face to create or /// retrieve</param> /// <returns>A TextureEntryFace containing all the properties for that /// face</returns> public TextureEntryFace CreateFace(uint index) { if (index >= MAX_FACES) throw new Exception(index + " is outside the range of MAX_FACES"); if (FaceTextures[index] == null) FaceTextures[index] = new TextureEntryFace(this.DefaultTexture); return FaceTextures[index]; }
public static TextureEntryFace FromLLSD(LLSD llsd, TextureEntryFace defaultFace, out int faceNumber) { LLSDMap map = (LLSDMap)llsd; TextureEntryFace face = new TextureEntryFace(defaultFace); faceNumber = (map.ContainsKey("face_number")) ? map["face_number"].AsInteger() : -1; face.RGBA = LLColor.FromLLSD(map["colors"]); face.RepeatU = (float)map["scales"].AsReal(); face.RepeatV = (float)map["scalet"].AsReal(); face.OffsetU = (float)map["offsets"].AsReal(); face.OffsetV = (float)map["offsett"].AsReal(); face.Rotation = (float)map["imagerot"].AsReal(); face.Bump = (Bumpiness)map["bump"].AsInteger(); face.Shiny = (Shininess)map["shiny"].AsInteger(); face.Fullbright = map["fullbright"].AsBoolean(); face.MediaFlags = map["media_flags"].AsBoolean(); face.TexMapType = (MappingType)map["mapping"].AsInteger(); face.Glow = (float)map["glow"].AsReal(); face.TextureID = map["imageid"].AsUUID(); return face; }
/// <summary> /// /// </summary> public TextureEntry() { FaceTextures = new Dictionary<uint, TextureEntryFace>(); DefaultTexture = new TextureEntryFace(null); }
/// <summary> /// This will either create a new face if a custom face for the given /// index is not defined, or return the custom face for that index if /// it already exists /// </summary> /// <param name="index">The index number of the face to create or /// retrieve</param> /// <returns>A TextureEntryFace containing all the properties for that /// face</returns> public TextureEntryFace CreateFace(uint index) { if (!FaceTextures.ContainsKey(index)) FaceTextures[index] = new TextureEntryFace(this.DefaultTexture); return FaceTextures[index]; }
private void FromBytes(byte[] data, int pos, int length) { if (length <= 0) { // No TextureEntry to process DefaultTexture = null; return; } else { DefaultTexture = new TextureEntryFace(null); } uint bitfieldSize = 0; uint faceBits = 0; int i = pos; #region Texture DefaultTexture.TextureID = new LLUUID(data, i); i += 16; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { LLUUID tmpUUID = new LLUUID(data, i); i += 16; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).TextureID = tmpUUID; } #endregion Texture #region Color DefaultTexture.RGBA = new LLColor(data[i], data[i + 1], data[i + 2], data[i + 3]); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { LLColor tmpColor = new LLColor(data[i], data[i + 1], data[i + 2], data[i + 3]); i += 4; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).RGBA = tmpColor; } #endregion Color #region RepeatU DefaultTexture.RepeatU = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.BytesToFloat(data, i); i += 4; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).RepeatU = tmpFloat; } #endregion RepeatU #region RepeatV DefaultTexture.RepeatV = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.BytesToFloat(data, i); i += 4; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).RepeatV = tmpFloat; } #endregion RepeatV #region OffsetU DefaultTexture.OffsetU = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TEOffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).OffsetU = tmpFloat; } #endregion OffsetU #region OffsetV DefaultTexture.OffsetV = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TEOffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).OffsetV = tmpFloat; } #endregion OffsetV #region Rotation DefaultTexture.Rotation = Helpers.TERotationFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TERotationFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).Rotation = tmpFloat; } #endregion Rotation #region Material DefaultTexture.material = data[i]; i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).material = tmpByte; } #endregion Material #region Media DefaultTexture.media = data[i]; i++; while (i - pos < length && ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).media = tmpByte; } #endregion Media #region Glow DefaultTexture.Glow = Helpers.TEGlowFloat(data, i); i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TEGlowFloat(data, i); i++; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) if ((faceBits & bit) != 0) CreateFace(face).Glow = tmpFloat; } #endregion Glow }
private void FromBytes(byte[] data, int pos, int length) { if (length <= 0) { // No TextureEntry to process DefaultTexture = null; return; } else { DefaultTexture = new TextureEntryFace(null); } uint bitfieldSize = 0; uint faceBits = 0; int i = pos; #region Texture DefaultTexture.TextureID = new LLUUID(data, i); i += 16; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { LLUUID tmpUUID = new LLUUID(data, i); i += 16; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).TextureID = tmpUUID; } } } #endregion Texture #region Color DefaultTexture.RGBA = new LLColor(data[i], data[i + 1], data[i + 2], data[i + 3]); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { LLColor tmpColor = new LLColor(data[i], data[i + 1], data[i + 2], data[i + 3]); i += 4; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).RGBA = tmpColor; } } } #endregion Color #region RepeatU DefaultTexture.RepeatU = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.BytesToFloat(data, i); i += 4; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).RepeatU = tmpFloat; } } } #endregion RepeatU #region RepeatV DefaultTexture.RepeatV = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.BytesToFloat(data, i); i += 4; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).RepeatV = tmpFloat; } } } #endregion RepeatV #region OffsetU DefaultTexture.OffsetU = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TEOffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).OffsetU = tmpFloat; } } } #endregion OffsetU #region OffsetV DefaultTexture.OffsetV = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TEOffsetFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).OffsetV = tmpFloat; } } } #endregion OffsetV #region Rotation DefaultTexture.Rotation = Helpers.TERotationFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TERotationFloat(data, i); i += 2; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).Rotation = tmpFloat; } } } #endregion Rotation #region Material DefaultTexture.material = data[i]; i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).material = tmpByte; } } } #endregion Material #region Media DefaultTexture.media = data[i]; i++; while (i - pos < length && ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { byte tmpByte = data[i]; i++; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).media = tmpByte; } } } #endregion Media #region Glow DefaultTexture.Glow = Helpers.TEGlowFloat(data, i); i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { float tmpFloat = Helpers.TEGlowFloat(data, i); i++; for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) { if ((faceBits & bit) != 0) { CreateFace(face).Glow = tmpFloat; } } } #endregion Glow }