RenderMeshPreview() static private method

static private RenderMeshPreview ( Mesh mesh, PreviewRenderUtility previewUtility, Material litMaterial, Material wireMaterial, Vector2 direction, int meshSubset ) : void
mesh UnityEngine.Mesh
previewUtility PreviewRenderUtility
litMaterial UnityEngine.Material
wireMaterial UnityEngine.Material
direction Vector2
meshSubset int
return void
        private void DrawMeshPreview(FrameDebuggerEvent curEvent, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
        {
            if (this.m_PreviewUtility == null)
            {
                this.m_PreviewUtility = new PreviewRenderUtility();
                this.m_PreviewUtility.m_CameraFieldOfView = 30f;
            }
            if (this.m_Material == null)
            {
                this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material;
            }
            if (this.m_WireMaterial == null)
            {
                this.m_WireMaterial = ModelInspector.CreateWireframeMaterial();
            }
            this.m_PreviewUtility.BeginPreview(previewRect, "preBackground");
            ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
            this.m_PreviewUtility.EndAndDrawPreview(previewRect);
            string name = mesh.name;

            if (string.IsNullOrEmpty(name))
            {
                name = "<no name>";
            }
            object[] objArray1 = new object[] { name, " subset ", meshSubset, "\n", curEvent.vertexCount, " verts, ", curEvent.indexCount, " indices" };
            string   text      = string.Concat(objArray1);

            EditorGUI.DropShadowLabel(meshInfoRect, text);
        }
示例#2
0
        private void DrawMeshPreview(FrameDebuggerEventData curEventData, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
        {
            if (this.m_PreviewUtility == null)
            {
                this.m_PreviewUtility = new PreviewRenderUtility();
                this.m_PreviewUtility.m_CameraFieldOfView = 30f;
            }
            if ((UnityEngine.Object) this.m_Material == (UnityEngine.Object)null)
            {
                this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material;
            }
            if ((UnityEngine.Object) this.m_WireMaterial == (UnityEngine.Object)null)
            {
                this.m_WireMaterial = ModelInspector.CreateWireframeMaterial();
            }
            this.m_PreviewUtility.BeginPreview(previewRect, (GUIStyle)"preBackground");
            ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
            this.m_PreviewUtility.EndAndDrawPreview(previewRect);
            string str = mesh.name;

            if (string.IsNullOrEmpty(str))
            {
                str = "<no name>";
            }
            string text = str + " subset " + (object)meshSubset + "\n" + (object)curEventData.vertexCount + " verts, " + (object)curEventData.indexCount + " indices";

            EditorGUI.DropShadowLabel(meshInfoRect, text);
        }
示例#3
0
        private void DrawMeshPreview(FrameDebuggerEvent curEvent, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
        {
            if (this.m_PreviewUtility == null)
            {
                this.m_PreviewUtility = new PreviewRenderUtility();
                this.m_PreviewUtility.m_CameraFieldOfView = 30f;
            }
            if (this.m_Material == null)
            {
                this.m_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material);
            }
            if (this.m_WireMaterial == null)
            {
                this.m_WireMaterial                  = new Material(ModelInspector.WireframeShaderSource);
                this.m_WireMaterial.hideFlags        = HideFlags.HideAndDontSave;
                this.m_WireMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
            }
            this.m_PreviewUtility.BeginPreview(previewRect, "preBackground");
            ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
            Texture image = this.m_PreviewUtility.EndPreview();

            GUI.DrawTexture(previewRect, image, ScaleMode.StretchToFill, false);
            string text = mesh.name;

            if (string.IsNullOrEmpty(text))
            {
                text = "<no name>";
            }
            string text2 = string.Concat(new object[]
            {
                text,
                " subset ",
                meshSubset,
                "\n",
                curEvent.vertexCount,
                " verts, ",
                curEvent.indexCount,
                " indices"
            });

            EditorGUI.DropShadowLabel(meshInfoRect, text2);
        }
 private void DoRenderPreview()
 {
     ModelInspector.RenderMeshPreview(this.target as Mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.previewDir, -1);
 }