Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
 /// </summary>
 /// <param name="root">The control to render.</param>
 /// <param name="renderTarget">The render target.</param>
 /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
 /// <remarks>
 /// This constructor is intended to be used for unit testing.
 /// </remarks>
 public DeferredRenderer(
     IVisual root,
     IRenderTarget renderTarget,
     ISceneBuilder?sceneBuilder = null) : base(true)
 {
     _root         = root ?? throw new ArgumentNullException(nameof(root));
     RenderTarget  = renderTarget ?? throw new ArgumentNullException(nameof(renderTarget));
     _sceneBuilder = sceneBuilder ?? new SceneBuilder();
     Layers        = new RenderLayers();
     _lock         = new ManagedDeferredRendererLock();
     _updateSceneIfNeededDelegate = UpdateSceneIfNeeded;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
        /// </summary>
        /// <param name="root">The control to render.</param>
        /// <param name="renderTarget">The render target.</param>
        /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
        /// <remarks>
        /// This constructor is intended to be used for unit testing.
        /// </remarks>
        public DeferredRenderer(
            IVisual root,
            IRenderTarget renderTarget,
            ISceneBuilder sceneBuilder = null)
        {
            Contract.Requires <ArgumentNullException>(root != null);
            Contract.Requires <ArgumentNullException>(renderTarget != null);

            _root         = root;
            RenderTarget  = renderTarget;
            _sceneBuilder = sceneBuilder ?? new SceneBuilder();
            Layers        = new RenderLayers();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
        /// </summary>
        /// <param name="root">The control to render.</param>
        /// <param name="renderLoop">The render loop.</param>
        /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
        /// <param name="dispatcher">The dispatcher to use. Optional.</param>
        public DeferredRenderer(
            IRenderRoot root,
            IRenderLoop renderLoop,
            ISceneBuilder sceneBuilder = null,
            IDispatcher dispatcher     = null)
        {
            Contract.Requires <ArgumentNullException>(root != null);

            _dispatcher   = dispatcher ?? Dispatcher.UIThread;
            _root         = root;
            _sceneBuilder = sceneBuilder ?? new SceneBuilder();
            Layers        = new RenderLayers();
            _renderLoop   = renderLoop;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
        /// </summary>
        /// <param name="root">The control to render.</param>
        /// <param name="renderTarget">The render target.</param>
        /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
        /// <param name="layerFactory">The layer factory to use. Optional.</param>
        /// <remarks>
        /// This constructor is intended to be used for unit testing.
        /// </remarks>
        public DeferredRenderer(
            IVisual root,
            IRenderTarget renderTarget,
            ISceneBuilder sceneBuilder       = null,
            IRenderLayerFactory layerFactory = null)
        {
            Contract.Requires <ArgumentNullException>(root != null);
            Contract.Requires <ArgumentNullException>(renderTarget != null);

            _root         = root;
            _renderTarget = renderTarget;
            _sceneBuilder = sceneBuilder ?? new SceneBuilder();
            _layerFactory = layerFactory ?? new DefaultRenderLayerFactory();
            _layers       = new RenderLayers(_layerFactory);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
        /// </summary>
        /// <param name="root">The control to render.</param>
        /// <param name="renderTarget">The render target.</param>
        /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
        /// <remarks>
        /// This constructor is intended to be used for unit testing.
        /// </remarks>
        public DeferredRenderer(
            IVisual root,
            IRenderTarget renderTarget,
            ISceneBuilder sceneBuilder = null) : base(true)
        {
            Contract.Requires <ArgumentNullException>(root != null);
            Contract.Requires <ArgumentNullException>(renderTarget != null);

            _root         = root;
            RenderTarget  = renderTarget;
            _sceneBuilder = sceneBuilder ?? new SceneBuilder();
            Layers        = new RenderLayers();
            _lock         = new ManagedDeferredRendererLock();
            _updateSceneIfNeededDelegate = UpdateSceneIfNeeded;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
 /// </summary>
 /// <param name="root">The control to render.</param>
 /// <param name="renderLoop">The render loop.</param>
 /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
 /// <param name="dispatcher">The dispatcher to use. Optional.</param>
 /// <param name="rendererLock">Lock object used before trying to access render target</param>
 public DeferredRenderer(
     IRenderRoot root,
     IRenderLoop renderLoop,
     ISceneBuilder?sceneBuilder         = null,
     IDispatcher?dispatcher             = null,
     IDeferredRendererLock?rendererLock = null) : base(true)
 {
     _dispatcher   = dispatcher ?? Dispatcher.UIThread;
     _root         = root ?? throw new ArgumentNullException(nameof(root));
     _sceneBuilder = sceneBuilder ?? new SceneBuilder();
     Layers        = new RenderLayers();
     _renderLoop   = renderLoop;
     _lock         = rendererLock ?? new ManagedDeferredRendererLock();
     _updateSceneIfNeededDelegate = UpdateSceneIfNeeded;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeferredRenderer"/> class.
        /// </summary>
        /// <param name="root">The control to render.</param>
        /// <param name="renderLoop">The render loop.</param>
        /// <param name="sceneBuilder">The scene builder to use. Optional.</param>
        /// <param name="dispatcher">The dispatcher to use. Optional.</param>
        /// <param name="rendererLock">Lock object used before trying to access render target</param>
        public DeferredRenderer(
            IRenderRoot root,
            IRenderLoop renderLoop,
            ISceneBuilder sceneBuilder         = null,
            IDispatcher dispatcher             = null,
            IDeferredRendererLock rendererLock = null) : base(true)
        {
            Contract.Requires <ArgumentNullException>(root != null);

            _dispatcher   = dispatcher ?? Dispatcher.UIThread;
            _root         = root;
            _sceneBuilder = sceneBuilder ?? new SceneBuilder();
            Layers        = new RenderLayers();
            _renderLoop   = renderLoop;
            _lock         = rendererLock ?? new ManagedDeferredRendererLock();
            _updateSceneIfNeededDelegate = UpdateSceneIfNeeded;
        }