// Token: 0x06000CAF RID: 3247 RVA: 0x0005D8AC File Offset: 0x0005BCAC
        public static void addCut(IShapeVolume cut)
        {
            Bounds        worldBounds   = cut.worldBounds;
            FoliageBounds foliageBounds = new FoliageBounds(worldBounds);

            for (int i = foliageBounds.min.x; i <= foliageBounds.max.x; i++)
            {
                for (int j = foliageBounds.min.y; j <= foliageBounds.max.y; j++)
                {
                    FoliageCoord tileCoord = new FoliageCoord(i, j);
                    FoliageTile  orAddTile = FoliageSystem.getOrAddTile(tileCoord);
                    orAddTile.addCut(cut);
                }
            }
        }
        // Token: 0x06000C77 RID: 3191 RVA: 0x0005D340 File Offset: 0x0005B740
        public FoliageBounds getFoliageSurfaceBounds()
        {
            bool activeSelf = base.gameObject.activeSelf;

            if (!activeSelf)
            {
                base.gameObject.SetActive(true);
            }
            FoliageBounds result = new FoliageBounds(this.surfaceCollider.bounds);

            if (!activeSelf)
            {
                base.gameObject.SetActive(false);
            }
            return(result);
        }
示例#3
0
        // Token: 0x06000C4A RID: 3146 RVA: 0x0005CB44 File Offset: 0x0005AF44
        public override int getInstanceCountInVolume(IShapeVolume volume)
        {
            Bounds        worldBounds   = volume.worldBounds;
            FoliageBounds foliageBounds = new FoliageBounds(worldBounds);
            int           num           = 0;

            for (int i = foliageBounds.min.x; i <= foliageBounds.max.x; i++)
            {
                for (int j = foliageBounds.min.y; j <= foliageBounds.max.y; j++)
                {
                    FoliageCoord tileCoord = new FoliageCoord(i, j);
                    FoliageTile  tile      = FoliageSystem.getTile(tileCoord);
                    if (tile != null)
                    {
                        if (!tile.hasInstances)
                        {
                            tile.readInstancesOnThread();
                        }
                        FoliageInstanceList foliageInstanceList;
                        if (tile.instances != null && tile.instances.TryGetValue(base.getReferenceTo <FoliageInstancedMeshInfoAsset>(), out foliageInstanceList))
                        {
                            foreach (List <Matrix4x4> list in foliageInstanceList.matrices)
                            {
                                foreach (Matrix4x4 matrix in list)
                                {
                                    if (volume.containsPoint(matrix.GetPosition()))
                                    {
                                        num++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(num);
        }
        // Token: 0x06000CB0 RID: 3248 RVA: 0x0005D934 File Offset: 0x0005BD34
        private static Dictionary <FoliageTile, List <IFoliageSurface> > getTileSurfacePairs()
        {
            Dictionary <FoliageTile, List <IFoliageSurface> > dictionary = new Dictionary <FoliageTile, List <IFoliageSurface> >();

            foreach (KeyValuePair <FoliageCoord, FoliageTile> keyValuePair in FoliageSystem.tiles)
            {
                FoliageTile value = keyValuePair.Value;
                if (FoliageVolumeUtility.isTileBakeable(value))
                {
                    dictionary.Add(value, new List <IFoliageSurface>());
                }
            }
            foreach (IFoliageSurface foliageSurface in FoliageSystem.surfaces)
            {
                FoliageBounds foliageSurfaceBounds = foliageSurface.getFoliageSurfaceBounds();
                for (int i = foliageSurfaceBounds.min.x; i <= foliageSurfaceBounds.max.x; i++)
                {
                    for (int j = foliageSurfaceBounds.min.y; j <= foliageSurfaceBounds.max.y; j++)
                    {
                        FoliageCoord tileCoord = new FoliageCoord(i, j);
                        FoliageTile  orAddTile = FoliageSystem.getOrAddTile(tileCoord);
                        if (FoliageVolumeUtility.isTileBakeable(orAddTile))
                        {
                            List <IFoliageSurface> list;
                            if (!dictionary.TryGetValue(orAddTile, out list))
                            {
                                list = new List <IFoliageSurface>();
                                dictionary.Add(orAddTile, list);
                            }
                            list.Add(foliageSurface);
                        }
                    }
                }
            }
            return(dictionary);
        }