Пример #1
0
 public RetroLooksContext Reset()
 {
     profile              = null;
     camera               = null;
     materialFactory      = null;
     renderTextureFactory = null;
     interrupted          = false;
     return(this);
 }
        void OnPreCull()
        {
            // All the per-frame initialization logic has to be done in OnPreCull instead of Update
            // because [ImageEffectAllowedInSceneView] doesn't trigger Update events...

            m_Camera = GetComponent <Camera>();

            if (profile == null || m_Camera == null)
            {
                return;
            }

#if UNITY_EDITOR
            // Track the scene view camera to disable some effects we don't want to see in the
            // scene view
            // Currently disabled effects :
            //  - Temporal Antialiasing
            //  - Depth of Field
            //  - Motion blur
            m_RenderingInSceneView = UnityEditor.SceneView.currentDrawingSceneView != null &&
                                     UnityEditor.SceneView.currentDrawingSceneView.camera == m_Camera;
#endif

            // Prepare context
            var context = m_Context.Reset();
            context.profile = profile;
            context.renderTextureFactory = m_RenderTextureFactory;
            context.materialFactory      = m_MaterialFactory;
            context.camera = m_Camera;

            // Prepare components
            m_RetroBloom.Init(context, profile.retroBloom);

            // Handles profile change and 'enable' state observers
            if (m_PreviousProfile != profile)
            {
                DisableComponents();
                m_PreviousProfile = profile;
            }

            CheckObservers();

            // Find out which camera flags are needed before rendering begins
            // Note that motion vectors will only be available one frame after being enabled
            var flags = DepthTextureMode.None;
            foreach (var component in m_Components)
            {
                if (component.active)
                {
                    flags |= component.GetCameraFlags();
                }
            }

            context.camera.depthTextureMode = flags;
        }
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            RetroLooksProfile profile = RetroLooksFactory.CreateRetroLooksProfileAtPath(pathName);

            ProjectWindowUtil.ShowCreatedAsset(profile);
        }