/// <summary> /// Called when [render]. /// </summary> /// <param name="context">The context.</param> protected virtual void OnRender(RenderContext2D context) { RenderCore.Render(context); for (var i = 0; i < this.ItemsInternal.Count; ++i) { ItemsInternal[i].Render(context); } }
/// <summary> /// Called when [render]. /// </summary> /// <param name="context">The context.</param> protected virtual void OnRender(RenderContext2D context) { RenderCore.Render(context); for (int i = 0; i < this.Items.Count; ++i) { Items[i].Render(context); } }
/// <summary> /// Detaches the element from the host. Override <see cref="OnDetach"/> /// </summary> public void Detach() { if (IsAttached) { IsAttached = false; RenderCore.Detach(); OnDetach(); OnDetached?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Called when [attach]. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> protected override bool OnAttach(IRenderHost host) { RenderCore.Attach(renderTechnique); var screenSpaceCore = RenderCore as ScreenSpacedMeshRenderCore; screenSpaceCore.RelativeScreenLocationX = RelativeScreenLocationX; screenSpaceCore.RelativeScreenLocationY = RelativeScreenLocationY; screenSpaceCore.SizeScale = SizeScale; return(base.OnAttach(host)); }
protected override bool OnAttach(IEffectsManager effectsManager) { RenderCore.Attach(EffectTechnique); var screenSpaceCore = RenderCore as ScreenSpacedMeshRenderCore; screenSpaceCore.RelativeScreenLocationX = RelativeScreenLocationX; screenSpaceCore.RelativeScreenLocationY = RelativeScreenLocationY; screenSpaceCore.SizeScale = SizeScale; return(base.OnAttach(effectsManager)); }
/// <summary> /// Initializes a new instance of the <see cref="SceneNode"/> class. /// </summary> public SceneNode() { WrapperSource = this; renderCore = new Lazy <RenderCore>(() => { core = OnCreateRenderCore(); core.OnInvalidateRenderer += RenderCore_OnInvalidateRenderer; return(core); }, true); }
private bool previewTest(MultiSourceTreeNode node, NodeInfo info) { // Check to see if the tag is previewable and isn't already open. if (game.TypeTable.Previewable(Path.GetExtension(info.Identifier).TrimStart('.'))) { TagPath path = new TagPath(info.Identifier, game.GameID, TagLocation.Project); return(!RenderCore.ContainsScene(path.ToPath())); } return(false); }
/// <summary> /// Detaches this instance. /// </summary> public void Detach() { if (IsAttached) { IsAttached = false; RenderCore.Detach(); Disposer.RemoveAndDispose(ref bitmapCache); OnDetach(); OnDetached?.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Assigns the default values to core. /// </summary> /// <param name="core">The core.</param> protected override void AssignDefaultValuesToCore(RenderCore core) { base.AssignDefaultValuesToCore(core); var c = core as ShadowMapCore; //c.FactorPCF = (float)FactorPCF; c.Intensity = (float)Intensity; c.Bias = (float)Bias; c.Width = (int)(Resolution.Width); c.Height = (int)(Resolution.Height); }
protected override bool OnAttach(IRenderHost host) { if (base.OnAttach(host)) { RenderCore.Attach(this.EffectTechnique); return(true); } else { return(false); } }
/// <summary> /// Detaches the element from the host. Override <see cref="OnDetach"/> /// </summary> public void Detach() { if (IsAttached) { IsAttached = false; InvalidateSceneGraph(); RenderCore.Detach(); OnDetach(); DisposeAndClear(); OnDetached?.Invoke(this, EventArgs.Empty); } }
protected override bool OnAttach(IEffectsManager effectsManager) { if (base.OnAttach(effectsManager)) { RenderCore.Attach(this.EffectTechnique); return(true); } else { return(false); } }
/// <summary> /// Called when [attach]. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> protected override bool OnAttach(IRenderHost host) { RenderCore.Attach(EffectTechnique); var screenSpaceCore = RenderCore as ScreenSpacedMeshRenderCore; screenSpaceCore.RelativeScreenLocationX = RelativeScreenLocationX; screenSpaceCore.RelativeScreenLocationY = RelativeScreenLocationY; screenSpaceCore.SizeScale = SizeScale; for (int i = 0; i < ItemsInternal.Count; ++i) { ItemsInternal[i].RenderType = RenderType.ScreenSpaced; } return(base.OnAttach(host)); }
private void InitializeCore() { Core = new RenderCore(); ThumbnailBinding.ThumbMan.SetTarget(Core.ThumbMan); ThumbnailBinding.TexLoad.SetTarget(Core.TexLoader); OperateTargets[0] = Core.TheScene.MainCamera; OperateTargets[1] = Core.TheScene.Drawables.LastOrDefault(); OperateTargets[2] = Core.TheScene.Lights.LastOrDefault(); Core.Resize((uint)glMain.ClientSize.Width, (uint)glMain.ClientSize.Height); this.Closed += (o, e) => { Core.Dispose(); Core = null; }; glMain.Draw += Core.Draw; glMain.Resize += (o, e) => { Core.Resize((uint)e.Width, (uint)e.Height); }; AutoRefresher = new Timer(o => { if (!ShouldRefresh) { return; } OperateTargets[1]?.Rotate(0, 3 * MULER, 0); this.Dispatcher.InvokeAsync(() => glMain.Invalidate(), System.Windows.Threading.DispatcherPriority.Normal); }, null, 0, 15); this.Closing += (o, e) => AutoRefresher.Change(Timeout.Infinite, 20); glMain.Invalidate(); WaitingCount = 0; var fpsTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.5) }; fpsTimer.Tick += (o, e) => { var timeUs = glMain?.AvgDrawTime ?? 0; txtFPS.Text = timeUs > 0 ? $"{1000000 / timeUs} FPS@{timeUs / 1000}ms" : ""; }; fpsTimer.Start(); Core.TheScene.Drawables.ObjectPropertyChanged += (s, t, e) => InvalidateOnPropChanged(e.PropertyName); drawablePage.DataContext = Core.TheScene.Drawables; Core.TheScene.Lights.ObjectPropertyChanged += (s, t, e) => InvalidateOnPropChanged(e.PropertyName); lightPage.DataContext = Core.TheScene.Lights; Core.Passes.ObjectPropertyChanged += (s, t, e) => InvalidateOnPropChanged(e.PropertyName); shaderPage.DataContext = Core.Passes; Core.Controls.ForEach(x => x.PropertyChanged += (o, e) => InvalidateOnPropChanged(e.PropertyName)); controlPage.DataContext = Core.Controls; Core.TheScene.MainCamera.PropertyChanged += (o, e) => InvalidateOnPropChanged(e.PropertyName); }
protected override void OnDispose(bool disposeManagedResources) { if (!Items.IsReadOnly) { Items.Clear(); } RenderCore.Dispose(); OnVisibleChanged = null; OnTransformChanged = null; OnSetRenderTechnique = null; OnBoundChanged = null; OnTransformBoundChanged = null; OnBoundSphereChanged = null; OnTransformBoundSphereChanged = null; OnAttached = null; OnDetached = null; WrapperSource = null; base.OnDispose(disposeManagedResources); }
void Init() { Console.WriteLine(GL.GetString(StringName.Renderer)); Console.WriteLine(GL.GetString(StringName.Version)); AssetLoader.Init(); RenderCore.Create(); GameLoop = new GameLoop(this); EditorLoop = new GameLoop(this); DisplayRT = new RenderTexture(); FullscreenQuadProgram = ShaderUtils.CreateFromResource("RasterDraw.Shaders.SimpleVert.glsl", "RasterDraw.Shaders.SimpleFrag.glsl"); PhysicsEngine = new PhysicsManager(); EditorManager = new EditorManager(ClientSize); EditorManager.GameGameLoop = GameLoop; GameObject editorManager = new GameObject("Editor Manager"); editorManager.AddScript(EditorManager); EditorManager.Enabled = false; EditorLoop.Add(editorManager); }
public Form1() { Common.ViewModelSyncRoot.Init(); InitializeComponent(); AllowDrop = true; DragEnter += (o, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Link; } else { e.Effect = DragDropEffects.None; } }; DragDrop += OnDropFileAsync; GLView = new OGLView() { Location = new System.Drawing.Point(0, 0), Name = "oglv", Size = ClientSize, ResizeBGDraw = false }; Core = new RenderCore(); OperateTargets[0] = Core.TheScene.MainCamera; OperateTargets[1] = Core.TheScene.Drawables.LastOrDefault(); OperateTargets[2] = Core.TheScene.Lights.LastOrDefault(); Core.Resize((uint)ClientSize.Width, (uint)ClientSize.Height); Controls.Add(GLView); Resize += (o, e) => { GLView.Size = ClientSize; }; FormClosing += (o, e) => { Core.Dispose(); Core = null; }; GLView.Draw += Core.Draw; GLView.Resize += (o, e) => { Core.Resize((uint)e.Width, (uint)e.Height); }; GLView.KeyDown += OnKeyDown; //oglv.KeyAction += OnKeyAction; GLView.MouseAction += OnMouse; }
/// <summary> /// Assigns the default values to core. /// </summary> /// <param name="core">The core.</param> protected virtual void AssignDefaultValuesToCore(RenderCore core) { }
/// <summary> /// To override Attach routine, please override this. /// </summary> /// <param name="host"></param> /// <returns>Return true if attached</returns> protected virtual bool OnAttach(IRenderHost host) { RenderCore.Attach(host); return(true); }
/// <summary> /// Assigns the default values to core. /// </summary> /// <param name="core">The core.</param> protected override void AssignDefaultValuesToCore(RenderCore core) { base.AssignDefaultValuesToCore(core); boneSkinRenderCore.BoneMatrices = BoneMatrices; }
/// <summary> /// Renders the specified context. /// </summary> /// <param name="context">The context.</param> /// <param name="deviceContext">The device context.</param> public void Render(RenderContext context, DeviceContextProxy deviceContext) { RenderCore.Render(context, deviceContext); }
/// <summary> /// Called when [detach]. /// </summary> protected override void OnDetach() { RenderCore.Detach(); base.OnDetach(); }
/// <summary> /// To override Attach routine, please override this. /// </summary> /// <param name="host"></param> /// <returns>Return true if attached</returns> protected virtual bool OnAttach(IRenderHost host) { RenderCore.Attach(renderTechnique); AssignDefaultValuesToCore(RenderCore); return(RenderCore == null ? false : RenderCore.IsAttached); }