Exemplo n.º 1
0
        public override void FrameCleanup(CommandBuffer cmd)
        {
            base.FrameCleanup(cmd);
            characterShadow = null;

            if (cmd == null)
            {
                throw new ArgumentNullException("cmd");
            }

            if (m_CharacterShadowmapTexture)
            {
                RenderTexture.ReleaseTemporary(m_CharacterShadowmapTexture);
                m_CharacterShadowmapTexture = null;
            }
        }
Exemplo n.º 2
0
        public bool Setup(ref RenderingData renderingData, CharacterShadow InCharacterShadow)
        {
            if (InCharacterShadow == null)
            {
                return(false);
            }
            if (!renderingData.shadowData.supportsCharacterShadows)
            {
                return(false);
            }

            int shadowLightIndex = renderingData.lightData.mainLightIndex;

            if (shadowLightIndex == -1)
            {
                return(false);
            }

            VisibleLight shadowLight = renderingData.lightData.visibleLights[shadowLightIndex];
            Light        light       = shadowLight.light;

            if (light.shadows == LightShadows.None)
            {
                return(false);
            }

            if (shadowLight.lightType != LightType.Directional)
            {
                Debug.LogWarning("Only directional lights are supported character shadow.");
                return(false);
            }

            Clear();

            characterShadow   = InCharacterShadow;
            m_ShadowmapWidth  = renderingData.shadowData.characterShadowmapWidth;
            m_ShadowmapHeight = renderingData.shadowData.characterShadowmapHeight;
            return(true);
        }