minor improvements

This commit is contained in:
Perfare 2018-12-09 11:56:24 +08:00
parent 324c5ec7a2
commit eb170d4f34
16 changed files with 366 additions and 416 deletions

View File

@ -7,16 +7,16 @@ namespace AssetStudio
{
public sealed class Animation : Behaviour
{
public List<PPtr<AnimationClip>> m_Animations;
public PPtr<AnimationClip>[] m_Animations;
public Animation(ObjectReader reader) : base(reader)
{
var m_Animation = new PPtr<AnimationClip>(reader);
int numAnimations = reader.ReadInt32();
m_Animations = new List<PPtr<AnimationClip>>(numAnimations);
m_Animations = new PPtr<AnimationClip>[numAnimations];
for (int i = 0; i < numAnimations; i++)
{
m_Animations.Add(new PPtr<AnimationClip>(reader));
m_Animations[i] = new PPtr<AnimationClip>(reader);
}
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SharpDX;
namespace AssetStudio
@ -22,7 +23,7 @@ namespace AssetStudio
value = readerFunc();
inSlope = readerFunc();
outSlope = readerFunc();
if (reader.version[0] >= 2018)
if (reader.version[0] >= 2018) //2018 and up
{
weightedMode = reader.ReadInt32();
inWeight = readerFunc();
@ -33,7 +34,7 @@ namespace AssetStudio
public class AnimationCurve<T>
{
public List<Keyframe<T>> m_Curve;
public Keyframe<T>[] m_Curve;
public int m_PreInfinity;
public int m_PostInfinity;
public int m_RotationOrder;
@ -42,10 +43,10 @@ namespace AssetStudio
{
var version = reader.version;
int numCurves = reader.ReadInt32();
m_Curve = new List<Keyframe<T>>(numCurves);
m_Curve = new Keyframe<T>[numCurves];
for (int i = 0; i < numCurves; i++)
{
m_Curve.Add(new Keyframe<T>(reader, readerFunc));
m_Curve[i] = new Keyframe<T>(reader, readerFunc);
}
m_PreInfinity = reader.ReadInt32();
@ -321,7 +322,7 @@ namespace AssetStudio
public class PPtrCurve
{
public List<PPtrKeyframe> curve;
public PPtrKeyframe[] curve;
public string attribute;
public string path;
public int classID;
@ -331,10 +332,10 @@ namespace AssetStudio
public PPtrCurve(ObjectReader reader)
{
int numCurves = reader.ReadInt32();
curve = new List<PPtrKeyframe>(numCurves);
curve = new PPtrKeyframe[numCurves];
for (int i = 0; i < numCurves; i++)
{
curve.Add(new PPtrKeyframe(reader));
curve[i] = new PPtrKeyframe(reader);
}
attribute = reader.ReadAlignedString();
@ -418,7 +419,7 @@ namespace AssetStudio
public xform m_RootX;
public Vector3 m_LookAtPosition;
public Vector4 m_LookAtWeight;
public List<HumanGoal> m_GoalArray;
public HumanGoal[] m_GoalArray;
public HandPose m_LeftHandPose;
public HandPose m_RightHandPose;
public float[] m_DoFArray;
@ -432,10 +433,10 @@ namespace AssetStudio
m_LookAtWeight = reader.ReadVector4();
int numGoals = reader.ReadInt32();
m_GoalArray = new List<HumanGoal>(numGoals);
m_GoalArray = new HumanGoal[numGoals];
for (int i = 0; i < numGoals; i++)
{
m_GoalArray.Add(new HumanGoal(reader));
m_GoalArray[i] = new HumanGoal(reader);
}
m_LeftHandPose = new HandPose(reader);
@ -504,17 +505,17 @@ namespace AssetStudio
public class StreamedFrame
{
public float time;
public List<StreamedCurveKey> keyList;
public StreamedCurveKey[] keyList;
public StreamedFrame(BinaryReader reader)
{
time = reader.ReadSingle();
int numKeys = reader.ReadInt32();
keyList = new List<StreamedCurveKey>(numKeys);
keyList = new StreamedCurveKey[numKeys];
for (int i = 0; i < numKeys; i++)
{
keyList.Add(new StreamedCurveKey(reader));
keyList[i] = new StreamedCurveKey(reader);
}
}
}
@ -540,7 +541,7 @@ namespace AssetStudio
for (int i = frameIndex - 1; i >= 0; i--)
{
var preFrame = frameList[i];
var preCurveKey = preFrame.keyList.Find(x => x.index == curveKey.index);
var preCurveKey = preFrame.keyList.FirstOrDefault(x => x.index == curveKey.index);
if (preCurveKey != null)
{
curveKey.inSlope = preCurveKey.CalculateNextInSlope(frame.time - preFrame.time, curveKey);
@ -603,15 +604,15 @@ namespace AssetStudio
public class ValueArrayConstant
{
public List<ValueConstant> m_ValueArray;
public ValueConstant[] m_ValueArray;
public ValueArrayConstant(ObjectReader reader)
{
int numVals = reader.ReadInt32();
m_ValueArray = new List<ValueConstant>(numVals);
m_ValueArray = new ValueConstant[numVals];
for (int i = 0; i < numVals; i++)
{
m_ValueArray.Add(new ValueConstant(reader));
m_ValueArray[i] = new ValueConstant(reader);
}
}
}
@ -669,7 +670,7 @@ namespace AssetStudio
public float m_CycleOffset;
public float m_AverageAngularSpeed;
public int[] m_IndexArray;
public List<ValueDelta> m_ValueArrayDelta;
public ValueDelta[] m_ValueArrayDelta;
public float[] m_ValueArrayReferencePose;
public bool m_Mirror;
public bool m_LoopTime;
@ -714,10 +715,10 @@ namespace AssetStudio
var m_AdditionalCurveIndexArray = reader.ReadInt32Array();
}
int numDeltas = reader.ReadInt32();
m_ValueArrayDelta = new List<ValueDelta>(numDeltas);
m_ValueArrayDelta = new ValueDelta[numDeltas];
for (int i = 0; i < numDeltas; i++)
{
m_ValueArrayDelta.Add(new ValueDelta(reader));
m_ValueArrayDelta[i] = new ValueDelta(reader);
}
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
{
@ -725,7 +726,10 @@ namespace AssetStudio
}
m_Mirror = reader.ReadBoolean();
m_LoopTime = reader.ReadBoolean();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
{
m_LoopTime = reader.ReadBoolean();
}
m_LoopBlend = reader.ReadBoolean();
m_LoopBlendOrientation = reader.ReadBoolean();
m_LoopBlendPositionY = reader.ReadBoolean();
@ -773,23 +777,23 @@ namespace AssetStudio
public class AnimationClipBindingConstant
{
public List<GenericBinding> genericBindings;
public List<PPtr<Object>> pptrCurveMapping;
public GenericBinding[] genericBindings;
public PPtr<Object>[] pptrCurveMapping;
public AnimationClipBindingConstant(ObjectReader reader)
{
int numBindings = reader.ReadInt32();
genericBindings = new List<GenericBinding>(numBindings);
genericBindings = new GenericBinding[numBindings];
for (int i = 0; i < numBindings; i++)
{
genericBindings.Add(new GenericBinding(reader));
genericBindings[i] = new GenericBinding(reader);
}
int numMappings = reader.ReadInt32();
pptrCurveMapping = new List<PPtr<Object>>(numMappings);
pptrCurveMapping = new PPtr<Object>[numMappings];
for (int i = 0; i < numMappings; i++)
{
pptrCurveMapping.Add(new PPtr<Object>(reader));
pptrCurveMapping[i] = new PPtr<Object>(reader);
}
}
@ -842,20 +846,20 @@ namespace AssetStudio
public bool m_Legacy;
public bool m_Compressed;
public bool m_UseHighQualityCurve;
public List<QuaternionCurve> m_RotationCurves;
public List<CompressedAnimationCurve> m_CompressedRotationCurves;
public List<Vector3Curve> m_EulerCurves;
public List<Vector3Curve> m_PositionCurves;
public List<Vector3Curve> m_ScaleCurves;
public List<FloatCurve> m_FloatCurves;
public List<PPtrCurve> m_PPtrCurves;
public QuaternionCurve[] m_RotationCurves;
public CompressedAnimationCurve[] m_CompressedRotationCurves;
public Vector3Curve[] m_EulerCurves;
public Vector3Curve[] m_PositionCurves;
public Vector3Curve[] m_ScaleCurves;
public FloatCurve[] m_FloatCurves;
public PPtrCurve[] m_PPtrCurves;
public float m_SampleRate;
public int m_WrapMode;
public AABB m_Bounds;
public uint m_MuscleClipSize;
public ClipMuscleConstant m_MuscleClip;
public AnimationClipBindingConstant m_ClipBindingConstant;
//public List<AnimationEvent> m_Events;
//public AnimationEvent[] m_Events;
public AnimationClip(ObjectReader reader) : base(reader)
@ -881,57 +885,57 @@ namespace AssetStudio
}
reader.AlignStream();
int numRCurves = reader.ReadInt32();
m_RotationCurves = new List<QuaternionCurve>(numRCurves);
m_RotationCurves = new QuaternionCurve[numRCurves];
for (int i = 0; i < numRCurves; i++)
{
m_RotationCurves.Add(new QuaternionCurve(reader));
m_RotationCurves[i] = new QuaternionCurve(reader);
}
int numCRCurves = reader.ReadInt32();
m_CompressedRotationCurves = new List<CompressedAnimationCurve>(numCRCurves);
m_CompressedRotationCurves = new CompressedAnimationCurve[numCRCurves];
for (int i = 0; i < numCRCurves; i++)
{
m_CompressedRotationCurves.Add(new CompressedAnimationCurve(reader));
m_CompressedRotationCurves[i] = new CompressedAnimationCurve(reader);
}
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
{
int numEulerCurves = reader.ReadInt32();
m_EulerCurves = new List<Vector3Curve>(numEulerCurves);
m_EulerCurves = new Vector3Curve[numEulerCurves];
for (int i = 0; i < numEulerCurves; i++)
{
m_EulerCurves.Add(new Vector3Curve(reader));
m_EulerCurves[i] = new Vector3Curve(reader);
}
}
int numPCurves = reader.ReadInt32();
m_PositionCurves = new List<Vector3Curve>(numPCurves);
m_PositionCurves = new Vector3Curve[numPCurves];
for (int i = 0; i < numPCurves; i++)
{
m_PositionCurves.Add(new Vector3Curve(reader));
m_PositionCurves[i] = new Vector3Curve(reader);
}
int numSCurves = reader.ReadInt32();
m_ScaleCurves = new List<Vector3Curve>(numSCurves);
m_ScaleCurves = new Vector3Curve[numSCurves];
for (int i = 0; i < numSCurves; i++)
{
m_ScaleCurves.Add(new Vector3Curve(reader));
m_ScaleCurves[i] = new Vector3Curve(reader);
}
int numFCurves = reader.ReadInt32();
m_FloatCurves = new List<FloatCurve>(numFCurves);
m_FloatCurves = new FloatCurve[numFCurves];
for (int i = 0; i < numFCurves; i++)
{
m_FloatCurves.Add(new FloatCurve(reader));
m_FloatCurves[i] = new FloatCurve(reader);
}
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
{
int numPtrCurves = reader.ReadInt32();
m_PPtrCurves = new List<PPtrCurve>(numPtrCurves);
m_PPtrCurves = new PPtrCurve[numPtrCurves];
for (int i = 0; i < numPtrCurves; i++)
{
m_PPtrCurves.Add(new PPtrCurve(reader));
m_PPtrCurves[i] = new PPtrCurve(reader);
}
}
@ -953,10 +957,10 @@ namespace AssetStudio
//m_HasGenericRootTransform 2018.3
//m_HasMotionFloatCurves 2018.3
/*int numEvents = reader.ReadInt32();
m_Events = new List<AnimationEvent>(numEvents);
m_Events = new AnimationEvent[numEvents];
for (int i = 0; i < numEvents; i++)
{
m_Events.Add(new AnimationEvent(reader));
m_Events[i] = new AnimationEvent(reader);
}*/
}
}

View File

@ -14,9 +14,11 @@ namespace AssetStudio
public HumanPoseMask(ObjectReader reader)
{
var version = reader.version;
word0 = reader.ReadUInt32();
word1 = reader.ReadUInt32();
if (reader.version[0] >= 5) //5.0 and up
if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up
{
word2 = reader.ReadUInt32();
}
@ -64,15 +66,23 @@ namespace AssetStudio
public LayerConstant(ObjectReader reader)
{
var version = reader.version;
m_StateMachineIndex = reader.ReadUInt32();
m_StateMachineMotionSetIndex = reader.ReadUInt32();
m_BodyMask = new HumanPoseMask(reader);
m_SkeletonMask = new SkeletonMask(reader);
m_Binding = reader.ReadUInt32();
m_LayerBlendingMode = reader.ReadInt32();
m_DefaultWeight = reader.ReadSingle();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 2)) //4.2 and up
{
m_DefaultWeight = reader.ReadSingle();
}
m_IKPass = reader.ReadBoolean();
m_SyncedLayerAffectsTiming = reader.ReadBoolean();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 2)) //4.2 and up
{
m_SyncedLayerAffectsTiming = reader.ReadBoolean();
}
reader.AlignStream();
}
}
@ -113,6 +123,7 @@ namespace AssetStudio
public TransitionConstant(ObjectReader reader)
{
var version = reader.version;
int numConditions = reader.ReadInt32();
m_ConditionConstantArray = new ConditionConstant[numConditions];
for (int i = 0; i < numConditions; i++)
@ -144,7 +155,11 @@ namespace AssetStudio
m_Atomic = reader.ReadBoolean();
}
m_CanTransitionToSelf = reader.ReadBoolean();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
{
m_CanTransitionToSelf = reader.ReadBoolean();
}
reader.AlignStream();
}
}
@ -224,6 +239,7 @@ namespace AssetStudio
public uint m_BlendEventID;
public uint m_BlendEventYID;
public uint[] m_ChildIndices;
public float[] m_ChildThresholdArray;
public Blend1dDataConstant m_Blend1dData;
public Blend2dDataConstant m_Blend2dData;
public BlendDirectDataConstant m_BlendDirectData;
@ -236,42 +252,70 @@ namespace AssetStudio
public BlendTreeNodeConstant(ObjectReader reader)
{
var version = reader.version;
m_BlendType = reader.ReadUInt32();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
{
m_BlendType = reader.ReadUInt32();
}
m_BlendEventID = reader.ReadUInt32();
m_BlendEventYID = reader.ReadUInt32();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
{
m_BlendEventYID = reader.ReadUInt32();
}
m_ChildIndices = reader.ReadUInt32Array();
m_Blend1dData = new Blend1dDataConstant(reader);
m_Blend2dData = new Blend2dDataConstant(reader);
if (version[0] < 4 || (version[0] == 4 && version[1] < 1)) //4.1 down
{
m_ChildThresholdArray = reader.ReadSingleArray();
}
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
{
m_Blend1dData = new Blend1dDataConstant(reader);
m_Blend2dData = new Blend2dDataConstant(reader);
}
if (version[0] >= 5) //5.0 and up
{
m_BlendDirectData = new BlendDirectDataConstant(reader);
}
m_ClipID = reader.ReadUInt32();
if (version[0] < 5) //5.0 down
if (version[0] == 4 && version[1] >= 5) //4.5 - 5.0
{
m_ClipIndex = reader.ReadUInt32();
}
m_Duration = reader.ReadSingle();
m_CycleOffset = reader.ReadSingle();
m_Mirror = reader.ReadBoolean();
reader.AlignStream();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
{
m_CycleOffset = reader.ReadSingle();
m_Mirror = reader.ReadBoolean();
reader.AlignStream();
}
}
}
public class BlendTreeConstant
{
public BlendTreeNodeConstant[] m_NodeArray;
public ValueArrayConstant m_BlendEventArrayConstant;
public BlendTreeConstant(ObjectReader reader)
{
var version = reader.version;
int numNodes = reader.ReadInt32();
m_NodeArray = new BlendTreeNodeConstant[numNodes];
for (int i = 0; i < numNodes; i++)
{
m_NodeArray[i] = new BlendTreeNodeConstant(reader);
}
if (version[0] < 4 || (version[0] == 4 && version[1] < 5)) //4.5 down
{
m_BlendEventArrayConstant = new ValueArrayConstant(reader);
}
}
}
@ -299,6 +343,7 @@ namespace AssetStudio
public StateConstant(ObjectReader reader)
{
var version = reader.version;
int numTransistions = reader.ReadInt32();
m_TransitionConstantArray = new TransitionConstant[numTransistions];
for (int i = 0; i < numTransistions; i++)
@ -308,7 +353,7 @@ namespace AssetStudio
m_BlendTreeConstantIndexArray = reader.ReadInt32Array();
if (version[0] < 5) //5.0 down
if (version[0] < 5 || (version[0] == 5 && version[1] < 2)) //5.2 down
{
int numInfos = reader.ReadInt32();
m_LeafInfoArray = new LeafInfoConstant[numInfos];
@ -326,14 +371,17 @@ namespace AssetStudio
}
m_NameID = reader.ReadUInt32();
m_PathID = reader.ReadUInt32();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
{
m_PathID = reader.ReadUInt32();
}
if (version[0] >= 5) //5.0 and up
{
m_FullPathID = reader.ReadUInt32();
}
m_TagID = reader.ReadUInt32();
if (version[0] >= 5) //5.0 and up
if (version[0] > 5 || (version[0] == 5 && version[1] >= 1)) //5.1 and up
{
m_SpeedParamID = reader.ReadUInt32();
m_MirrorParamID = reader.ReadUInt32();
@ -346,7 +394,10 @@ namespace AssetStudio
}
m_Speed = reader.ReadSingle();
m_CycleOffset = reader.ReadSingle();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
{
m_CycleOffset = reader.ReadSingle();
}
m_IKOnFeet = reader.ReadBoolean();
if (version[0] >= 5) //5.0 and up
{
@ -354,7 +405,11 @@ namespace AssetStudio
}
m_Loop = reader.ReadBoolean();
m_Mirror = reader.ReadBoolean();
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
{
m_Mirror = reader.ReadBoolean();
}
reader.AlignStream();
}
}
@ -409,6 +464,7 @@ namespace AssetStudio
public StateMachineConstant(ObjectReader reader)
{
var version = reader.version;
int numStates = reader.ReadInt32();
m_StateConstantArray = new StateConstant[numStates];
for (int i = 0; i < numStates; i++)
@ -443,6 +499,7 @@ namespace AssetStudio
public bool[] m_BoolValues;
public int[] m_IntValues;
public float[] m_FloatValues;
public Vector4[] m_VectorValues;
public Vector3[] m_PositionValues;
public Vector4[] m_QuaternionValues;
public Vector3[] m_ScaleValues;
@ -450,40 +507,44 @@ namespace AssetStudio
public ValueArray(ObjectReader reader)
{
var version = reader.version;
if (version[0] < 5 || (version[0] == 5 && version[1] < 5)) //5.5 down
{
m_BoolValues = reader.ReadBooleanArray();
reader.AlignStream();
m_IntValues = reader.ReadInt32Array();
m_FloatValues = reader.ReadSingleArray();
}
int numPosValues = reader.ReadInt32();
m_PositionValues = new Vector3[numPosValues];
for (int i = 0; i < numPosValues; i++)
if (version[0] < 4 || (version[0] == 4 && version[1] < 3)) //4.3 down
{
m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
m_VectorValues = reader.ReadVector4Array();
}
m_QuaternionValues = reader.ReadVector4Array();
int numScaleValues = reader.ReadInt32();
m_ScaleValues = new Vector3[numScaleValues];
for (int i = 0; i < numScaleValues; i++)
else
{
m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
}
int numPosValues = reader.ReadInt32();
m_PositionValues = new Vector3[numPosValues];
for (int i = 0; i < numPosValues; i++)
{
m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
}
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
{
m_FloatValues = reader.ReadSingleArray();
m_IntValues = reader.ReadInt32Array();
m_QuaternionValues = reader.ReadVector4Array();
m_BoolValues = reader.ReadBooleanArray();
int numScaleValues = reader.ReadInt32();
m_ScaleValues = new Vector3[numScaleValues];
for (int i = 0; i < numScaleValues; i++)
{
m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
}
reader.AlignStream();
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
{
m_FloatValues = reader.ReadSingleArray();
m_IntValues = reader.ReadInt32Array();
m_BoolValues = reader.ReadBooleanArray();
reader.AlignStream();
}
}
}
}
@ -526,10 +587,10 @@ namespace AssetStudio
var m_Controller = new ControllerConstant(reader);
int tosSize = reader.ReadInt32();
var m_TOS = new List<KeyValuePair<uint, string>>(tosSize);
var m_TOS = new KeyValuePair<uint, string>[tosSize];
for (int i = 0; i < tosSize; i++)
{
m_TOS.Add(new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString()));
m_TOS[i] = new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString());
}
int numClips = reader.ReadInt32();

View File

@ -20,17 +20,17 @@ namespace AssetStudio
public sealed class AnimatorOverrideController : RuntimeAnimatorController
{
public PPtr<RuntimeAnimatorController> m_Controller;
public List<AnimationClipOverride> m_Clips;
public AnimationClipOverride[] m_Clips;
public AnimatorOverrideController(ObjectReader reader) : base(reader)
{
m_Controller = new PPtr<RuntimeAnimatorController>(reader);
int numOverrides = reader.ReadInt32();
m_Clips = new List<AnimationClipOverride>(numOverrides);
m_Clips = new AnimationClipOverride[numOverrides];
for (int i = 0; i < numOverrides; i++)
{
m_Clips.Add(new AnimationClipOverride(reader));
m_Clips[i] = new AnimationClipOverride(reader);
}
}
}

View File

@ -21,23 +21,23 @@ namespace AssetStudio
public sealed class AssetBundle : NamedObject
{
public List<PPtr<Object>> m_PreloadTable;
public List<KeyValuePair<string, AssetInfo>> m_Container;
public PPtr<Object>[] m_PreloadTable;
public KeyValuePair<string, AssetInfo>[] m_Container;
public AssetBundle(ObjectReader reader) : base(reader)
{
var m_PreloadTableSize = reader.ReadInt32();
m_PreloadTable = new List<PPtr<Object>>(m_PreloadTableSize);
m_PreloadTable = new PPtr<Object>[m_PreloadTableSize];
for (int i = 0; i < m_PreloadTableSize; i++)
{
m_PreloadTable.Add(new PPtr<Object>(reader));
m_PreloadTable[i] = new PPtr<Object>(reader);
}
var m_ContainerSize = reader.ReadInt32();
m_Container = new List<KeyValuePair<string, AssetInfo>>(m_ContainerSize);
m_Container = new KeyValuePair<string, AssetInfo>[m_ContainerSize];
for (int i = 0; i < m_ContainerSize; i++)
{
m_Container.Add(new KeyValuePair<string, AssetInfo>(reader.ReadAlignedString(), new AssetInfo(reader)));
m_Container[i] = new KeyValuePair<string, AssetInfo>(reader.ReadAlignedString(), new AssetInfo(reader));
}
}
}

View File

@ -1,5 +1,6 @@
using SharpDX;
using System.Collections.Generic;
using System.Linq;
namespace AssetStudio
{
@ -66,47 +67,42 @@ namespace AssetStudio
public class Skeleton
{
public List<Node> m_Node;
public Node[] m_Node;
public uint[] m_ID;
public List<Axes> m_AxesArray;
public Axes[] m_AxesArray;
public Skeleton(ObjectReader reader)
{
int numNodes = reader.ReadInt32();
m_Node = new List<Node>(numNodes);
m_Node = new Node[numNodes];
for (int i = 0; i < numNodes; i++)
{
m_Node.Add(new Node(reader));
m_Node[i] = new Node(reader);
}
m_ID = reader.ReadUInt32Array();
int numAxes = reader.ReadInt32();
m_AxesArray = new List<Axes>(numAxes);
m_AxesArray = new Axes[numAxes];
for (int i = 0; i < numAxes; i++)
{
m_AxesArray.Add(new Axes(reader));
m_AxesArray[i] = new Axes(reader);
}
}
}
public class SkeletonPose
{
public List<xform> m_X;
public SkeletonPose()
{
m_X = new List<xform>();
}
public xform[] m_X;
public SkeletonPose(ObjectReader reader)
{
int numXforms = reader.ReadInt32();
m_X = new List<xform>(numXforms);
m_X = new xform[numXforms];
for (int i = 0; i < numXforms; i++)
{
m_X.Add(new xform(reader));
m_X[i] = new xform(reader);
}
}
}
@ -168,8 +164,8 @@ namespace AssetStudio
public SkeletonPose m_SkeletonPose;
public Hand m_LeftHand;
public Hand m_RightHand;
public List<Handle> m_Handles;
public List<Collider> m_ColliderArray;
public Handle[] m_Handles;
public Collider[] m_ColliderArray;
public int[] m_HumanBoneIndex;
public float[] m_HumanBoneMass;
public int[] m_ColliderIndex;
@ -197,17 +193,17 @@ namespace AssetStudio
if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
{
int numHandles = reader.ReadInt32();
m_Handles = new List<Handle>(numHandles);
m_Handles = new Handle[numHandles];
for (int i = 0; i < numHandles; i++)
{
m_Handles.Add(new Handle(reader));
m_Handles[i] = new Handle(reader);
}
int numColliders = reader.ReadInt32();
m_ColliderArray = new List<Collider>(numColliders);
m_ColliderArray = new Collider[numColliders];
for (int i = 0; i < numColliders; i++)
{
m_ColliderArray.Add(new Collider(reader));
m_ColliderArray[i] = new Collider(reader);
}
}
@ -230,7 +226,10 @@ namespace AssetStudio
m_FeetSpacing = reader.ReadSingle();
m_HasLeftHand = reader.ReadBoolean();
m_HasRightHand = reader.ReadBoolean();
m_HasTDoF = reader.ReadBoolean();
if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up
{
m_HasTDoF = reader.ReadBoolean();
}
reader.AlignStream();
}
}
@ -289,7 +288,7 @@ namespace AssetStudio
{
public uint m_AvatarSize;
public AvatarConstant m_Avatar;
public List<KeyValuePair<uint, string>> m_TOS;
public KeyValuePair<uint, string>[] m_TOS;
public Avatar(ObjectReader reader) : base(reader)
{
@ -297,10 +296,10 @@ namespace AssetStudio
m_Avatar = new AvatarConstant(reader);
int numTOS = reader.ReadInt32();
m_TOS = new List<KeyValuePair<uint, string>>(numTOS);
m_TOS = new KeyValuePair<uint, string>[numTOS];
for (int i = 0; i < numTOS; i++)
{
m_TOS.Add(new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString()));
m_TOS[i] = new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString());
}
}
@ -318,7 +317,7 @@ namespace AssetStudio
public string FindBonePath(uint hash)
{
return m_TOS.Find(pair => pair.Key == hash).Value;
return m_TOS.FirstOrDefault(pair => pair.Key == hash).Value;
}
}
}

View File

@ -7,7 +7,7 @@ namespace AssetStudio
{
public sealed class GameObject : EditorExtension
{
public List<PPtr<Component>> m_Components;
public PPtr<Component>[] m_Components;
public string m_Name;
public Transform m_Transform;
@ -20,18 +20,14 @@ namespace AssetStudio
public GameObject(ObjectReader reader) : base(reader)
{
int m_Component_size = reader.ReadInt32();
m_Components = new List<PPtr<Component>>(m_Component_size);
for (int j = 0; j < m_Component_size; j++)
m_Components = new PPtr<Component>[m_Component_size];
for (int i = 0; i < m_Component_size; i++)
{
if ((version[0] == 5 && version[1] >= 5) || version[0] > 5) //5.5.0 and up
{
m_Components.Add(new PPtr<Component>(reader));
}
else
if ((version[0] == 5 && version[1] < 5) || version[0] < 5) //5.5 down
{
int first = reader.ReadInt32();
m_Components.Add(new PPtr<Component>(reader));
}
m_Components[i] = new PPtr<Component>(reader);
}
var m_Layer = reader.ReadInt32();

View File

@ -19,31 +19,31 @@ namespace AssetStudio
public class UnityPropertySheet
{
public List<KeyValuePair<string, UnityTexEnv>> m_TexEnvs;
public List<KeyValuePair<string, float>> m_Floats;
public List<KeyValuePair<string, Color4>> m_Colors;
public KeyValuePair<string, UnityTexEnv>[] m_TexEnvs;
public KeyValuePair<string, float>[] m_Floats;
public KeyValuePair<string, Color4>[] m_Colors;
public UnityPropertySheet(ObjectReader reader)
{
int m_TexEnvsSize = reader.ReadInt32();
m_TexEnvs = new List<KeyValuePair<string, UnityTexEnv>>(m_TexEnvsSize);
m_TexEnvs = new KeyValuePair<string, UnityTexEnv>[m_TexEnvsSize];
for (int i = 0; i < m_TexEnvsSize; i++)
{
m_TexEnvs.Add(new KeyValuePair<string, UnityTexEnv>(reader.ReadAlignedString(), new UnityTexEnv(reader)));
m_TexEnvs[i] = new KeyValuePair<string, UnityTexEnv>(reader.ReadAlignedString(), new UnityTexEnv(reader));
}
int m_FloatsSize = reader.ReadInt32();
m_Floats = new List<KeyValuePair<string, float>>(m_FloatsSize);
m_Floats = new KeyValuePair<string, float>[m_FloatsSize];
for (int i = 0; i < m_FloatsSize; i++)
{
m_Floats.Add(new KeyValuePair<string, float>(reader.ReadAlignedString(), reader.ReadSingle()));
m_Floats[i] = new KeyValuePair<string, float>(reader.ReadAlignedString(), reader.ReadSingle());
}
int m_ColorsSize = reader.ReadInt32();
m_Colors = new List<KeyValuePair<string, Color4>>(m_ColorsSize);
m_Colors = new KeyValuePair<string, Color4>[m_ColorsSize];
for (int i = 0; i < m_ColorsSize; i++)
{
m_Colors.Add(new KeyValuePair<string, Color4>(reader.ReadAlignedString(), reader.ReadColor4()));
m_Colors[i] = new KeyValuePair<string, Color4>(reader.ReadAlignedString(), reader.ReadColor4());
}
}
}

View File

@ -317,32 +317,32 @@ namespace AssetStudio
public class BlendShapeData
{
public List<BlendShapeVertex> vertices;
public List<MeshBlendShape> shapes;
public List<MeshBlendShapeChannel> channels;
public BlendShapeVertex[] vertices;
public MeshBlendShape[] shapes;
public MeshBlendShapeChannel[] channels;
public float[] fullWeights;
public BlendShapeData(ObjectReader reader)
{
int numVerts = reader.ReadInt32();
vertices = new List<BlendShapeVertex>(numVerts);
vertices = new BlendShapeVertex[numVerts];
for (int i = 0; i < numVerts; i++)
{
vertices.Add(new BlendShapeVertex(reader));
vertices[i] = new BlendShapeVertex(reader);
}
int numShapes = reader.ReadInt32();
shapes = new List<MeshBlendShape>(numShapes);
shapes = new MeshBlendShape[numShapes];
for (int i = 0; i < numShapes; i++)
{
shapes.Add(new MeshBlendShape(reader));
shapes[i] = new MeshBlendShape(reader);
}
int numChannels = reader.ReadInt32();
channels = new List<MeshBlendShapeChannel>(numChannels);
channels = new MeshBlendShapeChannel[numChannels];
for (int i = 0; i < numChannels; i++)
{
channels.Add(new MeshBlendShapeChannel(reader));
channels[i] = new MeshBlendShapeChannel(reader);
}
fullWeights = reader.ReadSingleArray();
@ -393,7 +393,7 @@ namespace AssetStudio
public SubMesh[] m_SubMeshes;
private uint[] m_IndexBuffer;
public BlendShapeData m_Shapes;
public float[][,] m_BindPose;
public Matrix[] m_BindPose;
public uint[] m_BoneNameHashes;
public int m_VertexCount;
public float[] m_Vertices;
@ -467,19 +467,8 @@ namespace AssetStudio
else if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3.0 and later
{
m_Shapes = new BlendShapeData(reader);
m_BindPose = new float[reader.ReadInt32()][,];
for (int i = 0; i < m_BindPose.Length; i++)
{
m_BindPose[i] = new[,] {
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() } };
}
m_BindPose = reader.ReadMatrixArray();
m_BoneNameHashes = reader.ReadUInt32Array();
var m_RootBoneNameHash = reader.ReadUInt32();
}
@ -530,11 +519,7 @@ namespace AssetStudio
if (version[0] < 3 || (version[0] == 3 && version[1] < 5)) //3.4.2 and earlier
{
m_VertexCount = reader.ReadInt32();
m_Vertices = new float[m_VertexCount * 3];
for (int v = 0; v < m_VertexCount * 3; v++)
{
m_Vertices[v] = reader.ReadSingle();
}
m_Vertices = reader.ReadSingleArray(m_VertexCount * 3); //Vector3
m_Skin = new BoneWeights4[reader.ReadInt32()];
for (int s = 0; s < m_Skin.Length; s++)
@ -542,15 +527,7 @@ namespace AssetStudio
m_Skin[s] = new BoneWeights4(reader);
}
m_BindPose = new float[reader.ReadInt32()][,];
for (int i = 0; i < m_BindPose.Length; i++)
{
m_BindPose[i] = new[,] {
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() } };
}
m_BindPose = reader.ReadMatrixArray();
m_UV0 = reader.ReadSingleArray(reader.ReadInt32() * 2); //Vector2
@ -588,15 +565,7 @@ namespace AssetStudio
if (version[0] == 3 || (version[0] == 4 && version[1] <= 2)) //4.2 and down
{
m_BindPose = new float[reader.ReadInt32()][,];
for (int i = 0; i < m_BindPose.Length; i++)
{
m_BindPose[i] = new[,] {
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() },
{ reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() } };
}
m_BindPose = reader.ReadMatrixArray();
}
m_VertexData = new VertexData(reader);
@ -858,11 +827,13 @@ namespace AssetStudio
{
if (m_CompressedMesh.m_BindPoses.m_NumItems > 0)
{
m_BindPose = new float[m_CompressedMesh.m_BindPoses.m_NumItems / 16][,];
m_BindPose = new Matrix[m_CompressedMesh.m_BindPoses.m_NumItems / 16];
var m_BindPoses_Unpacked = m_CompressedMesh.m_BindPoses.UnpackFloats(16, 4 * 16);
var buffer = new float[16];
for (int i = 0; i < m_BindPose.Length; i++)
{
Array.Copy(m_BindPoses_Unpacked, i * 16, m_BindPose[i], 0, 16);
Array.Copy(m_BindPoses_Unpacked, i * 16, buffer, 0, 16);
m_BindPose[i] = new Matrix(buffer);
}
}
}

View File

@ -6,8 +6,8 @@ namespace AssetStudio
{
public class StructParameter
{
public List<MatrixParameter> m_MatrixParams;
public List<VectorParameter> m_VectorParams;
public MatrixParameter[] m_MatrixParams;
public VectorParameter[] m_VectorParams;
public StructParameter(BinaryReader reader)
{
@ -17,17 +17,17 @@ namespace AssetStudio
var m_StructSize = reader.ReadInt32();
int numVectorParams = reader.ReadInt32();
m_VectorParams = new List<VectorParameter>(numVectorParams);
m_VectorParams = new VectorParameter[numVectorParams];
for (int i = 0; i < numVectorParams; i++)
{
m_VectorParams.Add(new VectorParameter(reader));
m_VectorParams[i] = new VectorParameter(reader);
}
int numMatrixParams = reader.ReadInt32();
m_MatrixParams = new List<MatrixParameter>(numMatrixParams);
m_MatrixParams = new MatrixParameter[numMatrixParams];
for (int i = 0; i < numMatrixParams; i++)
{
m_MatrixParams.Add(new MatrixParameter(reader));
m_MatrixParams[i] = new MatrixParameter(reader);
}
}
}
@ -101,15 +101,15 @@ namespace AssetStudio
public class SerializedProperties
{
public List<SerializedProperty> m_Props;
public SerializedProperty[] m_Props;
public SerializedProperties(BinaryReader reader)
{
int numProps = reader.ReadInt32();
m_Props = new List<SerializedProperty>(numProps);
m_Props = new SerializedProperty[numProps];
for (int i = 0; i < numProps; i++)
{
m_Props.Add(new SerializedProperty(reader));
m_Props[i] = new SerializedProperty(reader);
}
}
}
@ -285,16 +285,16 @@ namespace AssetStudio
public class ParserBindChannels
{
public List<ShaderBindChannel> m_Channels;
public ShaderBindChannel[] m_Channels;
public uint m_SourceMap;
public ParserBindChannels(BinaryReader reader)
{
int numChannels = reader.ReadInt32();
m_Channels = new List<ShaderBindChannel>(numChannels);
m_Channels = new ShaderBindChannel[numChannels];
for (int i = 0; i < numChannels; i++)
{
m_Channels.Add(new ShaderBindChannel(reader));
m_Channels[i] = new ShaderBindChannel(reader);
}
reader.AlignStream();
@ -378,9 +378,9 @@ namespace AssetStudio
public class ConstantBuffer
{
public int m_NameIndex;
public List<MatrixParameter> m_MatrixParams;
public List<VectorParameter> m_VectorParams;
public List<StructParameter> m_StructParams;
public MatrixParameter[] m_MatrixParams;
public VectorParameter[] m_VectorParams;
public StructParameter[] m_StructParams;
public int m_Size;
public ConstantBuffer(ObjectReader reader)
@ -390,25 +390,25 @@ namespace AssetStudio
m_NameIndex = reader.ReadInt32();
int numMatrixParams = reader.ReadInt32();
m_MatrixParams = new List<MatrixParameter>(numMatrixParams);
m_MatrixParams = new MatrixParameter[numMatrixParams];
for (int i = 0; i < numMatrixParams; i++)
{
m_MatrixParams.Add(new MatrixParameter(reader));
m_MatrixParams[i] = new MatrixParameter(reader);
}
int numVectorParams = reader.ReadInt32();
m_VectorParams = new List<VectorParameter>(numVectorParams);
m_VectorParams = new VectorParameter[numVectorParams];
for (int i = 0; i < numVectorParams; i++)
{
m_VectorParams.Add(new VectorParameter(reader));
m_VectorParams[i] = new VectorParameter(reader);
}
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up
{
int numStructParams = reader.ReadInt32();
m_StructParams = new List<StructParameter>(numStructParams);
m_StructParams = new StructParameter[numStructParams];
for (int i = 0; i < numStructParams; i++)
{
m_StructParams.Add(new StructParameter(reader));
m_StructParams[i] = new StructParameter(reader);
}
}
m_Size = reader.ReadInt32();
@ -467,14 +467,14 @@ namespace AssetStudio
public ushort[] m_KeywordIndices;
public sbyte m_ShaderHardwareTier;
public ShaderGpuProgramType m_GpuProgramType;
public List<VectorParameter> m_VectorParams;
public List<MatrixParameter> m_MatrixParams;
public List<TextureParameter> m_TextureParams;
public List<BufferBinding> m_BufferParams;
public List<ConstantBuffer> m_ConstantBuffers;
public List<BufferBinding> m_ConstantBufferBindings;
public List<UAVParameter> m_UAVParams;
public List<SamplerParameter> m_Samplers;
public VectorParameter[] m_VectorParams;
public MatrixParameter[] m_MatrixParams;
public TextureParameter[] m_TextureParams;
public BufferBinding[] m_BufferParams;
public ConstantBuffer[] m_ConstantBuffers;
public BufferBinding[] m_ConstantBufferBindings;
public UAVParameter[] m_UAVParams;
public SamplerParameter[] m_Samplers;
public SerializedSubProgram(ObjectReader reader)
{
@ -493,61 +493,61 @@ namespace AssetStudio
reader.AlignStream();
int numVectorParams = reader.ReadInt32();
m_VectorParams = new List<VectorParameter>(numVectorParams);
m_VectorParams = new VectorParameter[numVectorParams];
for (int i = 0; i < numVectorParams; i++)
{
m_VectorParams.Add(new VectorParameter(reader));
m_VectorParams[i] = new VectorParameter(reader);
}
int numMatrixParams = reader.ReadInt32();
m_MatrixParams = new List<MatrixParameter>(numMatrixParams);
m_MatrixParams = new MatrixParameter[numMatrixParams];
for (int i = 0; i < numMatrixParams; i++)
{
m_MatrixParams.Add(new MatrixParameter(reader));
m_MatrixParams[i] = new MatrixParameter(reader);
}
int numTextureParams = reader.ReadInt32();
m_TextureParams = new List<TextureParameter>(numTextureParams);
m_TextureParams = new TextureParameter[numTextureParams];
for (int i = 0; i < numTextureParams; i++)
{
m_TextureParams.Add(new TextureParameter(reader));
m_TextureParams[i] = new TextureParameter(reader);
}
int numBufferParams = reader.ReadInt32();
m_BufferParams = new List<BufferBinding>(numBufferParams);
m_BufferParams = new BufferBinding[numBufferParams];
for (int i = 0; i < numBufferParams; i++)
{
m_BufferParams.Add(new BufferBinding(reader));
m_BufferParams[i] = new BufferBinding(reader);
}
int numConstantBuffers = reader.ReadInt32();
m_ConstantBuffers = new List<ConstantBuffer>(numConstantBuffers);
m_ConstantBuffers = new ConstantBuffer[numConstantBuffers];
for (int i = 0; i < numConstantBuffers; i++)
{
m_ConstantBuffers.Add(new ConstantBuffer(reader));
m_ConstantBuffers[i] = new ConstantBuffer(reader);
}
int numConstantBufferBindings = reader.ReadInt32();
m_ConstantBufferBindings = new List<BufferBinding>(numConstantBufferBindings);
m_ConstantBufferBindings = new BufferBinding[numConstantBufferBindings];
for (int i = 0; i < numConstantBufferBindings; i++)
{
m_ConstantBufferBindings.Add(new BufferBinding(reader));
m_ConstantBufferBindings[i] = new BufferBinding(reader);
}
int numUAVParams = reader.ReadInt32();
m_UAVParams = new List<UAVParameter>(numUAVParams);
m_UAVParams = new UAVParameter[numUAVParams];
for (int i = 0; i < numUAVParams; i++)
{
m_UAVParams.Add(new UAVParameter(reader));
m_UAVParams[i] = new UAVParameter(reader);
}
if (version[0] >= 2017) //2017 and up
{
int numSamplers = reader.ReadInt32();
m_Samplers = new List<SamplerParameter>(numSamplers);
m_Samplers = new SamplerParameter[numSamplers];
for (int i = 0; i < numSamplers; i++)
{
m_Samplers.Add(new SamplerParameter(reader));
m_Samplers[i] = new SamplerParameter(reader);
}
}
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up
@ -559,15 +559,15 @@ namespace AssetStudio
public class SerializedProgram
{
public List<SerializedSubProgram> m_SubPrograms;
public SerializedSubProgram[] m_SubPrograms;
public SerializedProgram(ObjectReader reader)
{
int numSubPrograms = reader.ReadInt32();
m_SubPrograms = new List<SerializedSubProgram>(numSubPrograms);
m_SubPrograms = new SerializedSubProgram[numSubPrograms];
for (int i = 0; i < numSubPrograms; i++)
{
m_SubPrograms.Add(new SerializedSubProgram(reader));
m_SubPrograms[i] = new SerializedSubProgram(reader);
}
}
}
@ -581,7 +581,7 @@ namespace AssetStudio
public class SerializedPass
{
public List<KeyValuePair<string, int>> m_NameIndices;
public KeyValuePair<string, int>[] m_NameIndices;
public PassType m_Type;
public SerializedShaderState m_State;
public uint m_ProgramMask;
@ -601,10 +601,10 @@ namespace AssetStudio
var version = reader.version;
int numIndices = reader.ReadInt32();
m_NameIndices = new List<KeyValuePair<string, int>>(numIndices);
m_NameIndices = new KeyValuePair<string, int>[numIndices];
for (int i = 0; i < numIndices; i++)
{
m_NameIndices.Add(new KeyValuePair<string, int>(reader.ReadAlignedString(), reader.ReadInt32()));
m_NameIndices[i] = new KeyValuePair<string, int>(reader.ReadAlignedString(), reader.ReadInt32());
}
m_Type = (PassType)reader.ReadInt32();
@ -630,32 +630,32 @@ namespace AssetStudio
public class SerializedTagMap
{
public List<KeyValuePair<string, string>> tags;
public KeyValuePair<string, string>[] tags;
public SerializedTagMap(BinaryReader reader)
{
int numTags = reader.ReadInt32();
tags = new List<KeyValuePair<string, string>>(numTags);
tags = new KeyValuePair<string, string>[numTags];
for (int i = 0; i < numTags; i++)
{
tags.Add(new KeyValuePair<string, string>(reader.ReadAlignedString(), reader.ReadAlignedString()));
tags[i] = new KeyValuePair<string, string>(reader.ReadAlignedString(), reader.ReadAlignedString());
}
}
}
public class SerializedSubShader
{
public List<SerializedPass> m_Passes;
public SerializedPass[] m_Passes;
public SerializedTagMap m_Tags;
public int m_LOD;
public SerializedSubShader(ObjectReader reader)
{
int numPasses = reader.ReadInt32();
m_Passes = new List<SerializedPass>(numPasses);
m_Passes = new SerializedPass[numPasses];
for (int i = 0; i < numPasses; i++)
{
m_Passes.Add(new SerializedPass(reader));
m_Passes[i] = new SerializedPass(reader);
}
m_Tags = new SerializedTagMap(reader);
@ -678,11 +678,11 @@ namespace AssetStudio
public class SerializedShader
{
public SerializedProperties m_PropInfo;
public List<SerializedSubShader> m_SubShaders;
public SerializedSubShader[] m_SubShaders;
public string m_Name;
public string m_CustomEditorName;
public string m_FallbackName;
public List<SerializedShaderDependency> m_Dependencies;
public SerializedShaderDependency[] m_Dependencies;
public bool m_DisableNoSubshadersMessage;
public SerializedShader(ObjectReader reader)
@ -690,10 +690,10 @@ namespace AssetStudio
m_PropInfo = new SerializedProperties(reader);
int numSubShaders = reader.ReadInt32();
m_SubShaders = new List<SerializedSubShader>(numSubShaders);
m_SubShaders = new SerializedSubShader[numSubShaders];
for (int i = 0; i < numSubShaders; i++)
{
m_SubShaders.Add(new SerializedSubShader(reader));
m_SubShaders[i] = new SerializedSubShader(reader);
}
m_Name = reader.ReadAlignedString();
@ -701,10 +701,10 @@ namespace AssetStudio
m_FallbackName = reader.ReadAlignedString();
int numDependencies = reader.ReadInt32();
m_Dependencies = new List<SerializedShaderDependency>(numDependencies);
m_Dependencies = new SerializedShaderDependency[numDependencies];
for (int i = 0; i < numDependencies; i++)
{
m_Dependencies.Add(new SerializedShaderDependency(reader));
m_Dependencies[i] = new SerializedShaderDependency(reader);
}
m_DisableNoSubshadersMessage = reader.ReadBoolean();

View File

@ -8,22 +8,23 @@ namespace AssetStudio
{
public class Transform : Component
{
public float[] m_LocalRotation;
public float[] m_LocalPosition;
public float[] m_LocalScale;
public List<PPtr<Transform>> m_Children;
public Quaternion m_LocalRotation;
public Vector3 m_LocalPosition;
public Vector3 m_LocalScale;
public PPtr<Transform>[] m_Children;
public PPtr<Transform> m_Father;
public Transform(ObjectReader reader) : base(reader)
{
m_LocalRotation = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
m_LocalPosition = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
m_LocalScale = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
m_LocalRotation = reader.ReadQuaternion();
m_LocalPosition = reader.ReadVector3();
m_LocalScale = reader.ReadVector3();
int m_ChildrenCount = reader.ReadInt32();
m_Children = new List<PPtr<Transform>>(m_ChildrenCount);
for (int j = 0; j < m_ChildrenCount; j++)
m_Children = new PPtr<Transform>[m_ChildrenCount];
for (int i = 0; i < m_ChildrenCount; i++)
{
m_Children.Add(new PPtr<Transform>(reader));
m_Children[i] = new PPtr<Transform>(reader);
}
m_Father = new PPtr<Transform>(reader);
}

View File

@ -19,9 +19,9 @@ namespace AssetStudio
public class ImportedFrame : IEnumerable<ImportedFrame>
{
public string Name { get; set; }
public float[] LocalRotation { get; set; }
public float[] LocalPosition { get; set; }
public float[] LocalScale { get; set; }
public Vector3 LocalRotation { get; set; }
public Vector3 LocalPosition { get; set; }
public Vector3 LocalScale { get; set; }
public ImportedFrame Parent { get; set; }
private List<ImportedFrame> children;
@ -30,9 +30,9 @@ namespace AssetStudio
public int Count => children.Count;
public void InitChildren(int count)
public ImportedFrame(int childrenCount = 0)
{
children = new List<ImportedFrame>(count);
children = new List<ImportedFrame>(childrenCount);
}
public void AddChild(ImportedFrame obj)
@ -95,7 +95,7 @@ namespace AssetStudio
public class ImportedBone
{
public string Name { get; set; }
public float[,] Matrix { get; set; }
public Matrix Matrix { get; set; }
}
public class ImportedMaterial

View File

@ -288,9 +288,9 @@ namespace AssetStudio
Marshal::FreeHGlobal((IntPtr)pName);
}
pFrameNode->LclScaling.Set(FbxDouble3(frame->LocalScale[0], frame->LocalScale[1], frame->LocalScale[2]));
pFrameNode->LclRotation.Set(FbxDouble3(frame->LocalRotation[0], frame->LocalRotation[1], frame->LocalRotation[2]));
pFrameNode->LclTranslation.Set(FbxDouble3(frame->LocalPosition[0], frame->LocalPosition[1], frame->LocalPosition[2]));
pFrameNode->LclScaling.Set(FbxDouble3(frame->LocalScale.X, frame->LocalScale.Y, frame->LocalScale.Z));
pFrameNode->LclRotation.Set(FbxDouble3(frame->LocalRotation.X, frame->LocalRotation.Y, frame->LocalRotation.Z));
pFrameNode->LclTranslation.Set(FbxDouble3(frame->LocalPosition.X, frame->LocalPosition.Y, frame->LocalPosition.Z));
pParentNode->AddChild(pFrameNode);
if (imported->MeshList != nullptr && ImportedHelpers::FindMesh(frame, imported->MeshList) != nullptr)
@ -545,11 +545,11 @@ namespace AssetStudio
}
array<float>^ uv = vertex->UV;
if (uv != nullptr)
lGeometryElementUV->GetDirectArray().Add(FbxVector2(uv[0], -uv[1]));
lGeometryElementUV->GetDirectArray().Add(FbxVector2(uv[0], uv[1]));
if (normals)
{
Vector4 tangent = vertex->Tangent;
lGeometryElementTangent->GetDirectArray().Add(FbxVector4(tangent.X, tangent.Y, tangent.Z, -tangent.W));
lGeometryElementTangent->GetDirectArray().Add(FbxVector4(tangent.X, tangent.Y, tangent.Z, tangent.W));
}
if (hasBones && vertex->BoneIndices != nullptr)

View File

@ -277,7 +277,7 @@ namespace AssetStudioGUI
if (e.Control) //Normal mode
{
normalMode = (normalMode + 1) % 2;
createVAO();
CreateVAO();
glControl1.Invalidate();
}
break;
@ -1060,7 +1060,7 @@ namespace AssetStudioGUI
}
#endregion
glControl1.Visible = true;
createVAO();
CreateVAO();
StatusStripUpdate("Using OpenGL Version: " + GL.GetString(StringName.Version) + "\n"
+ "'Mouse Left'=Rotate | 'Mouse Right'=Move | 'Mouse Wheel'=Zoom \n"
+ "'Ctrl W'=Wireframe | 'Ctrl S'=Shade | 'Ctrl N'=ReNormal ");
@ -1446,23 +1446,23 @@ namespace AssetStudioGUI
Progress.Default = new GUIProgress(SetProgressBarValue);
}
private void initOpenTK()
private void InitOpenTK()
{
changeGLSize(glControl1.Size);
ChangeGLSize(glControl1.Size);
GL.ClearColor(Color.CadetBlue);
pgmID = GL.CreateProgram();
loadShader("vs", ShaderType.VertexShader, pgmID, out int vsID);
loadShader("fs", ShaderType.FragmentShader, pgmID, out int fsID);
LoadShader("vs", ShaderType.VertexShader, pgmID, out int vsID);
LoadShader("fs", ShaderType.FragmentShader, pgmID, out int fsID);
GL.LinkProgram(pgmID);
pgmColorID = GL.CreateProgram();
loadShader("vs", ShaderType.VertexShader, pgmColorID, out vsID);
loadShader("fsColor", ShaderType.FragmentShader, pgmColorID, out fsID);
LoadShader("vs", ShaderType.VertexShader, pgmColorID, out vsID);
LoadShader("fsColor", ShaderType.FragmentShader, pgmColorID, out fsID);
GL.LinkProgram(pgmColorID);
pgmBlackID = GL.CreateProgram();
loadShader("vs", ShaderType.VertexShader, pgmBlackID, out vsID);
loadShader("fsBlack", ShaderType.FragmentShader, pgmBlackID, out fsID);
LoadShader("vs", ShaderType.VertexShader, pgmBlackID, out vsID);
LoadShader("fsBlack", ShaderType.FragmentShader, pgmBlackID, out fsID);
GL.LinkProgram(pgmBlackID);
attributeVertexPosition = GL.GetAttribLocation(pgmID, "vertexPosition");
@ -1473,7 +1473,7 @@ namespace AssetStudioGUI
uniformProjMatrix = GL.GetUniformLocation(pgmID, "projMatrix");
}
private void loadShader(string filename, ShaderType type, int program, out int address)
private static void LoadShader(string filename, ShaderType type, int program, out int address)
{
address = GL.CreateShader(type);
var str = (string)Properties.Resources.ResourceManager.GetObject(filename);
@ -1483,7 +1483,7 @@ namespace AssetStudioGUI
GL.DeleteShader(address);
}
private void createVBO(out int vboAddress, Vector3[] data, int address)
private static void CreateVBO(out int vboAddress, Vector3[] data, int address)
{
GL.GenBuffers(1, out vboAddress);
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
@ -1495,7 +1495,7 @@ namespace AssetStudioGUI
GL.EnableVertexAttribArray(address);
}
private void createVBO(out int vboAddress, Vector4[] data, int address)
private static void CreateVBO(out int vboAddress, Vector4[] data, int address)
{
GL.GenBuffers(1, out vboAddress);
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
@ -1507,13 +1507,13 @@ namespace AssetStudioGUI
GL.EnableVertexAttribArray(address);
}
private void createVBO(out int vboAddress, Matrix4 data, int address)
private static void CreateVBO(out int vboAddress, Matrix4 data, int address)
{
GL.GenBuffers(1, out vboAddress);
GL.UniformMatrix4(address, false, ref data);
}
private void createEBO(out int address, int[] data)
private static void CreateEBO(out int address, int[] data)
{
GL.GenBuffers(1, out address);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, address);
@ -1523,31 +1523,31 @@ namespace AssetStudioGUI
BufferUsageHint.StaticDraw);
}
private void createVAO()
private void CreateVAO()
{
GL.DeleteVertexArray(vao);
GL.GenVertexArrays(1, out vao);
GL.BindVertexArray(vao);
createVBO(out var vboPositions, vertexData, attributeVertexPosition);
CreateVBO(out var vboPositions, vertexData, attributeVertexPosition);
if (normalMode == 0)
{
createVBO(out var vboNormals, normal2Data, attributeNormalDirection);
CreateVBO(out var vboNormals, normal2Data, attributeNormalDirection);
}
else
{
if (normalData != null)
createVBO(out var vboNormals, normalData, attributeNormalDirection);
CreateVBO(out var vboNormals, normalData, attributeNormalDirection);
}
createVBO(out var vboColors, colorData, attributeVertexColor);
createVBO(out var vboModelMatrix, modelMatrixData, uniformModelMatrix);
createVBO(out var vboViewMatrix, viewMatrixData, uniformViewMatrix);
createVBO(out var vboProjMatrix, projMatrixData, uniformProjMatrix);
createEBO(out var eboElements, indiceData);
CreateVBO(out var vboColors, colorData, attributeVertexColor);
CreateVBO(out var vboModelMatrix, modelMatrixData, uniformModelMatrix);
CreateVBO(out var vboViewMatrix, viewMatrixData, uniformViewMatrix);
CreateVBO(out var vboProjMatrix, projMatrixData, uniformProjMatrix);
CreateEBO(out var eboElements, indiceData);
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.BindVertexArray(0);
}
private void changeGLSize(Size size)
private void ChangeGLSize(Size size)
{
GL.Viewport(0, 0, size.Width, size.Height);
@ -1567,14 +1567,14 @@ namespace AssetStudioGUI
{
if (glControlLoaded && glControl1.Visible)
{
changeGLSize(glControl1.Size);
ChangeGLSize(glControl1.Size);
glControl1.Invalidate();
}
}
private void glControl1_Load(object sender, EventArgs e)
{
initOpenTK();
InitOpenTK();
glControlLoaded = true;
}

View File

@ -201,7 +201,7 @@ namespace AssetStudioGUI
{
foreach (var item in tempExportableAssets)
{
var originalPath = ab.m_Container.Find(y => y.Value.asset.m_PathID == item.Asset.m_PathID).Key;
var originalPath = ab.m_Container.FirstOrDefault(y => y.Value.asset.m_PathID == item.Asset.m_PathID).Key;
if (!string.IsNullOrEmpty(originalPath))
{
var extension = Path.GetExtension(originalPath);

View File

@ -81,7 +81,7 @@ namespace AssetStudio
var m_Transform = m_GameObject.m_Transform;
if (!hasTransformHierarchy)
{
ConvertFrames(m_Transform, null);
ConvertTransforms(m_Transform, null);
DeoptimizeTransformHierarchy();
}
else
@ -90,7 +90,7 @@ namespace AssetStudio
var tempTransform = m_Transform;
while (tempTransform.m_Father.TryGet(out var m_Father))
{
frameList.Add(ConvertFrame(m_Father));
frameList.Add(ConvertTransform(m_Father));
tempTransform = m_Father;
}
if (frameList.Count > 0)
@ -102,11 +102,11 @@ namespace AssetStudio
var parent = frameList[i + 1];
parent.AddChild(frame);
}
ConvertFrames(m_Transform, frameList[0]);
ConvertTransforms(m_Transform, frameList[0]);
}
else
{
ConvertFrames(m_Transform, null);
ConvertTransforms(m_Transform, null);
}
CreateBonePathHash(m_Transform);
@ -183,39 +183,33 @@ namespace AssetStudio
}
}
private ImportedFrame ConvertFrame(Transform trans)
private static ImportedFrame ConvertTransform(Transform trans)
{
var frame = new ImportedFrame();
var frame = new ImportedFrame(trans.m_Children.Length);
trans.m_GameObject.TryGet(out var m_GameObject);
frame.Name = m_GameObject.m_Name;
frame.InitChildren(trans.m_Children.Count);
var m_EulerRotation = QuatToEuler(new[] { trans.m_LocalRotation[0], -trans.m_LocalRotation[1], -trans.m_LocalRotation[2], trans.m_LocalRotation[3] });
frame.LocalRotation = new[] { m_EulerRotation[0], m_EulerRotation[1], m_EulerRotation[2] };
frame.LocalScale = new[] { trans.m_LocalScale[0], trans.m_LocalScale[1], trans.m_LocalScale[2] };
frame.LocalPosition = new[] { -trans.m_LocalPosition[0], trans.m_LocalPosition[1], trans.m_LocalPosition[2] };
SetFrame(frame, trans.m_LocalPosition, trans.m_LocalRotation, trans.m_LocalScale);
return frame;
}
private ImportedFrame ConvertFrame(Vector3 t, Quaternion q, Vector3 s, string name)
private static ImportedFrame CreateFrame(string name, Vector3 t, Quaternion q, Vector3 s)
{
var frame = new ImportedFrame();
frame.Name = name;
frame.InitChildren(0);
SetFrame(frame, t, q, s);
return frame;
}
private void SetFrame(ImportedFrame frame, Vector3 t, Quaternion q, Vector3 s)
private static void SetFrame(ImportedFrame frame, Vector3 t, Quaternion q, Vector3 s)
{
var m_EulerRotation = QuatToEuler(new[] { q.X, -q.Y, -q.Z, q.W });
frame.LocalRotation = new[] { m_EulerRotation[0], m_EulerRotation[1], m_EulerRotation[2] };
frame.LocalScale = new[] { s.X, s.Y, s.Z };
frame.LocalPosition = new[] { -t.X, t.Y, t.Z };
frame.LocalPosition = new Vector3(-t.X, t.Y, t.Z);
frame.LocalRotation = Fbx.QuaternionToEuler(new Quaternion(q.X, -q.Y, -q.Z, q.W));
frame.LocalScale = s;
}
private void ConvertFrames(Transform trans, ImportedFrame parent)
private void ConvertTransforms(Transform trans, ImportedFrame parent)
{
var frame = ConvertFrame(trans);
var frame = ConvertTransform(trans);
if (parent == null)
{
RootFrame = frame;
@ -227,7 +221,7 @@ namespace AssetStudio
foreach (var pptr in trans.m_Children)
{
if (pptr.TryGet(out var child))
ConvertFrames(child, frame);
ConvertTransforms(child, frame);
}
}
@ -323,16 +317,16 @@ namespace AssetStudio
//UV
if (mesh.m_UV0 != null && mesh.m_UV0.Length == mesh.m_VertexCount * 2)
{
iVertex.UV = new[] { mesh.m_UV0[j * 2], -mesh.m_UV0[j * 2 + 1] };
iVertex.UV = new[] { mesh.m_UV0[j * 2], mesh.m_UV0[j * 2 + 1] };
}
else if (mesh.m_UV1 != null && mesh.m_UV1.Length == mesh.m_VertexCount * 2)
{
iVertex.UV = new[] { mesh.m_UV1[j * 2], -mesh.m_UV1[j * 2 + 1] };
iVertex.UV = new[] { mesh.m_UV1[j * 2], mesh.m_UV1[j * 2 + 1] };
}
//Tangent
if (mesh.m_Tangents != null && mesh.m_Tangents.Length == mesh.m_VertexCount * 4)
{
iVertex.Tangent = new Vector4(-mesh.m_Tangents[j * 4], mesh.m_Tangents[j * 4 + 1], mesh.m_Tangents[j * 4 + 2], mesh.m_Tangents[j * 4 + 3]);
iVertex.Tangent = new Vector4(-mesh.m_Tangents[j * 4], mesh.m_Tangents[j * 4 + 1], mesh.m_Tangents[j * 4 + 2], -mesh.m_Tangents[j * 4 + 3]);
}
//BoneInfluence
if (mesh.m_Skin?.Length > 0)
@ -382,25 +376,8 @@ namespace AssetStudio
//throw new Exception("A Bone could neither be found by hash in Avatar nor by index in SkinnedMeshRenderer.");
continue;
}
var om = new float[4, 4];
var m = mesh.m_BindPose[i];
om[0, 0] = m[0, 0];
om[0, 1] = -m[1, 0];
om[0, 2] = -m[2, 0];
om[0, 3] = m[3, 0];
om[1, 0] = -m[0, 1];
om[1, 1] = m[1, 1];
om[1, 2] = m[2, 1];
om[1, 3] = m[3, 1];
om[2, 0] = -m[0, 2];
om[2, 1] = m[1, 2];
om[2, 2] = m[2, 2];
om[2, 3] = m[3, 2];
om[3, 0] = -m[0, 3];
om[3, 1] = m[1, 3];
om[3, 2] = m[2, 3];
om[3, 3] = m[3, 3];
bone.Matrix = om;
var convert = Matrix.Scaling(new Vector3(-1, 1, 1));
bone.Matrix = convert * Matrix.Transpose(mesh.m_BindPose[i]) * convert;
iMesh.BoneList.Add(bone);
}
}
@ -434,25 +411,8 @@ namespace AssetStudio
continue;
}
}
var om = new float[4, 4];
var m = mesh.m_BindPose[i];
om[0, 0] = m[0, 0];
om[0, 1] = -m[1, 0];
om[0, 2] = -m[2, 0];
om[0, 3] = m[3, 0];
om[1, 0] = -m[0, 1];
om[1, 1] = m[1, 1];
om[1, 2] = m[2, 1];
om[1, 3] = m[3, 1];
om[2, 0] = -m[0, 2];
om[2, 1] = m[1, 2];
om[2, 2] = m[2, 2];
om[2, 3] = m[3, 2];
om[3, 0] = -m[0, 3];
om[3, 1] = m[1, 3];
om[3, 2] = m[2, 3];
om[3, 3] = m[3, 3];
bone.Matrix = om;
var convert = Matrix.Scaling(new Vector3(-1, 1, 1));
bone.Matrix = convert * Matrix.Transpose(mesh.m_BindPose[i]) * convert;
iMesh.BoneList.Add(bone);
}
}
@ -464,11 +424,11 @@ namespace AssetStudio
{
morphChannelInfo[channel.nameHash] = channel.name;
}
if (mesh.m_Shapes.shapes.Count > 0)
if (mesh.m_Shapes.shapes.Length > 0)
{
ImportedMorph morph = null;
string lastGroup = "";
for (int i = 0; i < mesh.m_Shapes.channels.Count; i++)
for (int i = 0; i < mesh.m_Shapes.channels.Length; i++)
{
string group = BlendShapeNameGroup(mesh, i);
if (group != lastGroup)
@ -477,8 +437,8 @@ namespace AssetStudio
MorphList.Add(morph);
morph.Name = iMesh.Name;
morph.ClipName = group;
morph.Channels = new List<Tuple<float, int, int>>(mesh.m_Shapes.channels.Count);
morph.KeyframeList = new List<ImportedMorphKeyframe>(mesh.m_Shapes.shapes.Count);
morph.Channels = new List<Tuple<float, int, int>>(mesh.m_Shapes.channels.Length);
morph.KeyframeList = new List<ImportedMorphKeyframe>(mesh.m_Shapes.shapes.Length);
lastGroup = group;
}
@ -535,7 +495,7 @@ namespace AssetStudio
MeshList.Add(iMesh);
}
private Mesh GetMesh(Renderer meshR)
private static Mesh GetMesh(Renderer meshR)
{
if (meshR is SkinnedMeshRenderer sMesh)
{
@ -573,7 +533,7 @@ namespace AssetStudio
return path;
}
private string GetTransformPath(Transform transform)
private static string GetTransformPath(Transform transform)
{
transform.m_GameObject.TryGet(out var m_GameObject);
if (transform.m_Father.TryGet(out var father))
@ -817,7 +777,7 @@ namespace AssetStudio
{
var frame = streamedFrames[frameIndex];
var streamedValues = frame.keyList.Select(x => x.value).ToArray();
for (int curveIndex = 0; curveIndex < frame.keyList.Count;)
for (int curveIndex = 0; curveIndex < frame.keyList.Length;)
{
ReadCurveData(iAnim, m_ClipBindingConstant, frame.keyList[curveIndex].index, frame.time, streamedValues, 0, ref curveIndex);
}
@ -1036,52 +996,10 @@ namespace AssetStudio
}
else
{
frame = ConvertFrame(xform.t, xform.q, xform.s, transformName);
frame = CreateFrame(transformName, xform.t, xform.q, xform.s);
parentFrame.AddChild(frame);
}
}
}
private static float[] QuatToEuler(float[] q)
{
double eax = 0;
double eay = 0;
double eaz = 0;
float qx = q[0];
float qy = q[1];
float qz = q[2];
float qw = q[3];
double[,] M = new double[4, 4];
double Nq = qx * qx + qy * qy + qz * qz + qw * qw;
double s = (Nq > 0.0) ? (2.0 / Nq) : 0.0;
double xs = qx * s, ys = qy * s, zs = qz * s;
double wx = qw * xs, wy = qw * ys, wz = qw * zs;
double xx = qx * xs, xy = qx * ys, xz = qx * zs;
double yy = qy * ys, yz = qy * zs, zz = qz * zs;
M[0, 0] = 1.0 - (yy + zz); M[0, 1] = xy - wz; M[0, 2] = xz + wy;
M[1, 0] = xy + wz; M[1, 1] = 1.0 - (xx + zz); M[1, 2] = yz - wx;
M[2, 0] = xz - wy; M[2, 1] = yz + wx; M[2, 2] = 1.0 - (xx + yy);
M[3, 0] = M[3, 1] = M[3, 2] = M[0, 3] = M[1, 3] = M[2, 3] = 0.0; M[3, 3] = 1.0;
double test = Math.Sqrt(M[0, 0] * M[0, 0] + M[1, 0] * M[1, 0]);
if (test > 16 * 1.19209290E-07F)//FLT_EPSILON
{
eax = Math.Atan2(M[2, 1], M[2, 2]);
eay = Math.Atan2(-M[2, 0], test);
eaz = Math.Atan2(M[1, 0], M[0, 0]);
}
else
{
eax = Math.Atan2(-M[1, 2], M[1, 1]);
eay = Math.Atan2(-M[2, 0], test);
eaz = 0;
}
return new[] { (float)(eax * 180 / Math.PI), (float)(eay * 180 / Math.PI), (float)(eaz * 180 / Math.PI) };
}
}
}