mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Add offset parameter to DrawVb/DrawVbBatch.
This commit is contained in:
parent
aba1ae465c
commit
2c18ebc5bb
@ -122,11 +122,11 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
|
|
||||||
public abstract void DeleteIb( int ib );
|
public abstract void DeleteIb( int ib );
|
||||||
|
|
||||||
public abstract void DrawVb( DrawMode mode, VertexFormat format, int id, int verticesCount );
|
public abstract void DrawVb( DrawMode mode, VertexFormat format, int id, int offset, int verticesCount );
|
||||||
|
|
||||||
public abstract void BeginVbBatch( VertexFormat format );
|
public abstract void BeginVbBatch( VertexFormat format );
|
||||||
|
|
||||||
public abstract void DrawVbBatch( DrawMode mode, int id, int verticesCount );
|
public abstract void DrawVbBatch( DrawMode mode, int id, int offset, int verticesCount );
|
||||||
|
|
||||||
public abstract void EndVbBatch();
|
public abstract void EndVbBatch();
|
||||||
|
|
||||||
|
@ -190,10 +190,10 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
#if TRACK_RESOURCES
|
#if TRACK_RESOURCES
|
||||||
Dictionary<int, string> vbs = new Dictionary<int, string>();
|
Dictionary<int, string> vbs = new Dictionary<int, string>();
|
||||||
#endif
|
#endif
|
||||||
Action<DrawMode, int, int> drawBatchFunc;
|
Action<DrawMode, int, int, int> drawBatchFunc;
|
||||||
Action<DrawMode, int, int> drawBatchFuncTex2f;
|
Action<DrawMode, int, int, int> drawBatchFuncTex2f;
|
||||||
Action<DrawMode, int, int> drawBatchFuncCol4b;
|
Action<DrawMode, int, int, int> drawBatchFuncCol4b;
|
||||||
Action<DrawMode, int, int> drawBatchFuncTex2fCol4b;
|
Action<DrawMode, int, int, int> drawBatchFuncTex2fCol4b;
|
||||||
|
|
||||||
|
|
||||||
public override int CreateDynamicVb( VertexFormat format, int maxVertices ) {
|
public override int CreateDynamicVb( VertexFormat format, int maxVertices ) {
|
||||||
@ -235,7 +235,7 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
GL.Arb.BufferSubData( BufferTargetArb.ArrayBuffer, IntPtr.Zero, new IntPtr( sizeInBytes ), vertices );
|
GL.Arb.BufferSubData( BufferTargetArb.ArrayBuffer, IntPtr.Zero, new IntPtr( sizeInBytes ), vertices );
|
||||||
|
|
||||||
BeginVbBatch( format );
|
BeginVbBatch( format );
|
||||||
DrawVbBatch( mode, vb, count );
|
DrawVbBatch( mode, vb, 0, count );
|
||||||
EndVbBatch();
|
EndVbBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,9 +265,9 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
return GL.Arb.IsBuffer( ib );
|
return GL.Arb.IsBuffer( ib );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawVb( DrawMode mode, VertexFormat format, int id, int verticesCount ) {
|
public override void DrawVb( DrawMode mode, VertexFormat format, int id, int offset, int verticesCount ) {
|
||||||
BeginVbBatch( format );
|
BeginVbBatch( format );
|
||||||
DrawVbBatch( mode, id, verticesCount );
|
DrawVbBatch( mode, id, offset, verticesCount );
|
||||||
EndVbBatch();
|
EndVbBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,8 +288,8 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
EnableClientState( VertexFormat.Pos3fTex2fCol4b );
|
EnableClientState( VertexFormat.Pos3fTex2fCol4b );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawVbBatch( DrawMode mode, int id, int verticesCount ) {
|
public override void DrawVbBatch( DrawMode mode, int id, int offset, int verticesCount ) {
|
||||||
drawBatchFunc( mode, id, verticesCount );
|
drawBatchFunc( mode, id, offset, verticesCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawIndexedVbBatch( DrawMode mode, int vb, int ib, int indicesCount ) {
|
public override void DrawIndexedVbBatch( DrawMode mode, int vb, int ib, int indicesCount ) {
|
||||||
@ -312,26 +312,26 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
GL.Arb.BindBuffer( BufferTargetArb.ElementArrayBuffer, 0 );
|
GL.Arb.BindBuffer( BufferTargetArb.ElementArrayBuffer, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawVbPos3fTex2fFast( DrawMode mode, int id, int verticesCount ) {
|
void DrawVbPos3fTex2fFast( DrawMode mode, int id, int offset, int verticesCount ) {
|
||||||
GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id );
|
GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id );
|
||||||
GL.VertexPointer( 3, VertexPointerType.Float, 20, new IntPtr( 0 ) );
|
GL.VertexPointer( 3, VertexPointerType.Float, 20, new IntPtr( 0 ) );
|
||||||
GL.TexCoordPointer( 2, TexCoordPointerType.Float, 20, new IntPtr( 12 ) );
|
GL.TexCoordPointer( 2, TexCoordPointerType.Float, 20, new IntPtr( 12 ) );
|
||||||
GL.DrawArrays( modeMappings[(int)mode], 0, verticesCount );
|
GL.DrawArrays( modeMappings[(int)mode], offset, verticesCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawVbPos3fCol4bFast( DrawMode mode, int id, int verticesCount ) {
|
void DrawVbPos3fCol4bFast( DrawMode mode, int id, int offset, int verticesCount ) {
|
||||||
GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id );
|
GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id );
|
||||||
GL.VertexPointer( 3, VertexPointerType.Float, 16, new IntPtr( 0 ) );
|
GL.VertexPointer( 3, VertexPointerType.Float, 16, new IntPtr( 0 ) );
|
||||||
GL.ColorPointer( 4, ColorPointerType.UnsignedByte, 16, new IntPtr( 12 ) );
|
GL.ColorPointer( 4, ColorPointerType.UnsignedByte, 16, new IntPtr( 12 ) );
|
||||||
GL.DrawArrays( modeMappings[(int)mode], 0, verticesCount );
|
GL.DrawArrays( modeMappings[(int)mode], offset, verticesCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawVbPos3fTex2fCol4bFast( DrawMode mode, int id, int verticesCount ) {
|
void DrawVbPos3fTex2fCol4bFast( DrawMode mode, int id, int offset, int verticesCount ) {
|
||||||
GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id );
|
GL.Arb.BindBuffer( BufferTargetArb.ArrayBuffer, id );
|
||||||
GL.VertexPointer( 3, VertexPointerType.Float, 24, new IntPtr( 0 ) );
|
GL.VertexPointer( 3, VertexPointerType.Float, 24, new IntPtr( 0 ) );
|
||||||
GL.TexCoordPointer( 2, TexCoordPointerType.Float, 24, new IntPtr( 12 ) );
|
GL.TexCoordPointer( 2, TexCoordPointerType.Float, 24, new IntPtr( 12 ) );
|
||||||
GL.ColorPointer( 4, ColorPointerType.UnsignedByte, 24, new IntPtr( 20 ) );
|
GL.ColorPointer( 4, ColorPointerType.UnsignedByte, 24, new IntPtr( 20 ) );
|
||||||
GL.DrawArrays( modeMappings[(int)mode], 0, verticesCount );
|
GL.DrawArrays( modeMappings[(int)mode], offset, verticesCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EnableClientState( VertexFormat format ) {
|
static void EnableClientState( VertexFormat format ) {
|
||||||
|
@ -16,7 +16,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Render() {
|
public void Render() {
|
||||||
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, VbId, Count );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, VbId, 0, Count );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
|
@ -45,7 +45,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
Graphics.Texturing = true;
|
Graphics.Texturing = true;
|
||||||
Graphics.Bind2DTexture( sideTexId );
|
Graphics.Bind2DTexture( sideTexId );
|
||||||
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, sidesVboId, sidesVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, sidesVboId, 0, sidesVertices );
|
||||||
Graphics.Texturing = false;
|
Graphics.Texturing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ namespace ClassicalSharp {
|
|||||||
Graphics.Texturing = true;
|
Graphics.Texturing = true;
|
||||||
Graphics.AlphaBlending = true;
|
Graphics.AlphaBlending = true;
|
||||||
Graphics.Bind2DTexture( edgeTexId );
|
Graphics.Bind2DTexture( edgeTexId );
|
||||||
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, edgesVboId, edgesVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, edgesVboId, 0, edgesVertices );
|
||||||
Graphics.AlphaBlending = false;
|
Graphics.AlphaBlending = false;
|
||||||
Graphics.Texturing = false;
|
Graphics.Texturing = false;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
|
|
||||||
Vector3 pos = Window.LocalPlayer.EyePosition;
|
Vector3 pos = Window.LocalPlayer.EyePosition;
|
||||||
if( pos.Y < Map.Height + skyOffset ) {
|
if( pos.Y < Map.Height + skyOffset ) {
|
||||||
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fCol4b, skyVbo, skyVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fCol4b, skyVbo, 0, skyVertices );
|
||||||
}
|
}
|
||||||
RenderClouds( deltaTime );
|
RenderClouds( deltaTime );
|
||||||
ResetFog();
|
ResetFog();
|
||||||
@ -97,7 +97,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
Graphics.AlphaTest = true;
|
Graphics.AlphaTest = true;
|
||||||
Graphics.Texturing = true;
|
Graphics.Texturing = true;
|
||||||
Graphics.Bind2DTexture( cloudTexture );
|
Graphics.Bind2DTexture( cloudTexture );
|
||||||
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, cloudsVbo, cloudsVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.Pos3fTex2fCol4b, cloudsVbo, 0, cloudsVertices );
|
||||||
Graphics.AlphaTest = false;
|
Graphics.AlphaTest = false;
|
||||||
Graphics.Texturing = false;
|
Graphics.Texturing = false;
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ namespace ClassicalSharp.Selections {
|
|||||||
|
|
||||||
public void Render( double delta ) {
|
public void Render( double delta ) {
|
||||||
Graphics.DepthWrite = false;
|
Graphics.DepthWrite = false;
|
||||||
Graphics.DrawVbBatch( DrawMode.Triangles, VboId, VerticesCount );
|
Graphics.DrawVbBatch( DrawMode.Triangles, VboId, 0, VerticesCount );
|
||||||
Graphics.DepthWrite = true;
|
Graphics.DepthWrite = true;
|
||||||
Graphics.DrawVbBatch( DrawMode.Lines, LineVboId, LineVerticesCount );
|
Graphics.DrawVbBatch( DrawMode.Lines, LineVboId, 0, LineVerticesCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectionBox( Vector3I start, Vector3I end, FastColour col, IGraphicsApi graphics ) {
|
public SelectionBox( Vector3I start, Vector3I end, FastColour col, IGraphicsApi graphics ) {
|
||||||
|
@ -6,10 +6,11 @@ using OpenTK;
|
|||||||
namespace ClassicalSharp {
|
namespace ClassicalSharp {
|
||||||
|
|
||||||
// NOTE: These delegates should be removed when using versions later than NET 2.0.
|
// NOTE: These delegates should be removed when using versions later than NET 2.0.
|
||||||
// ################################################################
|
// ################################################################
|
||||||
public delegate void Action<T1, T2>( T1 arg1, T2 arg2 );
|
|
||||||
public delegate void Action();
|
public delegate void Action();
|
||||||
|
public delegate void Action<T1, T2>( T1 arg1, T2 arg2 );
|
||||||
public delegate void Action<T1, T2, T3>( T1 arg1, T2 arg2, T3 arg3 );
|
public delegate void Action<T1, T2, T3>( T1 arg1, T2 arg2, T3 arg3 );
|
||||||
|
public delegate void Action<T1, T2, T3, T4>( T1 arg1, T2 arg2, T3 arg3, T4 arg4 );
|
||||||
public delegate TResult Func<TResult>();
|
public delegate TResult Func<TResult>();
|
||||||
public delegate TResult Func<T1, TResult>( T1 arg1 );
|
public delegate TResult Func<T1, TResult>( T1 arg1 );
|
||||||
public delegate TResult Func<T1, T2, TResult>( T1 arg1, T2 arg2 );
|
public delegate TResult Func<T1, T2, TResult>( T1 arg1, T2 arg2 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user