Exemplo n.º 1
0
            public ShadowManager(ShadowSettings shadowSettings, ref ShadowContext.CtxtInit ctxtInitializer, ShadowmapBase[] shadowmaps)
            {
                m_ShadowSettings = shadowSettings;
                m_ShadowCtxt     = new ShadowContextAccess(ref ctxtInitializer);

                Debug.Assert(shadowmaps != null && shadowmaps.Length > 0);
                m_Shadowmaps = shadowmaps;
                foreach (var sm in shadowmaps)
                {
                    sm.ReserveSlots(m_ShadowCtxt);
                    ShadowmapBase.ShadowSupport smsupport = sm.QueryShadowSupport();
                    for (int i = 0, bit = 1; i < (int)GPUShadowType.MAX; ++i, bit <<= 1)
                    {
                        if (((int)smsupport & bit) == 0)
                        {
                            continue;
                        }

                        for (int idx = 0; i < k_MaxShadowmapPerType; ++idx)
                        {
                            if (m_ShadowmapsPerType[i, idx] == null)
                            {
                                m_ShadowmapsPerType[i, idx] = sm;
                                break;
                            }
                        }
                        Debug.Assert(m_ShadowmapsPerType[i, k_MaxShadowmapPerType - 1] == null || m_ShadowmapsPerType[i, k_MaxShadowmapPerType - 1] == sm,
                                     "Only up to " + k_MaxShadowmapPerType + " are allowed per light type. If more are needed then increase ShadowManager.k_MaxShadowmapPerType");
                    }
                }

                m_MaxShadows[(int)GPUShadowType.Point, 0]       = m_MaxShadows[(int)GPUShadowType.Point, 1] = 4;
                m_MaxShadows[(int)GPUShadowType.Spot, 0]        = m_MaxShadows[(int)GPUShadowType.Spot, 1] = 8;
                m_MaxShadows[(int)GPUShadowType.Directional, 0] = m_MaxShadows[(int)GPUShadowType.Directional, 1] = 1;
            }
Exemplo n.º 2
0
 public ShadowContextAccess(ref ShadowContext.CtxtInit initializer) : base(ref initializer)
 {
 }