public override void Render(RenderTarget rt) { if (!bRunning) { return; } Camera camera = rt.cam; int cascadeCount = 1; Shader.SetGlobalBuffer(ShaderIDs.ID_VertexBuffer, pointsBuffer); if (asset.enableShadow) // 阴影绘制 { } if (drawCmd == null) // Cluster场景绘制 { if (shadowCmds != null && shadowCmds.Length == cascadeCount) { for (int i = 0; i < shadowCmds.Length; i++) { camera.AddCommandBuffer(CameraEvent.BeforeForwardOpaque, shadowCmds[i]); } } GraphicsRenderTarget renderTarget = rt as GraphicsRenderTarget; CreateDrawCmd(renderTarget); camera.AddCommandBuffer(CameraEvent.AfterForwardOpaque, drawCmd); } }
void CreateDrawCmd(GraphicsRenderTarget rt) { drawCmd = CommandBufferPool.Get("DrawProceduralIndirect: Draw Clusters"); drawCmd.SetRenderTarget(rt.gBufferIdentifier, rt.depthIdentifier); drawCmd.ClearRenderTarget(true, true, Color.black); drawCmd.DrawProceduralIndirect(Matrix4x4.identity, asset.deferredMaterial, 0, MeshTopology.Triangles, argsBuffer); }