Beispiel #1
0
 private void UpdateBehavic()
 {
     if (m_SelectedLOD >= 0)
     {
         GameObject go = m_LODs[m_SelectedLOD]?.go;
         LodUtil.UpdateCamera(m_cameraPercent, go);
         for (int i = 0; i < m_LODs.Count; i++)
         {
             if (m_LODs[i].go != null && m_LODs[i].go != go)
             {
                 m_LODs[i].go.SetActive(false);
             }
         }
         go.SetActive(true);
     }
     else
     {
         foreach (var it in m_LODs)
         {
             if (it.go != null)
             {
                 it.go.SetActive(false);
             }
         }
     }
 }
Beispiel #2
0
 private void UpdateBehavic()
 {
     if (SelectedLOD >= 0)
     {
         GameObject go = m_LODs[SelectedLOD]?.go;
         LodUtil.UpdateCamera(m_cameraPercent, go, m_direct);
     }
 }
Beispiel #3
0
 public void GUI()
 {
     if (meshes != null && go != null)
     {
         scroll = GUILayout.BeginScrollView(scroll);
         GUILayout.BeginVertical();
         GUILayout.BeginHorizontal();
         GUILayout.Label(go.name, LODGUI.totalStyle);
         if (GUILayout.Button("Visualize Bounds", GUILayout.MaxWidth(110)))
         {
             LodUtil.AttachCollider(go);
         }
         GUILayout.EndHorizontal();
         GUILayout.Label("total verts: " + vertCnt + " tris: " + triCnt, LODGUI.totalStyle);
         foreach (var mesh in meshes)
         {
             GUILayout.BeginHorizontal();
             DrawMesh(mesh);
             GUILayout.BeginVertical();
             GUILayout.Space(24);
             GUILayout.Label(mesh.name);
             GUILayout.Label("verts: " + mesh.vertexCount);
             GUILayout.Label("tris:  " + mesh.triangles.Length / 3);
             GUILayout.Label("bounds: " + mesh.bounds);
             string desc = "skin ";
             if (has(mesh.uv))
             {
                 desc += "uv ";
             }
             if (has(mesh.uv2))
             {
                 desc += "uv2 ";
             }
             if (has(mesh.uv3))
             {
                 desc += "uv3 ";
             }
             if (has(mesh.uv4))
             {
                 desc += "uv4 ";
             }
             if (has(mesh.normals))
             {
                 desc += "normal ";
             }
             if (has(mesh.tangents))
             {
                 desc += "tangent ";
             }
             if (has(mesh.colors))
             {
                 desc += "color ";
             }
             GUILayout.Label(desc);
             GUILayout.EndVertical();
             GUILayout.EndHorizontal();
         }
         GUILayout.EndVertical();
         GUILayout.EndScrollView();
     }
     else
     {
         GUILayout.Label("no gameobject attached");
     }
 }
Beispiel #4
0
        public LodUtil.Direct GUI(LodUtil.Direct direct)
        {
            if (meshes != null && go != null)
            {
                scroll = GUILayout.BeginScrollView(scroll);
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                GUILayout.Label(go.name, LODGUI.totalStyle);
                direct = (LodUtil.Direct)EditorGUILayout.EnumPopup(direct, GUILayout.MaxWidth(80));
                if (GUILayout.Button("Visualize Bounds", GUILayout.MaxWidth(110)))
                {
                    LodUtil.AttachCollider(go);
                }
                GUILayout.EndHorizontal();
                GUILayout.Label("total verts: " + vertCnt + " tris: " + triCnt, LODGUI.totalStyle);

                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical();
                int i = 0;
                foreach (var mesh in meshes)
                {
                    GUILayout.BeginHorizontal();
                    DrawMesh(mesh);
                    GUILayout.BeginVertical();
                    GUILayout.Space(24);
                    GUILayout.Label(mesh.name);
                    GUILayout.Label("verts: " + mesh.vertexCount);
                    GUILayout.Label("tris:  " + mesh.triangles.Length / 3);
                    GUILayout.Label("bounds: " + mesh.bounds);

                    GUILayout.BeginHorizontal();
                    var render = renders[i++];
                    var desc   = "render bones: " + render.bones.Length + " matrix:" + mesh.bindposes.Length + " weights:" + mesh.boneWeights.Length;
                    if (GUILayout.Button(desc, UnityEngine.GUI.skin.label) || string.IsNullOrEmpty(boneInfo))
                    {
                        BoneInfo(render);
                    }
                    GUILayout.EndHorizontal();

                    desc = "skin ";
                    if (has(mesh.uv))
                    {
                        desc += "uv ";
                    }
                    if (has(mesh.uv2))
                    {
                        desc += "uv2 ";
                    }
                    if (has(mesh.uv3))
                    {
                        desc += "uv3 ";
                    }
                    if (has(mesh.uv4))
                    {
                        desc += "uv4 ";
                    }
                    if (has(mesh.normals))
                    {
                        desc += "normal ";
                    }
                    if (has(mesh.tangents))
                    {
                        desc += "tangent ";
                    }
                    if (has(mesh.colors))
                    {
                        desc += "color ";
                    }
                    if (mesh.subMeshCount > 1)
                    {
                        desc += "submesh ";
                    }
                    GUILayout.Label(desc);
                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                }

                GUILayout.EndHorizontal();
                GUILayout.Space(10);
                GUILayout.Label(boneInfo);
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
                GUILayout.EndScrollView();
            }
            else
            {
                GUILayout.Label("no gameobject attached");
            }
            return(direct);
        }