Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Frustum(FrustumSettings frustumSettings, Camera camera, AuraCamera auraComponent)
        {
            _frustumSettings = frustumSettings;
            _frustumSettings.OnFrustumQualityChanged += _frustumSettings_OnFrustumQualityChanged;

            _cameraComponent     = camera;
            _auraComponent       = auraComponent;
            _volumesManager      = new VolumesManager(_cameraComponent, _frustumSettings);
            _spotLightsManager   = new SpotLightsManager(_cameraComponent, _frustumSettings);
            _pointLightsManager  = new PointLightsManager(_cameraComponent, _frustumSettings);
            _frustumSettingsToId = new FrustumSettingsToId(_frustumSettings, _auraComponent, _volumesManager, _spotLightsManager, _pointLightsManager);

            InitializeResources();

            _computeDataComputeShader.GetKernelThreadGroupSizes(0, out _threadSizeX, out _threadSizeY, out _threadSizeZ);

            SetFrustumGridResolution(_frustumSettings.QualitySettings.frustumGridResolution);

            _previousOcclusionCullingState = _frustumSettingsToId.HasFlags(FrustumParameters.EnableOcclusionCulling);
            _previousLightProbesState      = _frustumSettingsToId.HasFlags(FrustumParameters.EnableLightProbes);

            _cameraRanges = new Vector4();
            _zParameters  = new Vector4();
            _frustumCornersWorldPositionArray          = new float[32];
            _secondaryFrustumCornersWorldPositionArray = new float[32];
            _previousWorldToClipMatrix                = new Matrix4x4();
            _previousWorldToClipMatrixFloats          = new float[16];
            _previousSecondaryWorldToClipMatrix       = new Matrix4x4();
            _previousSecondaryWorldToClipMatrixFloats = new float[16];
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Frustum(FrustumSettings frustumSettings, Camera camera, AuraCamera auraComponent)
        {
            _frustumSettings = frustumSettings;
            _frustumSettings.OnFrustumQualityChanged += _frustumSettings_OnFrustumQualityChanged;

            _cameraComponent     = camera;
            _auraComponent       = auraComponent;
            _volumesManager      = new VolumesManager(_cameraComponent, _frustumSettings);
            _spotLightsManager   = new SpotLightsManager(_cameraComponent, _frustumSettings);
            _pointLightsManager  = new PointLightsManager(_cameraComponent, _frustumSettings);
            _frustumSettingsToId = new FrustumSettingsToId(_frustumSettings, _auraComponent, _volumesManager, _spotLightsManager, _pointLightsManager);

            InitializeResources();

            _computeDataComputeShader.GetKernelThreadGroupSizes(0, out _threadSizeX, out _threadSizeY, out _threadSizeZ);

            SetFrustumGridResolution(_frustumSettings.QualitySettings.frustumGridResolution);

            _previousOcclusionCullingState = _frustumSettingsToId.HasFlags(FrustumParameters.EnableOcclusionCulling);
            _previousLightProbesState      = _frustumSettingsToId.HasFlags(FrustumParameters.EnableLightProbes);
        }