public void CopyFrom(CompressedElement copySource)
 {
     this.crusher = copySource.crusher;
     this.cx      = copySource.cx;
     this.cy      = copySource.cy;
     this.cz      = copySource.cz;
 }
 public void Clear()
 {
     this.crusher = null;
     this.cx      = new CompressedFloat(null, 0);
     this.cy      = new CompressedFloat(null, 0);
     this.cz      = new CompressedFloat(null, 0);
 }
 public void Set(ElementCrusher crusher, uint cx, uint cy, uint cz)
 {
     this.crusher = crusher;
     this.cx      = new CompressedFloat(crusher.XCrusher, cx);
     this.cy      = new CompressedFloat(crusher.YCrusher, cy);
     this.cz      = new CompressedFloat(crusher.ZCrusher, cz);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Serialize a compressed value to an array buffer using this FloatCrusher.
        /// </summary>
        /// <param name="c">CompressedValue</param>
        /// <param name="buffer"></param>
        /// <param name="bitposition"></param>
        /// <param name="bcl"></param>
        /// <returns></returns>
        public static CompressedFloat Write(this FloatCrusher fc, CompressedFloat c, ulong[] buffer, ref int bitposition, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            int bits = fc._bits[(int)bcl];

            buffer.Write(c.cvalue, ref bitposition, bits);
            return(c);
        }
 public void Set(ElementCrusher crusher, CompressedFloat cx, CompressedFloat cy, CompressedFloat cz)
 {
     this.crusher = crusher;
     this.cx      = cx;
     this.cy      = cy;
     this.cz      = cz;
 }
        public static CompressedFloat Write(this FloatCrusher fc, CompressedFloat c, ref Bitstream bitstream, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            int bits = fc._bits[(int)bcl];

            bitstream.Write(c, bits);
            return(c);
        }
 // Constructor
 public CompressedElement(ElementCrusher crusher, uint cx, uint cy, uint cz)         /*: this()*/
 {
     UnityEngine.Debug.LogWarning("CE Construct");
     this.crusher = crusher;
     this.cx      = new CompressedFloat(crusher.XCrusher, cx);
     this.cy      = new CompressedFloat(crusher.YCrusher, cy);
     this.cz      = new CompressedFloat(crusher.ZCrusher, cz);
 }
 // Constructor
 public CompressedElement(ElementCrusher crusher, CompressedFloat cx, CompressedFloat cy, CompressedFloat cz)        /* : this()*/
 {
     //UnityEngine.Debug.LogWarning("CE Construct");
     this.crusher = crusher;
     this.cx      = cx;
     this.cy      = cy;
     this.cz      = cz;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Compress (encode) a float value using this FloatCrusher, then Inject() that compressed value into the
        /// supplied buffer starting at the indicated bitposition.
        /// </summary>
        /// <param name="f">Float to be compressed and serialized</param>
        /// <param name="buffer">Target primitive buffer to serialize into.</param>
        /// <param name="bitposition">The auto-incremented position in the array (in bits) where we will begin reading.</param>
        /// <param name="bcl"></param>
        /// <returns>Returns the compressed uint that was serialized.</returns>
        public static CompressedFloat Write(this FloatCrusher fc, float f, ref byte buffer, ref int bitposition, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            int             bits = fc._bits[(int)bcl];
            CompressedFloat c    = fc.Compress(f);

            c.cvalue.Inject(ref buffer, ref bitposition, bits);
            return(c);
        }
 public void Set(ElementCrusher crusher, uint cUniform)         /*: this()*/
 {
     this.crusher  = crusher;
     this.cUniform = new CompressedFloat(crusher.UCrusher, cUniform);
 }
 // Constructor for uniform scale
 /// <summary>
 /// A uint argument indicates compressed uniform scale. A ulong argument indicates a compressed quaternion.
 /// Be sure to cast ulongs down to uint, or your scale we be treated as quaternion values for this constructor.
 /// </summary>
 /// <param name="crusher"></param>
 /// <param name="cUniform"></param>
 /// <param name="ubits"></param>
 public CompressedElement(ElementCrusher crusher, uint cUniform)         /*: this()*/
 {
     UnityEngine.Debug.LogWarning("CE Construct");
     this.crusher  = crusher;
     this.cUniform = new CompressedFloat(crusher.UCrusher, cUniform);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Inject() a previously compressed value into the supplied ulong buffer starting at the indicated bitposition.
 /// </summary>
 /// <param name="c">Compressed value to be written</param>
 /// <param name="buffer">Where the bits will be written</param>
 /// <param name="bitposition">The position in the buffer to start writing at. Ref value will be increased by the bits used.</param>
 /// <param name="bcl"></param>
 /// <returns>Returns the compressed uint that was serialized.</returns>
 public static CompressedFloat Write(this FloatCrusher fc, CompressedFloat c, ref ulong buffer, ref int bitposition, BitCullingLevel bcl = BitCullingLevel.NoCulling)
 {
     c.cvalue.Inject(ref buffer, ref bitposition, fc._bits[(int)bcl]);
     return(c);
 }
        public static float ReadAndDecompress(this FloatCrusher fc, ref Bitstream bitstream, BitCullingLevel bcl = BitCullingLevel.NoCulling)
        {
            CompressedFloat c = fc.Read(ref bitstream, bcl);

            return(fc.Decompress(c));
        }