@@ -46,22 +46,38 @@ override protected bool LoadInternal()
4646 Vector4 Row2 = Utilities . Consume < Vector4 > ( reader ) ;
4747 double [ , ] matrix = new double [ , ]
4848 {
49+ #if UNITY_EDITOR || UNITY_STANDALONE_WIN
50+ { Row0 . x , Row0 . y , Row0 . z , Row0 . w } ,
51+ { Row1 . x , Row1 . y , Row1 . z , Row1 . w } ,
52+ { Row2 . x , Row2 . y , Row2 . z , Row2 . w } ,
53+ #else
4954 { Row0 . X , Row0 . Y , Row0 . Z , Row0 . W } ,
5055 { Row1 . X , Row1 . Y , Row1 . Z , Row1 . W } ,
5156 { Row2 . X , Row2 . Y , Row2 . Z , Row2 . W } ,
57+ #endif
5258 } ;
5359
5460 entry . Position = new Vector3 (
5561 ( float ) matrix [ 0 , 3 ] ,
5662 ( float ) matrix [ 1 , 3 ] ,
5763 ( float ) matrix [ 2 , 3 ]
5864 ) ;
65+ #if UNITY_EDITOR || UNITY_STANDALONE_WIN
66+ Matrix4x4 matrix4x4 = new Matrix4x4 (
67+ new Vector4 ( ( float ) matrix [ 0 , 0 ] , ( float ) matrix [ 0 , 1 ] , ( float ) matrix [ 0 , 2 ] , 0 ) ,
68+ new Vector4 ( ( float ) matrix [ 1 , 0 ] , ( float ) matrix [ 1 , 1 ] , ( float ) matrix [ 1 , 2 ] , 0 ) ,
69+ new Vector4 ( ( float ) matrix [ 2 , 0 ] , ( float ) matrix [ 2 , 1 ] , ( float ) matrix [ 2 , 2 ] , 0 ) ,
70+ new Vector4 ( 0 , 0 , 0 , 1 )
71+ ) ;
72+ entry . Rotation = Quaternion . LookRotation ( matrix4x4 . GetColumn ( 2 ) , matrix4x4 . GetColumn ( 1 ) ) ;
73+ #else
5974 entry . Rotation = Quaternion . CreateFromRotationMatrix ( new Matrix4x4 (
6075 ( float ) matrix [ 0 , 0 ] , ( float ) matrix [ 0 , 1 ] , ( float ) matrix [ 0 , 2 ] , 0 ,
6176 ( float ) matrix [ 1 , 0 ] , ( float ) matrix [ 1 , 1 ] , ( float ) matrix [ 1 , 2 ] , 0 ,
6277 ( float ) matrix [ 2 , 0 ] , ( float ) matrix [ 2 , 1 ] , ( float ) matrix [ 2 , 2 ] , 0 ,
6378 0 , 0 , 0 , 1
6479 ) ) ;
80+ #endif
6581
6682 reader . BaseStream . Position += 8 ;
6783 Entries . Add ( entry ) ;
@@ -87,10 +103,17 @@ override protected bool SaveInternal()
87103 Utilities . Write ( writer , Entries [ i ] . composite_instance_id ) ;
88104 Utilities . Write ( writer , Entries [ i ] . entity ) ;
89105
106+ #if UNITY_EDITOR || UNITY_STANDALONE_WIN
107+ Matrix4x4 rotationMatrix4x4 = Matrix4x4 . Rotate ( Entries [ i ] . Rotation ) ;
108+ Vector4 Row0 = new Vector4 ( rotationMatrix4x4 . m11 , rotationMatrix4x4 . m12 , rotationMatrix4x4 . m13 , Entries [ i ] . Position . x ) ;
109+ Vector4 Row1 = new Vector4 ( rotationMatrix4x4 . m21 , rotationMatrix4x4 . m22 , rotationMatrix4x4 . m23 , Entries [ i ] . Position . y ) ;
110+ Vector4 Row2 = new Vector4 ( rotationMatrix4x4 . m31 , rotationMatrix4x4 . m32 , rotationMatrix4x4 . m33 , Entries [ i ] . Position . z ) ;
111+ #else
90112 Matrix4x4 rotationMatrix4x4 = Matrix4x4 . CreateFromQuaternion ( Entries [ i ] . Rotation ) ;
91113 Vector4 Row0 = new Vector4 ( rotationMatrix4x4 . M11 , rotationMatrix4x4 . M12 , rotationMatrix4x4 . M13 , Entries [ i ] . Position . X ) ;
92114 Vector4 Row1 = new Vector4 ( rotationMatrix4x4 . M21 , rotationMatrix4x4 . M22 , rotationMatrix4x4 . M23 , Entries [ i ] . Position . Y ) ;
93115 Vector4 Row2 = new Vector4 ( rotationMatrix4x4 . M31 , rotationMatrix4x4 . M32 , rotationMatrix4x4 . M33 , Entries [ i ] . Position . Z ) ;
116+ #endif
94117
95118 Utilities . Write < Vector4 > ( writer , Row0 ) ;
96119 Utilities . Write < Vector4 > ( writer , Row1 ) ;
@@ -100,7 +123,7 @@ override protected bool SaveInternal()
100123 }
101124 return true ;
102125 }
103- #endregion
126+ #endregion
104127
105128 #region STRUCTURES
106129 public class Entry
0 commit comments