コード例 #1
0
 public void DrawGizmos()
 {
     if (this.bestRoot != null)
     {
         MB2_TexturePacker.drawGizmosNode(this.bestRoot.root);
     }
 }
コード例 #2
0
        private static void drawGizmosNode(MB2_TexturePacker.Node r)
        {
            Vector3 size   = new Vector3((float)r.r.w, (float)r.r.h, 0f);
            Vector3 center = new Vector3((float)r.r.x + size.x / 2f, (float)(-(float)r.r.y) - size.y / 2f, 0f);

            Gizmos.DrawWireCube(center, size);
            if (r.img != null)
            {
                Gizmos.color = Color.blue;
                size         = new Vector3((float)r.img.w, (float)r.img.h, 0f);
                center       = new Vector3((float)r.img.x + size.x / 2f, (float)(-(float)r.img.y) - size.y / 2f, 0f);
                Gizmos.DrawCube(center, size);
            }
            if (r.child[0] != null)
            {
                Gizmos.color = Color.red;
                MB2_TexturePacker.drawGizmosNode(r.child[0]);
            }
            if (r.child[1] != null)
            {
                Gizmos.color = Color.green;
                MB2_TexturePacker.drawGizmosNode(r.child[1]);
            }
        }