Пример #1
0
        /// <summary>
        /// On Awake, we cache various values and setup our command buffer to be called Before Image Effects.
        /// </summary>
        private void Awake()
        {
            _instance = this;

            _glowMat      = new Material(Shader.Find("Hidden/GlowCmdShader"));
            _blurMaterial = new Material(Shader.Find("Hidden/Blur"));

            _prePassRenderTexID  = Shader.PropertyToID("_GlowPrePassTex");
            _blurPassRenderTexID = Shader.PropertyToID("_GlowBlurredTex");
            _tempRenderTexID     = Shader.PropertyToID("_TempTex0");
            _blurSizeID          = Shader.PropertyToID("_BlurSize");
            _glowColorID         = Shader.PropertyToID("_GlowColor");

            _commandBuffer      = new CommandBuffer();
            _commandBuffer.name = "Glowing Objects Buffer"; // This name is visible in the Frame Debugger, so make it a descriptive!
            GetComponent <Camera>().AddCommandBuffer(CameraEvent.BeforeImageEffects, _commandBuffer);
        }
 void Start()
 {
     Renderers = GetComponentsInChildren <Renderer>();
     GlowController.RegisterObject(this);
 }