mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Implement more of the missing functions in DirectXApi.
This commit is contained in:
parent
c2b6ee83b1
commit
f309919ea5
@ -50,7 +50,7 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
Compare.Always, Compare.NotEqual, Compare.Never, Compare.Less,
|
Compare.Always, Compare.NotEqual, Compare.Never, Compare.Less,
|
||||||
Compare.LessEqual, Compare.Equal, Compare.GreaterEqual, Compare.Greater,
|
Compare.LessEqual, Compare.Equal, Compare.GreaterEqual, Compare.Greater,
|
||||||
};
|
};
|
||||||
public override void AlphaTestFunc( AlphaFunc func, float value ) {
|
public override void AlphaTestFunc( CompareFunc func, float value ) {
|
||||||
device.RenderState.AlphaFunction = compareFuncs[(int)func];
|
device.RenderState.AlphaFunction = compareFuncs[(int)func];
|
||||||
device.RenderState.ReferenceAlpha = (int)( value * 255f );
|
device.RenderState.ReferenceAlpha = (int)( value * 255f );
|
||||||
}
|
}
|
||||||
@ -99,6 +99,13 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
device.RenderState.FogStart = value;
|
device.RenderState.FogStart = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool FaceCulling {
|
||||||
|
set {
|
||||||
|
Cull mode = value ? Cull.CounterClockwise : Cull.None;
|
||||||
|
device.RenderState.CullMode = mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int MaxTextureDimensions {
|
public override int MaxTextureDimensions {
|
||||||
get {
|
get {
|
||||||
return Math.Min( caps.MaxTextureHeight, caps.MaxTextureWidth );
|
return Math.Min( caps.MaxTextureHeight, caps.MaxTextureWidth );
|
||||||
@ -138,7 +145,7 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DeleteTexture( int texId ) {
|
public override void DeleteTexture( ref int texId ) {
|
||||||
if( texId <= 0 || texId >= textures.Length ) return;
|
if( texId <= 0 || texId >= textures.Length ) return;
|
||||||
|
|
||||||
D3D.Texture texture = textures[texId];
|
D3D.Texture texture = textures[texId];
|
||||||
@ -146,6 +153,11 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
texture.Dispose();
|
texture.Dispose();
|
||||||
}
|
}
|
||||||
textures[texId] = null;
|
textures[texId] = null;
|
||||||
|
texId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsValidTexture( int texId ) {
|
||||||
|
return texId < textures.Length && textures[texId] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color lastClearCol = Color.Black;
|
Color lastClearCol = Color.Black;
|
||||||
@ -166,7 +178,7 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
device.RenderState.ColorWriteEnable = flags;
|
device.RenderState.ColorWriteEnable = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DepthTestFunc( DepthFunc func ) {
|
public override void DepthTestFunc( CompareFunc func ) {
|
||||||
device.RenderState.ZBufferFunction = compareFuncs[(int)func];
|
device.RenderState.ZBufferFunction = compareFuncs[(int)func];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,11 +280,8 @@ namespace ClassicalSharp.GraphicsAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawVbPos3f( DrawMode mode, int id, int verticesCount ) {
|
public override bool IsValidVb( int vb ) {
|
||||||
VertexBuffer buffer = buffers[id];
|
return vb < buffers.Length && buffers[vb] != null;
|
||||||
device.SetStreamSource( 0, buffer, 0 );
|
|
||||||
device.VertexFormat = VertexFormats.Position;
|
|
||||||
device.DrawPrimitives( modeMappings[(int)mode], 0, verticesCount / 3 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ) {
|
public override void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user