Esempio n. 1
0
        // ==========================================================================================================================

        public void ApplyChanges()
        {
            validRebakeLighting = rebakeLighting && !validCopyBakedLighting && !Application.isPlaying && Application.isEditor;

            for (int i = 0; i < changedCells.Count; i++)
            {
                ObjectOctree.MaxCell maxCell = changedCells[i];
                maxCell.hasChanged = false;

                maxCell.ApplyChanges(this);
            }

            changedCells.Clear();
        }
Esempio n. 2
0
        void SelectOrDeselect(Vector3 position, MeshRenderer mr, Material mat, bool select)
        {
            var octree = meshCombiner.octree;

            if (octree == null)
            {
                return;
            }

            ObjectOctree.MaxCell cell = octree.GetCell(position);

            if (cell == null)
            {
                return;
            }

            mr.sharedMaterial = mat;

            if (meshCombiner.activeOriginal)
            {
                return;
            }

            ObjectOctree.LODParent[] lodParents = cell.lodParents;

            for (int i = 0; i < lodParents.Length; i++)
            {
                ObjectOctree.LODParent lodParent = lodParents[i];
                if (lodParent == null)
                {
                    continue;
                }

                ObjectOctree.LODLevel[] lodLevels = lodParent.lodLevels;

                for (int j = 0; j < lodLevels.Length; j++)
                {
                    ObjectOctree.LODLevel lodLevel = lodLevels[j];

                    if (lodLevel == null)
                    {
                        continue;
                    }

                    Methods.SetMeshRenderersActive(lodLevel.newMeshRenderers, !select);
                    Methods.SetCachedGOSActive(lodLevel.cachedGOs, select);
                }
            }
        }
Esempio n. 3
0
            // Token: 0x0600307D RID: 12413 RVA: 0x000CDCEC File Offset: 0x000CBEEC
            private void AddObjectInternal(MeshCombiner meshCombiner, CachedGameObject cachedGO, Vector3 position, int lodParentIndex, int lodLevel, bool isChangeMode)
            {
                if (this.level == this.maxLevels)
                {
                    ObjectOctree.MaxCell maxCell = (ObjectOctree.MaxCell) this;
                    if (maxCell.lodParents == null)
                    {
                        maxCell.lodParents = new ObjectOctree.LODParent[10];
                    }
                    if (maxCell.lodParents[lodParentIndex] == null)
                    {
                        maxCell.lodParents[lodParentIndex] = new ObjectOctree.LODParent(lodParentIndex + 1);
                    }
                    ObjectOctree.LODParent lodparent = maxCell.lodParents[lodParentIndex];
                    ObjectOctree.LODLevel  lodlevel  = lodparent.lodLevels[lodLevel];
                    lodlevel.cachedGOs.Add(cachedGO);
                    if (isChangeMode && this.SortObject(meshCombiner, lodlevel, cachedGO, false))
                    {
                        if (!maxCell.hasChanged)
                        {
                            maxCell.hasChanged = true;
                            if (meshCombiner.changedCells == null)
                            {
                                meshCombiner.changedCells = new List <ObjectOctree.MaxCell>();
                            }
                            meshCombiner.changedCells.Add(maxCell);
                        }
                        if (!lodparent.hasChanged)
                        {
                            lodparent.hasChanged = true;
                            maxCell.changedLodParents.Add(lodparent);
                        }
                    }
                    lodlevel.objectCount++;
                    lodlevel.vertCount += cachedGO.mesh.vertexCount;
                    return;
                }
                bool flag;
                int  num = base.AddCell <ObjectOctree.Cell, ObjectOctree.MaxCell>(ref this.cells, position, out flag);

                if (flag)
                {
                    ObjectOctree.MaxCell.maxCellCount++;
                }
                this.cells[num].AddObjectInternal(meshCombiner, cachedGO, position, lodParentIndex, lodLevel, isChangeMode);
            }