some more work on graphics device

This commit is contained in:
Glatzemann 2011-11-07 09:01:42 +00:00
parent 68875fe086
commit a89e52a428
5 changed files with 171 additions and 2 deletions

View File

@ -174,6 +174,7 @@
<Compile Include="Graphics\GraphicsDeviceStatus.cs" />
<Compile Include="Graphics\GraphicsProfile.cs" />
<Compile Include="Graphics\GraphicsResource.cs" />
<Compile Include="Graphics\IDynamicGraphicsResource.cs" />
<Compile Include="Graphics\IEffectFog.cs" />
<Compile Include="Graphics\IEffectLights.cs" />
<Compile Include="Graphics\IEffectMatrices.cs" />

View File

@ -94,6 +94,21 @@ namespace ANX.Framework.Graphics
this.samplerStateCollection = new SamplerStateCollection(this, 8); //TODO: get maximum number of sampler states from capabilities
}
~GraphicsDevice()
{
this.Dispose(false);
}
public void Clear(ClearOptions options, Color color, float depth, int stencil)
{
throw new NotImplementedException();
}
public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
{
throw new NotImplementedException();
}
public void Clear(Color color)
{
nativeDevice.Clear(ref color);
@ -104,6 +119,11 @@ namespace ANX.Framework.Graphics
nativeDevice.Present();
}
public void Present(Nullable<Rectangle> sourceRectangle, Nullable<Rectangle> destinationRectangle, IntPtr overrideWindowHandle)
{
throw new NotImplementedException();
}
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
{
nativeDevice.DrawIndexedPrimitives(primitiveType, baseVertex, minVertexIndex, numVertices, startIndex, primitiveCount);
@ -226,6 +246,11 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
protected virtual void Dispose(Boolean disposeManaged)
{
throw new NotImplementedException();
}
public INativeGraphicsDevice NativeDevice
{
get
@ -455,5 +480,53 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
}
protected void raise_Disposing(object sender, EventArgs args)
{
if (Disposing != null)
{
Disposing(sender, args);
}
}
protected void raise_DeviceResetting(object sender, EventArgs args)
{
if (DeviceResetting != null)
{
DeviceResetting(sender, args);
}
}
protected void raise_DeviceReset(object sender, EventArgs args)
{
if (DeviceReset != null)
{
DeviceReset(sender, args);
}
}
protected void raise_DeviceLost(object sender, EventArgs args)
{
if (DeviceLost != null)
{
DeviceLost(sender, args);
}
}
protected void raise_ResourceCreated(object sender, ResourceCreatedEventArgs args)
{
if (ResourceCreated != null)
{
ResourceCreated(sender, args);
}
}
protected void raise_ResourceDestroyed(object sender, ResourceDestroyedEventArgs args)
{
if (ResourceDestroyed != null)
{
ResourceDestroyed(sender, args);
}
}
}
}

View File

@ -0,0 +1,63 @@
#region Using Statements
using System;
#endregion // Using Statements
#region License
//
// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
//
// This file is 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.Graphics
{
internal interface IDynamicGraphicsResource
{
event EventHandler<EventArgs> ContentLost;
void SetContentLost(bool isContentLost);
bool IsContentLost { get; }
}
}

View File

@ -57,7 +57,7 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics
{
public class RenderTarget2D : Texture2D
public class RenderTarget2D : Texture2D, IDynamicGraphicsResource
{
public event EventHandler<EventArgs> ContentLost;
@ -79,6 +79,11 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
protected virtual void Dispose(Boolean disposeManaged)
{
throw new NotImplementedException();
}
public DepthFormat DepthStencilFormat
{
get
@ -111,6 +116,17 @@ namespace ANX.Framework.Graphics
}
}
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{
throw new NotImplementedException();
}
protected void raise_ContentLost(object sender, EventArgs args)
{
if (ContentLost != null)
{
ContentLost(sender, args);
}
}
}
}

View File

@ -57,7 +57,7 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics
{
public class RenderTargetCube : TextureCube
public class RenderTargetCube : TextureCube, IDynamicGraphicsResource
{
public event EventHandler<EventArgs> ContentLost;
@ -73,6 +73,11 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
protected virtual void Dispose(Boolean disposeManaged)
{
throw new NotImplementedException();
}
public DepthFormat DepthStencilFormat
{
get
@ -105,6 +110,17 @@ namespace ANX.Framework.Graphics
}
}
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{
throw new NotImplementedException();
}
protected void raise_ContentLost(object sender, EventArgs args)
{
if (ContentLost != null)
{
ContentLost(sender, args);
}
}
}
}