Exemple #1
0
        public int ReserveShadowResolutions(Vector2 resolution, ShadowMapType shadowMapType)
        {
            if (m_ShadowRequestCount >= m_MaxShadowRequests)
            {
                Debug.LogWarning("Max shadow requests count reached, dropping all exceeding requests. You can increase this limit by changing the max requests in the HDRP asset");
                return(-1);
            }

            HDShadowResolutionRequest resolutionRequest = new HDShadowResolutionRequest {
                resolution    = resolution,
                shadowMapType = shadowMapType,
            };

            switch (shadowMapType)
            {
            case ShadowMapType.PunctualAtlas:
                m_Atlas.ReserveResolution(resolutionRequest);
                break;

            case ShadowMapType.AreaLightAtlas:
                m_AreaLightShadowAtlas.ReserveResolution(resolutionRequest);
                break;

            case ShadowMapType.CascadedDirectional:
                m_CascadeAtlas.ReserveResolution(resolutionRequest);
                break;
            }

            m_ShadowResolutionRequests.Add(resolutionRequest);
            m_ShadowRequestCount = m_ShadowResolutionRequests.Count;

            return(m_ShadowResolutionRequests.Count - 1);
        }
        public int ReserveShadowResolutions(Vector2 resolution, bool allowResize)
        {
            if (m_ShadowRequestCount >= m_MaxShadowRequests)
            {
                Debug.LogWarning("Max shadow requests count reached, dropping all exceeding requests. You can increase this limit by changing the max requests in the HDRP asset");
                return(-1);
            }

            HDShadowResolutionRequest resolutionRequest = new HDShadowResolutionRequest {
                resolution = resolution,
            };

            if (allowResize)
            {
                m_Atlas.ReserveResolution(resolutionRequest);
            }
            else
            {
                m_CascadeAtlas.ReserveResolution(resolutionRequest);
            }

            m_ShadowResolutionRequests.Add(resolutionRequest);
            m_ShadowRequestCount = m_ShadowResolutionRequests.Count;

            return(m_ShadowResolutionRequests.Count - 1);
        }
        public int ReserveShadowResolutions(Vector2 resolution, bool allowResize)
        {
            if (m_ShadowRequestCount >= m_MaxShadowRequests)
            {
                return(-1);
            }

            HDShadowResolutionRequest resolutionRequest = new HDShadowResolutionRequest {
                resolution = resolution,
            };

            if (allowResize)
            {
                m_Atlas.ReserveResolution(resolutionRequest);
            }
            else
            {
                m_CascadeAtlas.ReserveResolution(resolutionRequest);
            }

            m_ShadowResolutionRequests.Add(resolutionRequest);
            m_ShadowRequestCount = m_ShadowResolutionRequests.Count;

            return(m_ShadowResolutionRequests.Count - 1);
        }