* Fixes a subtle bug with TextureEntryFace where the face bits is incorrect. This is because it only uses 32-bits, the official viewer uses 64-bits, and the overflow matters.

* Adds a .Valid property to TextureEntryFace - sometimes it is not, and will throw exceptions if you actually try use anything in this class. At least have the ability to check first.
This commit is contained in:
Adam Frisby
2024-08-02 03:11:00 +10:00
committed by Cinder Roxley
parent 42cd98c393
commit b6fe83965a

View File

@@ -212,6 +212,14 @@ namespace OpenMetaverse
#region Properties
public bool Valid
{
get
{
return DefaultTexture != null;
}
}
/// <summary></summary>
internal byte material
{
@@ -721,18 +729,18 @@ namespace OpenMetaverse
return;
uint bitfieldSize = 0;
uint faceBits = 0;
UInt64 faceBits = 0;
int i = pos;
#region Texture
DefaultTexture.TextureID = new UUID(data, i);
i += 16;
while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize))
{
UUID tmpUUID = new UUID(data, i);
i += 16;
for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1)
{
if ((faceBits & bit) != 0)
@@ -1198,7 +1206,7 @@ namespace OpenMetaverse
array[i] = uint.MaxValue;
}
private bool ReadFaceBitfield(byte[] data, ref int pos, ref uint faceBits, ref uint bitfieldSize)
private bool ReadFaceBitfield(byte[] data, ref int pos, ref UInt64 faceBits, ref uint bitfieldSize)
{
faceBits = 0;
bitfieldSize = 0;