BitHelper.ToQuaternion C# (CSharp) Method

ToQuaternion() public static method

public static ToQuaternion ( byte buf, int pos ) : Quaternion,
buf byte
pos int
return Quaternion,
    public static Quaternion ToQuaternion(byte[] buf, int pos)
    {
        Quaternion vec;
        vec.x = BitConverter.ToSingle(buf, pos + 0);
        vec.y = BitConverter.ToSingle(buf, pos + 4);
        vec.z = BitConverter.ToSingle(buf, pos + 8);
        vec.w = BitConverter.ToSingle(buf, pos + 12);
        return vec;
    }
    public static void MatrixDeCompose(Matrix4x4 m, out Vector3 pos, out Vector3 scale, out Quaternion quat)

Usage Example

コード例 #1
0
ファイル: BoneMatrix.cs プロジェクト: liro0206/EgretUnity
 public void Load(System.IO.Stream stream, PoseBoneMatrix last)
 {
     byte[] btag = new byte[2];
     stream.Read(btag, 0, 2);
     this.tag = (PoseBoneMatrix.changetag)btag[0];
     PoseBoneMatrix.changetag savetag = (PoseBoneMatrix.changetag)btag[1];
     //Debug.LogWarning("savetag=" + this.tag + "|" + savetag);
     if ((savetag & PoseBoneMatrix.changetag.Rotate) > 0)
     {
         byte[] buf = new byte[16];
         stream.Read(buf, 0, 16);
         r = BitHelper.ToQuaternion(buf, 0);
     }
     else
     {
         r = last.r;
     }
     if ((savetag & PoseBoneMatrix.changetag.Trans) > 0)
     {
         byte[] buf = new byte[12];
         stream.Read(buf, 0, 12);
         t = BitHelper.ToVector3(buf, 0);
     }
     else
     {
         t = last.t;
     }
     if ((savetag & PoseBoneMatrix.changetag.Scale) > 0)
     {
         byte[] buf = new byte[12];
         stream.Read(buf, 0, 12);
         s = BitHelper.ToVector3(buf, 0);
     }
     else
     {
         s = last.s;
     }
 }
All Usage Examples Of BitHelper::ToQuaternion