From d48fe34c21987d86e84bcbf930cf018fafe58382 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 25 Apr 2015 07:51:40 +1000 Subject: [PATCH] Remove VertexPos3f. --- GraphicsAPI/IGraphicsApi.cs | 11 ++++------- GraphicsAPI/OpenGLApi.cs | 21 ++++----------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/GraphicsAPI/IGraphicsApi.cs b/GraphicsAPI/IGraphicsApi.cs index c989f120e..646f837a8 100644 --- a/GraphicsAPI/IGraphicsApi.cs +++ b/GraphicsAPI/IGraphicsApi.cs @@ -129,8 +129,6 @@ namespace ClassicalSharp.GraphicsAPI { public abstract void DeleteVb( int id ); - public abstract void DrawVbPos3f( DrawMode mode, int id, int verticesCount ); - public abstract void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ); public abstract void DrawVbPos3fCol4b( DrawMode mode, int id, int verticesCount ); @@ -146,7 +144,7 @@ namespace ClassicalSharp.GraphicsAPI { protected int GetSizeInBytes( int count, VertexFormat format ) { return count * strideSizes[(int)format]; } - protected static int[] strideSizes = new [] { 12, 20, 16, 24 }; + protected static int[] strideSizes = new [] { 20, 16, 24 }; public abstract void SetMatrixMode( MatrixType mode ); @@ -246,10 +244,9 @@ namespace ClassicalSharp.GraphicsAPI { } public enum VertexFormat { - VertexPos3f = 0, - VertexPos3fTex2f = 1, - VertexPos3fCol4b = 2, - VertexPos3fTex2fCol4b = 3 + VertexPos3fTex2f = 0, + VertexPos3fCol4b = 1, + VertexPos3fTex2fCol4b = 2, } public enum DrawMode { diff --git a/GraphicsAPI/OpenGLApi.cs b/GraphicsAPI/OpenGLApi.cs index 229e52706..c56ae1808 100644 --- a/GraphicsAPI/OpenGLApi.cs +++ b/GraphicsAPI/OpenGLApi.cs @@ -274,11 +274,10 @@ namespace ClassicalSharp.GraphicsAPI { Action[] drawBatchFuncs; Action drawBatchFunc; void SetupVb() { - drawBatchFuncs = new Action[4]; - drawBatchFuncs[0] = (mode, id, count) => DrawVbPos3fFast( mode, id, count ); - drawBatchFuncs[1] = (mode, id, count) => DrawVbPos3fTex2fFast( mode, id, count ); - drawBatchFuncs[2] = (mode, id, count) => DrawVbPos3fCol4bFast( mode, id, count ); - drawBatchFuncs[3] = (mode, id, count) => DrawVbPos3fTex2fCol4bFast( mode, id, count ); + drawBatchFuncs = new Action[3]; + drawBatchFuncs[0] = (mode, id, count) => DrawVbPos3fTex2fFast( mode, id, count ); + drawBatchFuncs[1] = (mode, id, count) => DrawVbPos3fCol4bFast( mode, id, count ); + drawBatchFuncs[2] = (mode, id, count) => DrawVbPos3fTex2fCol4bFast( mode, id, count ); } public override int InitVb( T[] vertices, DrawMode mode, VertexFormat format, int count ) { @@ -389,12 +388,6 @@ namespace ClassicalSharp.GraphicsAPI { GL.Arb.DeleteBuffers( 1, ref id ); } - public override void DrawVbPos3f( DrawMode mode, int id, int verticesCount ) { - BeginVbBatch( VertexFormat.VertexPos3f ); - DrawVbBatch( mode, id, verticesCount ); - EndVbBatch(); - } - public override void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ) { BeginVbBatch( VertexFormat.VertexPos3fTex2f ); DrawVbBatch( mode, id, verticesCount ); @@ -455,12 +448,6 @@ namespace ClassicalSharp.GraphicsAPI { GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, 0 ); } - void DrawVbPos3fFast( DrawMode mode, int id, int verticesCount ) { - GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id ); - GL.VertexPointer( 3, VertexPointerType.Float, 12, new IntPtr( 0 ) ); - GL.DrawArrays( modeMappings[(int)mode], 0, verticesCount ); - } - void DrawVbPos3fTex2fFast( DrawMode mode, int id, int verticesCount ) { GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id ); GL.VertexPointer( 3, VertexPointerType.Float, 20, new IntPtr( 0 ) );