Ejemplo n.º 1
0
 public virtual void IsLitByLightSource(List <PointLight> LightList)
 {
     m_lightVisibilityMap.Init(LightList.Count, false);
     for (Int32 i = 0; i < LightList.Count; i++)
     {
         BoundBase bound       = GetAABBFromAllChildComponents();
         FSphere   boundSphere = (FSphere)bound;
         FSphere   lightSphere = new FSphere(LightList[i].Position.Xyz, LightList[i].AttenuationRadius);
         m_lightVisibilityMap[i] = GeometryMath.IsSphereVsSphereIntersection(ref boundSphere, ref lightSphere);
     }
 }
Ejemplo n.º 2
0
        private void CheckRegularBoundingBoxAndCameraSphereCollision(ref bool bSphereAndFrameBoundingBoxCollision,
                                                                     ref List <BoundBase> collidedRootBounds, ref FSphere cameraCollisionSphere)
        {
            foreach (var testingBound in collidedRootBounds)
            {
                FSphere obbCollisionSphere = (FSphere)testingBound;

                if (GeometryMath.IsSphereVsSphereIntersection(ref cameraCollisionSphere, ref obbCollisionSphere))
                {
                    bSphereAndFrameBoundingBoxCollision = true;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        // CAMERA

        private List <BoundBase> GetBoundingBoxesForCameraCollisionTest(ref FSphere cameraCollisionSphere, Component characterRootComponent)
        {
            List <BoundBase> resultCollidedRootBounds = new List <BoundBase>();

            foreach (var unit in CollisionUnits)
            {
                if (unit.RootComponent == characterRootComponent)
                {
                    continue;
                }

                FSphere aabbCollisionSphere = (FSphere)(unit.GetAndTryUpdateFramingBoundingBox());
                if (GeometryMath.IsSphereVsSphereIntersection(ref cameraCollisionSphere, ref aabbCollisionSphere))
                {
                    resultCollidedRootBounds.AddRange(unit.GetBoundingBoxes());
                }
            }

            return(resultCollidedRootBounds);
        }