change math library

fixed bug
This commit is contained in:
Perfare
2019-01-03 08:55:43 +08:00
parent 33461e068f
commit e6ed312de2
28 changed files with 2011 additions and 90 deletions

View File

@ -59,15 +59,9 @@
<Reference Include="SharpDX.D3DCompiler">
<HintPath>..\AssetStudio\Libraries\SharpDX.D3DCompiler.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Mathematics">
<HintPath>..\AssetStudio\Libraries\SharpDX.Mathematics.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Half">
<HintPath>..\AssetStudio\Libraries\System.Half.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />

View File

@ -4,7 +4,6 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using SharpDX;
namespace AssetStudio
{
@ -308,11 +307,11 @@ namespace AssetStudio
{
if (mesh.m_Colors.Length == mesh.m_VertexCount * 3)
{
((ImportedVertexWithColour)iVertex).Colour = new Color4(mesh.m_Colors[j * 3], mesh.m_Colors[j * 3 + 1], mesh.m_Colors[j * 3 + 2], 1.0f);
((ImportedVertexWithColour)iVertex).Colour = new Color(mesh.m_Colors[j * 3], mesh.m_Colors[j * 3 + 1], mesh.m_Colors[j * 3 + 2], 1.0f);
}
else
{
((ImportedVertexWithColour)iVertex).Colour = new Color4(mesh.m_Colors[j * 4], mesh.m_Colors[j * 4 + 1], mesh.m_Colors[j * 4 + 2], mesh.m_Colors[j * 4 + 3]);
((ImportedVertexWithColour)iVertex).Colour = new Color(mesh.m_Colors[j * 4], mesh.m_Colors[j * 4 + 1], mesh.m_Colors[j * 4 + 2], mesh.m_Colors[j * 4 + 3]);
}
}
//UV
@ -364,8 +363,9 @@ namespace AssetStudio
//Bone
if (sMesh.m_Bones.Length > 0)
{
iMesh.BoneList = new List<ImportedBone>(sMesh.m_Bones.Length);
for (int i = 0; i < sMesh.m_Bones.Length; i++)
var boneMax = Math.Min(sMesh.m_Bones.Length, mesh.m_BindPose.Length);
iMesh.BoneList = new List<ImportedBone>(boneMax);
for (int i = 0; i < boneMax; i++)
{
var bone = new ImportedBone();
if (sMesh.m_Bones[i].TryGet(out var m_Transform))
@ -374,8 +374,8 @@ namespace AssetStudio
}
if (!string.IsNullOrEmpty(bone.Path))
{
var convert = Matrix.Scaling(new Vector3(-1, 1, 1));
bone.Matrix = convert * Matrix.Transpose(mesh.m_BindPose[i]) * convert;
var convert = Matrix4x4.Scale(new Vector3(-1, 1, 1));
bone.Matrix = convert * mesh.m_BindPose[i] * convert;
iMesh.BoneList.Add(bone);
}
}
@ -391,8 +391,8 @@ namespace AssetStudio
bone.Path = FixBonePath(path);
if (!string.IsNullOrEmpty(bone.Path))
{
var convert = Matrix.Scaling(new Vector3(-1, 1, 1));
bone.Matrix = convert * Matrix.Transpose(mesh.m_BindPose[i]) * convert;
var convert = Matrix4x4.Scale(new Vector3(-1, 1, 1));
bone.Matrix = convert * mesh.m_BindPose[i] * convert;
iMesh.BoneList.Add(bone);
}
}

View File

@ -4,8 +4,6 @@ using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using SharpDX;
using RectangleF = System.Drawing.RectangleF;
namespace AssetStudio
{
@ -73,7 +71,7 @@ namespace AssetStudio
{
path.AddPolygon(p);
}
using (var matr = new System.Drawing.Drawing2D.Matrix())
using (var matr = new Matrix())
{
if (m_Sprite.m_Pivot == Vector2.Zero) //5.4.2 down
{