Exemple #1
0
 public TestServices(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     KeyboardNavigation    = keyboardNavigation;
     MouseDevice           = mouseDevice;
     Platform              = platform;
     RenderInterface       = renderInterface;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl         = windowImpl;
     WindowingPlatform  = windowingPlatform;
 }
Exemple #2
0
 public TestServices With(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                keyboardNavigation: keyboardNavigation ?? KeyboardNavigation,
                mouseDevice: mouseDevice ?? MouseDevice,
                platform: platform ?? Platform,
                renderInterface: renderInterface ?? RenderInterface,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform,
                windowImpl: windowImpl ?? WindowImpl));
 }
Exemple #3
0
 public TestServices With(
     IAssetLoader assetLoader              = null,
     IFocusManager focusManager            = null,
     IInputManager inputManager            = null,
     Func <IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager          = null,
     IRuntimePlatform platform             = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                layoutManager: layoutManager ?? LayoutManager,
                platform: platform ?? Platform,
                renderer: renderer ?? Renderer,
                renderInterface: renderInterface ?? RenderInterface,
                renderLoop: renderLoop ?? RenderLoop,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform));
 }
Exemple #4
0
 public TestServices(
     IAssetLoader assetLoader              = null,
     IFocusManager focusManager            = null,
     IInputManager inputManager            = null,
     Func <IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager          = null,
     IRuntimePlatform platform             = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowingPlatform windowingPlatform           = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     LayoutManager         = layoutManager;
     Platform              = platform;
     Renderer              = renderer;
     RenderInterface       = renderInterface;
     RenderLoop            = renderLoop;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowingPlatform  = windowingPlatform;
 }
 public TestServices(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IRuntimePlatform platform = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader = assetLoader;
     FocusManager = focusManager;
     InputManager = inputManager;
     KeyboardDevice = keyboardDevice;
     LayoutManager = layoutManager;
     Platform = platform;
     Renderer = renderer;
     RenderInterface = renderInterface;
     RenderLoop = renderLoop;
     StandardCursorFactory = standardCursorFactory;
     Styler = styler;
     Theme = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl = windowImpl;
     WindowingPlatform = windowingPlatform;
 }
Exemple #6
0
        protected override void UpdateOverride(IRenderLoop renderLoop, IRenderContext context)
        {
            mKernel.Phase += 0.01f;
            mKernel.Execute();

            context.Blit(mKernel.OutputMemory);
        }
Exemple #7
0
        public Renderer(IRenderRoot root, IRenderLoop renderLoop)
        {
            Contract.Requires<ArgumentNullException>(root != null);

            _root = root;
            _renderLoop = renderLoop;
            _renderLoop.Tick += OnRenderLoopTick;
        }
Exemple #8
0
        public Renderer(IRenderRoot root, IRenderLoop renderLoop)
        {
            Contract.Requires <ArgumentNullException>(root != null);

            _root             = root;
            _renderLoop       = renderLoop;
            _renderLoop.Tick += OnRenderLoopTick;
        }
Exemple #9
0
        public void Update(IRenderLoop renderLoop)
        {
            if (renderLoop == null)
            {
                throw new ArgumentNullException(nameof(renderLoop));
            }

            UpdateOverride(renderLoop, mContext);
        }
Exemple #10
0
        public Grid(Camera camera, IRenderLoop renderLoop, LineRenderer gridRenderer)
        {
            _camera       = camera;
            _renderLoop   = renderLoop;
            _gridRenderer = gridRenderer;

            _gridGenerator = new GridGenerator(200, 1, _camera);
            _gridRenderer.SetData(_gridGenerator.GetVertices(), _gridGenerator.GetIndices());
            _gridRenderer.LineWidth = RenderConstants.GRID_SIZE;
            Initialize();
        }
Exemple #11
0
 void InitializeMonoMac()
 {
     if (s_monoMacInitialized)
     {
         return;
     }
     NSApplication.Init();
     ThreadHelper.InitializeCocoaThreadingLocks();
     App = NSApplication.SharedApplication;
     UpdateActivationPolicy();
     s_renderLoop         = new RenderLoop(); //TODO: use CVDisplayLink
     s_monoMacInitialized = true;
 }
Exemple #12
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;
        }
Exemple #13
0
        public PlotSampleView()
        {
            renderLoop = AvaloniaLocator.Current.GetService <IRenderLoop>();
            this.WhenActivated(disposables =>
            {
                SafeViewModel(vm =>
                {
                    stopWatchRenderLoopTask = new StopWatchRenderLoopTask().DisposeWith(disposables);
                    renderLoop.Add(stopWatchRenderLoopTask);
                    Disposable.Create(() => renderLoop.Remove(stopWatchRenderLoopTask)).DisposeWith(disposables);

                    this.WhenAnyValue(x => x.ViewModel.IsPlotEnable)
                    .Subscribe(x =>
                    {
                        if (x)// plot enable, start monitor ui update time
                        {
                            plotEnableDisposables = new CompositeDisposable().DisposeWith(disposables);

                            this.WhenAnyValue(x => x.stopWatchRenderLoopTask.UiUpdateElapsedMilliseconds)
                            .ObserveOn(RxApp.MainThreadScheduler)
                            .Subscribe(_ =>
                            {
#if DEBUG
                                try
                                {
                                    FpsBlock.Text = (1000 / vm.InvalidatePlotPostedElapsedMilliseconds).ToString("D2");
                                }
                                catch (DivideByZeroException) { }
                                catch (Exception) { throw; }
#endif
                                //Set MinPlotUpdateInterval higher if ui take long time to update
                                vm.MinPlotUpdateIntervalMilliseconds = (int)(
                                    stopWatchRenderLoopTask.UiUpdateElapsedMilliseconds +
                                    (stopWatchRenderLoopTask.UiUpdateElapsedMilliseconds - vm.InvalidatePlotPostedElapsedMilliseconds) * 0.5);
                            })
                            .DisposeWith(plotEnableDisposables);

                            stopWatchRenderLoopTask.NeedsUpdate = true;
                        }
                        else
                        {
                            // plot disable, stop monitor ui update time
                            stopWatchRenderLoopTask.NeedsUpdate = false;
                            plotEnableDisposables?.Dispose();
                        }
                    }).DisposeWith(disposables);
                });
            });
            InitializeComponent();
        }
Exemple #14
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;
 }
Exemple #15
0
        public void Update(IRenderLoop renderLoop)
        {
            UpdateOverride(renderLoop, mContext);

            foreach (var kernel in mHardwareQueue ?? new AcceleratedComputationKernel[0])
            {
                kernel.Execute();
            }

            if (mOutputKernel != null)
            {
                mOutputKernel.Execute();
                mOutputKernel.Output.Read(mOutputTextureMemory.GetPointer(), 0, mOutputTextureMemory.Size);
            }
        }
Exemple #16
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;
        }
Exemple #17
0
 public IRenderer CreateRenderer(IRenderRoot root, IRenderLoop renderLoop)
 {
     return(new Renderer(root, renderLoop));
 }
Exemple #18
0
 protected virtual void UpdateOverride([NotNull] IRenderLoop renderLoop, [NotNull] IAcceleratedReactorContext context)
 {
 }
 public IRenderer Create(IRenderRoot root, IRenderLoop renderLoop)
 => new ImmediateRenderer(root);
 public IRenderer CreateRenderer(IRenderRoot root, IRenderLoop renderLoop)
 {
     return(_cb?.Invoke(root, renderLoop));
 }
Exemple #21
0
 protected abstract void UpdateOverride([NotNull] IRenderLoop renderLoop, IRenderContext context);
Exemple #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="X11ImmediateRendererProxy"/> class.
 /// </summary>
 /// <param name="root">The root.</param>
 /// <param name="loop">The loop.</param>
 public X11ImmediateRendererProxy(IVisual root, IRenderLoop loop)
 {
     _loop     = loop;
     _renderer = new ImmediateRenderer(root);
 }
 public IRenderer CreateRenderer(IRenderRoot root, IRenderLoop renderLoop)
 {
     return new Renderer(root, renderLoop);
 }
Exemple #24
0
 public IRenderer CreateRenderer(IRenderRoot root, IRenderLoop renderLoop)
 {
     return(new ImmediateRenderer(root));
 }
Exemple #25
0
 public TestServices With(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IRuntimePlatform platform = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return new TestServices(
         assetLoader: assetLoader ?? AssetLoader,
         focusManager: focusManager ?? FocusManager,
         inputManager: inputManager ?? InputManager,
         keyboardDevice: keyboardDevice ?? KeyboardDevice,
         layoutManager: layoutManager ?? LayoutManager,
         platform: platform ?? Platform,
         renderer: renderer ?? Renderer,
         renderInterface: renderInterface ?? RenderInterface,
         renderLoop: renderLoop ?? RenderLoop,
         standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
         styler: styler ?? Styler,
         theme: theme ?? Theme,
         threadingInterface: threadingInterface ?? ThreadingInterface,
         windowImpl: windowImpl ?? WindowImpl,
         windowingPlatform: windowingPlatform ?? WindowingPlatform);
 }