BBGamelib.CGAffineTransform.IsIdentity C# (CSharp) Method

IsIdentity() public static method

public static IsIdentity ( CGAffineTransform t ) : bool
t CGAffineTransform
return bool
		public static bool IsIdentity(CGAffineTransform t){
			return EqualToTransform (Identity, t);
		}
		public static CGAffineTransform Translate(CGAffineTransform t, float tx, float ty){

Usage Example

        void updateMesh()
        {
            if (_meshDirty)
            {
                int       tilesCount = _tiles.DL_COUNT();
                Vector3[] vertices   = new Vector3[tilesCount * 4];
                Vector3[] normals    = new Vector3[vertices.Length];
                Vector2[] uvs        = new Vector2[vertices.Length];
                int[]     triangles  = new int[tilesCount * 6];

                int tileIndex = 0;
                for (var ent = _tiles.head; ent != null; ent = ent.next)
                {
                    Tile          tile         = ent.obj;
                    CCSpriteFrame spriteFrame  = tile.spriteFrame;
                    Rect          uTextureRect = spriteFrame.textureRect;
                    uTextureRect.position /= UIWindow.PIXEL_PER_UNIT;
                    uTextureRect.size     /= UIWindow.PIXEL_PER_UNIT;
                    float uTextureWidth     = spriteFrame.texture.width / UIWindow.PIXEL_PER_UNIT;
                    float uTextureHeight    = spriteFrame.texture.height / UIWindow.PIXEL_PER_UNIT;
                    float uTextureRectWidth = uTextureRect.width;
                    float uTextureRectHeigh = uTextureRect.height;


                    Vector2 uSpriteOffset = spriteFrame.offset / UIWindow.PIXEL_PER_UNIT;
                    Vector2 center = uSpriteOffset;
                    float   centerX = center.x;
                    float   centerY = center.y;
                    float   uViewWidth = uTextureRectWidth, uViewHeight = uTextureRectHeigh;
                    if (spriteFrame.rotated)
                    {
                        uViewWidth  = uTextureRectHeigh;
                        uViewHeight = uTextureRectWidth;
                    }
                    int verticesIndex = tileIndex * 4;
                    vertices [verticesIndex + 0] = new Vector3(centerX - uViewWidth / 2, centerY + uViewHeight / 2, 0);
                    vertices [verticesIndex + 1] = new Vector3(centerX + uViewWidth / 2, centerY + uViewHeight / 2, 0);
                    vertices [verticesIndex + 2] = new Vector3(centerX + uViewWidth / 2, centerY - uViewHeight / 2, 0);
                    vertices [verticesIndex + 3] = new Vector3(centerX - uViewWidth / 2, centerY - uViewHeight / 2, 0);

                    int trianglesIndex = tileIndex * 6;
                    triangles [trianglesIndex + 0] = verticesIndex + 0;
                    triangles [trianglesIndex + 1] = verticesIndex + 1;
                    triangles [trianglesIndex + 2] = verticesIndex + 2;
                    triangles [trianglesIndex + 3] = verticesIndex + 2;
                    triangles [trianglesIndex + 4] = verticesIndex + 3;
                    triangles [trianglesIndex + 5] = verticesIndex + 0;

                    float uLeft   = uTextureRect.xMin / uTextureWidth;
                    float vBottom = uTextureRect.yMin / uTextureHeight;
                    float uRight  = uTextureRect.xMax / uTextureWidth;
                    float vTop    = uTextureRect.yMax / uTextureHeight;
                    if (!spriteFrame.rotated)
                    {
                        uvs [verticesIndex + 0] = new Vector2(uLeft, vTop);     //top-left
                        uvs [verticesIndex + 1] = new Vector2(uRight, vTop);    //top-right
                        uvs [verticesIndex + 2] = new Vector2(uRight, vBottom); //bottom-right
                        uvs [verticesIndex + 3] = new Vector2(uLeft, vBottom);  //bottom-left
                    }
                    else
                    {
                        uvs [verticesIndex + 0] = new Vector2(uRight, vTop);    //top-right
                        uvs [verticesIndex + 1] = new Vector2(uRight, vBottom); //bottom-right
                        uvs [verticesIndex + 2] = new Vector2(uLeft, vBottom);  //bottom-left
                        uvs [verticesIndex + 3] = new Vector2(uLeft, vTop);     //top-left
                    }

                    //apply transform
                    if (!CGAffineTransform.IsIdentity(tile.transform))
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            Vector2 vertex = vertices [verticesIndex + i];
                            vertex = CGAffineTransform.CGPointApplyAffineTransform(vertex, tile.transform);
                            vertices [verticesIndex + i] = vertex;
                        }
                    }
                    tileIndex++;
                }
                for (int i = 0; i < normals.Length; i++)
                {
                    normals [i] = Vector3.back;
                }

                Mesh mesh = this.meshFilter.sharedMesh;
                if (mesh == null)
                {
                    mesh = new Mesh();
                }
                mesh.vertices  = vertices;
                mesh.triangles = triangles;
                mesh.normals   = normals;
                mesh.uv        = uvs;

                this.meshFilter.sharedMesh = mesh;
                _meshDirty = false;
            }
        }