Ejemplo n.º 1
0
 internal void ClearStencil(ScriptableRenderContext context, Material nonSharedStencilMaterial, StencilTestOptions stencilTestOptions)
 {
     if (m_stencilTestState != StencilTestState.None)
     {
         if ((stencilTestOptions & StencilTestOptions.ClearStencil) == StencilTestOptions.ClearStencil)
         {
             CommandBuffer commandBuffer = CommandBufferPool.Get();
             if (m_stencilTestState == StencilTestState.BackfaceOnly)
             {
                 if ((stencilTestOptions & StencilTestOptions.PreventOverwriting) == 0)
                 {
                     commandBuffer.DrawMesh(GetFrustumMesh(), transform.localToWorldMatrix, nonSharedStencilMaterial, 0, 1);
                 }
                 else
                 {
                     ClearFullscreenStencil(commandBuffer);
                     StencilMaskAllocator.Init(StencilMaskAllocator.availableBits);                             // reset stencil allocator
                 }
             }
             else
             {
                 commandBuffer.DrawMesh(GetFrustumMesh(), transform.localToWorldMatrix, nonSharedStencilMaterial, 0, 3);
             }
             context.ExecuteCommandBuffer(commandBuffer);
             CommandBufferPool.Release(commandBuffer);
         }
         else
         {
             // allocate new stencil bit for the next projector
             StencilMaskAllocator.AllocateSingleBit();
         }
         m_stencilTestState = StencilTestState.None;
     }
 }
        public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
        {
            StencilMaskAllocator.Init(m_stencilMask);
            var passes = s_renderPassList[renderingData.cameraData.camera];

            foreach (var pass in passes)
            {
                renderer.EnqueuePass(pass);
            }
        }