public void init(Camera camera)
 {
     mf_                = GetComponent <MeshFilter>();
     mr_                = GetComponent <MeshRenderer>();
     mr_.enabled        = false;
     mf_.sharedMesh     = Sight.Instance.getMesh();
     mr_.sharedMaterial = Sight.Instance.getMaterial();
     command_buffer_    = new UnityEngine.Rendering.CommandBuffer();
     command_buffer_.DrawRenderer(mr_, Sight.Instance.getMaterial());
     camera.AddCommandBuffer(UnityEngine.Rendering.CameraEvent.AfterImageEffects, command_buffer_);
 }
Example #2
0
 protected void FillMaskBuffer(UnityEngine.Rendering.CommandBuffer cb, List <Renderer> rs, Material m)
 {
     for (int i = 0; i < rs.Count; ++i)
     {
         Renderer r = rs[i];
         if (r is MeshRenderer)
         {
             MeshFilter mf = r.GetComponent <MeshFilter>();
             if (!mf)
             {
                 continue;
             }
             int sms = mf.sharedMesh.subMeshCount;
             for (int j = 0; j < sms; ++j)
             {
                 cb.DrawRenderer(r, m, j);
             }
         }
         else
         {
             cb.DrawRenderer(r, m);
         }
     }
 }