Example #1
0
        public bool ForRangeInteresectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator, ObstacleOcclusionCalculationManagerV2 ObstacleOcclusionCalculationManagerV2,
                                                    out IsOccludedByObstacleJobData IsOccludedByObstacleJobData)
        {
            int ObstacleFrustumPointsPositionsBeginIndex = currentObstacleFrustumPointsCounter;
            var associatedObstacleListener = rangeIntersectionCalculator.GetAssociatedObstacleListener();

            if (associatedObstacleListener != null)
            {
                //obstacle listener may never have triggered calculation
                ObstacleOcclusionCalculationManagerV2.TryGetCalculatedOcclusionFrustumsForObstacleListener(associatedObstacleListener, out Dictionary <int, List <FrustumPointsPositions> > calculatedFrustumPositions);
                if (calculatedFrustumPositions != null)
                {
                    foreach (var calculatedObstacleFrustumList in calculatedFrustumPositions.Values)
                    {
                        foreach (var calculatedObstacleFrustum in calculatedObstacleFrustumList)
                        {
                            this.AssociatedObstacleFrustumPointsPositions[currentObstacleFrustumPointsCounter] = calculatedObstacleFrustum;
                            currentObstacleFrustumPointsCounter += 1;
                        }
                    }
                }

                IsOccludedByObstacleJobData = new IsOccludedByObstacleJobData
                {
                    TestedBoxCollider = new BoxDefinition(rangeIntersectionCalculator.TrackedInteractiveObject.InteractiveGameObject.GetLogicColliderAsBox()),
                    ObstacleFrustumPointsPositionsBeginIndex = ObstacleFrustumPointsPositionsBeginIndex,
                    ObstacleFrustumPointsPositionsEndIndex   = currentObstacleFrustumPointsCounter
                };
                return(true);
            }

            IsOccludedByObstacleJobData = default;
            return(false);
        }
Example #2
0
 public void CalculationDataSetupForRangeIntersectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator,
                                                                IsOccludedByObstacleJobData IsOccludedByObstacleJobData, int currentObstacleIntersectionCalculatorCounter)
 {
     if (rangeIntersectionCalculator.GetAssociatedRangeObjectType() == RangeType.SPHERE)
     {
         var SphereRangeObject         = (SphereRangeObjectV2)rangeIntersectionCalculator.GetAssociatedRangeObject();
         var SphereIntersectionJobData = new SphereIntersectionJobData
         {
             RangeIntersectionCalculatorV2UniqueID = rangeIntersectionCalculator.RangeIntersectionCalculatorV2UniqueID,
             RangeTransform = SphereRangeObject.GetTransform(),
             IsOccludedByObstacleJobData  = IsOccludedByObstacleJobData,
             ComparedCollider             = rangeIntersectionCalculator.TrackedInteractiveObject.InteractiveGameObject.GetLogicColliderBoxDefinition(),
             ObstacleCalculationDataIndex = SphereRangeObject.GetObstacleListener() == null ? -1 : (currentObstacleIntersectionCalculatorCounter - 1),
             SphereRadius = SphereRangeObject.SphereBoundingCollider.radius
         };
         this.SphereIntersectionJobData[this.currentSphereIntersectionJobdataCounter] = SphereIntersectionJobData;
         this.currentSphereIntersectionJobdataCounter += 1;
     }
 }
Example #3
0
 public void CalculationDataSetupForRangeIntersectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator,
                                                                IsOccludedByObstacleJobData IsOccludedByObstacleJobData, int currentObstacleIntersectionCalculatorCounter)
 {
     if (rangeIntersectionCalculator.GetAssociatedRangeObjectType() == RangeType.ROUNDED_FRUSTUM)
     {
         var RoundedFrustumRangeObject         = (RoundedFrustumRangeObjectV2)rangeIntersectionCalculator.GetAssociatedRangeObject();
         var RoundedFrustumIntersectionJobData = new RoundedFrustumIntersectionJobData
         {
             RangeIntersectionCalculatorV2UniqueID = rangeIntersectionCalculator.RangeIntersectionCalculatorV2UniqueID,
             FrustumRadius  = RoundedFrustumRangeObject.GetFrustum().GetFrustumFaceRadius(),
             RangeTransform = RoundedFrustumRangeObject.GetTransform(),
             IsOccludedByObstacleJobData  = IsOccludedByObstacleJobData,
             RoundedFrustumPositions      = RoundedFrustumRangeObject.GetFrustumWorldPositions(),
             ComparedCollider             = rangeIntersectionCalculator.TrackedInteractiveObject.InteractiveGameObject.GetLogicColliderBoxDefinition(),
             ObstacleCalculationDataIndex = RoundedFrustumRangeObject.GetObstacleListener() == null ? -1 : (currentObstacleIntersectionCalculatorCounter - 1)
         };
         this.RoundedFrustumIntersectionJobData[currentRoundedFrustumIntersectionJobDataCounter] = RoundedFrustumIntersectionJobData;
         currentRoundedFrustumIntersectionJobDataCounter += 1;
     }
 }
Example #4
0
        // Try to get all occlusion frustums fro mthe obstacle listener and push them in the AssociatedObstacleFrustumPointsPositions.
        // Returns the index range of insertion of AssociatedObstacleFrustumPointsPositions.
        public bool ForRangeInteresectionCalculator(RangeIntersectionCalculator rangeIntersectionCalculator, ObstacleOcclusionCalculationManagerV2 ObstacleOcclusionCalculationManagerV2,
                                                    out IsOccludedByObstacleJobData IsOccludedByObstacleJobData)
        {
            int ObstacleFrustumPointsPositionsBeginIndex = currentObstacleFrustumPointsCounter;
            var associatedObstacleListener = rangeIntersectionCalculator.GetAssociatedObstacleListener();

            if (associatedObstacleListener != null)
            {
                //obstacle listener may never have triggered calculation
                ObstacleOcclusionCalculationManagerV2.TryGetCalculatedOcclusionFrustumsForObstacleListener(associatedObstacleListener, out Dictionary <int, List <FrustumPointsPositions> > calculatedFrustumPositions);
                if (calculatedFrustumPositions != null)
                {
                    var calculatedFrustumPositionsEnumerator = calculatedFrustumPositions.Values.GetEnumerator();
                    while (calculatedFrustumPositionsEnumerator.MoveNext())
                    {
                        var calculatedObstacleFrustumList = calculatedFrustumPositionsEnumerator.Current;

                        for (int calculatedObstacleFrustumIndex = 0; calculatedObstacleFrustumIndex < calculatedObstacleFrustumList.Count; calculatedObstacleFrustumIndex++)
                        {
                            this.AssociatedObstacleFrustumPointsPositions[currentObstacleFrustumPointsCounter] = calculatedObstacleFrustumList[calculatedObstacleFrustumIndex];
                            currentObstacleFrustumPointsCounter += 1;
                        }
                    }
                }

                IsOccludedByObstacleJobData = new IsOccludedByObstacleJobData
                {
                    ObstacleFrustumPointsPositionsBeginIndex = ObstacleFrustumPointsPositionsBeginIndex,
                    ObstacleFrustumPointsPositionsEndIndex   = currentObstacleFrustumPointsCounter
                };
                return(true);
            }

            IsOccludedByObstacleJobData = default;
            return(false);
        }