MeshBatchRenderer is now more strict about state.
This commit is contained in:
		@@ -136,6 +136,7 @@ namespace SlatedGameToolkit.Framework.Graphics.Render
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="mesh">Draws the given mesh.</param>
 | 
					        /// <param name="mesh">Draws the given mesh.</param>
 | 
				
			||||||
        public virtual void Draw(IMesh mesh) {
 | 
					        public virtual void Draw(IMesh mesh) {
 | 
				
			||||||
 | 
					            if (!Batching) throw new InvalidOperationException("This batch has not been begun.");
 | 
				
			||||||
            IPositionInterpolable moveable = mesh as IPositionInterpolable;
 | 
					            IPositionInterpolable moveable = mesh as IPositionInterpolable;
 | 
				
			||||||
            if (moveable != null) {
 | 
					            if (moveable != null) {
 | 
				
			||||||
                moveable.InterpolatePosition(batchDelta);
 | 
					                moveable.InterpolatePosition(batchDelta);
 | 
				
			||||||
@@ -188,11 +189,12 @@ namespace SlatedGameToolkit.Framework.Graphics.Render
 | 
				
			|||||||
        
 | 
					        
 | 
				
			||||||
        public virtual void End() {
 | 
					        public virtual void End() {
 | 
				
			||||||
            if (!Batching) throw new InvalidOperationException("This batch was never started.");
 | 
					            if (!Batching) throw new InvalidOperationException("This batch was never started.");
 | 
				
			||||||
            this.Batching = false;
 | 
					 | 
				
			||||||
            Flush();
 | 
					            Flush();
 | 
				
			||||||
 | 
					            this.Batching = false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public virtual void Flush() {
 | 
					        public virtual void Flush() {
 | 
				
			||||||
 | 
					            if (!Batching) throw new InvalidOperationException("This batch has not been begun.");
 | 
				
			||||||
            if (offsetIndex == 0) return;
 | 
					            if (offsetIndex == 0) return;
 | 
				
			||||||
            if (texture != null) {
 | 
					            if (texture != null) {
 | 
				
			||||||
                GLContext.BindTexture(TextureTarget.Texture2D, texture.Handle);
 | 
					                GLContext.BindTexture(TextureTarget.Texture2D, texture.Handle);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user