Esempio n. 1
0
        void OnVisibilityChanged(bool isVisible)
        {
#if UNITY_EDITOR
            if (m_shadowRenderer == null)
            {
                m_shadowRenderer = GetComponent <ShadowTextureRenderer>();
            }
            if (m_commandBuffer == null)
            {
                CreateCommandBuffer();
                UpdateCommandBuffer();
                return;
            }
            if (m_isCommandBufferDirty)
            {
                UpdateCommandBuffer();
            }
#endif
            if (isVisible)
            {
                m_shadowRenderer.AddCommandBuffer(m_commandBuffer);
            }
            else
            {
                m_shadowRenderer.RemoveCommandBuffer(m_commandBuffer);
            }
        }
Esempio n. 2
0
 // message handlers
 void Awake()
 {
     m_shadowRenderer = GetComponent <ShadowTextureRenderer>();
     if (m_target != null)
     {
         m_localTargetPosition = transform.InverseTransformPoint(m_target.position);
     }
     CreateCommandBuffer();
 }
        public void ApplyFallback(Projector projector)
        {
            if (m_fallbackShaderOrMaterial is Shader)
            {
                projector.material.shader = m_fallbackShaderOrMaterial as Shader;
            }
            else if (m_fallbackShaderOrMaterial is Material)
            {
                projector.material = m_fallbackShaderOrMaterial as Material;
            }
            ShadowTextureRenderer shadowRenderer = projector.GetComponent <ShadowTextureRenderer>();

            shadowRenderer.blurLevel = m_blurLevel;
            shadowRenderer.blurSize  = m_blurSize;
            shadowRenderer.mipLevel  = 0;
            if (m_modifyTextureSize)
            {
                shadowRenderer.textureWidth  = m_textureWidth;
                shadowRenderer.textureHeight = m_textureHeight;
                shadowRenderer.multiSampling = m_multiSampling;
                shadowRenderer.superSampling = m_superSampling;
            }
        }