当前位置: 首页>>代码示例>>C#>>正文


C# CommandBuffer.DrawRenderer方法代码示例

本文整理汇总了C#中UnityEngine.Rendering.CommandBuffer.DrawRenderer方法的典型用法代码示例。如果您正苦于以下问题:C# CommandBuffer.DrawRenderer方法的具体用法?C# CommandBuffer.DrawRenderer怎么用?C# CommandBuffer.DrawRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Rendering.CommandBuffer的用法示例。


在下文中一共展示了CommandBuffer.DrawRenderer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IssueDrawCall_DepthMask

 public override void IssueDrawCall_DepthMask(SubRenderer br, CommandBuffer cb)
 {
     var renderer = GetComponent<Renderer>();
     int n = m_mask_materials.Length;
     for (int i = 0; i < n; ++i)
     {
         cb.DrawRenderer(renderer, m_mask_materials[i], i, 0);
         cb.DrawRenderer(renderer, m_mask_materials[i], i, 1);
         if (br.m_enable_piercing)
         {
             cb.DrawRenderer(renderer, m_mask_materials[i], i, 2);
         }
         cb.DrawRenderer(renderer, m_mask_materials[i], i, 3);
     }
 }
开发者ID:nicegary,项目名称:Unity5Effects,代码行数:15,代码来源:SubOperator.cs

示例2: IssueDrawCall_BackStencil

 public override void IssueDrawCall_BackStencil(LightWithStencilShadow light, CommandBuffer commands)
 {
     var renderer = GetComponent<Renderer>();
     int n = m_stencil_materials.Length;
     for (int i = 0; i < n; ++i)
     {
         commands.DrawRenderer(renderer, m_stencil_materials[i], i, 1);
     }
 }
开发者ID:davidlawson,项目名称:ggj2016,代码行数:9,代码来源:StencilShadowCaster.cs

示例3: IssueDrawCall_FrontDepth

 public override void IssueDrawCall_FrontDepth(AndRenderer br, CommandBuffer cb)
 {
     var renderer = GetComponent<Renderer>();
     int n = m_depth_materials.Length;
     for (int i = 0; i < n; ++i)
     {
         cb.DrawRenderer(renderer, m_depth_materials[i], i, 1);
     }
 }
开发者ID:davidlawson,项目名称:ggj2016,代码行数:9,代码来源:AndReceiver.cs

示例4: FillBuffer

        //
        public bool FillBuffer(CommandBuffer buffer)
        {
            if (r == null) { return false; }

            if (lastCamera == Camera.current)
            {
                for (int i = 0, imax = data.Count; i < imax; i++)
                {
                    Data d = data[i];
                    buffer.DrawRenderer(r, d.material, d.submeshIndex);
                }
            }
            return true;
        }
开发者ID:britg,项目名称:triple-trope-demo,代码行数:15,代码来源:HighlighterRenderer.cs

示例5: OnPreRender

    public void OnPreRender()
    {
        var act = gameObject.activeInHierarchy && enabled;
        if (!act)
        {
            Cleanup();
            return;
        }

        var cam = Camera.current;
        if (!cam)
            return;

        CommandBuffer buf = null;
        // Did we already add the command buffer on this camera? Nothing to do then.
        if (m_Cameras.ContainsKey(cam))
            return;

        if (!DepthMaterial)
        {
            DepthMaterial = new Material(DepthShader);
            DepthMaterial.hideFlags = HideFlags.HideAndDontSave;
        }

        buf = new CommandBuffer();
        buf.name = "Render Grass Depth Reference";
        m_Cameras[cam] = buf;

        int referenceDepthID = Shader.PropertyToID("_rdepth");
        buf.GetTemporaryRT(referenceDepthID, -1, -1, 24, FilterMode.Point, RenderTextureFormat.Depth);
        buf.SetRenderTarget(new RenderTargetIdentifier(referenceDepthID));
        buf.ClearRenderTarget(true, false, Color.white, 1);

        foreach (MeshRenderer r in GrassMeshes)
            buf.DrawRenderer(r, DepthMaterial);

        buf.SetRenderTarget(new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget));

        buf.SetGlobalTexture("_ReferenceDepth", referenceDepthID);

        cam.AddCommandBuffer(CameraEvent.BeforeImageEffects, buf);
        Debug.Log("Add Command Buffer");
    }
开发者ID:Flafla2,项目名称:Screen-Space-Grass,代码行数:43,代码来源:GrassManager.cs

示例6: FillBuffer

			// Fills given command buffer with this highlighter rendering commands
			public bool FillBuffer(ref CommandBuffer buffer)
			{
				if (IsDestroyed()) { return false; }

				for (int i = 0, imax = data.Count; i < imax; i++)
				{
					Data d = data[i];
					buffer.DrawRenderer(renderer, d.material, d.submeshIndex);
				}
				return true;
			}
开发者ID:sixeco,项目名称:Unnoticed,代码行数:12,代码来源:RendererCache.cs

示例7: CreateCommandBuffers

    private void CreateCommandBuffers()
    {
        m_renderCmdBuffer = new CommandBuffer();
        m_renderCmdBuffer.name = "Highlights: Drawing Objects";

        // Drawing objects to the buffer
        m_renderCmdBuffer.SetRenderTarget(m_colorRT, BuiltinRenderTextureType.CameraTarget);
        m_renderCmdBuffer.ClearRenderTarget(false, true, Color.clear);

        var pass = m_selectionType == HighlightType.Glow ? HighlightPass.MarkStencilArea : HighlightPass.DrawSolid;
        foreach(var hObject in m_renderers)
        {
            m_renderCmdBuffer.SetGlobalColor("_Color", hObject.Value);
            m_renderCmdBuffer.SetGlobalFloat("_Cutoff",  m_cutoffValue * 0.5f);
            m_renderCmdBuffer.DrawRenderer(hObject.Key, m_highlightMaterial, 0, (int) pass);
        }
            
        foreach(var hObject in m_renderers)
        {
            m_renderCmdBuffer.SetGlobalColor("_Color", hObject.Value);
            m_renderCmdBuffer.DrawRenderer(hObject.Key, m_highlightMaterial, 0, (int) HighlightPass.ExtrudeOutline);
        }

        var drawEvent = GetCameraDrawEvent();
        m_camera.AddCommandBuffer(drawEvent, m_renderCmdBuffer);
    }
开发者ID:BubbleRap,项目名称:ExploreTheDarkness,代码行数:26,代码来源:HighlightsImageEffect.cs

示例8: drawOverrideEyeMat

    private void drawOverrideEyeMat(CommandBuffer buf, OverrideEye eyeObj, int pass)
    {
        if(eyeObj.Mr != null)
        {
            MeshFilter _mf = eyeObj.GetComponent<MeshFilter>();

            for(int _i = 0; _i < _mf.sharedMesh.subMeshCount; ++_i)
            {
                buf.DrawMesh(_mf.sharedMesh, eyeObj.gameObject.transform.localToWorldMatrix, this.m_overrideEyeMat, _i, pass);
            }
        }
        else if(eyeObj.SkinMr != null)
        {
            for(int _i = 0; _i < eyeObj.SkinMr.sharedMesh.subMeshCount; ++_i)
            {
                buf.DrawRenderer(eyeObj.SkinMr, this.m_overrideEyeMat, _i, pass);
            }
        }
    }
开发者ID:GGSSKK,项目名称:Unity-OverrideEye_For_UnityChan,代码行数:19,代码来源:RenderOverrideEye.cs

示例9: drawSlefMat

    private void drawSlefMat(CommandBuffer buf, OverrideEye eyeObj, int pass)
    {
        if(eyeObj.Mr != null)
        {
            MeshFilter _mf = eyeObj.GetComponent<MeshFilter>();

            for(int _i = 0; _i < _mf.sharedMesh.subMeshCount; ++_i)
            {
                buf.DrawMesh(_mf.sharedMesh, eyeObj.gameObject.transform.localToWorldMatrix, eyeObj.Materials[_i], _i, pass);
            }
        }
        else if(eyeObj.SkinMr != null)
        {
            for(int _i = 0; _i < eyeObj.SkinMr.sharedMesh.subMeshCount; ++_i)
            {
                eyeObj.Materials[_i].EnableKeyword("DIRLIGHTMAP_OFF");
                eyeObj.Materials[_i].EnableKeyword("DYNAMICLIGHTMAP_OFF");
                buf.DrawRenderer(eyeObj.SkinMr, eyeObj.Materials[_i], _i, pass);
            }
        }
    }
开发者ID:GGSSKK,项目名称:Unity-OverrideEye_For_UnityChan,代码行数:21,代码来源:RenderOverrideEye.cs


注:本文中的UnityEngine.Rendering.CommandBuffer.DrawRenderer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。