Exemplo n.º 1
0
 public static short Compress(float raw, Bounds bounds)
 {
     const float Max = short.MaxValue;
     return (short)(((raw - bounds.Min) / (bounds.Max - bounds.Min)) * Max);
 }
Exemplo n.º 2
0
 public CompressionInfo(Stream stream)
 {
     BinaryReader br = new BinaryReader(stream);
     X = new Bounds(br.ReadSingle(), br.ReadSingle());
     Y = new Bounds(br.ReadSingle(), br.ReadSingle());
     Z = new Bounds(br.ReadSingle(), br.ReadSingle());
     U = new Bounds(br.ReadSingle(), br.ReadSingle());
     V = new Bounds(br.ReadSingle(), br.ReadSingle());
     U2 = new Bounds(br.ReadSingle(), br.ReadSingle());
     V2 = new Bounds(br.ReadSingle(), br.ReadSingle());
 }
Exemplo n.º 3
0
 public static float Decompress(short value, Bounds bounds)
 {
     const float Max = 1.0f / ushort.MaxValue;
     const float Half = short.MaxValue;
     return ((((float)value + Half) * Max ) * (bounds.Max - bounds.Min)) + bounds.Min;
 }