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:
Glatzemann 2011-11-28 16:06:52 +00:00
parent a0e94dc265
commit 0d196c2f53
15 changed files with 351 additions and 40 deletions

View File

@ -429,6 +429,7 @@
<Compile Include="NonXNA\AddInSystemFactory.cs" /> <Compile Include="NonXNA\AddInSystemFactory.cs" />
<Compile Include="NonXNA\RenderSystem\INativeRasterizerState.cs" /> <Compile Include="NonXNA\RenderSystem\INativeRasterizerState.cs" />
<Compile Include="NonXNA\RenderSystem\INativeDepthStencilState.cs" /> <Compile Include="NonXNA\RenderSystem\INativeDepthStencilState.cs" />
<Compile Include="NonXNA\RenderSystem\INativeRenderTarget2D.cs" />
<Compile Include="NonXNA\RenderSystem\INativeSamplerState.cs" /> <Compile Include="NonXNA\RenderSystem\INativeSamplerState.cs" />
<Compile Include="NonXNA\RenderSystem\INativeTexture.cs" /> <Compile Include="NonXNA\RenderSystem\INativeTexture.cs" />
<Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" /> <Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" />

View File

@ -243,9 +243,16 @@ namespace ANX.Framework.Graphics
#region SetRenderTarget #region SetRenderTarget
public void SetRenderTarget(RenderTarget2D renderTarget) public void SetRenderTarget(RenderTarget2D renderTarget)
{ {
RenderTargetBinding[] renderTargetBindings = new RenderTargetBinding[] { new RenderTargetBinding(renderTarget) }; if (renderTarget != null)
this.currentRenderTargetBindings = renderTargetBindings; {
nativeDevice.SetRenderTargets(renderTargetBindings); RenderTargetBinding[] renderTargetBindings = new RenderTargetBinding[] { new RenderTargetBinding(renderTarget) };
this.currentRenderTargetBindings = renderTargetBindings;
nativeDevice.SetRenderTargets(renderTargetBindings);
}
else
{
nativeDevice.SetRenderTargets(null);
}
} }
public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace) public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements #endregion // Using Statements
@ -61,34 +62,69 @@ namespace ANX.Framework.Graphics
{ {
public event EventHandler<EventArgs> ContentLost; 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) 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) 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) 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) protected virtual void Dispose(Boolean disposeManaged)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
internal INativeRenderTarget2D NativeRenderTarget
{
get
{
return this.nativeRenderTarget;
}
}
public DepthFormat DepthStencilFormat public DepthFormat DepthStencilFormat
{ {
get get
{ {
throw new NotImplementedException(); return this.depthStencilFormat;
} }
} }
@ -96,7 +132,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.isContentLost;
} }
} }
@ -104,7 +140,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.multiSampleCount;
} }
} }
@ -112,12 +148,18 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.usage;
} }
} }
void IDynamicGraphicsResource.SetContentLost(bool isContentLost) void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{ {
this.isContentLost = isContentLost;
if (isContentLost)
{
raise_ContentLost(this, EventArgs.Empty);
}
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -63,6 +63,12 @@ namespace ANX.Framework.Graphics
#endregion // Private Members #endregion // Private Members
internal Texture2D(GraphicsDevice graphicsDevice)
: base(graphicsDevice)
{
}
public Texture2D(GraphicsDevice graphicsDevice, int width, int height) public Texture2D(GraphicsDevice graphicsDevice, int width, int height)
: base(graphicsDevice) : base(graphicsDevice)
{ {
@ -72,7 +78,7 @@ namespace ANX.Framework.Graphics
base.levelCount = 1; base.levelCount = 1;
base.format = SurfaceFormat.Color; base.format = SurfaceFormat.Color;
CreateNativeTextureSurface(); CreateNativeTextureSurface(graphicsDevice, SurfaceFormat.Color, width, height, levelCount);
} }
public Texture2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format) 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.levelCount = 1; //TODO: mipmap paramter?!?!?
base.format = format; base.format = format;
CreateNativeTextureSurface(); CreateNativeTextureSurface(graphicsDevice, format, width, height, levelCount);
} }
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream) 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);
} }
} }
} }

View 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; }
}
}

View File

@ -65,6 +65,8 @@ namespace ANX.Framework
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);
INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexElementSize size, int indexCount, BufferUsage usage); INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexElementSize size, int indexCount, BufferUsage usage);
INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage); INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage);

View File

@ -75,6 +75,7 @@
<Compile Include="NativeMethods.cs" /> <Compile Include="NativeMethods.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RasterizerState_DX10.cs" /> <Compile Include="RasterizerState_DX10.cs" />
<Compile Include="RenderTarget2D_DX10.cs" />
<Compile Include="SamplerState_DX10.cs" /> <Compile Include="SamplerState_DX10.cs" />
<Compile Include="ShaderByteCode.cs" /> <Compile Include="ShaderByteCode.cs" />
<Compile Include="Texture2D_DX10.cs" /> <Compile Include="Texture2D_DX10.cs" />

View File

@ -227,5 +227,10 @@ namespace ANX.Framework.Windows.DX10
{ {
return new Texture2D_DX10(graphics, width, height, surfaceFormat, mipCount); 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);
}
} }
} }

View File

@ -99,6 +99,7 @@ namespace ANX.Framework.Windows.DX10
private Device device; private Device device;
private SwapChain swapChain; private SwapChain swapChain;
private RenderTargetView renderView; private RenderTargetView renderView;
private RenderTargetView renderTargetView;
private DepthStencilView depthStencilView; private DepthStencilView depthStencilView;
private SharpDX.Direct3D10.Texture2D backBuffer; private SharpDX.Direct3D10.Texture2D backBuffer;
internal Effect_DX10 currentEffect; internal Effect_DX10 currentEffect;
@ -159,7 +160,7 @@ namespace ANX.Framework.Windows.DX10
clearColor.Alpha = color.A * ColorMultiplier; 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) 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.Green = color.Y;
this.clearColor.Blue = color.Z; this.clearColor.Blue = color.Z;
this.clearColor.Alpha = color.W; 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) if (this.depthStencilView != null)
@ -396,7 +398,40 @@ namespace ANX.Framework.Windows.DX10
public void SetRenderTargets(params RenderTargetBinding[] renderTargets) 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() 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
} }
} }
} }

View 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);
}
}
}

View File

@ -63,14 +63,19 @@ namespace ANX.Framework.Windows.DX10
public class Texture2D_DX10 : INativeTexture2D public class Texture2D_DX10 : INativeTexture2D
{ {
#region Private Members #region Private Members
private SharpDX.Direct3D10.Texture2D nativeTexture; protected internal SharpDX.Direct3D10.Texture2D nativeTexture;
private SharpDX.Direct3D10.ShaderResourceView nativeShaderResourceView; protected internal SharpDX.Direct3D10.ShaderResourceView nativeShaderResourceView;
private int formatSize; protected internal int formatSize;
private SurfaceFormat surfaceFormat; protected internal SurfaceFormat surfaceFormat;
private GraphicsDevice graphicsDevice; protected internal GraphicsDevice graphicsDevice;
#endregion // Private Members #endregion // Private Members
internal Texture2D_DX10(GraphicsDevice graphicsDevice)
{
this.graphicsDevice = graphicsDevice;
}
public Texture2D_DX10(GraphicsDevice graphicsDevice, int width, int height, SurfaceFormat surfaceFormat, int mipCount) public Texture2D_DX10(GraphicsDevice graphicsDevice, int width, int height, SurfaceFormat surfaceFormat, int mipCount)
{ {
if (mipCount > 1) if (mipCount > 1)

View File

@ -302,5 +302,10 @@ namespace ANX.Framework.Windows.GL3
return new ReadOnlyCollection<GraphicsAdapter>(result); return new ReadOnlyCollection<GraphicsAdapter>(result);
} }
#endregion #endregion
}
public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
{
throw new NotImplementedException();
}
}
} }

View File

@ -229,5 +229,11 @@ namespace ANX.RenderSystem.Windows.DX11
{ {
throw new NotImplementedException(); 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();
}
} }
} }

View File

@ -2,18 +2,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Xna.Framework; using ANX.Framework;
using Microsoft.Xna.Framework.Audio; using ANX.Framework.Audio;
using Microsoft.Xna.Framework.Content; using ANX.Framework.Content;
using Microsoft.Xna.Framework.GamerServices; using ANX.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics; using ANX.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using ANX.Framework.Input;
using Microsoft.Xna.Framework.Media; using ANX.Framework.Media;
#endregion #endregion
namespace RenderTarget namespace RenderTarget
{ {
public class Game1 : Microsoft.Xna.Framework.Game public class Game1 : ANX.Framework.Game
{ {
GraphicsDeviceManager graphics; GraphicsDeviceManager graphics;
SpriteBatch spriteBatch; SpriteBatch spriteBatch;
@ -24,6 +24,8 @@ namespace RenderTarget
{ {
graphics = new GraphicsDeviceManager(this); graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content"; Content.RootDirectory = "Content";
this.Window.Title = "ANX.Framework - RenderTarget sample - you should see a green rectangle";
} }
protected override void Initialize() protected override void Initialize()
@ -37,7 +39,7 @@ namespace RenderTarget
{ {
spriteBatch = new SpriteBatch(GraphicsDevice); 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() protected override void UnloadContent()
@ -60,6 +62,7 @@ namespace RenderTarget
{ {
GraphicsDevice.SetRenderTarget(this.renderTarget); GraphicsDevice.SetRenderTarget(this.renderTarget);
GraphicsDevice.Clear(ClearOptions.Target, Color.Green, 1.0f, 0); GraphicsDevice.Clear(ClearOptions.Target, Color.Green, 1.0f, 0);
//GraphicsDevice.Clear(Color.Green);
GraphicsDevice.SetRenderTarget(null); GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.Clear(Color.CornflowerBlue);

View File

@ -60,10 +60,6 @@
<XnaCompressContent>true</XnaCompressContent> <XnaCompressContent>true</XnaCompressContent>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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="mscorlib" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
@ -83,6 +79,22 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<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"> <ProjectReference Include="..\SampleContent\SampleContent.contentproj">
<Project>{FA6E229D-4504-47B1-8A23-2D3FCC13F778}</Project> <Project>{FA6E229D-4504-47B1-8A23-2D3FCC13F778}</Project>
<Name>SampleContent</Name> <Name>SampleContent</Name>