This repository has been archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
5,886 additions
and
81 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace AssetStudio | ||
{ | ||
public struct Float : IYAMLExportable | ||
{ | ||
public float Value; | ||
|
||
public Float(float value) | ||
{ | ||
Value = value; | ||
} | ||
|
||
public static implicit operator Float(float value) | ||
{ | ||
return new Float(value); | ||
} | ||
|
||
public static implicit operator float(Float value) | ||
{ | ||
return value.Value; | ||
} | ||
|
||
public YAMLNode ExportYAML(int[] version) | ||
{ | ||
return new YAMLScalarNode(Value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace AssetStudio | ||
{ | ||
[StructLayout(LayoutKind.Sequential, Pack = 4)] | ||
public struct XForm : IEquatable<XForm> | ||
{ | ||
public Vector3 t; | ||
public Quaternion q; | ||
public Vector3 s; | ||
|
||
public XForm(Vector3 t, Quaternion q, Vector3 s) | ||
{ | ||
this.t = t; | ||
this.q = q; | ||
this.s = s; | ||
} | ||
public float this[int index] | ||
{ | ||
get | ||
{ | ||
switch (index) | ||
{ | ||
case 0: return t.X; | ||
case 1: return t.Y; | ||
case 2: return t.Z; | ||
case 3: return q.X; | ||
case 4: return q.Y; | ||
case 5: return q.Z; | ||
case 6: return q.W; | ||
case 7: return s.X; | ||
case 8: return s.Y; | ||
case 9: return s.Z; | ||
default: throw new ArgumentOutOfRangeException(nameof(index), "Invalid xform index!"); | ||
} | ||
} | ||
|
||
set | ||
{ | ||
switch (index) | ||
{ | ||
case 0: t.X = value; break; | ||
case 1: t.Y = value; break; | ||
case 2: t.Z = value; break; | ||
case 3: q.X = value; break; | ||
case 4: q.Y = value; break; | ||
case 5: q.Z = value; break; | ||
case 6: q.W = value; break; | ||
case 7: s.X = value; break; | ||
case 8: s.Y = value; break; | ||
case 9: s.Z = value; break; | ||
default: | ||
throw new ArgumentOutOfRangeException(nameof(index), "Invalid xform index!"); | ||
} | ||
} | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return t.GetHashCode() ^ (q.GetHashCode() << 2) ^ (s.GetHashCode() >> 2); | ||
} | ||
|
||
bool IEquatable<XForm>.Equals(XForm other) | ||
{ | ||
return t.Equals(other.t) && q.Equals(other.q) && s.Equals(other.s); | ||
} | ||
|
||
public static XForm Zero => new XForm(Vector3.Zero, Quaternion.Zero, Vector3.One); | ||
} | ||
} |
Oops, something went wrong.