Spine.SkeletonBinary.ReadVarint C# (CSharp) 메소드

ReadVarint() 개인적인 정적인 메소드

private static ReadVarint ( Stream input, bool optimizePositive ) : int
input Stream
optimizePositive bool
리턴 int
		private static int ReadVarint (Stream input, bool optimizePositive) {
			int b = input.ReadByte();
			int result = b & 0x7F;
			if ((b & 0x80) != 0) {
				b = input.ReadByte();
				result |= (b & 0x7F) << 7;
				if ((b & 0x80) != 0) {
					b = input.ReadByte();
					result |= (b & 0x7F) << 14;
					if ((b & 0x80) != 0) {
						b = input.ReadByte();
						result |= (b & 0x7F) << 21;
						if ((b & 0x80) != 0) result |= (input.ReadByte() & 0x7F) << 28;
					}
				}
			}
			return optimizePositive ? result : ((result >> 1) ^ -(result & 1));
		}

Usage Example

예제 #1
0
        private Vertices ReadVertices(Stream input, int vertexCount)
        {
            float    scale    = this.Scale;
            int      num      = vertexCount << 1;
            Vertices vertices = new Vertices();

            if (!SkeletonBinary.ReadBoolean(input))
            {
                vertices.vertices = this.ReadFloatArray(input, num, scale);
                return(vertices);
            }
            ExposedList <float> exposedList  = new ExposedList <float>(num * 3 * 3);
            ExposedList <int>   exposedList2 = new ExposedList <int>(num * 3);

            for (int i = 0; i < vertexCount; i++)
            {
                int num2 = SkeletonBinary.ReadVarint(input, true);
                exposedList2.Add(num2);
                for (int j = 0; j < num2; j++)
                {
                    exposedList2.Add(SkeletonBinary.ReadVarint(input, true));
                    exposedList.Add(this.ReadFloat(input) * scale);
                    exposedList.Add(this.ReadFloat(input) * scale);
                    exposedList.Add(this.ReadFloat(input));
                }
            }
            vertices.vertices = exposedList.ToArray();
            vertices.bones    = exposedList2.ToArray();
            return(vertices);
        }
All Usage Examples Of Spine.SkeletonBinary::ReadVarint