Started implementing RenderTargets for RenderSystem DX10. The target is creatable and usable but the Texture of the RenderTarget is currently empty.
This commit is contained in:
parent
a0e94dc265
commit
0d196c2f53
@ -429,6 +429,7 @@
|
||||
<Compile Include="NonXNA\AddInSystemFactory.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeRasterizerState.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeDepthStencilState.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeRenderTarget2D.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeSamplerState.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeTexture.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" />
|
||||
|
@ -243,9 +243,16 @@ namespace ANX.Framework.Graphics
|
||||
#region SetRenderTarget
|
||||
public void SetRenderTarget(RenderTarget2D renderTarget)
|
||||
{
|
||||
RenderTargetBinding[] renderTargetBindings = new RenderTargetBinding[] { new RenderTargetBinding(renderTarget) };
|
||||
this.currentRenderTargetBindings = renderTargetBindings;
|
||||
nativeDevice.SetRenderTargets(renderTargetBindings);
|
||||
if (renderTarget != null)
|
||||
{
|
||||
RenderTargetBinding[] renderTargetBindings = new RenderTargetBinding[] { new RenderTargetBinding(renderTarget) };
|
||||
this.currentRenderTargetBindings = renderTargetBindings;
|
||||
nativeDevice.SetRenderTargets(renderTargetBindings);
|
||||
}
|
||||
else
|
||||
{
|
||||
nativeDevice.SetRenderTargets(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
|
||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using ANX.Framework.NonXNA;
|
||||
using ANX.Framework.Graphics;
|
||||
using ANX.Framework.NonXNA.RenderSystem;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -61,34 +62,69 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
public event EventHandler<EventArgs> ContentLost;
|
||||
|
||||
#region Private Members
|
||||
private DepthFormat depthStencilFormat;
|
||||
private int multiSampleCount;
|
||||
private RenderTargetUsage usage;
|
||||
private bool isContentLost;
|
||||
private INativeRenderTarget2D nativeRenderTarget;
|
||||
|
||||
#endregion // Private Members
|
||||
|
||||
#region Constructors
|
||||
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height)
|
||||
: base(graphicsDevice, width, height)
|
||||
: base(graphicsDevice)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
this.depthStencilFormat = DepthFormat.None;
|
||||
this.multiSampleCount = 0;
|
||||
this.usage = RenderTargetUsage.DiscardContents;
|
||||
|
||||
this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage);
|
||||
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
|
||||
}
|
||||
|
||||
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
|
||||
: base(graphicsDevice, width, height)
|
||||
: base(graphicsDevice)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
this.depthStencilFormat = DepthFormat.None;
|
||||
this.multiSampleCount = 0;
|
||||
this.usage = RenderTargetUsage.DiscardContents;
|
||||
|
||||
this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage);
|
||||
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
|
||||
}
|
||||
|
||||
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
|
||||
: base(graphicsDevice, width, height)
|
||||
: base(graphicsDevice)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
this.depthStencilFormat = preferredDepthFormat;
|
||||
this.multiSampleCount = preferredMultiSampleCount;
|
||||
this.usage = usage;
|
||||
|
||||
this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage);
|
||||
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
protected virtual void Dispose(Boolean disposeManaged)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal INativeRenderTarget2D NativeRenderTarget
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.nativeRenderTarget;
|
||||
}
|
||||
}
|
||||
|
||||
public DepthFormat DepthStencilFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return this.depthStencilFormat;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +132,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return this.isContentLost;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +140,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return this.multiSampleCount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,12 +148,18 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return this.usage;
|
||||
}
|
||||
}
|
||||
|
||||
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
|
||||
{
|
||||
this.isContentLost = isContentLost;
|
||||
if (isContentLost)
|
||||
{
|
||||
raise_ContentLost(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,12 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
#endregion // Private Members
|
||||
|
||||
internal Texture2D(GraphicsDevice graphicsDevice)
|
||||
: base(graphicsDevice)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Texture2D(GraphicsDevice graphicsDevice, int width, int height)
|
||||
: base(graphicsDevice)
|
||||
{
|
||||
@ -72,7 +78,7 @@ namespace ANX.Framework.Graphics
|
||||
base.levelCount = 1;
|
||||
base.format = SurfaceFormat.Color;
|
||||
|
||||
CreateNativeTextureSurface();
|
||||
CreateNativeTextureSurface(graphicsDevice, SurfaceFormat.Color, width, height, levelCount);
|
||||
}
|
||||
|
||||
public Texture2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format)
|
||||
@ -84,7 +90,7 @@ namespace ANX.Framework.Graphics
|
||||
base.levelCount = 1; //TODO: mipmap paramter?!?!?
|
||||
base.format = format;
|
||||
|
||||
CreateNativeTextureSurface();
|
||||
CreateNativeTextureSurface(graphicsDevice, format, width, height, levelCount);
|
||||
}
|
||||
|
||||
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream)
|
||||
@ -171,9 +177,9 @@ namespace ANX.Framework.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateNativeTextureSurface()
|
||||
internal void CreateNativeTextureSurface(GraphicsDevice device, SurfaceFormat format, int width, int height, int levelCount)
|
||||
{
|
||||
base.nativeTexture = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateTexture(GraphicsDevice, format, Width, Height, levelCount);
|
||||
base.nativeTexture = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateTexture(device, format, width, height, levelCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
60
ANX.Framework/NonXNA/RenderSystem/INativeRenderTarget2D.cs
Normal file
60
ANX.Framework/NonXNA/RenderSystem/INativeRenderTarget2D.cs
Normal file
@ -0,0 +1,60 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
#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 INativeRenderTarget2D
|
||||
{
|
||||
//INativeTexture2D NativeTexture { get; }
|
||||
}
|
||||
}
|
@ -65,6 +65,8 @@ namespace ANX.Framework
|
||||
|
||||
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);
|
||||
|
||||
INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexElementSize size, int indexCount, BufferUsage usage);
|
||||
|
||||
INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage);
|
||||
|
@ -75,6 +75,7 @@
|
||||
<Compile Include="NativeMethods.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RasterizerState_DX10.cs" />
|
||||
<Compile Include="RenderTarget2D_DX10.cs" />
|
||||
<Compile Include="SamplerState_DX10.cs" />
|
||||
<Compile Include="ShaderByteCode.cs" />
|
||||
<Compile Include="Texture2D_DX10.cs" />
|
||||
|
@ -227,5 +227,10 @@ namespace ANX.Framework.Windows.DX10
|
||||
{
|
||||
return new Texture2D_DX10(graphics, width, height, surfaceFormat, mipCount);
|
||||
}
|
||||
|
||||
public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
|
||||
{
|
||||
return new RenderTarget2D_DX10(graphics, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ namespace ANX.Framework.Windows.DX10
|
||||
private Device device;
|
||||
private SwapChain swapChain;
|
||||
private RenderTargetView renderView;
|
||||
private RenderTargetView renderTargetView;
|
||||
private DepthStencilView depthStencilView;
|
||||
private SharpDX.Direct3D10.Texture2D backBuffer;
|
||||
internal Effect_DX10 currentEffect;
|
||||
@ -159,7 +160,7 @@ namespace ANX.Framework.Windows.DX10
|
||||
clearColor.Alpha = color.A * ColorMultiplier;
|
||||
}
|
||||
|
||||
this.device.ClearRenderTargetView(this.renderView, this.clearColor);
|
||||
this.device.ClearRenderTargetView(this.renderTargetView != null ? this.renderTargetView : this.renderView, this.clearColor);
|
||||
}
|
||||
|
||||
public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
|
||||
@ -172,8 +173,9 @@ namespace ANX.Framework.Windows.DX10
|
||||
this.clearColor.Green = color.Y;
|
||||
this.clearColor.Blue = color.Z;
|
||||
this.clearColor.Alpha = color.W;
|
||||
this.lastClearColor = 0;
|
||||
|
||||
this.device.ClearRenderTargetView(this.renderView, this.clearColor);
|
||||
this.device.ClearRenderTargetView(this.renderTargetView != null ? this.renderTargetView : this.renderView, this.clearColor);
|
||||
}
|
||||
|
||||
if (this.depthStencilView != null)
|
||||
@ -396,7 +398,40 @@ namespace ANX.Framework.Windows.DX10
|
||||
|
||||
public void SetRenderTargets(params RenderTargetBinding[] renderTargets)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (renderTargets == null)
|
||||
{
|
||||
// reset the RenderTarget to backbuffer
|
||||
if (renderTargetView != null)
|
||||
{
|
||||
renderTargetView.Dispose();
|
||||
renderTargetView = null;
|
||||
}
|
||||
|
||||
device.OutputMerger.SetRenderTargets(1, new RenderTargetView[] { this.renderView }, this.depthStencilView);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (renderTargets.Length == 1)
|
||||
{
|
||||
RenderTarget2D renderTarget = renderTargets[0].RenderTarget as RenderTarget2D;
|
||||
RenderTarget2D_DX10 nativeRenderTarget = renderTarget.NativeRenderTarget as RenderTarget2D_DX10;
|
||||
if (renderTarget != null)
|
||||
{
|
||||
if (renderTargetView != null)
|
||||
{
|
||||
renderTargetView.Dispose();
|
||||
renderTargetView = null;
|
||||
}
|
||||
this.renderTargetView = new RenderTargetView(device, ((Texture2D_DX10)nativeRenderTarget).NativeShaderResourceView.Resource);
|
||||
DepthStencilView depthStencilView = null;
|
||||
device.OutputMerger.SetRenderTargets(1,new RenderTargetView[] { this.renderTargetView }, depthStencilView);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException("handling of multiple RenderTargets are not yet implemented");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -473,7 +508,25 @@ namespace ANX.Framework.Windows.DX10
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
//TODO: implement
|
||||
if (renderTargetView != null)
|
||||
{
|
||||
renderTargetView.Dispose();
|
||||
renderTargetView = null;
|
||||
}
|
||||
|
||||
if (swapChain != null)
|
||||
{
|
||||
renderView.Dispose();
|
||||
renderView = null;
|
||||
|
||||
backBuffer.Dispose();
|
||||
backBuffer = null;
|
||||
|
||||
swapChain.Dispose();
|
||||
swapChain = null;
|
||||
}
|
||||
|
||||
//TODO: dispose everything else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
103
RenderSystems/ANX.Framework.Windows.DX10/RenderTarget2D_DX10.cs
Normal file
103
RenderSystems/ANX.Framework.Windows.DX10/RenderTarget2D_DX10.cs
Normal file
@ -0,0 +1,103 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ANX.Framework.Graphics;
|
||||
using ANX.Framework.NonXNA.RenderSystem;
|
||||
using SharpDX.Direct3D10;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
#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.Windows.DX10
|
||||
{
|
||||
public class RenderTarget2D_DX10 : Texture2D_DX10, INativeRenderTarget2D, INativeTexture2D
|
||||
{
|
||||
#region Private Members
|
||||
|
||||
#endregion // Private Members
|
||||
|
||||
public RenderTarget2D_DX10(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
|
||||
: base(graphics)
|
||||
{
|
||||
if (mipMap)
|
||||
{
|
||||
throw new NotImplementedException("creating RenderTargets with mip map not yet implemented");
|
||||
}
|
||||
|
||||
this.surfaceFormat = surfaceFormat;
|
||||
|
||||
GraphicsDeviceWindowsDX10 graphicsDX10 = graphicsDevice.NativeDevice as GraphicsDeviceWindowsDX10;
|
||||
SharpDX.Direct3D10.Device device = graphicsDX10.NativeDevice;
|
||||
|
||||
SharpDX.Direct3D10.Texture2DDescription description = new SharpDX.Direct3D10.Texture2DDescription()
|
||||
{
|
||||
Width = width,
|
||||
Height = height,
|
||||
MipLevels = 1,
|
||||
ArraySize = 1,
|
||||
Format = FormatConverter.Translate(preferredFormat),
|
||||
SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
|
||||
Usage = SharpDX.Direct3D10.ResourceUsage.Default,
|
||||
BindFlags = SharpDX.Direct3D10.BindFlags.ShaderResource | SharpDX.Direct3D10.BindFlags.RenderTarget,
|
||||
CpuAccessFlags = SharpDX.Direct3D10.CpuAccessFlags.None,
|
||||
OptionFlags = SharpDX.Direct3D10.ResourceOptionFlags.None,
|
||||
};
|
||||
this.nativeTexture = new SharpDX.Direct3D10.Texture2D(graphicsDX10.NativeDevice, description);
|
||||
this.nativeShaderResourceView = new SharpDX.Direct3D10.ShaderResourceView(graphicsDX10.NativeDevice, this.nativeTexture);
|
||||
|
||||
// description of texture formats of DX10: http://msdn.microsoft.com/en-us/library/bb694531(v=VS.85).aspx
|
||||
// more helpfull information on DX10 textures: http://msdn.microsoft.com/en-us/library/windows/desktop/bb205131(v=vs.85).aspx
|
||||
|
||||
this.formatSize = FormatConverter.FormatSize(surfaceFormat);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -63,14 +63,19 @@ namespace ANX.Framework.Windows.DX10
|
||||
public class Texture2D_DX10 : INativeTexture2D
|
||||
{
|
||||
#region Private Members
|
||||
private SharpDX.Direct3D10.Texture2D nativeTexture;
|
||||
private SharpDX.Direct3D10.ShaderResourceView nativeShaderResourceView;
|
||||
private int formatSize;
|
||||
private SurfaceFormat surfaceFormat;
|
||||
private GraphicsDevice graphicsDevice;
|
||||
protected internal SharpDX.Direct3D10.Texture2D nativeTexture;
|
||||
protected internal SharpDX.Direct3D10.ShaderResourceView nativeShaderResourceView;
|
||||
protected internal int formatSize;
|
||||
protected internal SurfaceFormat surfaceFormat;
|
||||
protected internal GraphicsDevice graphicsDevice;
|
||||
|
||||
#endregion // Private Members
|
||||
|
||||
internal Texture2D_DX10(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
this.graphicsDevice = graphicsDevice;
|
||||
}
|
||||
|
||||
public Texture2D_DX10(GraphicsDevice graphicsDevice, int width, int height, SurfaceFormat surfaceFormat, int mipCount)
|
||||
{
|
||||
if (mipCount > 1)
|
||||
|
@ -302,5 +302,10 @@ namespace ANX.Framework.Windows.GL3
|
||||
return new ReadOnlyCollection<GraphicsAdapter>(result);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,5 +229,11 @@ namespace ANX.RenderSystem.Windows.DX11
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public Framework.NonXNA.RenderSystem.INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.GamerServices;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Microsoft.Xna.Framework.Media;
|
||||
using ANX.Framework;
|
||||
using ANX.Framework.Audio;
|
||||
using ANX.Framework.Content;
|
||||
using ANX.Framework.GamerServices;
|
||||
using ANX.Framework.Graphics;
|
||||
using ANX.Framework.Input;
|
||||
using ANX.Framework.Media;
|
||||
#endregion
|
||||
|
||||
namespace RenderTarget
|
||||
{
|
||||
public class Game1 : Microsoft.Xna.Framework.Game
|
||||
public class Game1 : ANX.Framework.Game
|
||||
{
|
||||
GraphicsDeviceManager graphics;
|
||||
SpriteBatch spriteBatch;
|
||||
@ -24,6 +24,8 @@ namespace RenderTarget
|
||||
{
|
||||
graphics = new GraphicsDeviceManager(this);
|
||||
Content.RootDirectory = "Content";
|
||||
|
||||
this.Window.Title = "ANX.Framework - RenderTarget sample - you should see a green rectangle";
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
@ -37,7 +39,7 @@ namespace RenderTarget
|
||||
{
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
|
||||
this.renderTarget = new RenderTarget2D(GraphicsDevice, 128, 128, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
|
||||
this.renderTarget = new RenderTarget2D(GraphicsDevice, 128, 128); //, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
|
||||
}
|
||||
|
||||
protected override void UnloadContent()
|
||||
@ -60,6 +62,7 @@ namespace RenderTarget
|
||||
{
|
||||
GraphicsDevice.SetRenderTarget(this.renderTarget);
|
||||
GraphicsDevice.Clear(ClearOptions.Target, Color.Green, 1.0f, 0);
|
||||
//GraphicsDevice.Clear(Color.Green);
|
||||
GraphicsDevice.SetRenderTarget(null);
|
||||
|
||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||
|
@ -60,10 +60,6 @@
|
||||
<XnaCompressContent>true</XnaCompressContent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
||||
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
||||
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
||||
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
@ -83,6 +79,22 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
|
||||
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
|
||||
<Name>ANX.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Windows.XInput\ANX.InputSystem.Windows.XInput.csproj">
|
||||
<Project>{60D08399-244F-46A3-91F1-4CFD26D961A3}</Project>
|
||||
<Name>ANX.InputSystem.Windows.XInput</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.Windows.DX10\ANX.Framework.Windows.DX10.csproj">
|
||||
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project>
|
||||
<Name>ANX.Framework.Windows.DX10</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio.csproj">
|
||||
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
|
||||
<Name>ANX.SoundSystem.Windows.XAudio</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SampleContent\SampleContent.contentproj">
|
||||
<Project>{FA6E229D-4504-47B1-8A23-2D3FCC13F778}</Project>
|
||||
<Name>SampleContent</Name>
|
||||
|
Loading…
x
Reference in New Issue
Block a user