コード例 #1
0
        void AddBounds(CachedShadowMapLight a_light)
        {
            var bounding_sphere = BoundsUtility.ComputeLightBoundingSphere(a_light: a_light);

            if (this._LightBoundingSpheres.ContainsKey(key: a_light.LightComponent))
            {
                this._LightBoundingSpheres[key : a_light.LightComponent] = bounding_sphere;
            }
            else
            {
                this._LightBoundingSpheres.Add(key: a_light.LightComponent, value: bounding_sphere);
            }

            var light_bounds = BoundsUtility.ComputeLightBounds(light: a_light);

            if (this._LightBounds.ContainsKey(key: a_light.LightComponent))
            {
                this._LightBounds[key : a_light.LightComponent] = light_bounds;
            }
            else
            {
                this._LightBounds.Add(key: a_light.LightComponent, value: light_bounds);
            }

            this.ReceiverCamera?.RefreshCullingGroup();
        }
コード例 #2
0
        void OnDrawGizmosSelected()
        {
            var sphere = BoundsUtility.ComputeLightBoundingSphere(a_light: this);

            Gizmos.color = Color.yellow;
            Gizmos.DrawWireSphere(center: sphere.position, radius: sphere.radius);
        }
コード例 #3
0
        float GetPivotOffset(GameObject go)
        {
            Bounds bounds = BoundsUtility.GetHierarchyBounds(go);

            // If size y = 0, there's likely no mesh renderers in the object.
            if (bounds.size.y == 0)
            {
                return(0f);
            }

            Vector3 pivotToBoundsCenter = (bounds.center - go.transform.position);
            Vector3 offset = pivotToBoundsCenter - bounds.extents;

            return(offset.y);
        }
コード例 #4
0
        /// <summary>
        /// Tests if go intersects with any painted objects.
        /// </summary>
        /// <param name="go"></param>
        /// <returns></returns>
        bool TestIntersection(GameObject go)
        {
            BoundsUtility.SphereBounds bounds, it_bounds;

            if (!BoundsUtility.GetSphereBounds(go, out bounds))
            {
                return(false);
            }

            int c = m_PrefabsInstances == null ? 0 : m_PrefabsInstances.Count;

            for (int i = 0; i < c; i++)
            {
                if (BoundsUtility.GetSphereBounds(m_PrefabsInstances[i], out it_bounds) && bounds.Intersects(it_bounds))
                {
                    return(true);
                }
            }

            return(false);
        }