using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; using System; using System.Collections.Generic; using System.ComponentModel.Design; using System.Text; namespace StgSharp.Logic { public partial class ViewModelBase { private Dictionary allView; public T BuildNewView(string name,(int x, int y, int z) unitCubeSize) where T : View,new() { var ret = new T(); ret.SelfName = name; ret.InternalInitialize(this); allView.Add(name, ret); return ret; } public T BuildRenderStream(View view) where T : RenderStream { #nullable enable T? ret = Activator.CreateInstance(typeof(T), view.Port, view.UnitCubeSize) as T; #nullable restore if (ret == null) { throw new InvalidOperationException( $"Failed in creating a new {typeof(T).Name} instance when calling ShareContextWith." ); } ret.timeProvider = this.frameTimeProvider; ret.PlatformSpecifiedInit(); return ret; } } }