private void OnEnable()
    {
        HandlePPPositionRequest += ProviderPPPosition;

        // Initialize members.
        mMainCamera = gameObject.GetComponent <Camera>();

        if (mMainCamera == null)
        {
            throw new Exception("FovSystemManager require Camera component to operate.");
        }

        ValidateMainCamera(mMainCamera, renderSettings);

        if (mOcclusionRenderer == null)
        {
            mOcclusionRenderer = OcclusionMaskRenderer.InitializeMaskRenderer(gameObject, renderSettings.occlusionLayers, materialContainer.OcclusionMaskShader);
        }

        if (mLightMaskRenderer == null)
        {
            mLightMaskRenderer = LightMaskRenderer.InitializeMaskRenderer(gameObject);
        }

        if (mBackgroundRenderer == null)
        {
            mBackgroundRenderer = BackgroundRenderer.InitializeMaskRenderer(gameObject);
        }

        if (mPostProcessingStack == null)
        {
            mPostProcessingStack = new PostProcessingStack(materialContainer);
        }
    }
Exemple #2
0
    private void OnEnable()
    {
        Logger.Log("Lighting system enabled.", Category.Lighting);
        //don't run lighting system on headless
        if (GameData.IsHeadlessServer)
        {
            return;
        }

        OnLightingSystemEnabled?.Invoke(true);

        if (!SystemInfo.supportsAsyncGPUReadback)
        {
            Logger.LogWarning("LightingSystem: Async GPU Readback not supported on this machine, slower synchronous readback will" +
                              " be used instead.", Category.Lighting);
        }
        HandlePPPositionRequest += ProviderPPPosition;

        // Initialize members.
        mMainCamera = gameObject.GetComponent <Camera>();

        if (mMainCamera == null)
        {
            throw new Exception("FovSystemManager require Camera component to operate.");
        }

        // Let's force camera to cull background light
        mMainCamera.cullingMask &= ~renderSettings.backgroundLayers;
        // Now validate other settings
        ValidateMainCamera(mMainCamera, renderSettings);

        if (mOcclusionRenderer == null)
        {
            mOcclusionRenderer = OcclusionMaskRenderer.InitializeMaskRenderer(gameObject, renderSettings.occlusionLayers, materialContainer.OcclusionMaskShader);
        }

        if (mLightMaskRenderer == null)
        {
            mLightMaskRenderer = LightMaskRenderer.InitializeMaskRenderer(gameObject);
        }

        if (mBackgroundRenderer == null)
        {
            mBackgroundRenderer = BackgroundRenderer.InitializeMaskRenderer(gameObject);
        }

        if (mPostProcessingStack == null)
        {
            mPostProcessingStack = new PostProcessingStack(materialContainer);
        }

        if (!renderSettings.disableAsyncGPUReadback && SystemInfo.supportsAsyncGPUReadback)
        {
            mTextureDataRequest = new TextureDataRequest();
        }

        operationParameters = new OperationParameters(mMainCamera, renderSettings, matrixRotationMode);;

        ResolveRenderingTextures(operationParameters);
    }
Exemple #3
0
    private void OnEnable()
    {
        //don't run lighting system on headless
        if (GameData.IsHeadlessServer)
        {
            return;
        }

        if (!SystemInfo.supportsAsyncGPUReadback)
        {
            UnityEngine.Debug.LogWarning("LightingSystem: Async GPU Readback not supported on this machine, slower synchronous readback will" +
                                         " be used instead.");
        }
        HandlePPPositionRequest += ProviderPPPosition;

        // Initialize members.
        mMainCamera = gameObject.GetComponent <Camera>();

        if (mMainCamera == null)
        {
            throw new Exception("FovSystemManager require Camera component to operate.");
        }

        ValidateMainCamera(mMainCamera, renderSettings);

        if (mOcclusionRenderer == null)
        {
            mOcclusionRenderer = OcclusionMaskRenderer.InitializeMaskRenderer(gameObject, renderSettings.occlusionLayers, materialContainer.OcclusionMaskShader);
        }

        if (mLightMaskRenderer == null)
        {
            mLightMaskRenderer = LightMaskRenderer.InitializeMaskRenderer(gameObject);
        }

        if (mBackgroundRenderer == null)
        {
            mBackgroundRenderer = BackgroundRenderer.InitializeMaskRenderer(gameObject);
        }

        if (mPostProcessingStack == null)
        {
            mPostProcessingStack = new PostProcessingStack(materialContainer);
        }
    }