예제 #1
0
        internal void AddPendingAssetLoading(ProbeVolumeAsset asset)
        {
            var key = asset.GetSerializedFullPath();

            if (m_PendingAssetsToBeLoaded.ContainsKey(key))
            {
                m_PendingAssetsToBeLoaded.Remove(key);
            }
            m_PendingAssetsToBeLoaded.Add(asset.GetSerializedFullPath(), asset);
            m_NeedLoadAsset = true;

            // Compute the max index dimension from all the loaded assets + assets we need to load
            Vector3Int indexDimension = Vector3Int.zero;

            foreach (var a in m_PendingAssetsToBeLoaded.Values)
            {
                indexDimension = Vector3Int.Max(indexDimension, a.maxCellIndex);
            }
            foreach (var a in m_ActiveAssets.Values)
            {
                indexDimension = Vector3Int.Max(indexDimension, a.maxCellIndex);
            }

            m_PendingIndexDimChange = indexDimension;
            m_NeedsIndexDimChange   = true;
        }
예제 #2
0
        internal void AddPendingAssetRemoval(ProbeVolumeAsset asset)
        {
            var key = asset.GetSerializedFullPath();

            if (m_PendingAssetsToBeUnloaded.ContainsKey(key))
            {
                m_PendingAssetsToBeUnloaded.Remove(key);
            }
            m_PendingAssetsToBeUnloaded.Add(asset.GetSerializedFullPath(), asset);
        }
예제 #3
0
        internal void RemovePendingAsset(ProbeVolumeAsset asset)
        {
            var key = asset.GetSerializedFullPath();

            if (m_ActiveAssets.ContainsKey(key))
            {
                m_ActiveAssets.Remove(key);
            }

            // Remove bricks and empty cells
            foreach (var cell in asset.cells)
            {
                if (cells.ContainsKey(cell.index))
                {
                    cells.Remove(cell.index);
                }
            }

            // Unload brick data
            if (m_AssetPathToBricks.ContainsKey(key))
            {
                var regIds = m_AssetPathToBricks[key];
                foreach (var regId in regIds)
                {
                    ReleaseBricks(regId);
                }

                m_AssetPathToBricks.Remove(key);
            }
        }
예제 #4
0
        private void LoadAsset(ProbeVolumeAsset asset)
        {
            var path = asset.GetSerializedFullPath();

            m_AssetPathToBricks[path] = new List <RegId>();

            foreach (var cell in asset.cells)
            {
                // Push data to HDRP
                bool compressed   = false;
                var  dataLocation = ProbeBrickPool.CreateDataLocation(cell.sh.Length, compressed, ProbeVolumeSHBands.SphericalHarmonicsL2);
                ProbeBrickPool.FillDataLocation(ref dataLocation, cell.sh, ProbeVolumeSHBands.SphericalHarmonicsL2);

                // TODO register ID of brick list
                List <ProbeBrickIndex.Brick> brickList = new List <ProbeBrickIndex.Brick>();
                brickList.AddRange(cell.bricks);
                var regId = AddBricks(brickList, dataLocation);

                cells[cell.index] = cell;
                m_AssetPathToBricks[path].Add(regId);

                dataLocation.Cleanup();
            }
        }