public Render ( |
||
arg | ||
Résultat | void |
///// <summary> ///// Occurs before this object and all of its children's rendering. ///// </summary> //public event EventHandler BeforeRendering; ///// <summary> ///// Occurs before this object and all of its children's rendering. ///// </summary> //internal void DoBeforeRendering() //{ // EventHandler handler = this.BeforeRendering; // if (handler != null) // { // handler(this, new EventArgs()); // } //} /// <summary> /// /// </summary> /// <param name="arg"></param> public void Render(RenderEventArgs arg) { RendererBase renderer = this.Renderer; if (renderer != null) { renderer.Render(arg); } }
/// <summary> /// Render something. /// </summary> /// <param name="arg"></param> protected virtual void DoRender(RenderEventArgs arg) { if (this.locationUpdated) { this.viewportState.X = this.Location.X; this.viewportState.Y = this.Location.Y; this.scissorTestState.X = this.Location.X; this.scissorTestState.Y = this.Location.Y; this.locationUpdated = false; } if (this.sizeUpdated) { this.viewportState.Width = this.Size.Width; this.viewportState.Height = this.Size.Height; this.scissorTestState.Width = this.Size.Width; this.scissorTestState.Height = this.Size.Height; this.sizeUpdated = false; } this.viewportState.On(); this.scissorTestState.On(); int count = this.stateList.Count; for (int i = 0; i < count; i++) { this.stateList[i].On(); } if (this.ClearDepthBuffer) { // 把所有在此之前渲染的内容都推到最远。 // Push all rendered stuff to farest position. OpenGL.Clear(OpenGL.GL_DEPTH_BUFFER_BIT); } RendererBase renderer = this.Renderer; if (renderer != null) { renderer.Render(arg); } for (int i = count - 1; i >= 0; i--) { this.stateList[i].Off(); } this.scissorTestState.Off(); this.viewportState.Off(); }
/// <summary> /// /// </summary> /// <param name="arg"></param> protected override void DoRender(RenderEventArgs arg) { this.viewportSwitch.X = this.Location.X; this.viewportSwitch.Y = this.Location.Y; this.viewportSwitch.Width = this.Size.Width; this.viewportSwitch.Height = this.Size.Height; this.scissorTestSwitch.X = this.Location.X; this.scissorTestSwitch.Y = this.Location.Y; this.scissorTestSwitch.Width = this.Size.Width; this.scissorTestSwitch.Height = this.Size.Height; this.viewportSwitch.On(); this.scissorTestSwitch.On(); int count = this.switchList.Count; for (int i = 0; i < count; i++) { this.switchList[i].On(); } // 把所有在此之前渲染的内容都推到最远。 // Push all rendered stuff to farest position. OpenGL.Clear(OpenGL.GL_DEPTH_BUFFER_BIT); RendererBase renderer = this.Renderer; if (renderer != null) { renderer.Render(arg); } for (int i = count - 1; i >= 0; i--) { this.switchList[i].Off(); } this.scissorTestSwitch.Off(); this.viewportSwitch.Off(); }