Пример #1
0
        private void PrepareRulesForBoxInternal(ref BoundingBox request)
        {
            if (m_rangeBiomes == null)
            {
                m_rangeBiomes = new List <PlanetMaterialRule> [256];
            }

            BoundingBox box;

            request.Translate(-m_planetShape.Center());

            // Inflate so we don't miss any rules.
            request.Inflate(request.Extents.Length() * .1f);

            GetRuleBounds(ref request, out box);

            foreach (var bio in m_biomes.Values)
            {
                if (ReferenceEquals(m_rangeBiomes[bio.Value], bio.Rules) || m_rangeBiomes[bio.Value] == null || m_providerForRules != this)
                {
                    m_rangeBiomes[bio.Value] = new List <PlanetMaterialRule>();
                }

                bio.MateriaTree.OverlapAllBoundingBox(ref box, m_rangeBiomes[bio.Value], clear: true);
            }
            m_rangeClean       = false;
            m_providerForRules = this;
        }
        private void PrepareRulesForBoxInternal(ref BoundingBox request)
        {
            if (m_rangeBiomes == null)
            {
                m_rangeBiomes = new List <PlanetMaterialRule> [256];
            }

            BoundingBox box;

            request.Translate(-m_planetShape.Center());

            // Inflate so we don't miss any rules.
            request.Inflate(request.Extents.Length() * .1f);

            GetRuleBounds(ref request, out box);

            foreach (var bio in m_biomes.Values)
            {
                if (Object.ReferenceEquals(m_rangeBiomes[bio.Value], bio.Rules) || m_rangeBiomes[bio.Value] == null || m_providerForRules != this)
                {
                    m_rangeBiomes[bio.Value] = new List <PlanetMaterialRule>();
                }

                m_rangeBiomes[bio.Value].Clear();

                bio.MateriaTree.Query(delegate(int x)
                {
                    m_rangeBiomes[bio.Value].Add(bio.MateriaTree.GetUserData <PlanetMaterialRule>(x)); return(true);
                }, ref box);
            }
            m_rangeClean       = false;
            m_providerForRules = this;
        }