UnityEditor.PreviewRenderUtility.DrawMesh C# (CSharp) Method

DrawMesh() public method

public DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material mat, int subMeshIndex ) : void
mesh UnityEngine.Mesh
matrix UnityEngine.Matrix4x4
mat UnityEngine.Material
subMeshIndex int
return void
        public void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material mat, int subMeshIndex)
        {
            this.DrawMesh(mesh, matrix, mat, subMeshIndex, null);
        }

Same methods

PreviewRenderUtility::DrawMesh ( Mesh mesh, Matrix4x4 matrix, Material mat, int subMeshIndex, MaterialPropertyBlock customProperties ) : void
PreviewRenderUtility::DrawMesh ( Mesh mesh, Vector3 pos, Quaternion rot, Material mat, int subMeshIndex ) : void
PreviewRenderUtility::DrawMesh ( Mesh mesh, Vector3 pos, Quaternion rot, Material mat, int subMeshIndex, MaterialPropertyBlock customProperties ) : void
PreviewRenderUtility::DrawMesh ( Mesh mesh, Vector3 pos, Quaternion rot, Material mat, int subMeshIndex, MaterialPropertyBlock customProperties, Transform probeAnchor ) : void

Usage Example

        internal static void RenderMeshPreviewSkipCameraAndLighting(Mesh mesh, Bounds bounds, PreviewRenderUtility previewUtility, Material litMaterial, Material wireMaterial, MaterialPropertyBlock customProperties, Vector2 direction, int meshSubset)
        {
            if ((Object)mesh == (Object)null || previewUtility == null)
            {
                return;
            }
            Quaternion rot = Quaternion.Euler(direction.y, 0.0f, 0.0f) * Quaternion.Euler(0.0f, direction.x, 0.0f);
            Vector3    pos = rot * -bounds.center;
            bool       fog = RenderSettings.fog;

            Unsupported.SetRenderSettingsUseFogNoDirty(false);
            int subMeshCount = mesh.subMeshCount;

            if ((Object)litMaterial != (Object)null)
            {
                previewUtility.m_Camera.clearFlags = CameraClearFlags.Nothing;
                if (meshSubset < 0 || meshSubset >= subMeshCount)
                {
                    for (int subMeshIndex = 0; subMeshIndex < subMeshCount; ++subMeshIndex)
                    {
                        previewUtility.DrawMesh(mesh, pos, rot, litMaterial, subMeshIndex, customProperties);
                    }
                }
                else
                {
                    previewUtility.DrawMesh(mesh, pos, rot, litMaterial, meshSubset, customProperties);
                }
                previewUtility.m_Camera.Render();
            }
            if ((Object)wireMaterial != (Object)null)
            {
                previewUtility.m_Camera.clearFlags = CameraClearFlags.Nothing;
                GL.wireframe = true;
                if (meshSubset < 0 || meshSubset >= subMeshCount)
                {
                    for (int subMeshIndex = 0; subMeshIndex < subMeshCount; ++subMeshIndex)
                    {
                        previewUtility.DrawMesh(mesh, pos, rot, wireMaterial, subMeshIndex, customProperties);
                    }
                }
                else
                {
                    previewUtility.DrawMesh(mesh, pos, rot, wireMaterial, meshSubset, customProperties);
                }
                previewUtility.m_Camera.Render();
                GL.wireframe = false;
            }
            Unsupported.SetRenderSettingsUseFogNoDirty(fog);
        }
All Usage Examples Of UnityEditor.PreviewRenderUtility::DrawMesh