Пример #1
0
        public FrustumRangeBufferData ToFrustumBuffer()
        {
            var FrustumRangeBufferData      = new FrustumRangeBufferData();
            var frustumPointsLocalPositions = FrustumRangeObjectRenderingDataprovider.GetFrustumWorldPosition();

            FrustumRangeBufferData.FC1 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC1);
            FrustumRangeBufferData.FC2 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC2);
            FrustumRangeBufferData.FC3 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC3);
            FrustumRangeBufferData.FC4 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC4);
            FrustumRangeBufferData.FC5 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC5);
            FrustumRangeBufferData.FC6 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC6);
            FrustumRangeBufferData.FC7 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC7);
            FrustumRangeBufferData.FC8 = FrustumRangeObjectRenderingDataprovider.BoundingCollider.transform.TransformPoint(frustumPointsLocalPositions.FC8);

            if (rangeTypeInherentConfigurationData.RangeColorProvider != null)
            {
                FrustumRangeBufferData.AuraColor = rangeTypeInherentConfigurationData.RangeColorProvider.Invoke();
            }
            else
            {
                FrustumRangeBufferData.AuraColor = rangeTypeInherentConfigurationData.RangeBaseColor;
            }

            if (rangeObjectRenderingDataProvider.IsTakingObstacleIntoConsideration())
            {
                FrustumRangeBufferData.OccludedByFrustums = 1;
            }
            else
            {
                FrustumRangeBufferData.OccludedByFrustums = 0;
            }

            return(FrustumRangeBufferData);
        }
Пример #2
0
        public RoundedFrustumRangeBufferData ToFrustumBuffer()
        {
            var RoundedFrustumRangeBufferData = new RoundedFrustumRangeBufferData();

            var frustumPointsWorldPositions = RoundedFrustumRangeObjectRenderingDataProvider.GetFrustumWorldPosition();

            RoundedFrustumRangeBufferData.FC1     = frustumPointsWorldPositions.FC1;
            RoundedFrustumRangeBufferData.FC2     = frustumPointsWorldPositions.FC2;
            RoundedFrustumRangeBufferData.FC3     = frustumPointsWorldPositions.FC3;
            RoundedFrustumRangeBufferData.FC4     = frustumPointsWorldPositions.FC4;
            RoundedFrustumRangeBufferData.FC5     = frustumPointsWorldPositions.FC5;
            RoundedFrustumRangeBufferData.normal1 = frustumPointsWorldPositions.normal1;
            RoundedFrustumRangeBufferData.normal2 = frustumPointsWorldPositions.normal2;
            RoundedFrustumRangeBufferData.normal3 = frustumPointsWorldPositions.normal3;
            RoundedFrustumRangeBufferData.normal4 = frustumPointsWorldPositions.normal4;
            RoundedFrustumRangeBufferData.normal5 = frustumPointsWorldPositions.normal5;
            RoundedFrustumRangeBufferData.normal6 = frustumPointsWorldPositions.normal6;


            RoundedFrustumRangeBufferData.BoundingBoxMax = RoundedFrustumRangeObjectRenderingDataProvider.BoundingCollider.bounds.max;
            RoundedFrustumRangeBufferData.BoundingBoxMin = RoundedFrustumRangeObjectRenderingDataProvider.BoundingCollider.bounds.min;

            RoundedFrustumRangeBufferData.RangeRadius         = RoundedFrustumRangeObjectRenderingDataProvider.Frustum.GetFrustumFaceRadius();
            RoundedFrustumRangeBufferData.CenterWorldPosition = RoundedFrustumRangeObjectRenderingDataProvider.BoundingCollider.transform.position;

            if (rangeTypeInherentConfigurationData.RangeColorProvider != null)
            {
                RoundedFrustumRangeBufferData.AuraColor = rangeTypeInherentConfigurationData.RangeColorProvider.Invoke();
            }
            else
            {
                RoundedFrustumRangeBufferData.AuraColor = rangeTypeInherentConfigurationData.RangeBaseColor;
            }

            if (RoundedFrustumRangeObjectRenderingDataProvider.IsTakingObstacleIntoConsideration())
            {
                RoundedFrustumRangeBufferData.OccludedByFrustums = 1;
            }
            else
            {
                RoundedFrustumRangeBufferData.OccludedByFrustums = 0;
            }

            return(RoundedFrustumRangeBufferData);
        }