public void Register()
    {
        Bounds bounds1 = this.collider.get_bounds();

        this.center = ((Bounds) ref bounds1).get_center();
        Bounds bounds2 = this.collider.get_bounds();
        // ISSUE: variable of the null type
        __Null x = ((Bounds) ref bounds2).get_extents().x;

        bounds2 = this.collider.get_bounds();
        // ISSUE: variable of the null type
        __Null y   = ((Bounds) ref bounds2).get_extents().y;
        double num = (double)Mathf.Max((float)x, (float)y);

        bounds2 = this.collider.get_bounds();
        // ISSUE: variable of the null type
        __Null z = ((Bounds) ref bounds2).get_extents().z;

        this.radius     = Mathf.Max((float)num, (float)z);
        this.occludeeId = OcclusionCulling.RegisterOccludee(this.center, this.radius, this.renderer.get_enabled(), this.minTimeVisible, this.isStatic, ((Component)this).get_gameObject().get_layer(), new OcclusionCulling.OnVisibilityChanged(this.OnVisibilityChanged));
        if (this.occludeeId < 0)
        {
            Debug.LogWarning((object)("[OcclusionCulling] Occludee registration failed for " + ((Object)this).get_name() + ". Too many registered."));
        }
        this.state = OcclusionCulling.GetStateById(this.occludeeId);
    }
 private void UnregisterFromCulling()
 {
     if (localOccludee.IsRegistered)
     {
         OcclusionCulling.UnregisterOccludee(localOccludee.id);
         localOccludee.Invalidate();
     }
 }
Exemple #3
0
    protected override void DoTick()
    {
        if (!initialized)
        {
            current               = traffic.GetStartingPoint();
            next                  = traffic.GetRandomWalk(current);
            far                   = traffic.GetRandomWalk(current, next);
            transform.position    = current.data;
            speed                 = speed + Random.Range(-speedDispertion, speedDispertion);
            lastNonZeroHorizontal = Vector3.forward;
            initialized           = true;
            return;
        }
        Vector3 delta = traffic.GetOffset(next.data - current.data);

        if ((this.transform.position - (next.data + delta)).sqrMagnitude < (checkpointMinDistance * checkpointMinDistance))
        {
            var tmp = traffic.GetRandomWalk(next, far);
            current = next;
            next    = far;
            far     = tmp;
            delta   = traffic.GetOffset(next.data - current.data);
        }

        Vector3 perfect    = Vector3.Project(transform.position - (current.data + delta), (next.data + delta) - (current.data + delta));
        Vector3 correction = perfect + (current.data + delta) - transform.position;

        if (correction.sqrMagnitude > 0.5f)
        {
            correction = correction.normalized * correctionSpeed * Time.deltaTime;
        }
        else
        {
            correction = Vector3.zero;
        }
        Vector3 movement = (next.data + delta - transform.position).normalized * speed * Time.deltaTime;

        controller.Move(correction + movement);

        Vector3 horizontal = next.data - current.data;

        horizontal.y = 0;
        if (horizontal.sqrMagnitude != 0)
        {
            lastNonZeroHorizontal = horizontal.normalized;
        }

        bool visible = OcclusionCulling.IsVisibleAABB(controller.bounds) && OcclusionCulling.IsVisibleCollider(controller);

        foreach (Renderer renderer in renderers)
        {
            renderer.enabled = visible;
        }
        foreach (LightTrail renderer in trails)
        {
            renderer.enabled = visible;
        }
    }
 private void UnregisterFromCulling()
 {
     if (!this.localOccludee.IsRegistered)
     {
         return;
     }
     OcclusionCulling.UnregisterOccludee(this.localOccludee.id);
     this.localOccludee.Invalidate();
 }
Exemple #5
0
 // Update is called once per frame
 public void SetState(bool enable)
 {
     foreach (MeshRenderer mr in meshrenderers)
     {
         mr.enabled = enable && OcclusionCulling.IsVisibleAABB(mr.bounds);
     }
     //foreach (LODProxy p in proxies)
     //    p.SetState(enable);
 }
Exemple #6
0
    void Update()
    {
        if (camera == null)
        {
            camera = Camera.main;
        }
        float startTime = Time.realtimeSinceStartup;

        if (!UpdateWhenNotMoving && Vector3.Distance(camPos, camera.transform.position) < 0.01f)
        {
            return;
        }
        else
        {
            camPos = camera.transform.position;
        }
        foreach (Group group in groups)
        {
            //Vector3 p = Camera.main.transform.InverseTransformPoint(group.transform.position);
            // float offset = Mathf.Sqrt(group.size.x * group.size.x + group.size.z * group.size.z);
            // bool visible = p.z > -offset && p.sqrMagnitude < blockVisibilityRadius * blockVisibilityRadius;
            bool visible = OcclusionCulling.IsVisibleAABB(group);

            if (visible)
            {
                //group.gameObject.SetActive(true);
                foreach (Block b in group.blocks)
                {
                    if (b.building)
                    {
                        bool  buildingVisible = OcclusionCulling.IsVisibleTerrainElement(b.building);
                        float distance        = Camera.main.transform.InverseTransformPoint(b.transform.position).magnitude;

                        SetBuildingVisibility(b, buildingVisible, distance);
                        b.building.visible = buildingVisible;
                    }
                }
                group.visible = true;
            }
            else if (group.visible)
            {
                foreach (Block b in group.blocks)
                {
                    if (b.building)
                    {
                        bool  buildingVisible = false;
                        float distance        = -1;

                        SetBuildingVisibility(b, buildingVisible, distance);
                        b.building.visible = false;
                    }
                }
                group.visible = false;
            }
        }
        UpdateTime = Time.realtimeSinceStartup - startTime;
    }
    // Direction must be 0, 1 or 2
    public Portal(Vector3i position, int direction, OcclusionCulling cullingData)
    {
        this.Position1   = position;
        this.Direction   = direction;
        this.Position2   = this.Position1 + Orientations.Direction[direction];
        this.cullingData = cullingData;

        var dir = Orientations.Direction[this.Direction].ToVector3();

        this.Bounds = new Bounds(cullingData.MapBehaviour.GetWorldspacePosition(this.Position1) + dir, (Vector3.one - new Vector3(Mathf.Abs(dir.x), Mathf.Abs(dir.y), Mathf.Abs(dir.z)) * 0.95f) * 2f);
    }
 public void Initialize()
 {
     ModuleData.Current = this.ModuleData.Modules;
     this.Clear();
     this.Map = new InfiniteMap(this.MapHeight);
     if (this.ApplyBoundaryConstraints && this.BoundaryConstraints != null && this.BoundaryConstraints.Any())
     {
         this.Map.ApplyBoundaryConstraints(this.BoundaryConstraints);
     }
     this.OcclusionData = this.GetComponent <OcclusionCulling>();
     this.OcclusionData.Initialize();
 }
Exemple #9
0
    private void OnDrawGizmos()
    {
        Gizmos.color = OcclusionCulling.ContainsCamera(Bounds)? Color.yellow: visible ? Color.green : Color.red;

        /*if (containMegaStructure)
         * {
         *  Gizmos.DrawWireCube(transform.position + center + new Vector3(0, size.y/2, 0), new Vector3(2* size.x, size.y, 2* size.z)/2);
         * }
         * else*/
        {
            Gizmos.DrawWireCube(transform.position + center + new Vector3(0, size.y / 2, 0), size / 2);
        }
    }
 static void DrawGizmo(OcclusionCulling occlusion, GizmoType gizmoType)
 {
     if (occlusion.chunksInRange == null)
     {
         return;
     }
     foreach (var chunk in occlusion.chunksInRange)
     {
         foreach (var room in chunk.Rooms)
         {
             room.DrawGizmo(occlusion.MapBehaviour);
         }
     }
 }
    private void RegisterForCulling(OcclusionCulling.Sphere sphere, bool visible)
    {
        if (localOccludee.IsRegistered)
        {
            UnregisterFromCulling();
        }
        int num = OcclusionCulling.RegisterOccludee(sphere.position, sphere.radius, visible, 0.25f, false, base.gameObject.layer, OnVisibilityChanged);

        if (num >= 0)
        {
            localOccludee = new OccludeeSphere(num, localOccludee.sphere);
            return;
        }
        localOccludee.Invalidate();
        Debug.LogWarning("[OcclusionCulling] Occludee registration failed for " + base.name + ". Too many registered.");
    }
    public OccludeeSphere(int id)
    {
        OccludeeState stateById;

        this.id = id;
        if (id < 0)
        {
            stateById = null;
        }
        else
        {
            stateById = OcclusionCulling.GetStateById(id);
        }
        this.state  = stateById;
        this.sphere = new OcclusionCulling.Sphere(Vector3.zero, 0f);
    }
    public OccludeeSphere(int id, OcclusionCulling.Sphere sphere)
    {
        OccludeeState stateById;

        this.id = id;
        if (id < 0)
        {
            stateById = null;
        }
        else
        {
            stateById = OcclusionCulling.GetStateById(id);
        }
        this.state  = stateById;
        this.sphere = sphere;
    }
    private void RegisterForCulling(OcclusionCulling.Sphere sphere, bool visible)
    {
        if (this.localOccludee.IsRegistered)
        {
            this.UnregisterFromCulling();
        }
        ArticulatedOccludee articulatedOccludee = this;
        int num = OcclusionCulling.RegisterOccludee(sphere.position, sphere.radius, visible, 0.25f, false, base.gameObject.layer, new OcclusionCulling.OnVisibilityChanged(articulatedOccludee.OnVisibilityChanged));

        if (num >= 0)
        {
            this.localOccludee = new OccludeeSphere(num, this.localOccludee.sphere);
            return;
        }
        this.localOccludee.Invalidate();
        Debug.LogWarning(string.Concat("[OcclusionCulling] Occludee registration failed for ", base.name, ". Too many registered."));
    }
    private void RegisterForCulling(OcclusionCulling.Sphere sphere, bool visible)
    {
        if (this.localOccludee.IsRegistered)
        {
            this.UnregisterFromCulling();
        }
        int id = OcclusionCulling.RegisterOccludee(sphere.position, sphere.radius, visible, 0.25f, false, ((Component)this).get_gameObject().get_layer(), new OcclusionCulling.OnVisibilityChanged(this.OnVisibilityChanged));

        if (id >= 0)
        {
            this.localOccludee = new OccludeeSphere(id, this.localOccludee.sphere);
        }
        else
        {
            this.localOccludee.Invalidate();
            Debug.LogWarning((object)("[OcclusionCulling] Occludee registration failed for " + ((Object)this).get_name() + ". Too many registered."));
        }
    }
Exemple #16
0
    protected override void DoTick()
    {
        direction = path[(int)(pathIndex + 1) % path.Count] - path[(int)pathIndex];
        pathIndex = (int)pathIndex + Mathf.Clamp(Vector3.Dot((transform.position - path[(int)pathIndex]) / direction.magnitude, direction.normalized), 0f, 1f);
        if (pathIndex >= path.Count)
        {
            pathIndex -= path.Count;
        }
        pathIndex = Mathf.Clamp(pathIndex, 0f, path.Count);
        Vector3 gravity = controller.isGrounded ? Vector3.zero : -Vector3.up;

        controller.Move(direction.normalized * speed * Time.deltaTime + gravity);

        bool visible = OcclusionCulling.IsVisibleAABB(controller.bounds) && OcclusionCulling.IsVisibleCollider(controller);

        renderer.enabled = visible;
        animator.enabled = visible;
    }
    public void Register()
    {
        Bounds bound = this.collider.bounds;

        this.center = bound.center;
        bound       = this.collider.bounds;
        float single = bound.extents.x;

        bound = this.collider.bounds;
        float single1 = Mathf.Max(single, bound.extents.y);

        bound       = this.collider.bounds;
        this.radius = Mathf.Max(single1, bound.extents.z);
        Occludee occludee = this;

        this.occludeeId = OcclusionCulling.RegisterOccludee(this.center, this.radius, this.renderer.enabled, this.minTimeVisible, this.isStatic, base.gameObject.layer, new OcclusionCulling.OnVisibilityChanged(occludee.OnVisibilityChanged));
        if (this.occludeeId < 0)
        {
            Debug.LogWarning(string.Concat("[OcclusionCulling] Occludee registration failed for ", base.name, ". Too many registered."));
        }
        this.state = OcclusionCulling.GetStateById(this.occludeeId);
    }
 public void Unregister()
 {
     OcclusionCulling.UnregisterOccludee(this.occludeeId);
 }
Exemple #19
0
 // Start is called before the first frame update
 private void OnValidate()
 {
     instance = this;
     camera   = Camera.main;
 }
Exemple #20
0
 public OccludeeSphere(int id)
 {
     this.id     = id;
     this.state  = id < 0 ? (OccludeeState)null : OcclusionCulling.GetStateById(id);
     this.sphere = new OcclusionCulling.Sphere(Vector3.get_zero(), 0.0f);
 }
Exemple #21
0
 public OccludeeSphere(int id, OcclusionCulling.Sphere sphere)
 {
     this.id     = id;
     this.state  = id < 0 ? (OccludeeState)null : OcclusionCulling.GetStateById(id);
     this.sphere = sphere;
 }
    public void UpdateCullingBounds()
    {
        Vector3 vector3_1 = Vector3.get_zero();
        Vector3 vector3_2 = Vector3.get_zero();
        bool    flag      = false;
        int     num1      = this.renderers != null ? this.renderers.Count : 0;
        int     num2      = this.colliders != null ? this.colliders.Count : 0;

        if (num1 > 0 && (num2 == 0 || num1 < num2))
        {
            for (int index = 0; index < this.renderers.Count; ++index)
            {
                if (this.renderers[index].get_isVisible())
                {
                    Bounds  bounds = this.renderers[index].get_bounds();
                    Vector3 min    = ((Bounds) ref bounds).get_min();
                    Vector3 max    = ((Bounds) ref bounds).get_max();
                    if (!flag)
                    {
                        vector3_1 = min;
                        vector3_2 = max;
                        flag      = true;
                    }
                    else
                    {
                        vector3_1.x = vector3_1.x < min.x ? vector3_1.x : min.x;
                        vector3_1.y = vector3_1.y < min.y ? vector3_1.y : min.y;
                        vector3_1.z = vector3_1.z < min.z ? vector3_1.z : min.z;
                        vector3_2.x = vector3_2.x > max.x ? vector3_2.x : max.x;
                        vector3_2.y = vector3_2.y > max.y ? vector3_2.y : max.y;
                        vector3_2.z = vector3_2.z > max.z ? vector3_2.z : max.z;
                    }
                }
            }
        }
        if (!flag && num2 > 0)
        {
            flag = true;
            Bounds bounds1 = this.colliders[0].get_bounds();
            vector3_1 = ((Bounds) ref bounds1).get_min();
            bounds1   = this.colliders[0].get_bounds();
            vector3_2 = ((Bounds) ref bounds1).get_max();
            for (int index = 1; index < this.colliders.Count; ++index)
            {
                Bounds  bounds2 = this.colliders[index].get_bounds();
                Vector3 min     = ((Bounds) ref bounds2).get_min();
                Vector3 max     = ((Bounds) ref bounds2).get_max();
                vector3_1.x = vector3_1.x < min.x ? vector3_1.x : min.x;
                vector3_1.y = vector3_1.y < min.y ? vector3_1.y : min.y;
                vector3_1.z = vector3_1.z < min.z ? vector3_1.z : min.z;
                vector3_2.x = vector3_2.x > max.x ? vector3_2.x : max.x;
                vector3_2.y = vector3_2.y > max.y ? vector3_2.y : max.y;
                vector3_2.z = vector3_2.z > max.z ? vector3_2.z : max.z;
            }
        }
        if (!flag)
        {
            return;
        }
        Vector3 vector3_3 = Vector3.op_Subtraction(vector3_2, vector3_1);

        OcclusionCulling.Sphere sphere = new OcclusionCulling.Sphere(Vector3.op_Addition(vector3_1, Vector3.op_Multiply(vector3_3, 0.5f)), Mathf.Max(Mathf.Max((float)vector3_3.x, (float)vector3_3.y), (float)vector3_3.z) * 0.5f);
        if (this.localOccludee.IsRegistered)
        {
            OcclusionCulling.UpdateDynamicOccludee(this.localOccludee.id, sphere.position, sphere.radius);
            this.localOccludee.sphere = sphere;
        }
        else
        {
            bool visible = true;
            if (Object.op_Inequality((Object)this.lodGroup, (Object)null))
            {
                visible = this.lodGroup.get_enabled();
            }
            this.RegisterForCulling(sphere, visible);
        }
    }
    public void UpdateCullingBounds()
    {
        Vector3 vector  = Vector3.zero;
        Vector3 vector2 = Vector3.zero;
        bool    flag    = false;
        int     num     = ((renderers != null) ? renderers.Count : 0);
        int     num2    = ((colliders != null) ? colliders.Count : 0);

        if (num > 0 && (num2 == 0 || num < num2))
        {
            for (int i = 0; i < renderers.Count; i++)
            {
                if (renderers[i].isVisible)
                {
                    Bounds  bounds = renderers[i].bounds;
                    Vector3 min    = bounds.min;
                    Vector3 max    = bounds.max;
                    if (!flag)
                    {
                        vector  = min;
                        vector2 = max;
                        flag    = true;
                        continue;
                    }
                    vector.x  = ((vector.x < min.x) ? vector.x : min.x);
                    vector.y  = ((vector.y < min.y) ? vector.y : min.y);
                    vector.z  = ((vector.z < min.z) ? vector.z : min.z);
                    vector2.x = ((vector2.x > max.x) ? vector2.x : max.x);
                    vector2.y = ((vector2.y > max.y) ? vector2.y : max.y);
                    vector2.z = ((vector2.z > max.z) ? vector2.z : max.z);
                }
            }
        }
        if (!flag && num2 > 0)
        {
            flag    = true;
            vector  = colliders[0].bounds.min;
            vector2 = colliders[0].bounds.max;
            for (int j = 1; j < colliders.Count; j++)
            {
                Bounds  bounds2 = colliders[j].bounds;
                Vector3 min2    = bounds2.min;
                Vector3 max2    = bounds2.max;
                vector.x  = ((vector.x < min2.x) ? vector.x : min2.x);
                vector.y  = ((vector.y < min2.y) ? vector.y : min2.y);
                vector.z  = ((vector.z < min2.z) ? vector.z : min2.z);
                vector2.x = ((vector2.x > max2.x) ? vector2.x : max2.x);
                vector2.y = ((vector2.y > max2.y) ? vector2.y : max2.y);
                vector2.z = ((vector2.z > max2.z) ? vector2.z : max2.z);
            }
        }
        if (!flag)
        {
            return;
        }
        Vector3 vector3  = vector2 - vector;
        Vector3 position = vector + vector3 * 0.5f;
        float   radius   = Mathf.Max(Mathf.Max(vector3.x, vector3.y), vector3.z) * 0.5f;

        OcclusionCulling.Sphere sphere = new OcclusionCulling.Sphere(position, radius);
        if (localOccludee.IsRegistered)
        {
            OcclusionCulling.UpdateDynamicOccludee(localOccludee.id, sphere.position, sphere.radius);
            localOccludee.sphere = sphere;
            return;
        }
        bool visible = true;

        if (lodGroup != null)
        {
            visible = lodGroup.enabled;
        }
        RegisterForCulling(sphere, visible);
    }
Exemple #24
0
    void SetBuildingVisibility(Block b, bool visible, float distance)
    {
        if (visible)
        {
            // building blocs
            if (visible && !b.building.visibleBuilding)
            {
                b.building.visibleBuilding = true;
                foreach (MeshRenderer mr in b.building.lodbuilding)
                {
                    mr.enabled = true;
                }
            }

            // pepole
            if (distance < personVisibilityRadius && !b.hasPersons)
            {
                b.hasPersons = true;
                b.building.GeneratePersons((b.building.sharedBuilding ? 2 * pedestrianDensity : pedestrianDensity));
            }
            else if (distance >= personVisibilityRadius && b.hasPersons)
            {
                b.hasPersons = false;
                foreach (GameObject pepole in b.building.persons)
                {
                    pepole.SetActive(false);
                }
                b.building.persons.Clear();
            }

            // windows
            if (b.building.lodwindow)
            {
                b.building.lodwindow.enabled = distance < windowVisibilityRadius && OcclusionCulling.IsVisibleAABB(b.building.lodwindow.bounds);
            }


            // laterals
            if (distance < lateralVisibilityRadius && !b.building.visibleLateral)
            {
                b.building.visibleLateral = true;
                foreach (LODProxy proxy in b.building.lodlateral)
                {
                    proxy.SetState(true);
                }
            }
            else if (distance >= lateralVisibilityRadius && b.building.visibleLateral)
            {
                b.building.visibleLateral = false;
                foreach (LODProxy proxy in b.building.lodlateral)
                {
                    proxy.SetState(false);
                }
            }

            // roof
            if (distance < roofVisibilityRadius && !b.building.visibleroof)
            {
                b.building.visibleroof = true;
                foreach (LODProxy proxy in b.building.lodroof)
                {
                    proxy.SetState(true);
                }
            }
            else if (distance >= roofVisibilityRadius && b.building.visibleroof)
            {
                b.building.visibleroof = false;
                foreach (LODProxy proxy in b.building.lodroof)
                {
                    proxy.SetState(false);
                }
            }

            // lights
            if (distance < lightsVisibilityRadius && !b.building.visiblelights)
            {
                b.building.visiblelights = true;
                foreach (LODProxy proxy in b.building.lodlight)
                {
                    proxy.SetState(true);
                }
            }
            else if (distance >= lightsVisibilityRadius && b.building.visiblelights)
            {
                b.building.visiblelights = false;
                foreach (LODProxy proxy in b.building.lodlight)
                {
                    proxy.SetState(false);
                }
            }
        }

        else
        {
            if (b.building)
            {
                if (b.hasPersons)
                {
                    b.hasPersons = false;
                    foreach (GameObject pepole in b.building.persons)
                    {
                        pepole.SetActive(false);
                    }
                    b.building.persons.Clear();
                }

                if (b.building.lodwindow)
                {
                    b.building.lodwindow.enabled = false;
                }
                foreach (LODProxy proxy in b.building.lodlateral)
                {
                    proxy.SetState(false);
                }
                foreach (LODProxy proxy in b.building.lodroof)
                {
                    proxy.SetState(false);
                }
                foreach (MeshRenderer mr in b.building.lodbuilding)
                {
                    mr.enabled = false;
                }
                foreach (LODProxy proxy in b.building.lodlight)
                {
                    proxy.SetState(false);
                }

                b.building.visibleroof     = false;
                b.building.visibleLateral  = false;
                b.building.visibleBuilding = false;
                b.building.visiblelights   = false;
            }
        }

        /*
         * if (b.building)
         * {
         *  b.building.visible = visible;
         * }*/
    }
    public void UpdateCullingBounds()
    {
        Vector3 vector3  = Vector3.zero;
        Vector3 vector31 = Vector3.zero;
        bool    flag     = false;
        int     num      = (this.renderers != null ? this.renderers.Count : 0);
        int     num1     = (this.colliders != null ? this.colliders.Count : 0);

        if (num > 0 && (num1 == 0 || num < num1))
        {
            for (int i = 0; i < this.renderers.Count; i++)
            {
                if (this.renderers[i].isVisible)
                {
                    Bounds  item     = this.renderers[i].bounds;
                    Vector3 vector32 = item.min;
                    Vector3 vector33 = item.max;
                    if (flag)
                    {
                        vector3.x  = (vector3.x < vector32.x ? vector3.x : vector32.x);
                        vector3.y  = (vector3.y < vector32.y ? vector3.y : vector32.y);
                        vector3.z  = (vector3.z < vector32.z ? vector3.z : vector32.z);
                        vector31.x = (vector31.x > vector33.x ? vector31.x : vector33.x);
                        vector31.y = (vector31.y > vector33.y ? vector31.y : vector33.y);
                        vector31.z = (vector31.z > vector33.z ? vector31.z : vector33.z);
                    }
                    else
                    {
                        vector3  = vector32;
                        vector31 = vector33;
                        flag     = true;
                    }
                }
            }
        }
        if (!flag && num1 > 0)
        {
            flag = true;
            Bounds bound = this.colliders[0].bounds;
            vector3  = bound.min;
            bound    = this.colliders[0].bounds;
            vector31 = bound.max;
            for (int j = 1; j < this.colliders.Count; j++)
            {
                Bounds  item1    = this.colliders[j].bounds;
                Vector3 vector34 = item1.min;
                Vector3 vector35 = item1.max;
                vector3.x  = (vector3.x < vector34.x ? vector3.x : vector34.x);
                vector3.y  = (vector3.y < vector34.y ? vector3.y : vector34.y);
                vector3.z  = (vector3.z < vector34.z ? vector3.z : vector34.z);
                vector31.x = (vector31.x > vector35.x ? vector31.x : vector35.x);
                vector31.y = (vector31.y > vector35.y ? vector31.y : vector35.y);
                vector31.z = (vector31.z > vector35.z ? vector31.z : vector35.z);
            }
        }
        if (flag)
        {
            Vector3 vector36 = vector31 - vector3;
            Vector3 vector37 = vector3 + (vector36 * 0.5f);
            float   single   = Mathf.Max(Mathf.Max(vector36.x, vector36.y), vector36.z) * 0.5f;
            OcclusionCulling.Sphere sphere = new OcclusionCulling.Sphere(vector37, single);
            if (this.localOccludee.IsRegistered)
            {
                OcclusionCulling.UpdateDynamicOccludee(this.localOccludee.id, sphere.position, sphere.radius);
                this.localOccludee.sphere = sphere;
                return;
            }
            bool flag1 = true;
            if (this.lodGroup != null)
            {
                flag1 = this.lodGroup.enabled;
            }
            this.RegisterForCulling(sphere, flag1);
        }
    }