Esempio n. 1
0
 public void Dispose()
 {
     if (/*NativeLightsBoundList != null && */ NativeLightsBoundList.IsCreated)
     {
         NativeLightsBoundList.Dispose();
     }
     if (LightsSphereList.IsCreated)
     {
         LightsSphereList.Dispose();
     }
     if (/*NativeLightsDataList != null &&*/ NativeLightsDataList.IsCreated)
     {
         NativeLightsDataList.Dispose();
     }
     if (culsterDataGenerator != null)
     {
         culsterDataGenerator.CleanUp();
         culsterDataGenerator = null;
     }
     if (tileAndClusterData != null)
     {
         tileAndClusterData.CleanUp();
         tileAndClusterData = null;
     }
     if (lightLoopLightsData != null)
     {
         lightLoopLightsData.CleanUp();
         lightLoopLightsData = null;
     }
 }
Esempio n. 2
0
        public LightLoopLightsData lightLoopLightsData;   // = new LightLoopLightsData();

        public void Initilize(PipelineSettings pipelineSettings)
        {
            bool needRebuild = false;

            if (NumMaxLights != pipelineSettings.MaxItemsOnScreen)
            {
                needRebuild = true;
            }
            if (NativeLightsBoundList == null ||
                NativeLightsDataList == null)
            {
                needRebuild = true;
            }

            if (needRebuild)
            {
                Dispose();
                NumMaxLights          = pipelineSettings.MaxItemsOnScreen;
                NativeLightsBoundList = new NativeArray <SFiniteLightBound>(NumMaxLights, Allocator.Persistent);
                LightsSphereList      = new NativeArray <Sphere>(NumMaxLights, Allocator.Persistent);
                NativeLightsDataList  = new NativeArray <LightData>(NumMaxLights, Allocator.Persistent);
                lights.Clear();
                culsterDataGenerator = new CulsterDataGenerator();
                tileAndClusterData   = new TileAndClusterData();
                lightLoopLightsData  = new LightLoopLightsData();
                culsterDataGenerator.Initilize(pipelineSettings);
                tileAndClusterData.Initilize(pipelineSettings.NumClusters, pipelineSettings.MaxItemsPerCluster);
                lightLoopLightsData.Initialize(pipelineSettings.MaxItemsOnScreen);

                LightsDataForShadow.Allocate(NumMaxLights);
            }
        }