Ejemplo n.º 1
0
        public CompressedMatrix Write(Transform transform, ref Bitstream bitstream, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            if (!cached)
            {
                CacheValues();
            }

            CompressedMatrix cm = Compress(transform);

            bitstream.Write(cm);
            return(cm);
        }
Ejemplo n.º 2
0
        public Matrix Decompress(CompressedMatrix compMatrix)
        {
            if (!cached)
            {
                CacheValues();
            }

            return(new Matrix(
                       this,
                       posCrusher.Decompress(compMatrix.cPos),
                       rotCrusher.Decompress(compMatrix.cRot),
                       sclCrusher.Decompress(compMatrix.cScl)
                       ));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Apply the TRS matrix to a transform. Any axes not included in the Crusher are left as is.
 /// </summary>
 public void Apply(Transform t, CompressedMatrix cmatrix)
 {
     if (cached_pBits > 0)
     {
         posCrusher.Apply(t, cmatrix.cPos);
     }
     if (cached_rBits > 0)
     {
         rotCrusher.Apply(t, cmatrix.cRot);
     }
     if (cached_sBits > 0)
     {
         sclCrusher.Apply(t, cmatrix.cScl);
     }
 }
Ejemplo n.º 4
0
        public CompressedMatrix Compress(Transform transform)
        {
            if (!cached)
            {
                CacheValues();
            }

            CompressedElement cpos = (cached_pBits > 0) ? posCrusher.Compress(transform) : CompressedElement.Empty;
            CompressedElement crot = (cached_rBits > 0) ? rotCrusher.Compress(transform) : CompressedElement.Empty;
            CompressedElement cscl = (cached_sBits > 0) ? sclCrusher.Compress(transform) : CompressedElement.Empty;

            //Debug.Log("<b>TC compress </b> \n" + cpos + "\n" + crot + "\n" + cscl);
            CompressedMatrix cm = new CompressedMatrix(
                this, cpos, crot, cscl, cached_pBits, cached_rBits, cached_sBits);

            return(cm);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Compress this matrix using the crusher it was previously created with.
 /// </summary>
 /// <returns></returns>
 public void Compress(CompressedMatrix nonalloc)
 {
     crusher.Compress(nonalloc, this);
 }
 public static StringBuilder AppendSB(this StringBuilder strb, CompressedMatrix cm)
 {
     strb.Append(" cPos: ").AppendSB(cm.cPos).Append(" cRot: ").AppendSB(cm.cRot).Append(" cScl: ").AppendSB(cm.cScl);
     return(strb);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Apply the TRS matrix to a transform. Any axes not included in the Crusher are left as is.
 /// </summary>
 public void Apply(CompressedMatrix cmatrix)
 {
     DebugX.LogError(transformMissingError, !defaultTransform, true);
     Apply(defaultTransform, cmatrix);
 }
Ejemplo n.º 8
0
        public void Apply(Transform t, ulong u0, ulong u1, ulong u2, ulong u3, uint u4)
        {
            CompressedMatrix cmatrix = Read(u0, u1, u2, u3, u4);

            Apply(t, cmatrix);
        }
Ejemplo n.º 9
0
        //public Matrix Decompress(CompositeBuffer buffer, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        //{
        //	CompressedMatrix compMatrix = Read(buffer, bcl);
        //	return Decompress(compMatrix);
        //}

        public Matrix Decompress(ulong compressed, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            CompressedMatrix compMatrix = Read(compressed, bcl);

            return(Decompress(compMatrix));
        }
Ejemplo n.º 10
0
        public Matrix ReadAndDecompress(ref Bitstream bitstream, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            CompressedMatrix cm = Read(ref bitstream, bcl);

            return(Decompress(cm));
        }
Ejemplo n.º 11
0
        public Matrix ReadAndDecompress(ulong buffer, ref int bitposition, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            CompressedMatrix cMatrix = Read(buffer, ref bitposition, bcl);

            return(Decompress(cMatrix));
        }