Esempio n. 1
0
        private Vertices ReadVertices(NewStream input, int vertexCount)
        {
            float    scale          = Scale;
            int      verticesLength = vertexCount << 1;
            Vertices vertices       = new Vertices();

            if (!ReadBoolean(input))
            {
                vertices.vertices = ReadFloatArray(input, verticesLength, scale);
                return(vertices);
            }
            var weights    = new ExposedList <float>(verticesLength * 3 * 3);
            var bonesArray = new ExposedList <int>(verticesLength * 3);

            for (int i = 0; i < vertexCount; i++)
            {
                int boneCount = ReadVarint(input, true);
                bonesArray.Add(boneCount);
                for (int ii = 0; ii < boneCount; ii++)
                {
                    bonesArray.Add(ReadVarint(input, true));
                    weights.Add(ReadFloat(input) * scale);
                    weights.Add(ReadFloat(input) * scale);
                    weights.Add(ReadFloat(input));
                }
            }

            vertices.vertices = weights.ToArray();
            vertices.bones    = bonesArray.ToArray();
            return(vertices);
        }
Esempio n. 2
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);
        }
 static int ToArray(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Spine.ExposedList <Spine.Animation> obj = (Spine.ExposedList <Spine.Animation>)ToLua.CheckObject <Spine.ExposedList <Spine.Animation> >(L, 1);
         Spine.Animation[] o = obj.ToArray();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 4
0
        private void ReadVertices(Dictionary <string, object> map, VertexAttachment attachment, int verticesLength)
        {
            attachment.WorldVerticesLength = verticesLength;
            float[] floatArray = GetFloatArray(map, "vertices", 1f);
            float   scale      = Scale;

            if (verticesLength == floatArray.Length)
            {
                if (scale != 1f)
                {
                    for (int i = 0; i < floatArray.Length; i++)
                    {
                        floatArray[i] *= scale;
                    }
                }
                attachment.vertices = floatArray;
                return;
            }
            ExposedList <float> exposedList  = new ExposedList <float>(verticesLength * 3 * 3);
            ExposedList <int>   exposedList2 = new ExposedList <int>(verticesLength * 3);
            int j   = 0;
            int num = floatArray.Length;

            while (j < num)
            {
                int num3 = (int)floatArray[j++];
                exposedList2.Add(num3);
                for (int num4 = j + num3 * 4; j < num4; j += 4)
                {
                    exposedList2.Add((int)floatArray[j]);
                    exposedList.Add(floatArray[j + 1] * Scale);
                    exposedList.Add(floatArray[j + 2] * Scale);
                    exposedList.Add(floatArray[j + 3]);
                }
            }
            attachment.bones    = exposedList2.ToArray();
            attachment.vertices = exposedList.ToArray();
        }
Esempio n. 5
0
        private void ReadVertices(Dictionary <String, Object> map, VertexAttachment attachment, int verticesLength)
        {
            attachment.WorldVerticesLength = verticesLength;
            float[] vertices = GetFloatArray(map, "vertices", 1);
            float   scale    = Scale;

            if (verticesLength == vertices.Length)
            {
                if (scale != 1)
                {
                    for (int i = 0; i < vertices.Length; i++)
                    {
                        vertices[i] *= scale;
                    }
                }
                attachment.vertices = vertices;
                return;
            }
            ExposedList <float> weights = new ExposedList <float>(verticesLength * 3 * 3);
            ExposedList <int>   bones   = new ExposedList <int>(verticesLength * 3);

            for (int i = 0, n = vertices.Length; i < n;)
            {
                int boneCount = (int)vertices[i++];
                bones.Add(boneCount);
                for (int nn = i + boneCount * 4; i < nn; i += 4)
                {
                    bones.Add((int)vertices[i]);
                    weights.Add(vertices[i + 1] * this.Scale);
                    weights.Add(vertices[i + 2] * this.Scale);
                    weights.Add(vertices[i + 3]);
                }
            }
            attachment.bones    = bones.ToArray();
            attachment.vertices = weights.ToArray();
        }