protected override void OnRendering(IHostScreen screen, ref FBO currentFbo) { currentFbo = _gBuffer.FBO; FBO.Bind(currentFbo, FBO.Target.FrameBuffer); ElffyGL.Clear(ClearMask.ColorBufferBit | ClearMask.DepthBufferBit); _gBuffer.ClearColorBuffers(); }
internal FrameTimingPoint(IHostScreen screen, FrameTiming timing) { Debug.Assert(timing.IsSpecified()); _screen = screen; _eventQueue = new AsyncEventQueueCore(); _timing = timing; }
private ComputeShaderDispatcher(ProgramObject program, IHostScreen screen, IComputeShader shader) { Debug.Assert(program.IsEmpty == false); _program = program; _screen = screen; _shader = shader; }
internal static void ThrowIfContextNotEqual(IHostScreen actual, IHostScreen expected) { Debug.Assert(actual != null); Debug.Assert(expected != null); if(actual != expected) { Throw(actual, expected); } }
/// <summary> /// NavService setup where vm is HostScreen /// NOTE: Must be initiated in the hostscreen constructor /// </summary> /// <param name="vm">HostScreen</param> public void Setup(IHostScreen vm) { // Set hostscreen HostScreen = vm; // Initialize stack ViewModels ??= new List <IViewModel>(); }
internal RenderingArea(IHostScreen screen) { _state = RenderingAreaLifeState.New; OwnerScreen = screen; TimingPoints = new FrameTimingPointList(screen); Lights = new LightManager(screen); Layers = new LayerCollection(this); _runningTokenSource = new CancellationTokenSource(); }
protected override void OnSizeChanged(IHostScreen screen) { base.OnSizeChanged(screen); _isSizeChangeRequested = true; _sizeChangeRequestedFrameNum = screen.FrameNum; if (_isSizeChangeObserved == false) { _isSizeChangeObserved = true; StartObserveSizeChanged(screen); } }
private protected sealed override void RenderOverride(IHostScreen screen, ref FBO currentFbo) { var timingPoints = TimingPoints; timingPoints.BeforeRendering.DoQueuedEvents(); if (IsVisible) { RenderPostProcess(screen, ref currentFbo); } timingPoints.AfterRendering.DoQueuedEvents(); }
internal FrameTimingPointList(IHostScreen screen) { _screen = screen; _frameInitializingPoint = new FrameTimingPoint(screen, FrameTiming.FrameInitializing); _earlyUpdatePoint = new FrameTimingPoint(screen, FrameTiming.EarlyUpdate); _updatePoint = new FrameTimingPoint(screen, FrameTiming.Update); _lateUpdatePoint = new FrameTimingPoint(screen, FrameTiming.LateUpdate); _beforeRenderingPoint = new FrameTimingPoint(screen, FrameTiming.BeforeRendering); _afterRenderingPoint = new FrameTimingPoint(screen, FrameTiming.AfterRendering); _internalEndOfFrame = new FrameTimingPoint(screen, FrameTiming.Internal_EndOfFrame); }
private static async UniTask Start(IHostScreen screen) { UniTask.Void(async() => { await foreach (var _ in screen.Frames(FrameTiming.Update)) { if (screen.Keyboard.IsPress(Elffy.InputSystem.Keys.Escape)) { screen.Close(); } } }); var(drLayer, wLayer, uiLayer) = await LayerPipelines.CreateBuilder(screen).Build( () => new DeferredRenderingLayer(), () => new WorldLayer(), () => new UILayer()); InitializeLights(screen); var uiRoot = uiLayer.UIRoot; var timings = screen.TimingPoints; uiRoot.Background = Color4.Black; try { await ParallelOperation.WhenAll( //Sample.CreateUI(uiLayer.UIRoot), CreateDice2(drLayer), CreateCameraMouse(wLayer, new Vector3(0, 3, 0)), CreateDice(wLayer), CreateModel2(wLayer), CreateBox(wLayer), CreateFloor(wLayer), //CreateFloor2(wLayer), CreateSky(wLayer), timings.Update.DelayTime(800)); var time = TimeSpanF.FromMilliseconds(200); await foreach (var frame in timings.Update.Frames()) { if (frame.Time >= time) { break; } uiRoot.Background.A = 1f - frame.Time / time; } } finally { uiRoot.Background = Color4.Transparent; } }
private static void InitializeLights(IHostScreen screen) { ReadOnlySpan <Vector4> pos = stackalloc Vector4[] { new(1, 1, 1, 0), //new(1, 0, 0, 0), }; ReadOnlySpan <Color4> color = stackalloc Color4[] { Color4.White, //Color4.OrangeRed, }; screen.Lights.Initialize(pos, color); }
protected override void OnRendered(IHostScreen screen, ref FBO currentFbo) { var targetFbo = FBO.Empty; var gBuffer = _gBuffer; var screenSize = screen.FrameBufferSize; var gBufSize = gBuffer.Size; Debug.Assert(_postProcess is not null); Debug.Assert(_ppProgram is not null); FBO.Bind(targetFbo, FBO.Target.FrameBuffer); if (IsVisible) { _ppProgram.Render(screenSize, (Vector2)screenSize / (Vector2)gBufSize); } currentFbo = targetFbo; }
private void StartObserveSizeChanged(IHostScreen screen) { screen.StartCoroutine(this, static async(co, self) => { while (co.CanRun) { if (self._isSizeChangeRequested && co.Screen.FrameNum - self._sizeChangeRequestedFrameNum > 1) { // TODO: when height is 0. self._gBuffer.Resize(); Debug.WriteLine("Resize !!!!!!!!!!!!"); self._isSizeChangeRequested = false; } await co.TimingPoints.FrameInitializing.Next(); } }, FrameTiming.FrameInitializing).Forget(); }
private static async void OnScreenInitialized(IHostScreen screen) { //Timing.Initialize(screen); //Game.Initialize(screen); ExceptionDispatchInfo?edi = null; try { await(_func?.Invoke(screen) ?? throw new InvalidOperationException("func is null")); } catch (Exception ex) { edi = ExceptionDispatchInfo.Capture(ex); await screen.TimingPoints.Update.Next(); } finally { screen.Close(); //Timing.Clear(); //Game.Clear(); _func = null; } edi?.Throw(); }
protected override void SelectMatrix(IHostScreen screen, out Matrix4 view, out Matrix4 projection) { Debug.Fail("This method should not be called."); throw new NotSupportedException("This method should not be called."); }
protected sealed override void OnRendered(IHostScreen screen, ref FBO currentFbo) { Debug.Fail("This method should not be called."); throw new NotSupportedException("This method should not be called."); }
protected abstract void RenderPostProcess(IHostScreen screen, ref FBO currentFbo);
internal ComputeShaderContext(IHostScreen screen) { _screen = screen; }
protected override void OnAlive(IHostScreen screen) { // nop }
protected override void OnSizeChanged(IHostScreen screen) { // nop }
public static UniTask StartCoroutine(this IHostScreen parent, Func <CoroutineState, UniTask> coroutine) { return(Coroutine.Start(parent, coroutine)); }
public static void StartOrReserveCoroutine <TState>(this IHostScreen parent, TState state, Func <CoroutineState, TState, UniTask> coroutine) { Coroutine.StartOrReserve(parent, state, coroutine); }
internal LayerPipelineBuilder(IHostScreen screen) { ArgumentNullException.ThrowIfNull(screen); _screen = screen; }
protected override void OnRendered(IHostScreen screen, ref FBO currentFbo) { // nop }
protected override void OnRendering(IHostScreen screen, ref FBO currentFbo) { FBO.Bind(FBO.Empty, FBO.Target.FrameBuffer); currentFbo = FBO.Empty; }
public AbstractPage(IHostScreen parent, InstagramSession session) { this.parent = parent; this.session = session; }
public static ProgramObject GetCacheOrCompile(IHostScreen screen, SourceKey key) { _dictionaries ??= new(); ref var dic = ref CollectionsMarshal.GetValueRefOrAddDefault(_dictionaries, screen, out _);
public static UniTask StartCoroutine <TState>(this IHostScreen parent, TState state, Func <CoroutineState, TState, UniTask> coroutine, FrameTiming timing) { return(Coroutine.Start(parent, state, coroutine, timing)); }
public static void StartOrReserveCoroutine(this IHostScreen parent, Func <CoroutineState, UniTask> coroutine, FrameTiming timing) { Coroutine.StartOrReserve(parent, coroutine, timing); }
public bool TryGetScreen([MaybeNullWhen(false)] out IHostScreen screen) { screen = _screen; return(_screen is not null); }