コード例 #1
0
        public void Render()
        {
            s_MarkerRender.Begin();

            if (BeforeDrawChain != null)
            {
                BeforeDrawChain(this);
            }

            Exception immediateException = null;

            if (m_FirstCommand != null)
            {
                if (!m_DrawInCameras)
                {
                    var viewport = panel.visualTree.layout;

                    Material standardMaterial = GetStandardMaterial();
                    standardMaterial?.SetPass(0);

                    var projection = ProjectionUtils.Ortho(viewport.xMin, viewport.xMax, viewport.yMax, viewport.yMin, -0.001f, 1.001f);
                    GL.LoadProjectionMatrix(projection);
                    GL.modelview = Matrix4x4.identity;

                    //TODO: Reactivate this guard check once InspectorWindow is fixed to stop adding VEs during OnGUI
                    //m_BlockDirtyRegistration = true;
                    device.EvaluateChain(m_FirstCommand, standardMaterial, standardMaterial, atlasManager?.atlas, vectorImageManager?.atlas, shaderInfoAllocator.atlas,
                                         (panel as BaseVisualElementPanel).scaledPixelsPerPoint, shaderInfoAllocator.transformConstants, shaderInfoAllocator.clipRectConstants,
                                         m_RenderNodesData[0].matPropBlock, true, ref immediateException);
                    //m_BlockDirtyRegistration = false;
                }
            }

            s_MarkerRender.End();

            if (immediateException != null)
            {
                if (GUIUtility.IsExitGUIException(immediateException))
                {
                    throw immediateException;
                }

                // Wrap the exception, this plays more nicely with the callstack logging.
                throw new ImmediateModeException(immediateException);
            }

            if (drawStats)
            {
                DrawStats();
            }
        }
コード例 #2
0
        public void Render()
        {
            s_MarkerRender.Begin();

            if (BeforeDrawChain != null)
            {
                BeforeDrawChain(device);
            }

            Exception immediateException = null;

            if (m_FirstCommand != null)
            {
                device.OnFrameRenderingBegin();

                var viewport = panel.visualTree.layout;

                device.GetStandardMaterial()?.SetPass(0);
                GL.modelview = Matrix4x4.identity;
                var projection = ProjectionUtils.Ortho(viewport.xMin, viewport.xMax, viewport.yMax, viewport.yMin, -1, 1);
                GL.LoadProjectionMatrix(projection);

                MaterialPropertyBlock stateMatProps = new MaterialPropertyBlock();
                device.EvaluateChain(m_FirstCommand, viewport, projection, atlasManager?.atlas, vectorImageManager?.atlas, shaderInfoAllocator.atlas,
                                     (panel as BaseVisualElementPanel).scaledPixelsPerPoint, shaderInfoAllocator.transformConstants, shaderInfoAllocator.clipRectConstants,
                                     stateMatProps, ref immediateException);

                device?.OnFrameRenderingDone();
            }

            s_MarkerRender.End();

            if (immediateException != null)
            {
                throw immediateException;
            }

            if (drawStats)
            {
                DrawStats();
            }
        }