コード例 #1
0
        ///<summary>
        ///    Set the state of a compositor on a viewport to enabled or disabled.
        ///    Disabling a compositor stops it from rendering but does not free any resources.
        ///    This can be more efficient than using removeCompositor and addCompositor in cases
        ///    the filter is switched on and off a lot.
        ///</summary>
        public void SetCompositorEnabled(Viewport vp, string compositor, bool value)
        {
            CompositorChain chain = GetCompositorChain(vp);

            for (int i = 0; i < chain.Instances.Count; i++)
            {
                CompositorInstance instance = chain.GetCompositor(i);
                if (instance.Compositor.Name == compositor)
                {
                    chain.SetCompositorEnabled(i, value);
                    break;
                }
            }
        }
コード例 #2
0
        ///<summary>
        ///    Remove a compositor from a viewport
        ///</summary>
        public void RemoveCompositor(Viewport vp, string compositor)
        {
            CompositorChain chain = GetCompositorChain(vp);

            for (int i = 0; i < chain.Instances.Count; i++)
            {
                CompositorInstance instance = chain.GetCompositor(i);
                if (instance.Compositor.Name == compositor)
                {
                    chain.RemoveCompositor(i);
                    break;
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// another overload to remove a compositor instance from its chain
        /// </summary>
        /// <param name="remInstance"></param>
        public void RemoveCompositor(CompositorInstance remInstance)
        {
            CompositorChain chain = remInstance.Chain;

            for (int i = 0; i < chain.Instances.Count; i++)
            {
                CompositorInstance instance = chain.GetCompositor(i);
                if (instance == remInstance)
                {
                    chain.RemoveCompositor(i);
                    break;
                }
            }
        }