Пример #1
0
            //private int _index;

            /// <summary>
            /// get a mesh with at least this many triangles
            /// </summary>
            public MeshHolder Get(int spriteCount)
            {
                MeshHolder best      = null;
                int        bestIndex = -1;

                for (int i = 0; i < _unusedMeshes.Count; i++)
                {
                    var unusedMesh = _unusedMeshes[i];
                    if ((best == null || best.SpriteCount > unusedMesh.SpriteCount) && unusedMesh.SpriteCount >= spriteCount)
                    {
                        best      = unusedMesh;
                        bestIndex = i;
                    }
                }
                if (best == null)
                {
                    best = new MeshHolder(spriteCount);
                }
                else
                {
                    _unusedMeshes.RemoveAt(bestIndex);
                }
                _usedMeshes.Add(best);

                return(best);
            }
Пример #2
0
 public static void DrawB(MeshHolder holder)
 {
     holder.meshB.vertices = holder.Vertices;
     holder.meshB.uv       = holder.UVs;
     holder.meshB.colors32 = holder.Colors;
     UnityGraphics.DrawMeshNow(holder.meshB, Matrix4x4.identity);
 }