- Added INativeIndexBuffer and INativeVertexBuffer

- All methods in Vertex and IndexBuffer now call the native methods
- Nearly all methods in Texture2D now call the native methods
This commit is contained in:
SND\AstrorEnales_cp 2012-02-19 13:41:02 +00:00
parent 9e0bdcd9dc
commit 7546ff78d0
29 changed files with 932 additions and 452 deletions

View File

@ -441,6 +441,8 @@
<Compile Include="NonXNA\RenderSystem\INativeTexture.cs" /> <Compile Include="NonXNA\RenderSystem\INativeTexture.cs" />
<Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" /> <Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" />
<Compile Include="NonXNA\RenderSystem\INativeEffectPass.cs" /> <Compile Include="NonXNA\RenderSystem\INativeEffectPass.cs" />
<Compile Include="NonXNA\RenderSystem\INativeVertexBuffer.cs" />
<Compile Include="NonXNA\RenderSystem\INativeIndexBuffer.cs" />
<Compile Include="NonXNA\RenderSystem\PreDefinedShader.cs" /> <Compile Include="NonXNA\RenderSystem\PreDefinedShader.cs" />
<Compile Include="NonXNA\RenderSystem\INativeBlendState.cs" /> <Compile Include="NonXNA\RenderSystem\INativeBlendState.cs" />
<Compile Include="NonXNA\RenderSystem\INativeBuffer.cs" /> <Compile Include="NonXNA\RenderSystem\INativeBuffer.cs" />

View File

@ -1,10 +1,7 @@
#region Using Statements #region Using Statements
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
#endregion // Using Statements #endregion // Using Statements

View File

@ -1,12 +1,4 @@
#region Using Statements using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Graphics;
#endregion // Using Statements
#region License #region License
@ -57,22 +49,21 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
public sealed class DeviceLostException : Exception public sealed class DeviceLostException : Exception
{ {
public DeviceLostException() public DeviceLostException()
: base() : base()
{ {
} }
public DeviceLostException(string message) public DeviceLostException(string message)
: base(message) : base(message)
{ {
} }
public DeviceLostException(string message, Exception innerException) public DeviceLostException(string message, Exception innerException)
: base(message, innerException) : base(message, innerException)
{ {
} }
}
}
} }

View File

@ -1,12 +1,4 @@
#region Using Statements using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Graphics;
#endregion // Using Statements
#region License #region License
@ -57,22 +49,21 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
public sealed class DeviceNotResetException : Exception public sealed class DeviceNotResetException : Exception
{ {
public DeviceNotResetException() public DeviceNotResetException()
: base() : base()
{ {
} }
public DeviceNotResetException(string message) public DeviceNotResetException(string message)
: base(message) : base(message)
{ {
} }
public DeviceNotResetException(string message, Exception innerException) public DeviceNotResetException(string message, Exception innerException)
: base(message, innerException) : base(message, innerException)
{ {
} }
}
}
} }

View File

@ -1,12 +1,8 @@
#region Using Statements using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
#endregion // Using Statements using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.RenderSystem;
#region License #region License
@ -57,172 +53,190 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
public class IndexBuffer : GraphicsResource, IGraphicsResource [PercentageComplete(100)]
{ [TestState(TestStateAttribute.TestState.Untested)]
private int indexCount; public class IndexBuffer : GraphicsResource, IGraphicsResource
private BufferUsage bufferUsage; {
private IndexElementSize indexElementSize; #region Private
private INativeBuffer nativeIndexBuffer; private int indexCount;
private BufferUsage bufferUsage;
public IndexBuffer(GraphicsDevice graphicsDevice, IndexElementSize indexElementSize, int indexCount, BufferUsage usage) private IndexElementSize indexElementSize;
: base(graphicsDevice) private INativeIndexBuffer nativeIndexBuffer;
{ #endregion
this.indexElementSize = indexElementSize;
this.indexCount = indexCount;
this.bufferUsage = usage;
base.GraphicsDevice.ResourceCreated += GraphicsDevice_ResourceCreated;
base.GraphicsDevice.ResourceDestroyed += GraphicsDevice_ResourceDestroyed;
CreateNativeBuffer();
}
public IndexBuffer(GraphicsDevice graphicsDevice, Type indexType, int indexCount, BufferUsage usage)
: base(graphicsDevice)
{
if (indexType == typeof(int) || indexType == typeof(uint))
{
this.indexElementSize = Graphics.IndexElementSize.ThirtyTwoBits;
}
else if (indexType == typeof(short) || indexType == typeof(ushort))
{
this.indexElementSize = Graphics.IndexElementSize.SixteenBits;
}
else
{
throw new Exception("can't use IndexType " + indexType.ToString());
}
this.indexCount = indexCount;
this.bufferUsage = usage;
CreateNativeBuffer();
}
~IndexBuffer()
{
Dispose();
base.GraphicsDevice.ResourceCreated -= GraphicsDevice_ResourceCreated;
base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed;
}
private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e)
{
if (this.nativeIndexBuffer != null)
{
this.nativeIndexBuffer.Dispose();
this.nativeIndexBuffer = null;
}
}
private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e)
{
if (nativeIndexBuffer != null)
{
nativeIndexBuffer.Dispose();
nativeIndexBuffer = null;
}
CreateNativeBuffer();
}
private void CreateNativeBuffer()
{
this.nativeIndexBuffer =
AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateIndexBuffer(GraphicsDevice, this, indexElementSize, indexCount, bufferUsage);
}
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data) where T : struct
{
GetData<T>(0, data, 0, data.Length);
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
GetData<T>(0, data, startIndex, elementCount);
}
public void SetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
{
if (nativeIndexBuffer == null)
{
CreateNativeBuffer();
}
this.nativeIndexBuffer.SetData<T>(GraphicsDevice, offsetInBytes, data, startIndex, elementCount);
}
public void SetData<T>(T[] data) where T : struct
{
if (nativeIndexBuffer == null)
{
CreateNativeBuffer();
}
this.nativeIndexBuffer.SetData<T>(GraphicsDevice, data);
}
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
SetData<T>(0, data, startIndex, elementCount);
}
public override void Dispose()
{
if (this.nativeIndexBuffer != null)
{
this.nativeIndexBuffer.Dispose();
this.nativeIndexBuffer = null;
}
}
#region Public
// This is now internal because via befriending the assemblies // This is now internal because via befriending the assemblies
// it's usable in the modules but doesn't confuse the enduser. // it's usable in the modules but doesn't confuse the enduser.
internal INativeBuffer NativeIndexBuffer internal INativeIndexBuffer NativeIndexBuffer
{ {
get get
{ {
if (nativeIndexBuffer == null) if (nativeIndexBuffer == null)
{ {
CreateNativeBuffer(); CreateNativeBuffer();
} }
return this.nativeIndexBuffer; return this.nativeIndexBuffer;
} }
} }
public BufferUsage BufferUsage public BufferUsage BufferUsage
{ {
get get
{ {
return this.bufferUsage; return this.bufferUsage;
} }
} }
public int IndexCount public int IndexCount
{ {
get get
{ {
return this.indexCount; return this.indexCount;
} }
} }
public IndexElementSize IndexElementSize public IndexElementSize IndexElementSize
{ {
get get
{ {
return this.indexElementSize; return this.indexElementSize;
} }
} }
#endregion
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) #region Constructor
{ public IndexBuffer(GraphicsDevice graphicsDevice, IndexElementSize indexElementSize, int indexCount, BufferUsage usage)
throw new NotImplementedException(); : base(graphicsDevice)
} {
} this.indexElementSize = indexElementSize;
this.indexCount = indexCount;
this.bufferUsage = usage;
base.GraphicsDevice.ResourceCreated += GraphicsDevice_ResourceCreated;
base.GraphicsDevice.ResourceDestroyed += GraphicsDevice_ResourceDestroyed;
CreateNativeBuffer();
}
public IndexBuffer(GraphicsDevice graphicsDevice, Type indexType, int indexCount, BufferUsage usage)
: base(graphicsDevice)
{
if (indexType == typeof(int) ||
indexType == typeof(uint))
{
this.indexElementSize = IndexElementSize.ThirtyTwoBits;
}
else if (indexType == typeof(short) ||
indexType == typeof(ushort))
{
this.indexElementSize = IndexElementSize.SixteenBits;
}
else
{
throw new Exception("can't use IndexType " + indexType.ToString());
}
this.indexCount = indexCount;
this.bufferUsage = usage;
CreateNativeBuffer();
}
~IndexBuffer()
{
Dispose();
base.GraphicsDevice.ResourceCreated -= GraphicsDevice_ResourceCreated;
base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed;
}
#endregion
#region GraphicsDevice_ResourceDestroyed
private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e)
{
if (this.nativeIndexBuffer != null)
{
this.nativeIndexBuffer.Dispose();
this.nativeIndexBuffer = null;
}
}
#endregion
#region GraphicsDevice_ResourceCreated
private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e)
{
if (nativeIndexBuffer != null)
{
nativeIndexBuffer.Dispose();
nativeIndexBuffer = null;
}
CreateNativeBuffer();
}
#endregion
#region CreateNativeBuffer
private void CreateNativeBuffer()
{
this.nativeIndexBuffer =
AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateIndexBuffer(GraphicsDevice, this, indexElementSize, indexCount, bufferUsage);
}
#endregion
#region GetData
public void GetData<T>(int offsetInBytes, T[] data, int startIndex,
int elementCount) where T : struct
{
NativeIndexBuffer.GetData(offsetInBytes, data, startIndex, elementCount);
}
public void GetData<T>(T[] data) where T : struct
{
NativeIndexBuffer.GetData(data);
}
public void GetData<T>(T[] data, int startIndex, int elementCount)
where T : struct
{
NativeIndexBuffer.GetData(data, startIndex, elementCount);
}
#endregion
#region SetData
public void SetData<T>(int offsetInBytes, T[] data, int startIndex,
int elementCount) where T : struct
{
NativeIndexBuffer.SetData(GraphicsDevice, offsetInBytes, data,
startIndex, elementCount);
}
public void SetData<T>(T[] data) where T : struct
{
NativeIndexBuffer.SetData(GraphicsDevice, data);
}
public void SetData<T>(T[] data, int startIndex, int elementCount)
where T : struct
{
NativeIndexBuffer.SetData(GraphicsDevice, data, startIndex, elementCount);
}
#endregion
#region Dispose
public override void Dispose()
{
Dispose(true);
}
protected override void Dispose(
[MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
if (this.nativeIndexBuffer != null)
{
this.nativeIndexBuffer.Dispose();
this.nativeIndexBuffer = null;
}
}
#endregion
}
} }

View File

@ -1,9 +1,9 @@
#region Using Statements #region Using Statements
using System; using System;
using System.IO; using System.IO;
using ANX.Framework.NonXNA.RenderSystem;
using ANX.Framework.NonXNA;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -63,6 +63,18 @@ namespace ANX.Framework.Graphics
protected internal int height; protected internal int height;
private INativeTexture2D nativeTexture2D; private INativeTexture2D nativeTexture2D;
private INativeTexture2D NativeTexture2D
{
get
{
if (nativeTexture2D == null)
{
CreateNativeTextureSurface();
}
return nativeTexture2D;
}
}
#endregion #endregion
#region Public #region Public
@ -91,7 +103,7 @@ namespace ANX.Framework.Graphics
} }
#endregion #endregion
#region Constructor #region Constructor (TODO)
internal Texture2D(GraphicsDevice graphicsDevice) internal Texture2D(GraphicsDevice graphicsDevice)
: base(graphicsDevice) : base(graphicsDevice)
{ {
@ -109,7 +121,8 @@ namespace ANX.Framework.Graphics
CreateNativeTextureSurface(); CreateNativeTextureSurface();
} }
public Texture2D(GraphicsDevice graphicsDevice, int width, int height, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format) public Texture2D(GraphicsDevice graphicsDevice, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format)
: base(graphicsDevice) : base(graphicsDevice)
{ {
this.width = width; this.width = width;
@ -123,38 +136,43 @@ namespace ANX.Framework.Graphics
#endregion #endregion
#region FromStream (TODO) #region FromStream (TODO)
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream) public static Texture2D FromStream(GraphicsDevice graphicsDevice,
Stream stream)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream, int width, int height, [MarshalAsAttribute(UnmanagedType.U1)] bool zoom) public static Texture2D FromStream(GraphicsDevice graphicsDevice,
Stream stream, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool zoom)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region GetData (TODO) #region GetData
public void GetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct public void GetData<T>(int level, Nullable<Rectangle> rect, T[] data,
int startIndex, int elementCount) where T : struct
{ {
throw new NotImplementedException(); NativeTexture2D.GetData(level, rect, data, startIndex, elementCount);
} }
public void GetData<T>(T[] data) where T : struct public void GetData<T>(T[] data) where T : struct
{ {
throw new NotImplementedException(); NativeTexture.GetData(data);
} }
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{ {
throw new NotImplementedException(); NativeTexture.GetData(data, startIndex, elementCount);
} }
#endregion #endregion
#region SetData (TODO) #region SetData
public void SetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct public void SetData<T>(int level, Nullable<Rectangle> rect, T[] data,
{ int startIndex, int elementCount) where T : struct
throw new NotImplementedException(); {
NativeTexture2D.SetData(level, rect, data, startIndex, elementCount);
} }
public void SetData<T>(T[] data) where T : struct public void SetData<T>(T[] data) where T : struct
@ -171,14 +189,14 @@ namespace ANX.Framework.Graphics
#region SaveAsJpeg #region SaveAsJpeg
public void SaveAsJpeg(Stream stream, int width, int height) public void SaveAsJpeg(Stream stream, int width, int height)
{ {
nativeTexture2D.SaveAsJpeg(stream, width, height); NativeTexture2D.SaveAsJpeg(stream, width, height);
} }
#endregion #endregion
#region SaveAsPng #region SaveAsPng
public void SaveAsPng(Stream stream, int width, int height) public void SaveAsPng(Stream stream, int width, int height)
{ {
nativeTexture2D.SaveAsPng(stream, width, height); NativeTexture2D.SaveAsPng(stream, width, height);
} }
#endregion #endregion

View File

@ -1,9 +1,8 @@
#region Using Statements using System;
using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements using ANX.Framework.NonXNA.RenderSystem;
#region License #region License
@ -54,183 +53,192 @@ using ANX.Framework.NonXNA;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
public class VertexBuffer : GraphicsResource, IGraphicsResource [PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
public class VertexBuffer : GraphicsResource, IGraphicsResource
{
#region Private
private VertexDeclaration vertexDeclaration;
private int vertexCount;
private BufferUsage bufferUsage;
private INativeVertexBuffer nativeVertexBuffer;
#endregion
#region Public
// This is now internal because via befriending the assemblies
// it's usable in the modules but doesn't confuse the enduser.
internal INativeVertexBuffer NativeVertexBuffer
{ {
#region Private get
private VertexDeclaration vertexDeclaration; {
private int vertexCount; if (this.nativeVertexBuffer == null)
private BufferUsage bufferUsage;
private INativeBuffer nativeVertexBuffer;
#endregion
#region Constructor
// This is now internal because via befriending the assemblies
// it's usable in the modules but doesn't confuse the enduser.
internal INativeBuffer NativeVertexBuffer
{ {
get CreateNativeBuffer();
{
if (this.nativeVertexBuffer == null)
{
CreateNativeBuffer();
}
return this.nativeVertexBuffer;
}
} }
public BufferUsage BufferUsage return this.nativeVertexBuffer;
{ }
get }
{
return this.bufferUsage;
}
}
public int VertexCount public BufferUsage BufferUsage
{ {
get get
{ {
return this.vertexCount; return this.bufferUsage;
} }
} }
public VertexDeclaration VertexDeclaration public int VertexCount
{ {
get get
{ {
return this.vertexDeclaration; return this.vertexCount;
} }
} }
#endregion
#region Constructor public VertexDeclaration VertexDeclaration
public VertexBuffer(GraphicsDevice graphicsDevice, Type vertexType, int vertexCount, BufferUsage usage) {
: this(graphicsDevice, VertexBuffer.TypeToVertexDeclaration(vertexType), vertexCount, usage) get
{ {
} return this.vertexDeclaration;
}
}
#endregion
public VertexBuffer(GraphicsDevice graphicsDevice, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) #region Constructor
: base(graphicsDevice) public VertexBuffer(GraphicsDevice graphicsDevice, Type vertexType,
{ int vertexCount, BufferUsage usage)
this.vertexCount = vertexCount; : this(graphicsDevice, VertexBuffer.TypeToVertexDeclaration(vertexType),
this.vertexDeclaration = vertexDeclaration; vertexCount, usage)
this.bufferUsage = usage; {
}
base.GraphicsDevice.ResourceCreated += GraphicsDevice_ResourceCreated; public VertexBuffer(GraphicsDevice graphicsDevice,
base.GraphicsDevice.ResourceDestroyed += GraphicsDevice_ResourceDestroyed; VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
: base(graphicsDevice)
{
this.vertexCount = vertexCount;
this.vertexDeclaration = vertexDeclaration;
this.bufferUsage = usage;
CreateNativeBuffer(); base.GraphicsDevice.ResourceCreated += GraphicsDevice_ResourceCreated;
} base.GraphicsDevice.ResourceDestroyed += GraphicsDevice_ResourceDestroyed;
~VertexBuffer() CreateNativeBuffer();
{ }
Dispose();
base.GraphicsDevice.ResourceCreated -= GraphicsDevice_ResourceCreated;
base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed;
}
#endregion
#region GraphicsDevice_ResourceDestroyed ~VertexBuffer()
private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e) {
{ Dispose();
if (nativeVertexBuffer != null) base.GraphicsDevice.ResourceCreated -= GraphicsDevice_ResourceCreated;
{ base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed;
nativeVertexBuffer.Dispose(); }
nativeVertexBuffer = null; #endregion
}
}
#endregion
#region GraphicsDevice_ResourceCreated #region GraphicsDevice_ResourceDestroyed
private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e) private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e)
{ {
if (nativeVertexBuffer != null) if (nativeVertexBuffer != null)
{ {
nativeVertexBuffer.Dispose(); nativeVertexBuffer.Dispose();
nativeVertexBuffer = null; nativeVertexBuffer = null;
} }
}
#endregion
CreateNativeBuffer(); #region GraphicsDevice_ResourceCreated
} private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e)
#endregion {
if (nativeVertexBuffer != null)
{
nativeVertexBuffer.Dispose();
nativeVertexBuffer = null;
}
#region CreateNativeBuffer CreateNativeBuffer();
private void CreateNativeBuffer() }
{ #endregion
this.nativeVertexBuffer =
AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateVertexBuffer(GraphicsDevice, this, vertexDeclaration, vertexCount, bufferUsage);
}
#endregion
#region GetData #region CreateNativeBuffer
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct private void CreateNativeBuffer()
{ {
throw new NotImplementedException(); this.nativeVertexBuffer =
} AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateVertexBuffer(GraphicsDevice, this, vertexDeclaration, vertexCount, bufferUsage);
}
#endregion
public void GetData<T>(T[] data) where T : struct #region GetData
{ public void GetData<T>(int offsetInBytes, T[] data, int startIndex,
throw new NotImplementedException(); int elementCount, int vertexStride) where T : struct
} {
NativeVertexBuffer.GetData(offsetInBytes, data, startIndex,
elementCount, vertexStride);
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct public void GetData<T>(T[] data) where T : struct
{ {
throw new NotImplementedException(); NativeVertexBuffer.GetData(data);
} }
#endregion
#region SetData public void GetData<T>(T[] data, int startIndex, int elementCount)
public void SetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct where T : struct
{ {
//NativeVertexBuffer.SetData(GraphicsDevice, offsetInBytes, data, startIndex, elementCount, vertexStride); NativeVertexBuffer.GetData(data, startIndex, elementCount);
throw new NotImplementedException(); }
} #endregion
public void SetData<T>(T[] data) where T : struct #region SetData
{ public void SetData<T>(int offsetInBytes, T[] data, int startIndex,
NativeVertexBuffer.SetData(GraphicsDevice, data); int elementCount, int vertexStride) where T : struct
} {
NativeVertexBuffer.SetData(GraphicsDevice, offsetInBytes, data,
startIndex, elementCount, vertexStride);
}
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct public void SetData<T>(T[] data) where T : struct
{ {
NativeVertexBuffer.SetData(GraphicsDevice, data, startIndex, elementCount); NativeVertexBuffer.SetData(GraphicsDevice, data);
} }
#endregion
#region TypeToVertexDeclaration public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
private static VertexDeclaration TypeToVertexDeclaration(Type t) {
{ NativeVertexBuffer.SetData(GraphicsDevice, data, startIndex, elementCount);
IVertexType vt = Activator.CreateInstance(t) as IVertexType; }
if (vt != null) #endregion
{
return vt.VertexDeclaration;
}
return null; #region TypeToVertexDeclaration
} private static VertexDeclaration TypeToVertexDeclaration(Type t)
#endregion {
IVertexType vt = Activator.CreateInstance(t) as IVertexType;
if (vt != null)
{
return vt.VertexDeclaration;
}
#region Dispose return null;
public override void Dispose() }
{ #endregion
if (nativeVertexBuffer != null)
{
nativeVertexBuffer.Dispose();
nativeVertexBuffer = null;
}
if (vertexDeclaration != null) #region Dispose
{ public override void Dispose()
// do not dispose the VertexDeclaration here, because it's only a reference {
vertexDeclaration = null; if (nativeVertexBuffer != null)
} {
} nativeVertexBuffer.Dispose();
nativeVertexBuffer = null;
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) if (vertexDeclaration != null)
{ {
throw new NotImplementedException(); // do not dispose the VertexDeclaration here, because it's only a reference
} vertexDeclaration = null;
#endregion }
} }
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -1,9 +1,6 @@
#region Using Statements using System;
using System;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
#endregion // Using Statements
#region License #region License
// //
@ -51,12 +48,17 @@ using ANX.Framework.Graphics;
#endregion // License #endregion // License
namespace ANX.Framework.NonXNA namespace ANX.Framework.NonXNA.RenderSystem
{ {
public interface INativeBuffer : IDisposable public interface INativeBuffer : IDisposable
{ {
void SetData<T>(GraphicsDevice graphicsDevice, T[] data) where T : struct; void SetData<T>(GraphicsDevice graphicsDevice, T[] data) where T : struct;
void SetData<T>(GraphicsDevice graphicsDevice, T[] data, int startIndex, int elementCount) where T : struct; void SetData<T>(GraphicsDevice graphicsDevice, T[] data, int startIndex,
void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct; int elementCount) where T : struct;
} void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data,
int startIndex, int elementCount) where T : struct;
void GetData<T>(T[] data) where T : struct;
void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct;
}
} }

View File

@ -0,0 +1,58 @@
using System;
using System.IO;
#region License
//
// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
//
// This file is released under the Ms-PL license.
//
//
//
// Microsoft Public License (Ms-PL)
//
// This license governs use of the accompanying software. If you use the software, you accept this license.
// If you do not accept the license, do not use the software.
//
// 1.Definitions
// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
// here as under U.S. copyright law.
// A "contribution" is the original software, or any additions or changes to the software.
// A "contributor" is any person that distributes its contribution under this license.
// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
//
// 2.Grant of Rights
// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
// or any derivative works that you create.
// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
// in the software or derivative works of the contribution in the software.
//
// 3.Conditions and Limitations
// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
// patent license from such contributor to the software ends automatically.
// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
// notices that are present in the software.
// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
// object code form, you may only do so under a license that complies with this license.
// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
// particular purpose and non-infringement.
#endregion // License
namespace ANX.Framework.NonXNA.RenderSystem
{
public interface INativeIndexBuffer : INativeBuffer
{
void GetData<T>(int offsetInBytes, T[] data, int startIndex,
int elementCount) where T : struct;
}
}

View File

@ -1,4 +1,5 @@
using System.IO; using System;
using System.IO;
#region License #region License
@ -53,5 +54,11 @@ namespace ANX.Framework.NonXNA.RenderSystem
{ {
void SaveAsJpeg(Stream stream, int width, int height); void SaveAsJpeg(Stream stream, int width, int height);
void SaveAsPng(Stream stream, int width, int height); void SaveAsPng(Stream stream, int width, int height);
void GetData<T>(int level, Nullable<Rectangle> rect, T[] data,
int startIndex, int elementCount) where T : struct;
void SetData<T>(int level, Nullable<Rectangle> rect, T[] data,
int startIndex, int elementCount) where T : struct;
} }
} }

View File

@ -0,0 +1,62 @@
using System;
using System.IO;
using ANX.Framework.Graphics;
#region License
//
// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
//
// This file is released under the Ms-PL license.
//
//
//
// Microsoft Public License (Ms-PL)
//
// This license governs use of the accompanying software. If you use the software, you accept this license.
// If you do not accept the license, do not use the software.
//
// 1.Definitions
// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
// here as under U.S. copyright law.
// A "contribution" is the original software, or any additions or changes to the software.
// A "contributor" is any person that distributes its contribution under this license.
// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
//
// 2.Grant of Rights
// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
// or any derivative works that you create.
// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
// in the software or derivative works of the contribution in the software.
//
// 3.Conditions and Limitations
// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
// patent license from such contributor to the software ends automatically.
// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
// notices that are present in the software.
// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
// object code form, you may only do so under a license that complies with this license.
// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
// particular purpose and non-infringement.
#endregion // License
namespace ANX.Framework.NonXNA.RenderSystem
{
public interface INativeVertexBuffer : INativeBuffer
{
void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount,
int vertexStride) where T : struct;
void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data,
int startIndex, int elementCount, int vertexStride) where T : struct;
}
}

View File

@ -1,9 +1,7 @@
#region Using Statements #region Using Statements
using System;
using ANX.Framework.Graphics;
using System.IO;
using ANX.Framework.NonXNA;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.RenderSystem; using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -61,18 +59,29 @@ namespace ANX.Framework.NonXNA
{ {
GameHost CreateGameHost(Game game); GameHost CreateGameHost(Game game);
INativeGraphicsDevice CreateGraphicsDevice(PresentationParameters presentationParameters); INativeGraphicsDevice CreateGraphicsDevice(
PresentationParameters presentationParameters);
INativeTexture2D CreateTexture(GraphicsDevice graphics, SurfaceFormat surfaceFormat, int width, int height, int mipCount); INativeTexture2D CreateTexture(GraphicsDevice graphics,
SurfaceFormat surfaceFormat, int width, int height, int mipCount);
INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage); INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics,
int width, int height, bool mipMap, SurfaceFormat preferredFormat,
DepthFormat preferredDepthFormat, int preferredMultiSampleCount,
RenderTargetUsage usage);
INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage); INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
IndexBuffer managedBuffer, IndexElementSize size, int indexCount,
BufferUsage usage);
INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage); INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration,
int vertexCount, BufferUsage usage);
INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream byteCode); INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode); Stream byteCode);
INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
Stream vertexShaderByteCode, Stream pixelShaderByteCode);
INativeBlendState CreateBlendState(); INativeBlendState CreateBlendState();
INativeRasterizerState CreateRasterizerState(); INativeRasterizerState CreateRasterizerState();

View File

@ -1,9 +1,4 @@
#region Using Statements #region License
using System;
#endregion // Using Statements
#region License
// //
// This file is part of the ANX.Framework created by the "ANX.Framework developer group". // This file is part of the ANX.Framework created by the "ANX.Framework developer group".

View File

@ -96,7 +96,7 @@ namespace ANX.Framework.Windows.DX10
return new GraphicsDeviceWindowsDX10(presentationParameters); return new GraphicsDeviceWindowsDX10(presentationParameters);
} }
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage) IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage)
{ {
AddInSystemFactory.Instance.PreventSystemChange( AddInSystemFactory.Instance.PreventSystemChange(
@ -104,7 +104,7 @@ namespace ANX.Framework.Windows.DX10
return new IndexBuffer_DX10(graphics, size, indexCount, usage); return new IndexBuffer_DX10(graphics, size, indexCount, usage);
} }
public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, public INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
{ {
AddInSystemFactory.Instance.PreventSystemChange( AddInSystemFactory.Instance.PreventSystemChange(

View File

@ -7,6 +7,7 @@ using ANX.Framework.NonXNA;
using SharpDX.Direct3D10; using SharpDX.Direct3D10;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -59,7 +60,7 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Windows.DX10 namespace ANX.Framework.Windows.DX10
{ {
public class IndexBuffer_DX10 : INativeBuffer, IDisposable public class IndexBuffer_DX10 : INativeIndexBuffer, IDisposable
{ {
private SharpDX.Direct3D10.Buffer buffer; private SharpDX.Direct3D10.Buffer buffer;
private IndexElementSize size; private IndexElementSize size;
@ -163,5 +164,29 @@ namespace ANX.Framework.Windows.DX10
buffer = null; buffer = null;
} }
} }
}
#region INativeIndexBuffer Member
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -326,5 +326,35 @@ namespace ANX.Framework.Windows.DX10
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
}
#region INativeTexture2D Member
public void GetData<T>(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -7,6 +7,7 @@ using ANX.Framework.NonXNA;
using SharpDX.Direct3D10; using SharpDX.Direct3D10;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -59,7 +60,7 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Windows.DX10 namespace ANX.Framework.Windows.DX10
{ {
public class VertexBuffer_DX10 : INativeBuffer, IDisposable public class VertexBuffer_DX10 : INativeVertexBuffer, IDisposable
{ {
SharpDX.Direct3D10.Buffer buffer; SharpDX.Direct3D10.Buffer buffer;
int vertexStride; int vertexStride;
@ -164,5 +165,34 @@ namespace ANX.Framework.Windows.DX10
buffer = null; buffer = null;
} }
} }
}
#region INativeVertexBuffer Member
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -172,7 +172,7 @@ namespace ANX.Framework.Windows.GL3
/// </param> /// </param>
/// <param name="usage">The usage type of the buffer.</param> /// <param name="usage">The usage type of the buffer.</param>
/// <returns>Native OpenGL index buffer.</returns> /// <returns>Native OpenGL index buffer.</returns>
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
IndexBuffer managedBuffer, IndexElementSize size, int indexCount, IndexBuffer managedBuffer, IndexElementSize size, int indexCount,
BufferUsage usage) BufferUsage usage)
{ {
@ -191,7 +191,7 @@ namespace ANX.Framework.Windows.GL3
/// </param> /// </param>
/// <param name="usage">The usage type of the buffer.</param> /// <param name="usage">The usage type of the buffer.</param>
/// <returns>Native OpenGL vertex buffer.</returns> /// <returns>Native OpenGL vertex buffer.</returns>
public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, public INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration,
int vertexCount, BufferUsage usage) int vertexCount, BufferUsage usage)
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA.RenderSystem;
using ANX.Framework.Windows.GL3.Helpers; using ANX.Framework.Windows.GL3.Helpers;
using OpenTK.Graphics.OpenGL; using OpenTK.Graphics.OpenGL;
@ -56,7 +56,7 @@ namespace ANX.Framework.Windows.GL3
/// <summary> /// <summary>
/// Native OpenGL implementation of a Index Buffer. /// Native OpenGL implementation of a Index Buffer.
/// </summary> /// </summary>
public class IndexBufferGL3 : INativeBuffer public class IndexBufferGL3 : INativeIndexBuffer
{ {
#region Private #region Private
private IndexBuffer managedBuffer; private IndexBuffer managedBuffer;
@ -188,6 +188,25 @@ namespace ANX.Framework.Windows.GL3
} }
#endregion #endregion
#region GetData (TODO)
public void GetData<T>(int offsetInBytes, T[] data, int startIndex,
int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount)
where T : struct
{
throw new NotImplementedException();
}
#endregion
#region BufferData (private helper) #region BufferData (private helper)
private void BufferData<T>(T[] data, int offset) where T : struct private void BufferData<T>(T[] data, int offset) where T : struct
{ {

View File

@ -276,6 +276,31 @@ namespace ANX.Framework.Windows.GL3
} }
#endregion #endregion
#region GetData (TODO)
public void GetData<T>(int level, Rectangle? rect, T[] data, int startIndex,
int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(int level, Rectangle? rect, T[] data, int startIndex,
int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount)
where T : struct
{
throw new NotImplementedException();
}
#endregion
#region GetTextureData #region GetTextureData
private void GetTextureData() private void GetTextureData()
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA.RenderSystem;
using ANX.Framework.Windows.GL3.Helpers; using ANX.Framework.Windows.GL3.Helpers;
using OpenTK.Graphics.OpenGL; using OpenTK.Graphics.OpenGL;
@ -59,7 +59,7 @@ namespace ANX.Framework.Windows.GL3
/// Great tutorial about VBO/IBO directly for OpenTK: /// Great tutorial about VBO/IBO directly for OpenTK:
/// http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects /// http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects
/// </summary> /// </summary>
public class VertexBufferGL3 : INativeBuffer public class VertexBufferGL3 : INativeVertexBuffer
{ {
#region Private #region Private
private VertexBuffer managedBuffer; private VertexBuffer managedBuffer;
@ -191,6 +191,33 @@ namespace ANX.Framework.Windows.GL3
} }
#endregion #endregion
#region SetData (TODO)
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes,
T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region GetData (TODO)
public void GetData<T>(int offsetInBytes, T[] data, int startIndex,
int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount)
where T : struct
{
throw new NotImplementedException();
}
#endregion
#region BufferData (private helper) #region BufferData (private helper)
private void BufferData<T>(T[] data, int offset) where T : struct private void BufferData<T>(T[] data, int offset) where T : struct
{ {

View File

@ -97,7 +97,7 @@ namespace ANX.RenderSystem.Windows.DX11
return new GraphicsDeviceWindowsDX11(presentationParameters); return new GraphicsDeviceWindowsDX11(presentationParameters);
} }
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage) IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage)
{ {
AddInSystemFactory.Instance.PreventSystemChange( AddInSystemFactory.Instance.PreventSystemChange(
@ -105,7 +105,7 @@ namespace ANX.RenderSystem.Windows.DX11
return new IndexBuffer_DX11(graphics, size, indexCount, usage); return new IndexBuffer_DX11(graphics, size, indexCount, usage);
} }
public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, public INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
{ {
AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem); AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);

View File

@ -7,6 +7,7 @@ using ANX.Framework.NonXNA;
using SharpDX.Direct3D11; using SharpDX.Direct3D11;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -59,7 +60,7 @@ using System.Runtime.InteropServices;
namespace ANX.RenderSystem.Windows.DX11 namespace ANX.RenderSystem.Windows.DX11
{ {
public class IndexBuffer_DX11 : INativeBuffer, IDisposable public class IndexBuffer_DX11 : INativeIndexBuffer, IDisposable
{ {
private SharpDX.Direct3D11.Buffer buffer; private SharpDX.Direct3D11.Buffer buffer;
private IndexElementSize size; private IndexElementSize size;
@ -164,5 +165,29 @@ namespace ANX.RenderSystem.Windows.DX11
buffer = null; buffer = null;
} }
} }
}
#region INativeIndexBuffer Member
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -326,5 +326,35 @@ namespace ANX.RenderSystem.Windows.DX11
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
}
#region INativeTexture2D Member
public void GetData<T>(int level, Framework.Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(int level, Framework.Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -7,6 +7,7 @@ using ANX.Framework.NonXNA;
using SharpDX.Direct3D11; using SharpDX.Direct3D11;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -59,7 +60,7 @@ using System.Runtime.InteropServices;
namespace ANX.RenderSystem.Windows.DX11 namespace ANX.RenderSystem.Windows.DX11
{ {
public class VertexBuffer_DX11 : INativeBuffer, IDisposable public class VertexBuffer_DX11 : INativeVertexBuffer, IDisposable
{ {
SharpDX.Direct3D11.Buffer buffer; SharpDX.Direct3D11.Buffer buffer;
int vertexStride; int vertexStride;
@ -165,5 +166,34 @@ namespace ANX.RenderSystem.Windows.DX11
buffer = null; buffer = null;
} }
} }
}
#region INativeVertexBuffer Member
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
}
} }

View File

@ -92,13 +92,13 @@ namespace ANX.Framework.Windows.DX10
return new GraphicsDeviceWindowsDX10(presentationParameters); return new GraphicsDeviceWindowsDX10(presentationParameters);
} }
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage) IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage)
{ {
return new IndexBuffer_DX10(graphics, size, indexCount, usage); return new IndexBuffer_DX10(graphics, size, indexCount, usage);
} }
public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, public INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
{ {
return new VertexBuffer_DX10(graphics, vertexDeclaration, vertexCount, usage); return new VertexBuffer_DX10(graphics, vertexDeclaration, vertexCount, usage);

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.RenderSystem;
using SharpDX.Direct3D10; using SharpDX.Direct3D10;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -59,7 +60,7 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Windows.DX10 namespace ANX.Framework.Windows.DX10
{ {
public class IndexBuffer_DX10 : INativeBuffer, IDisposable public class IndexBuffer_DX10 : INativeIndexBuffer, IDisposable
{ {
private SharpDX.Direct3D10.Buffer buffer; private SharpDX.Direct3D10.Buffer buffer;
private IndexElementSize size; private IndexElementSize size;
@ -148,6 +149,30 @@ namespace ANX.Framework.Windows.DX10
buffer.Dispose(); buffer.Dispose();
buffer = null; buffer = null;
} }
} }
#region INativeIndexBuffer Member
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
} }
} }

View File

@ -326,5 +326,35 @@ namespace ANX.Framework.Windows.DX10
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region INativeTexture2D Member
public void GetData<T>(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
} }
} }

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.RenderSystem;
using SharpDX.Direct3D10; using SharpDX.Direct3D10;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -59,7 +60,7 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Windows.DX10 namespace ANX.Framework.Windows.DX10
{ {
public class VertexBuffer_DX10 : INativeBuffer, IDisposable public class VertexBuffer_DX10 : INativeVertexBuffer, IDisposable
{ {
SharpDX.Direct3D10.Buffer buffer; SharpDX.Direct3D10.Buffer buffer;
int vertexStride; int vertexStride;
@ -153,6 +154,35 @@ namespace ANX.Framework.Windows.DX10
buffer.Dispose(); buffer.Dispose();
buffer = null; buffer = null;
} }
} }
#region INativeVertexBuffer Member
public void GetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
throw new NotImplementedException();
}
#endregion
#region INativeBuffer Member
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
} }
} }