diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj index 36d05077..0a2645c0 100644 --- a/ANX.Framework/ANX.Framework.csproj +++ b/ANX.Framework/ANX.Framework.csproj @@ -441,6 +441,8 @@ + + diff --git a/ANX.Framework/Graphics/BlendState.cs b/ANX.Framework/Graphics/BlendState.cs index ec4caf23..d1a781fe 100644 --- a/ANX.Framework/Graphics/BlendState.cs +++ b/ANX.Framework/Graphics/BlendState.cs @@ -1,10 +1,7 @@ #region Using Statements using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ANX.Framework.NonXNA; using System.Runtime.InteropServices; +using ANX.Framework.NonXNA; #endregion // Using Statements diff --git a/ANX.Framework/Graphics/DeviceLostException.cs b/ANX.Framework/Graphics/DeviceLostException.cs index 43847961..8353d7a0 100644 --- a/ANX.Framework/Graphics/DeviceLostException.cs +++ b/ANX.Framework/Graphics/DeviceLostException.cs @@ -1,12 +1,4 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ANX.Framework.NonXNA; -using ANX.Framework.Graphics; - -#endregion // Using Statements +using System; #region License @@ -57,22 +49,21 @@ using ANX.Framework.Graphics; namespace ANX.Framework.Graphics { - public sealed class DeviceLostException : Exception - { - public DeviceLostException() - : base() - { - } + public sealed class DeviceLostException : Exception + { + public DeviceLostException() + : base() + { + } - public DeviceLostException(string message) - : base(message) - { - } + public DeviceLostException(string message) + : base(message) + { + } - public DeviceLostException(string message, Exception innerException) - : base(message, innerException) - { - } - - } + public DeviceLostException(string message, Exception innerException) + : base(message, innerException) + { + } + } } diff --git a/ANX.Framework/Graphics/DeviceNotResetException.cs b/ANX.Framework/Graphics/DeviceNotResetException.cs index b5c437fe..e359009a 100644 --- a/ANX.Framework/Graphics/DeviceNotResetException.cs +++ b/ANX.Framework/Graphics/DeviceNotResetException.cs @@ -1,12 +1,4 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ANX.Framework.NonXNA; -using ANX.Framework.Graphics; - -#endregion // Using Statements +using System; #region License @@ -57,22 +49,21 @@ using ANX.Framework.Graphics; namespace ANX.Framework.Graphics { - public sealed class DeviceNotResetException : Exception - { - public DeviceNotResetException() - : base() - { - } + public sealed class DeviceNotResetException : Exception + { + public DeviceNotResetException() + : base() + { + } - public DeviceNotResetException(string message) - : base(message) - { - } + public DeviceNotResetException(string message) + : base(message) + { + } - public DeviceNotResetException(string message, Exception innerException) - : base(message, innerException) - { - } - - } + public DeviceNotResetException(string message, Exception innerException) + : base(message, innerException) + { + } + } } diff --git a/ANX.Framework/Graphics/IndexBuffer.cs b/ANX.Framework/Graphics/IndexBuffer.cs index b525fa1c..33e8e1b1 100644 --- a/ANX.Framework/Graphics/IndexBuffer.cs +++ b/ANX.Framework/Graphics/IndexBuffer.cs @@ -1,12 +1,8 @@ -#region Using Statements -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ANX.Framework.NonXNA; +using System; using System.Runtime.InteropServices; - -#endregion // Using Statements +using ANX.Framework.NonXNA; +using ANX.Framework.NonXNA.Development; +using ANX.Framework.NonXNA.RenderSystem; #region License @@ -57,172 +53,190 @@ using System.Runtime.InteropServices; namespace ANX.Framework.Graphics { - public class IndexBuffer : GraphicsResource, IGraphicsResource - { - private int indexCount; - private BufferUsage bufferUsage; - private IndexElementSize indexElementSize; - private INativeBuffer nativeIndexBuffer; - - public IndexBuffer(GraphicsDevice graphicsDevice, IndexElementSize indexElementSize, int indexCount, BufferUsage usage) - : 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 = 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().CreateIndexBuffer(GraphicsDevice, this, indexElementSize, indexCount, bufferUsage); - } - - public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct - { - throw new NotImplementedException(); - } - - public void GetData(T[] data) where T : struct - { - GetData(0, data, 0, data.Length); - } - - public void GetData(T[] data, int startIndex, int elementCount) where T : struct - { - GetData(0, data, startIndex, elementCount); - } - - public void SetData(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct - { - if (nativeIndexBuffer == null) - { - CreateNativeBuffer(); - } - - this.nativeIndexBuffer.SetData(GraphicsDevice, offsetInBytes, data, startIndex, elementCount); - } - - public void SetData(T[] data) where T : struct - { - if (nativeIndexBuffer == null) - { - CreateNativeBuffer(); - } - - this.nativeIndexBuffer.SetData(GraphicsDevice, data); - } - - public void SetData(T[] data, int startIndex, int elementCount) where T : struct - { - SetData(0, data, startIndex, elementCount); - } - - public override void Dispose() - { - if (this.nativeIndexBuffer != null) - { - this.nativeIndexBuffer.Dispose(); - this.nativeIndexBuffer = null; - } - } + [PercentageComplete(100)] + [TestState(TestStateAttribute.TestState.Untested)] + public class IndexBuffer : GraphicsResource, IGraphicsResource + { + #region Private + private int indexCount; + private BufferUsage bufferUsage; + private IndexElementSize indexElementSize; + private INativeIndexBuffer nativeIndexBuffer; + #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 INativeBuffer NativeIndexBuffer - { - get - { - if (nativeIndexBuffer == null) - { - CreateNativeBuffer(); - } + internal INativeIndexBuffer NativeIndexBuffer + { + get + { + if (nativeIndexBuffer == null) + { + CreateNativeBuffer(); + } - return this.nativeIndexBuffer; - } - } + return this.nativeIndexBuffer; + } + } - public BufferUsage BufferUsage - { - get - { - return this.bufferUsage; - } - } + public BufferUsage BufferUsage + { + get + { + return this.bufferUsage; + } + } - public int IndexCount - { - get - { - return this.indexCount; - } - } + public int IndexCount + { + get + { + return this.indexCount; + } + } - public IndexElementSize IndexElementSize - { - get - { - return this.indexElementSize; - } - } + public IndexElementSize IndexElementSize + { + get + { + return this.indexElementSize; + } + } + #endregion - protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) - { - throw new NotImplementedException(); - } - } + #region Constructor + public IndexBuffer(GraphicsDevice graphicsDevice, IndexElementSize indexElementSize, int indexCount, BufferUsage usage) + : 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().CreateIndexBuffer(GraphicsDevice, this, indexElementSize, indexCount, bufferUsage); + } + #endregion + + #region GetData + public void GetData(int offsetInBytes, T[] data, int startIndex, + int elementCount) where T : struct + { + NativeIndexBuffer.GetData(offsetInBytes, data, startIndex, elementCount); + } + + public void GetData(T[] data) where T : struct + { + NativeIndexBuffer.GetData(data); + } + + public void GetData(T[] data, int startIndex, int elementCount) + where T : struct + { + NativeIndexBuffer.GetData(data, startIndex, elementCount); + } + #endregion + + #region SetData + public void SetData(int offsetInBytes, T[] data, int startIndex, + int elementCount) where T : struct + { + NativeIndexBuffer.SetData(GraphicsDevice, offsetInBytes, data, + startIndex, elementCount); + } + + public void SetData(T[] data) where T : struct + { + NativeIndexBuffer.SetData(GraphicsDevice, data); + } + + public void SetData(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 + } } diff --git a/ANX.Framework/Graphics/Texture2D.cs b/ANX.Framework/Graphics/Texture2D.cs index b4aa10be..5ccd3da8 100644 --- a/ANX.Framework/Graphics/Texture2D.cs +++ b/ANX.Framework/Graphics/Texture2D.cs @@ -1,9 +1,9 @@ #region Using Statements using System; using System.IO; -using ANX.Framework.NonXNA.RenderSystem; -using ANX.Framework.NonXNA; using System.Runtime.InteropServices; +using ANX.Framework.NonXNA; +using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -63,6 +63,18 @@ namespace ANX.Framework.Graphics protected internal int height; private INativeTexture2D nativeTexture2D; + private INativeTexture2D NativeTexture2D + { + get + { + if (nativeTexture2D == null) + { + CreateNativeTextureSurface(); + } + + return nativeTexture2D; + } + } #endregion #region Public @@ -91,7 +103,7 @@ namespace ANX.Framework.Graphics } #endregion - #region Constructor + #region Constructor (TODO) internal Texture2D(GraphicsDevice graphicsDevice) : base(graphicsDevice) { @@ -109,7 +121,8 @@ namespace ANX.Framework.Graphics 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) { this.width = width; @@ -123,38 +136,43 @@ namespace ANX.Framework.Graphics #endregion #region FromStream (TODO) - public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream) + public static Texture2D FromStream(GraphicsDevice graphicsDevice, + Stream stream) { 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(); } #endregion - #region GetData (TODO) - public void GetData(int level, Nullable rect, T[] data, int startIndex, int elementCount) where T : struct + #region GetData + public void GetData(int level, Nullable rect, T[] data, + int startIndex, int elementCount) where T : struct { - throw new NotImplementedException(); + NativeTexture2D.GetData(level, rect, data, startIndex, elementCount); } public void GetData(T[] data) where T : struct - { - throw new NotImplementedException(); + { + NativeTexture.GetData(data); } public void GetData(T[] data, int startIndex, int elementCount) where T : struct { - throw new NotImplementedException(); + NativeTexture.GetData(data, startIndex, elementCount); } #endregion - #region SetData (TODO) - public void SetData(int level, Nullable rect, T[] data, int startIndex, int elementCount) where T : struct - { - throw new NotImplementedException(); + #region SetData + public void SetData(int level, Nullable rect, T[] data, + int startIndex, int elementCount) where T : struct + { + NativeTexture2D.SetData(level, rect, data, startIndex, elementCount); } public void SetData(T[] data) where T : struct @@ -171,14 +189,14 @@ namespace ANX.Framework.Graphics #region SaveAsJpeg public void SaveAsJpeg(Stream stream, int width, int height) { - nativeTexture2D.SaveAsJpeg(stream, width, height); + NativeTexture2D.SaveAsJpeg(stream, width, height); } #endregion #region SaveAsPng public void SaveAsPng(Stream stream, int width, int height) { - nativeTexture2D.SaveAsPng(stream, width, height); + NativeTexture2D.SaveAsPng(stream, width, height); } #endregion diff --git a/ANX.Framework/Graphics/VertexBuffer.cs b/ANX.Framework/Graphics/VertexBuffer.cs index ba5b24a8..ac7d45a2 100644 --- a/ANX.Framework/Graphics/VertexBuffer.cs +++ b/ANX.Framework/Graphics/VertexBuffer.cs @@ -1,9 +1,8 @@ -#region Using Statements -using System; +using System; using System.Runtime.InteropServices; using ANX.Framework.NonXNA; - -#endregion // Using Statements +using ANX.Framework.NonXNA.Development; +using ANX.Framework.NonXNA.RenderSystem; #region License @@ -54,183 +53,192 @@ using ANX.Framework.NonXNA; 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 - private VertexDeclaration vertexDeclaration; - private int vertexCount; - 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 + { + if (this.nativeVertexBuffer == null) { - get - { - if (this.nativeVertexBuffer == null) - { - CreateNativeBuffer(); - } - - return this.nativeVertexBuffer; - } + CreateNativeBuffer(); } - public BufferUsage BufferUsage - { - get - { - return this.bufferUsage; - } - } + return this.nativeVertexBuffer; + } + } - public int VertexCount - { - get - { - return this.vertexCount; - } - } + public BufferUsage BufferUsage + { + get + { + return this.bufferUsage; + } + } - public VertexDeclaration VertexDeclaration - { - get - { - return this.vertexDeclaration; - } - } - #endregion + public int VertexCount + { + get + { + return this.vertexCount; + } + } - #region Constructor - public VertexBuffer(GraphicsDevice graphicsDevice, Type vertexType, int vertexCount, BufferUsage usage) - : this(graphicsDevice, VertexBuffer.TypeToVertexDeclaration(vertexType), vertexCount, usage) - { - } + public VertexDeclaration VertexDeclaration + { + get + { + return this.vertexDeclaration; + } + } + #endregion - public VertexBuffer(GraphicsDevice graphicsDevice, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) - : base(graphicsDevice) - { - this.vertexCount = vertexCount; - this.vertexDeclaration = vertexDeclaration; - this.bufferUsage = usage; + #region Constructor + public VertexBuffer(GraphicsDevice graphicsDevice, Type vertexType, + int vertexCount, BufferUsage usage) + : this(graphicsDevice, VertexBuffer.TypeToVertexDeclaration(vertexType), + vertexCount, usage) + { + } - base.GraphicsDevice.ResourceCreated += GraphicsDevice_ResourceCreated; - base.GraphicsDevice.ResourceDestroyed += GraphicsDevice_ResourceDestroyed; + public VertexBuffer(GraphicsDevice graphicsDevice, + 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() - { - Dispose(); - base.GraphicsDevice.ResourceCreated -= GraphicsDevice_ResourceCreated; - base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed; - } - #endregion + CreateNativeBuffer(); + } - #region GraphicsDevice_ResourceDestroyed - private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e) - { - if (nativeVertexBuffer != null) - { - nativeVertexBuffer.Dispose(); - nativeVertexBuffer = null; - } - } - #endregion + ~VertexBuffer() + { + Dispose(); + base.GraphicsDevice.ResourceCreated -= GraphicsDevice_ResourceCreated; + base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed; + } + #endregion - #region GraphicsDevice_ResourceCreated - private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e) - { - if (nativeVertexBuffer != null) - { - nativeVertexBuffer.Dispose(); - nativeVertexBuffer = null; - } + #region GraphicsDevice_ResourceDestroyed + private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e) + { + if (nativeVertexBuffer != null) + { + nativeVertexBuffer.Dispose(); + nativeVertexBuffer = null; + } + } + #endregion - CreateNativeBuffer(); - } - #endregion + #region GraphicsDevice_ResourceCreated + private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e) + { + if (nativeVertexBuffer != null) + { + nativeVertexBuffer.Dispose(); + nativeVertexBuffer = null; + } - #region CreateNativeBuffer - private void CreateNativeBuffer() - { - this.nativeVertexBuffer = - AddInSystemFactory.Instance.GetDefaultCreator().CreateVertexBuffer(GraphicsDevice, this, vertexDeclaration, vertexCount, bufferUsage); - } - #endregion + CreateNativeBuffer(); + } + #endregion - #region GetData - public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct - { - throw new NotImplementedException(); - } + #region CreateNativeBuffer + private void CreateNativeBuffer() + { + this.nativeVertexBuffer = + AddInSystemFactory.Instance.GetDefaultCreator().CreateVertexBuffer(GraphicsDevice, this, vertexDeclaration, vertexCount, bufferUsage); + } + #endregion - public void GetData(T[] data) where T : struct - { - throw new NotImplementedException(); - } + #region GetData + public void GetData(int offsetInBytes, T[] data, int startIndex, + int elementCount, int vertexStride) where T : struct + { + NativeVertexBuffer.GetData(offsetInBytes, data, startIndex, + elementCount, vertexStride); + } - public void GetData(T[] data, int startIndex, int elementCount) where T : struct - { - throw new NotImplementedException(); - } - #endregion + public void GetData(T[] data) where T : struct + { + NativeVertexBuffer.GetData(data); + } - #region SetData - public void SetData(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct - { - //NativeVertexBuffer.SetData(GraphicsDevice, offsetInBytes, data, startIndex, elementCount, vertexStride); - throw new NotImplementedException(); - } + public void GetData(T[] data, int startIndex, int elementCount) + where T : struct + { + NativeVertexBuffer.GetData(data, startIndex, elementCount); + } + #endregion - public void SetData(T[] data) where T : struct - { - NativeVertexBuffer.SetData(GraphicsDevice, data); - } + #region SetData + public void SetData(int offsetInBytes, T[] data, int startIndex, + int elementCount, int vertexStride) where T : struct + { + NativeVertexBuffer.SetData(GraphicsDevice, offsetInBytes, data, + startIndex, elementCount, vertexStride); + } - public void SetData(T[] data, int startIndex, int elementCount) where T : struct - { - NativeVertexBuffer.SetData(GraphicsDevice, data, startIndex, elementCount); - } - #endregion + public void SetData(T[] data) where T : struct + { + NativeVertexBuffer.SetData(GraphicsDevice, data); + } - #region TypeToVertexDeclaration - private static VertexDeclaration TypeToVertexDeclaration(Type t) - { - IVertexType vt = Activator.CreateInstance(t) as IVertexType; - if (vt != null) - { - return vt.VertexDeclaration; - } + public void SetData(T[] data, int startIndex, int elementCount) where T : struct + { + NativeVertexBuffer.SetData(GraphicsDevice, data, startIndex, elementCount); + } + #endregion - return null; - } - #endregion + #region TypeToVertexDeclaration + private static VertexDeclaration TypeToVertexDeclaration(Type t) + { + IVertexType vt = Activator.CreateInstance(t) as IVertexType; + if (vt != null) + { + return vt.VertexDeclaration; + } - #region Dispose - public override void Dispose() - { - if (nativeVertexBuffer != null) - { - nativeVertexBuffer.Dispose(); - nativeVertexBuffer = null; - } + return null; + } + #endregion - if (vertexDeclaration != null) - { - // do not dispose the VertexDeclaration here, because it's only a reference - vertexDeclaration = null; - } - } + #region Dispose + public override void Dispose() + { + if (nativeVertexBuffer != null) + { + nativeVertexBuffer.Dispose(); + nativeVertexBuffer = null; + } - protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) - { - throw new NotImplementedException(); - } - #endregion - } + if (vertexDeclaration != null) + { + // do not dispose the VertexDeclaration here, because it's only a reference + vertexDeclaration = null; + } + } + + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) + { + throw new NotImplementedException(); + } + #endregion + } } diff --git a/ANX.Framework/NonXNA/RenderSystem/INativeBuffer.cs b/ANX.Framework/NonXNA/RenderSystem/INativeBuffer.cs index 4edbe226..dc4069ba 100644 --- a/ANX.Framework/NonXNA/RenderSystem/INativeBuffer.cs +++ b/ANX.Framework/NonXNA/RenderSystem/INativeBuffer.cs @@ -1,9 +1,6 @@ -#region Using Statements -using System; +using System; using ANX.Framework.Graphics; -#endregion // Using Statements - #region License // @@ -51,12 +48,17 @@ using ANX.Framework.Graphics; #endregion // License -namespace ANX.Framework.NonXNA +namespace ANX.Framework.NonXNA.RenderSystem { - public interface INativeBuffer : IDisposable - { - void SetData(GraphicsDevice graphicsDevice, T[] data) where T : struct; - void SetData(GraphicsDevice graphicsDevice, T[] data, int startIndex, int elementCount) where T : struct; - void SetData(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct; - } + public interface INativeBuffer : IDisposable + { + void SetData(GraphicsDevice graphicsDevice, T[] data) where T : struct; + void SetData(GraphicsDevice graphicsDevice, T[] data, int startIndex, + int elementCount) where T : struct; + void SetData(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, + int startIndex, int elementCount) where T : struct; + + void GetData(T[] data) where T : struct; + void GetData(T[] data, int startIndex, int elementCount) where T : struct; + } } diff --git a/ANX.Framework/NonXNA/RenderSystem/INativeIndexBuffer.cs b/ANX.Framework/NonXNA/RenderSystem/INativeIndexBuffer.cs new file mode 100644 index 00000000..a7585629 --- /dev/null +++ b/ANX.Framework/NonXNA/RenderSystem/INativeIndexBuffer.cs @@ -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(int offsetInBytes, T[] data, int startIndex, + int elementCount) where T : struct; + } +} diff --git a/ANX.Framework/NonXNA/RenderSystem/INativeTexture2D.cs b/ANX.Framework/NonXNA/RenderSystem/INativeTexture2D.cs index 59f5b796..2a367d82 100644 --- a/ANX.Framework/NonXNA/RenderSystem/INativeTexture2D.cs +++ b/ANX.Framework/NonXNA/RenderSystem/INativeTexture2D.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; #region License @@ -53,5 +54,11 @@ namespace ANX.Framework.NonXNA.RenderSystem { void SaveAsJpeg(Stream stream, int width, int height); void SaveAsPng(Stream stream, int width, int height); + + void GetData(int level, Nullable rect, T[] data, + int startIndex, int elementCount) where T : struct; + + void SetData(int level, Nullable rect, T[] data, + int startIndex, int elementCount) where T : struct; } } diff --git a/ANX.Framework/NonXNA/RenderSystem/INativeVertexBuffer.cs b/ANX.Framework/NonXNA/RenderSystem/INativeVertexBuffer.cs new file mode 100644 index 00000000..f75d42f6 --- /dev/null +++ b/ANX.Framework/NonXNA/RenderSystem/INativeVertexBuffer.cs @@ -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(int offsetInBytes, T[] data, int startIndex, int elementCount, + int vertexStride) where T : struct; + + void SetData(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, + int startIndex, int elementCount, int vertexStride) where T : struct; + } +} diff --git a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs index 4cc7b416..b2adb56a 100644 --- a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs +++ b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs @@ -1,9 +1,7 @@ #region Using Statements -using System; -using ANX.Framework.Graphics; -using System.IO; -using ANX.Framework.NonXNA; using System.Collections.ObjectModel; +using System.IO; +using ANX.Framework.Graphics; using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -61,18 +59,29 @@ namespace ANX.Framework.NonXNA { 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, Stream vertexShaderByteCode, Stream pixelShaderByteCode); + INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, + Stream byteCode); + INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, + Stream vertexShaderByteCode, Stream pixelShaderByteCode); INativeBlendState CreateBlendState(); INativeRasterizerState CreateRasterizerState(); diff --git a/ANX.Framework/NonXNA/RenderSystem/PreDefinedShader.cs b/ANX.Framework/NonXNA/RenderSystem/PreDefinedShader.cs index 7ce7cc87..1783b63b 100644 --- a/ANX.Framework/NonXNA/RenderSystem/PreDefinedShader.cs +++ b/ANX.Framework/NonXNA/RenderSystem/PreDefinedShader.cs @@ -1,9 +1,4 @@ -#region Using Statements -using System; - -#endregion // Using Statements - -#region License +#region License // // This file is part of the ANX.Framework created by the "ANX.Framework developer group". diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs index e745d830..7bb12e94 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs @@ -96,7 +96,7 @@ namespace ANX.Framework.Windows.DX10 return new GraphicsDeviceWindowsDX10(presentationParameters); } - public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, + public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage) { AddInSystemFactory.Instance.PreventSystemChange( @@ -104,7 +104,7 @@ namespace ANX.Framework.Windows.DX10 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) { AddInSystemFactory.Instance.PreventSystemChange( diff --git a/RenderSystems/ANX.Framework.Windows.DX10/IndexBuffer_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/IndexBuffer_DX10.cs index cacc49f5..cdb0433c 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/IndexBuffer_DX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/IndexBuffer_DX10.cs @@ -7,6 +7,7 @@ using ANX.Framework.NonXNA; using SharpDX.Direct3D10; using ANX.Framework.Graphics; using System.Runtime.InteropServices; +using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -59,7 +60,7 @@ using System.Runtime.InteropServices; namespace ANX.Framework.Windows.DX10 { - public class IndexBuffer_DX10 : INativeBuffer, IDisposable + public class IndexBuffer_DX10 : INativeIndexBuffer, IDisposable { private SharpDX.Direct3D10.Buffer buffer; private IndexElementSize size; @@ -163,5 +164,29 @@ namespace ANX.Framework.Windows.DX10 buffer = null; } } - } + + #region INativeIndexBuffer Member + + public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeBuffer Member + + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs index 4d2dc9d5..1cb287fa 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs @@ -326,5 +326,35 @@ namespace ANX.Framework.Windows.DX10 throw new NotImplementedException(); } #endregion - } + + #region INativeTexture2D Member + + + public void GetData(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeBuffer Member + + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.Framework.Windows.DX10/VertexBuffer_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/VertexBuffer_DX10.cs index f53c6025..b4b0acf7 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/VertexBuffer_DX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/VertexBuffer_DX10.cs @@ -7,6 +7,7 @@ using ANX.Framework.NonXNA; using SharpDX.Direct3D10; using ANX.Framework.Graphics; using System.Runtime.InteropServices; +using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -59,7 +60,7 @@ using System.Runtime.InteropServices; namespace ANX.Framework.Windows.DX10 { - public class VertexBuffer_DX10 : INativeBuffer, IDisposable + public class VertexBuffer_DX10 : INativeVertexBuffer, IDisposable { SharpDX.Direct3D10.Buffer buffer; int vertexStride; @@ -164,5 +165,34 @@ namespace ANX.Framework.Windows.DX10 buffer = null; } } - } + + #region INativeVertexBuffer Member + + public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(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[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs index aa1651ca..28c31b96 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs @@ -172,7 +172,7 @@ namespace ANX.Framework.Windows.GL3 /// /// The usage type of the buffer. /// Native OpenGL index buffer. - public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, + public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage) { @@ -191,7 +191,7 @@ namespace ANX.Framework.Windows.GL3 /// /// The usage type of the buffer. /// Native OpenGL vertex buffer. - public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, + public INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { diff --git a/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs index 1e9bc4b2..bdf1414a 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs @@ -1,6 +1,6 @@ using System; using ANX.Framework.Graphics; -using ANX.Framework.NonXNA; +using ANX.Framework.NonXNA.RenderSystem; using ANX.Framework.Windows.GL3.Helpers; using OpenTK.Graphics.OpenGL; @@ -56,7 +56,7 @@ namespace ANX.Framework.Windows.GL3 /// /// Native OpenGL implementation of a Index Buffer. /// - public class IndexBufferGL3 : INativeBuffer + public class IndexBufferGL3 : INativeIndexBuffer { #region Private private IndexBuffer managedBuffer; @@ -188,6 +188,25 @@ namespace ANX.Framework.Windows.GL3 } #endregion + #region GetData (TODO) + public void GetData(int offsetInBytes, T[] data, int startIndex, + int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) + where T : struct + { + throw new NotImplementedException(); + } + #endregion + #region BufferData (private helper) private void BufferData(T[] data, int offset) where T : struct { diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs index bb6b33a9..1cadfb0a 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs @@ -276,6 +276,31 @@ namespace ANX.Framework.Windows.GL3 } #endregion + #region GetData (TODO) + public void GetData(int level, Rectangle? rect, T[] data, int startIndex, + int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(int level, Rectangle? rect, T[] data, int startIndex, + int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) + where T : struct + { + throw new NotImplementedException(); + } + #endregion + #region GetTextureData private void GetTextureData() { diff --git a/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs index c1eeab32..69953106 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs @@ -1,6 +1,6 @@ using System; using ANX.Framework.Graphics; -using ANX.Framework.NonXNA; +using ANX.Framework.NonXNA.RenderSystem; using ANX.Framework.Windows.GL3.Helpers; using OpenTK.Graphics.OpenGL; @@ -59,7 +59,7 @@ namespace ANX.Framework.Windows.GL3 /// Great tutorial about VBO/IBO directly for OpenTK: /// http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects /// - public class VertexBufferGL3 : INativeBuffer + public class VertexBufferGL3 : INativeVertexBuffer { #region Private private VertexBuffer managedBuffer; @@ -191,6 +191,33 @@ namespace ANX.Framework.Windows.GL3 } #endregion + #region SetData (TODO) + public void SetData(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(int offsetInBytes, T[] data, int startIndex, + int elementCount, int vertexStride) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) + where T : struct + { + throw new NotImplementedException(); + } + #endregion + #region BufferData (private helper) private void BufferData(T[] data, int offset) where T : struct { diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs index f5d94edd..cb5ce043 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs @@ -97,7 +97,7 @@ namespace ANX.RenderSystem.Windows.DX11 return new GraphicsDeviceWindowsDX11(presentationParameters); } - public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, + public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage usage) { AddInSystemFactory.Instance.PreventSystemChange( @@ -105,7 +105,7 @@ namespace ANX.RenderSystem.Windows.DX11 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) { AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem); diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/IndexBuffer_DX11.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/IndexBuffer_DX11.cs index 5aae2e25..727fa07a 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/IndexBuffer_DX11.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/IndexBuffer_DX11.cs @@ -7,6 +7,7 @@ using ANX.Framework.NonXNA; using SharpDX.Direct3D11; using ANX.Framework.Graphics; using System.Runtime.InteropServices; +using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -59,7 +60,7 @@ using System.Runtime.InteropServices; namespace ANX.RenderSystem.Windows.DX11 { - public class IndexBuffer_DX11 : INativeBuffer, IDisposable + public class IndexBuffer_DX11 : INativeIndexBuffer, IDisposable { private SharpDX.Direct3D11.Buffer buffer; private IndexElementSize size; @@ -164,5 +165,29 @@ namespace ANX.RenderSystem.Windows.DX11 buffer = null; } } - } + + #region INativeIndexBuffer Member + + public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeBuffer Member + + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Texture2D_DX11.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Texture2D_DX11.cs index 76945b4a..15459778 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Texture2D_DX11.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Texture2D_DX11.cs @@ -326,5 +326,35 @@ namespace ANX.RenderSystem.Windows.DX11 throw new NotImplementedException(); } #endregion - } + + #region INativeTexture2D Member + + + public void GetData(int level, Framework.Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(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[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/VertexBuffer_DX11.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/VertexBuffer_DX11.cs index 25ebb758..e8d4e781 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/VertexBuffer_DX11.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/VertexBuffer_DX11.cs @@ -7,6 +7,7 @@ using ANX.Framework.NonXNA; using SharpDX.Direct3D11; using ANX.Framework.Graphics; using System.Runtime.InteropServices; +using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -59,7 +60,7 @@ using System.Runtime.InteropServices; namespace ANX.RenderSystem.Windows.DX11 { - public class VertexBuffer_DX11 : INativeBuffer, IDisposable + public class VertexBuffer_DX11 : INativeVertexBuffer, IDisposable { SharpDX.Direct3D11.Buffer buffer; int vertexStride; @@ -165,5 +166,34 @@ namespace ANX.RenderSystem.Windows.DX11 buffer = null; } } - } + + #region INativeVertexBuffer Member + + public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(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[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs index 992b6eb7..505c89a1 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs @@ -92,13 +92,13 @@ namespace ANX.Framework.Windows.DX10 return new GraphicsDeviceWindowsDX10(presentationParameters); } - public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, + public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexBuffer managedBuffer, IndexElementSize size, int indexCount, BufferUsage 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) { return new VertexBuffer_DX10(graphics, vertexDeclaration, vertexCount, usage); diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/IndexBuffer_Metro.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/IndexBuffer_Metro.cs index b0982919..6f7272ab 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.Metro/IndexBuffer_Metro.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/IndexBuffer_Metro.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using ANX.Framework.NonXNA; +using ANX.Framework.NonXNA.RenderSystem; using SharpDX.Direct3D10; using ANX.Framework.Graphics; using System.Runtime.InteropServices; @@ -59,7 +60,7 @@ using System.Runtime.InteropServices; namespace ANX.Framework.Windows.DX10 { - public class IndexBuffer_DX10 : INativeBuffer, IDisposable + public class IndexBuffer_DX10 : INativeIndexBuffer, IDisposable { private SharpDX.Direct3D10.Buffer buffer; private IndexElementSize size; @@ -148,6 +149,30 @@ namespace ANX.Framework.Windows.DX10 buffer.Dispose(); buffer = null; } - } + } + + #region INativeIndexBuffer Member + + public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeBuffer Member + + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/Texture2D_Metro.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/Texture2D_Metro.cs index 4d2dc9d5..5e119609 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.Metro/Texture2D_Metro.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/Texture2D_Metro.cs @@ -326,5 +326,35 @@ namespace ANX.Framework.Windows.DX10 throw new NotImplementedException(); } #endregion + + #region INativeTexture2D Member + + + public void GetData(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeBuffer Member + + + public void GetData(T[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/VertexBuffer_Metro.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/VertexBuffer_Metro.cs index 257e446a..49280e50 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.Metro/VertexBuffer_Metro.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/VertexBuffer_Metro.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using ANX.Framework.NonXNA; +using ANX.Framework.NonXNA.RenderSystem; using SharpDX.Direct3D10; using ANX.Framework.Graphics; using System.Runtime.InteropServices; @@ -59,7 +60,7 @@ using System.Runtime.InteropServices; namespace ANX.Framework.Windows.DX10 { - public class VertexBuffer_DX10 : INativeBuffer, IDisposable + public class VertexBuffer_DX10 : INativeVertexBuffer, IDisposable { SharpDX.Direct3D10.Buffer buffer; int vertexStride; @@ -153,6 +154,35 @@ namespace ANX.Framework.Windows.DX10 buffer.Dispose(); buffer = null; } - } + } + + #region INativeVertexBuffer Member + + public void GetData(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct + { + throw new NotImplementedException(); + } + + public void SetData(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[] data) where T : struct + { + throw new NotImplementedException(); + } + + public void GetData(T[] data, int startIndex, int elementCount) where T : struct + { + throw new NotImplementedException(); + } + + #endregion } }