mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Use single DrawVb method.
This commit is contained in:
parent
0889c5f4df
commit
c8ace076f5
@ -254,21 +254,9 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
return IsValid( iBuffers, ib );
|
return IsValid( iBuffers, ib );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ) {
|
public override void DrawVb( DrawMode mode, VertexFormat format, int id, int verticesCount ) {
|
||||||
device.SetStreamSource( 0, vBuffers[id], 0 );
|
device.SetStreamSource( 0, vBuffers[id], 0 );
|
||||||
device.VertexFormat = VertexFormats.Position | VertexFormats.Texture1;
|
device.VertexFormat = formatMapping[(int)format];
|
||||||
device.DrawPrimitives( modeMappings[(int)mode], 0, verticesCount / 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawVbPos3fCol4b( DrawMode mode, int id, int verticesCount ) {
|
|
||||||
device.SetStreamSource( 0, vBuffers[id], 0 );
|
|
||||||
device.VertexFormat = VertexFormats.Position | VertexFormats.Diffuse;
|
|
||||||
device.DrawPrimitives( modeMappings[(int)mode], 0, verticesCount / 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawVbPos3fTex2fCol4b( DrawMode mode, int id, int verticesCount ) {
|
|
||||||
device.SetStreamSource( 0, vBuffers[id], 0 );
|
|
||||||
device.VertexFormat = VertexFormats.Position | VertexFormats.Texture1 | VertexFormats.Diffuse;
|
|
||||||
device.DrawPrimitives( modeMappings[(int)mode], 0, verticesCount / 3 );
|
device.DrawPrimitives( modeMappings[(int)mode], 0, verticesCount / 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,11 +122,7 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
|
|
||||||
public abstract void DeleteIb( int ib );
|
public abstract void DeleteIb( int ib );
|
||||||
|
|
||||||
public abstract void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount );
|
public abstract void DrawVb( DrawMode mode, VertexFormat format, int id, int verticesCount );
|
||||||
|
|
||||||
public abstract void DrawVbPos3fCol4b( DrawMode mode, int id, int verticesCount );
|
|
||||||
|
|
||||||
public abstract void DrawVbPos3fTex2fCol4b( DrawMode mode, int id, int verticesCount );
|
|
||||||
|
|
||||||
public abstract void BeginVbBatch( VertexFormat format );
|
public abstract void BeginVbBatch( VertexFormat format );
|
||||||
|
|
||||||
|
@ -265,20 +265,8 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
return GL.Arb.IsBuffer( ib );
|
return GL.Arb.IsBuffer( ib );
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ) {
|
public override void DrawVb( DrawMode mode, VertexFormat format, int id, int verticesCount ) {
|
||||||
BeginVbBatch( VertexFormat.VertexPos3fTex2f );
|
BeginVbBatch( format );
|
||||||
DrawVbBatch( mode, id, verticesCount );
|
|
||||||
EndVbBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawVbPos3fCol4b( DrawMode mode, int id, int verticesCount ) {
|
|
||||||
BeginVbBatch( VertexFormat.VertexPos3fCol4b );
|
|
||||||
DrawVbBatch( mode, id, verticesCount );
|
|
||||||
EndVbBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawVbPos3fTex2fCol4b( DrawMode mode, int id, int verticesCount ) {
|
|
||||||
BeginVbBatch( VertexFormat.VertexPos3fTex2fCol4b );
|
|
||||||
DrawVbBatch( mode, id, verticesCount );
|
DrawVbBatch( mode, id, verticesCount );
|
||||||
EndVbBatch();
|
EndVbBatch();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Render() {
|
public void Render() {
|
||||||
Graphics.DrawVbPos3fTex2fCol4b( DrawMode.Triangles, VbId, Count );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.VertexPos3fTex2fCol4b, VbId, 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.DrawVbPos3fTex2fCol4b( DrawMode.Triangles, sidesVboId, sidesVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.VertexPos3fTex2fCol4b, sidesVboId, 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.DrawVbPos3fTex2fCol4b( DrawMode.Triangles, edgesVboId, edgesVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.VertexPos3fTex2fCol4b, edgesVboId, 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.DrawVbPos3fCol4b( DrawMode.Triangles, skyVbo, skyVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.VertexPos3fCol4b, skyVbo, 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.DrawVbPos3fTex2fCol4b( DrawMode.Triangles, cloudsVbo, cloudsVertices );
|
Graphics.DrawVb( DrawMode.Triangles, VertexFormat.VertexPos3fTex2fCol4b, cloudsVbo, cloudsVertices );
|
||||||
Graphics.AlphaTest = false;
|
Graphics.AlphaTest = false;
|
||||||
Graphics.Texturing = false;
|
Graphics.Texturing = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user