finished anx side handling of VertexBuffers in GraphicsDevice and finished VertexBufferBindings
This commit is contained in:
parent
e92ee6dfa7
commit
94e0509b44
@ -251,35 +251,32 @@ namespace ANX.Framework.Windows.DX10
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset)
|
|
||||||
{
|
|
||||||
if (vertexBuffer == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("vertexBuffer");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.currentVertexBuffer = vertexBuffer;
|
|
||||||
|
|
||||||
VertexBuffer_DX10 nativeVertexBuffer = vertexBuffer.NativeVertexBuffer as VertexBuffer_DX10;
|
|
||||||
|
|
||||||
if (nativeVertexBuffer != null)
|
|
||||||
{
|
|
||||||
device.InputAssembler.SetVertexBuffers(0, new SharpDX.Direct3D10.VertexBufferBinding(nativeVertexBuffer.NativeBuffer, vertexBuffer.VertexDeclaration.VertexStride, vertexOffset));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("couldn't fetch native DirectX10 VertexBuffer");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer)
|
|
||||||
{
|
|
||||||
SetVertexBuffer(vertexBuffer, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetVertexBuffers(Graphics.VertexBufferBinding[] vertexBuffers)
|
public void SetVertexBuffers(Graphics.VertexBufferBinding[] vertexBuffers)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (vertexBuffers == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("vertexBuffers");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentVertexBuffer = vertexBuffers[0].VertexBuffer; //TODO: hmmmmm, not nice :-)
|
||||||
|
|
||||||
|
SharpDX.Direct3D10.VertexBufferBinding[] nativeVertexBufferBindings = new SharpDX.Direct3D10.VertexBufferBinding[vertexBuffers.Length];
|
||||||
|
for (int i = 0; i < vertexBuffers.Length; i++)
|
||||||
|
{
|
||||||
|
ANX.Framework.Graphics.VertexBufferBinding anxVertexBufferBinding = vertexBuffers[i];
|
||||||
|
VertexBuffer_DX10 nativeVertexBuffer = anxVertexBufferBinding.VertexBuffer.NativeVertexBuffer as VertexBuffer_DX10;
|
||||||
|
|
||||||
|
if (nativeVertexBuffer != null)
|
||||||
|
{
|
||||||
|
nativeVertexBufferBindings[i] = new SharpDX.Direct3D10.VertexBufferBinding(nativeVertexBuffer.NativeBuffer, anxVertexBufferBinding.VertexBuffer.VertexDeclaration.VertexStride, anxVertexBufferBinding.VertexOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception("couldn't fetch native DirectX10 VertexBuffer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
device.InputAssembler.SetVertexBuffers(0, nativeVertexBufferBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetViewport(Graphics.Viewport viewport)
|
public void SetViewport(Graphics.Viewport viewport)
|
||||||
@ -331,5 +328,21 @@ namespace ANX.Framework.Windows.DX10
|
|||||||
|
|
||||||
return new InputElement(elementName, vertexElement.UsageIndex, elementFormat, vertexElement.Offset, 0);
|
return new InputElement(elementName, vertexElement.UsageIndex, elementFormat, vertexElement.Offset, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SetRenderTarget(RenderTarget2D renderTarget)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRenderTargets(params RenderTargetBinding[] renderTargets)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.7.0.0")]
|
[assembly: AssemblyVersion("0.7.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.7.0.0")]
|
[assembly: AssemblyFileVersion("0.7.1.0")]
|
||||||
|
@ -168,16 +168,6 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetVertexBuffers(VertexBufferBinding[] vertexBuffers)
|
public void SetVertexBuffers(VertexBufferBinding[] vertexBuffers)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -227,5 +217,21 @@ namespace ANX.Framework.Windows.GL3
|
|||||||
nativeContext.SwapBuffers();
|
nativeContext.SwapBuffers();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
|
||||||
|
|
||||||
|
public void SetRenderTarget(RenderTarget2D renderTarget)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRenderTargets(params RenderTargetBinding[] renderTargets)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.5.0.0")]
|
[assembly: AssemblyVersion("0.5.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.5.0.0")]
|
[assembly: AssemblyFileVersion("0.5.1.0")]
|
||||||
|
@ -71,6 +71,7 @@ namespace ANX.Framework.Graphics
|
|||||||
private PresentationParameters currentPresentationParameters;
|
private PresentationParameters currentPresentationParameters;
|
||||||
private bool isDisposed;
|
private bool isDisposed;
|
||||||
private GraphicsProfile graphicsProfile;
|
private GraphicsProfile graphicsProfile;
|
||||||
|
private VertexBufferBinding[] currentVertexBufferBindings;
|
||||||
|
|
||||||
#endregion // Private Members
|
#endregion // Private Members
|
||||||
|
|
||||||
@ -174,32 +175,37 @@ namespace ANX.Framework.Graphics
|
|||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer)
|
public void SetVertexBuffer(VertexBuffer vertexBuffer)
|
||||||
{
|
{
|
||||||
nativeDevice.SetVertexBuffer(vertexBuffer);
|
VertexBufferBinding[] bindings = new VertexBufferBinding[] { new VertexBufferBinding(vertexBuffer) };
|
||||||
|
this.currentVertexBufferBindings = bindings;
|
||||||
|
this.nativeDevice.SetVertexBuffers(bindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset)
|
public void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset)
|
||||||
{
|
{
|
||||||
nativeDevice.SetVertexBuffer(vertexBuffer, vertexOffset);
|
VertexBufferBinding[] bindings = new VertexBufferBinding[] { new VertexBufferBinding(vertexBuffer, vertexOffset) };
|
||||||
|
this.currentVertexBufferBindings = bindings;
|
||||||
|
this.nativeDevice.SetVertexBuffers(bindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVertexBuffers(Graphics.VertexBufferBinding[] vertexBuffers)
|
public void SetVertexBuffers(Graphics.VertexBufferBinding[] vertexBuffers)
|
||||||
{
|
{
|
||||||
|
this.currentVertexBufferBindings = vertexBuffers;
|
||||||
nativeDevice.SetVertexBuffers(vertexBuffers);
|
nativeDevice.SetVertexBuffers(vertexBuffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRenderTarget(RenderTarget2D renderTarget)
|
public void SetRenderTarget(RenderTarget2D renderTarget)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
nativeDevice.SetRenderTarget(renderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
|
public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
nativeDevice.SetRenderTarget(renderTarget, cubeMapFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRenderTargets(params RenderTargetBinding[] renderTargets)
|
public void SetRenderTargets(params RenderTargetBinding[] renderTargets)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
nativeDevice.SetRenderTargets(renderTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetBackBufferData<T>(Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
|
public void GetBackBufferData<T>(Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
|
||||||
@ -219,7 +225,7 @@ namespace ANX.Framework.Graphics
|
|||||||
|
|
||||||
public VertexBufferBinding[] GetVertexBuffers()
|
public VertexBufferBinding[] GetVertexBuffers()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return this.currentVertexBufferBindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderTargetBinding[] GetRenderTargets()
|
public RenderTargetBinding[] GetRenderTargets()
|
||||||
|
@ -54,6 +54,60 @@ namespace ANX.Framework.Graphics
|
|||||||
{
|
{
|
||||||
public struct VertexBufferBinding
|
public struct VertexBufferBinding
|
||||||
{
|
{
|
||||||
|
#region Private Members
|
||||||
|
private VertexBuffer vertexBuffer;
|
||||||
|
private int instanceFrequency;
|
||||||
|
private int vertexOffset;
|
||||||
|
#endregion // Private Members
|
||||||
|
|
||||||
|
public VertexBufferBinding(VertexBuffer vertexBuffer)
|
||||||
|
{
|
||||||
|
this.vertexBuffer = vertexBuffer;
|
||||||
|
this.vertexOffset = 0;
|
||||||
|
this.instanceFrequency = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VertexBufferBinding(VertexBuffer vertexBuffer, int vertexOffset)
|
||||||
|
{
|
||||||
|
this.vertexBuffer = vertexBuffer;
|
||||||
|
this.vertexOffset = vertexOffset;
|
||||||
|
this.instanceFrequency = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VertexBufferBinding(VertexBuffer vertexBuffer, int vertexOffset, int instanceFrequency)
|
||||||
|
{
|
||||||
|
this.vertexBuffer = vertexBuffer;
|
||||||
|
this.vertexOffset = vertexOffset;
|
||||||
|
this.instanceFrequency = instanceFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator VertexBufferBinding(VertexBuffer vertexBuffer)
|
||||||
|
{
|
||||||
|
return new VertexBufferBinding(vertexBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VertexBuffer VertexBuffer
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.vertexBuffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int InstanceFrequency
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.instanceFrequency;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int VertexOffset
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.vertexOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,14 +63,20 @@ namespace ANX.Framework.NonXNA
|
|||||||
|
|
||||||
void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset, int primitiveCount);
|
void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset, int primitiveCount);
|
||||||
|
|
||||||
void SetVertexBuffer(VertexBuffer vertexBuffer);
|
//void SetVertexBuffer(VertexBuffer vertexBuffer);
|
||||||
|
|
||||||
void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset);
|
//void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset);
|
||||||
|
|
||||||
void SetVertexBuffers(VertexBufferBinding[] vertexBuffers);
|
void SetVertexBuffers(VertexBufferBinding[] vertexBuffers);
|
||||||
|
|
||||||
void SetIndexBuffer(IndexBuffer indexBuffer);
|
void SetIndexBuffer(IndexBuffer indexBuffer);
|
||||||
|
|
||||||
void SetViewport(Viewport viewport);
|
void SetViewport(Viewport viewport);
|
||||||
|
|
||||||
|
void SetRenderTarget(RenderTarget2D renderTarget);
|
||||||
|
|
||||||
|
void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace);
|
||||||
|
|
||||||
|
void SetRenderTargets(params RenderTargetBinding[] renderTargets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,34 +245,6 @@ namespace ANX.RenderSystem.Windows.DX11_1
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer)
|
|
||||||
{
|
|
||||||
if (vertexBuffer == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("vertexBuffer");
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new NotImplementedException();
|
|
||||||
|
|
||||||
//this.currentVertexBuffer = vertexBuffer;
|
|
||||||
|
|
||||||
//VertexBuffer_DX10 nativeVertexBuffer = vertexBuffer.NativeVertexBuffer as VertexBuffer_DX10;
|
|
||||||
|
|
||||||
//if (nativeVertexBuffer != null)
|
|
||||||
//{
|
|
||||||
// device.InputAssembler.SetVertexBuffers(0, new SharpDX.Direct3D10.VertexBufferBinding(nativeVertexBuffer.NativeBuffer, vertexBuffer.VertexDeclaration.VertexStride, 0));
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// throw new Exception("couldn't fetch native DirectX10 VertexBuffer");
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetVertexBuffer(VertexBuffer vertexBuffer, int vertexOffset)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetVertexBuffers(ANX.Framework.Graphics.VertexBufferBinding[] vertexBuffers)
|
public void SetVertexBuffers(ANX.Framework.Graphics.VertexBufferBinding[] vertexBuffers)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -617,5 +589,21 @@ namespace ANX.RenderSystem.Windows.DX11_1
|
|||||||
return Comparison.Always;
|
return Comparison.Always;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void SetRenderTarget(Framework.Graphics.RenderTarget2D renderTarget)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRenderTarget(Framework.Graphics.RenderTargetCube renderTarget, Framework.Graphics.CubeMapFace cubeMapFace)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRenderTargets(params Framework.Graphics.RenderTargetBinding[] renderTargets)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Buildnummer
|
// Buildnummer
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.1.0.0")]
|
[assembly: AssemblyVersion("0.1.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
[assembly: AssemblyFileVersion("0.1.1.0")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user