implemented DrawUserIndexedPrimitives for RenderSystem DX10 and DX11 (currently untested)
This commit is contained in:
parent
41a38aa51f
commit
c7e2a4e0ec
@ -326,7 +326,19 @@ namespace ANX.Framework.Windows.DX10
|
|||||||
#region DrawUserIndexedPrimitives<T>
|
#region DrawUserIndexedPrimitives<T>
|
||||||
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration, IndexElementSize indexFormat) where T : struct, IVertexType
|
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration, IndexElementSize indexFormat) where T : struct, IVertexType
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
int vertexCount = vertexData.Length;
|
||||||
|
int indexCount = indexData.Length;
|
||||||
|
VertexBuffer_DX10 vb10 = new VertexBuffer_DX10(this.device, vertexDeclaration, vertexCount, BufferUsage.None);
|
||||||
|
vb10.SetData<T>(null, vertexData);
|
||||||
|
|
||||||
|
SharpDX.Direct3D10.VertexBufferBinding nativeVertexBufferBindings = new SharpDX.Direct3D10.VertexBufferBinding(vb10.NativeBuffer, vertexDeclaration.VertexStride, 0);
|
||||||
|
|
||||||
|
device.InputAssembler.SetVertexBuffers(0, nativeVertexBufferBindings);
|
||||||
|
|
||||||
|
IndexBuffer_DX10 idx10 = new IndexBuffer_DX10(this.device, indexFormat, indexCount, BufferUsage.None);
|
||||||
|
idx10.SetData<int>(null, (int[])indexData);
|
||||||
|
|
||||||
|
DrawIndexedPrimitives(primitiveType, 0, vertexOffset, numVertices, indexOffset, primitiveCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion // DrawUserIndexedPrimitives<T>
|
#endregion // DrawUserIndexedPrimitives<T>
|
||||||
|
@ -73,20 +73,29 @@ namespace ANX.Framework.Windows.DX10
|
|||||||
GraphicsDeviceWindowsDX10 gd10 = graphics.NativeDevice as GraphicsDeviceWindowsDX10;
|
GraphicsDeviceWindowsDX10 gd10 = graphics.NativeDevice as GraphicsDeviceWindowsDX10;
|
||||||
SharpDX.Direct3D10.Device device = gd10 != null ? gd10.NativeDevice as SharpDX.Direct3D10.Device : null;
|
SharpDX.Direct3D10.Device device = gd10 != null ? gd10.NativeDevice as SharpDX.Direct3D10.Device : null;
|
||||||
|
|
||||||
if (device != null)
|
InitializeBuffer(device, size, indexCount, usage);
|
||||||
{
|
}
|
||||||
BufferDescription description = new BufferDescription()
|
|
||||||
{
|
|
||||||
Usage = ResourceUsage.Dynamic,
|
|
||||||
SizeInBytes = (size == IndexElementSize.SixteenBits ? 2 : 4) * indexCount,
|
|
||||||
BindFlags = BindFlags.IndexBuffer,
|
|
||||||
CpuAccessFlags = CpuAccessFlags.Write,
|
|
||||||
OptionFlags = ResourceOptionFlags.None
|
|
||||||
};
|
|
||||||
|
|
||||||
this.buffer = new SharpDX.Direct3D10.Buffer(device, description);
|
internal IndexBuffer_DX10(SharpDX.Direct3D10.Device device, IndexElementSize size, int indexCount, BufferUsage usage)
|
||||||
this.buffer.Unmap();
|
{
|
||||||
}
|
this.size = size;
|
||||||
|
|
||||||
|
InitializeBuffer(device, size, indexCount, usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeBuffer(SharpDX.Direct3D10.Device device, IndexElementSize size, int indexCount, BufferUsage usage)
|
||||||
|
{
|
||||||
|
BufferDescription description = new BufferDescription()
|
||||||
|
{
|
||||||
|
Usage = ResourceUsage.Dynamic,
|
||||||
|
SizeInBytes = (size == IndexElementSize.SixteenBits ? 2 : 4) * indexCount,
|
||||||
|
BindFlags = BindFlags.IndexBuffer,
|
||||||
|
CpuAccessFlags = CpuAccessFlags.Write,
|
||||||
|
OptionFlags = ResourceOptionFlags.None
|
||||||
|
};
|
||||||
|
|
||||||
|
this.buffer = new SharpDX.Direct3D10.Buffer(device, description);
|
||||||
|
this.buffer.Unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data) where T : struct
|
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data) where T : struct
|
||||||
|
@ -32,7 +32,7 @@ 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.12.0")]
|
[assembly: AssemblyVersion("0.7.13.0")]
|
||||||
[assembly: AssemblyFileVersion("0.7.12.0")]
|
[assembly: AssemblyFileVersion("0.7.13.0")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
||||||
|
@ -330,7 +330,19 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
#region DrawUserIndexedPrimitives<T>
|
#region DrawUserIndexedPrimitives<T>
|
||||||
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration, IndexElementSize indexFormat) where T : struct, IVertexType
|
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration, IndexElementSize indexFormat) where T : struct, IVertexType
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
int vertexCount = vertexData.Length;
|
||||||
|
int indexCount = indexData.Length;
|
||||||
|
VertexBuffer_DX11 vb11 = new VertexBuffer_DX11(this.deviceContext.Device, vertexDeclaration, vertexCount, BufferUsage.None);
|
||||||
|
vb11.SetData<T>(null, vertexData);
|
||||||
|
|
||||||
|
SharpDX.Direct3D11.VertexBufferBinding nativeVertexBufferBindings = new SharpDX.Direct3D11.VertexBufferBinding(vb11.NativeBuffer, vertexDeclaration.VertexStride, 0);
|
||||||
|
|
||||||
|
deviceContext.InputAssembler.SetVertexBuffers(0, nativeVertexBufferBindings);
|
||||||
|
|
||||||
|
IndexBuffer_DX11 idx10 = new IndexBuffer_DX11(this.deviceContext.Device, indexFormat, indexCount, BufferUsage.None);
|
||||||
|
idx10.SetData<int>(null, (int[])indexData);
|
||||||
|
|
||||||
|
DrawIndexedPrimitives(primitiveType, 0, vertexOffset, numVertices, indexOffset, primitiveCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion // DrawUserIndexedPrimitives<T>
|
#endregion // DrawUserIndexedPrimitives<T>
|
||||||
|
@ -73,20 +73,28 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
GraphicsDeviceWindowsDX11 gd11 = graphics.NativeDevice as GraphicsDeviceWindowsDX11;
|
GraphicsDeviceWindowsDX11 gd11 = graphics.NativeDevice as GraphicsDeviceWindowsDX11;
|
||||||
SharpDX.Direct3D11.DeviceContext context = gd11 != null ? gd11.NativeDevice as SharpDX.Direct3D11.DeviceContext : null;
|
SharpDX.Direct3D11.DeviceContext context = gd11 != null ? gd11.NativeDevice as SharpDX.Direct3D11.DeviceContext : null;
|
||||||
|
|
||||||
if (context != null)
|
InitializeBuffer(context.Device, size, indexCount, usage);
|
||||||
{
|
}
|
||||||
BufferDescription description = new BufferDescription()
|
|
||||||
{
|
|
||||||
Usage = ResourceUsage.Dynamic,
|
|
||||||
SizeInBytes = (size == IndexElementSize.SixteenBits ? 2 : 4) * indexCount,
|
|
||||||
BindFlags = BindFlags.IndexBuffer,
|
|
||||||
CpuAccessFlags = CpuAccessFlags.Write,
|
|
||||||
OptionFlags = ResourceOptionFlags.None
|
|
||||||
};
|
|
||||||
|
|
||||||
this.buffer = new SharpDX.Direct3D11.Buffer(context.Device, description);
|
internal IndexBuffer_DX11(SharpDX.Direct3D11.Device device, IndexElementSize size, int indexCount, BufferUsage usage)
|
||||||
//this.buffer.Unmap();
|
{
|
||||||
}
|
this.size = size;
|
||||||
|
|
||||||
|
InitializeBuffer(device, size, indexCount, usage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeBuffer(SharpDX.Direct3D11.Device device, IndexElementSize size, int indexCount, BufferUsage usage)
|
||||||
|
{
|
||||||
|
BufferDescription description = new BufferDescription()
|
||||||
|
{
|
||||||
|
Usage = ResourceUsage.Dynamic,
|
||||||
|
SizeInBytes = (size == IndexElementSize.SixteenBits ? 2 : 4) * indexCount,
|
||||||
|
BindFlags = BindFlags.IndexBuffer,
|
||||||
|
CpuAccessFlags = CpuAccessFlags.Write,
|
||||||
|
OptionFlags = ResourceOptionFlags.None
|
||||||
|
};
|
||||||
|
|
||||||
|
this.buffer = new SharpDX.Direct3D11.Buffer(device, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data) where T : struct
|
public void SetData<T>(GraphicsDevice graphicsDevice, T[] data) where T : struct
|
||||||
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Buildnummer
|
// Buildnummer
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.7.4.0")]
|
[assembly: AssemblyVersion("0.7.5.0")]
|
||||||
[assembly: AssemblyFileVersion("0.7.4.0")]
|
[assembly: AssemblyFileVersion("0.7.5.0")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user