mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
parent
c3c4697562
commit
903be743ac
@ -20,7 +20,7 @@ namespace AssetStudio
|
||||
var m_ProxyHeight = reader.ReadUInt32();
|
||||
var Width = reader.ReadUInt32();
|
||||
var Height = reader.ReadUInt32();
|
||||
if (version[0] >= 2017) //2017.x and up
|
||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
|
||||
{
|
||||
var m_PixelAspecRatioNum = reader.ReadUInt32();
|
||||
var m_PixelAspecRatioDen = reader.ReadUInt32();
|
||||
|
@ -83,7 +83,7 @@ namespace AssetStudio
|
||||
case 13: return M13;
|
||||
case 14: return M23;
|
||||
case 15: return M33;
|
||||
default: throw new IndexOutOfRangeException("Invalid matrix index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Matrix4x4 index!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ namespace AssetStudio
|
||||
case 13: M13 = value; break;
|
||||
case 14: M23 = value; break;
|
||||
case 15: M33 = value; break;
|
||||
default: throw new IndexOutOfRangeException("Invalid matrix index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Matrix4x4 index!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace AssetStudio
|
||||
case 1: return Y;
|
||||
case 2: return Z;
|
||||
case 3: return W;
|
||||
default: throw new IndexOutOfRangeException("Invalid Quaternion index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Quaternion index!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ namespace AssetStudio
|
||||
case 1: Y = value; break;
|
||||
case 2: Z = value; break;
|
||||
case 3: W = value; break;
|
||||
default: throw new IndexOutOfRangeException("Invalid Quaternion index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Quaternion index!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,5 +62,27 @@ namespace AssetStudio
|
||||
{
|
||||
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W);
|
||||
}
|
||||
|
||||
public static float Dot(Quaternion a, Quaternion b)
|
||||
{
|
||||
return a.X * b.X + a.Y * b.Y + a.Z * b.Z + a.W * b.W;
|
||||
}
|
||||
|
||||
private static bool IsEqualUsingDot(float dot)
|
||||
{
|
||||
return dot > 1.0f - kEpsilon;
|
||||
}
|
||||
|
||||
public static bool operator ==(Quaternion lhs, Quaternion rhs)
|
||||
{
|
||||
return IsEqualUsingDot(Dot(lhs, rhs));
|
||||
}
|
||||
|
||||
public static bool operator !=(Quaternion lhs, Quaternion rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
private const float kEpsilon = 0.000001F;
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ namespace AssetStudio
|
||||
{
|
||||
case 0: return X;
|
||||
case 1: return Y;
|
||||
default:
|
||||
throw new IndexOutOfRangeException("Invalid Vector2 index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Vector2 index!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,8 +33,7 @@ namespace AssetStudio
|
||||
{
|
||||
case 0: X = value; break;
|
||||
case 1: Y = value; break;
|
||||
default:
|
||||
throw new IndexOutOfRangeException("Invalid Vector2 index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Vector2 index!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ namespace AssetStudio
|
||||
case 0: return X;
|
||||
case 1: return Y;
|
||||
case 2: return Z;
|
||||
default:
|
||||
throw new IndexOutOfRangeException("Invalid Vector3 index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Vector3 index!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,8 +37,7 @@ namespace AssetStudio
|
||||
case 0: X = value; break;
|
||||
case 1: Y = value; break;
|
||||
case 2: Z = value; break;
|
||||
default:
|
||||
throw new IndexOutOfRangeException("Invalid Vector3 index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Vector3 index!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace AssetStudio
|
||||
case 1: return Y;
|
||||
case 2: return Z;
|
||||
case 3: return W;
|
||||
default: throw new IndexOutOfRangeException("Invalid Vector4 index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Vector4 index!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ namespace AssetStudio
|
||||
case 1: Y = value; break;
|
||||
case 2: Z = value; break;
|
||||
case 3: W = value; break;
|
||||
default: throw new IndexOutOfRangeException("Invalid Vector4 index!");
|
||||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid Vector4 index!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -380,10 +380,11 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mesh.m_BindPose.Length > 0 && mesh.m_BoneNameHashes?.Length > 0 && mesh.m_BindPose.Length == mesh.m_BoneNameHashes.Length)
|
||||
else if (mesh.m_BindPose.Length > 0 && mesh.m_BoneNameHashes?.Length > 0)
|
||||
{
|
||||
iMesh.BoneList = new List<ImportedBone>(mesh.m_BoneNameHashes.Length);
|
||||
for (int i = 0; i < mesh.m_BoneNameHashes.Length; i++)
|
||||
var boneMax = Math.Min(mesh.m_BindPose.Length, mesh.m_BoneNameHashes.Length);
|
||||
iMesh.BoneList = new List<ImportedBone>(boneMax);
|
||||
for (int i = 0; i < boneMax; i++)
|
||||
{
|
||||
var bone = new ImportedBone();
|
||||
var boneHash = mesh.m_BoneNameHashes[i];
|
||||
|
Loading…
Reference in New Issue
Block a user