- Further implemented the Dispose chain which now prevents the OpenGL gd from leaking (still some work required)
- Logging OpenGL version on Device Reset with GL3 RenderSystem
This commit is contained in:
parent
4ec1977383
commit
845d8ec716
@ -442,6 +442,7 @@
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeConstantBuffer.cs" />
|
||||
<Compile Include="NonXNA\SoundSystem\IMicrophone.cs" />
|
||||
<Compile Include="NonXNA\ThreadHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
|
@ -442,6 +442,7 @@
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeConstantBuffer.cs" />
|
||||
<Compile Include="NonXNA\SoundSystem\IMicrophone.cs" />
|
||||
<Compile Include="NonXNA\ThreadHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
|
@ -444,6 +444,7 @@
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeConstantBuffer.cs" />
|
||||
<Compile Include="NonXNA\SoundSystem\IMicrophone.cs" />
|
||||
<Compile Include="NonXNA\ThreadHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
|
@ -445,6 +445,7 @@
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\RenderSystem\INativeConstantBuffer.cs" />
|
||||
<Compile Include="NonXNA\SoundSystem\IMicrophone.cs" />
|
||||
<Compile Include="NonXNA\ThreadHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
|
@ -86,8 +86,8 @@ namespace ANX.Framework
|
||||
|
||||
//TODO: implement draw- and update-order handling of GameComponents
|
||||
this.components = new GameComponentCollection();
|
||||
this.components.ComponentAdded += new EventHandler<GameComponentCollectionEventArgs>(components_ComponentAdded);
|
||||
this.components.ComponentRemoved += new EventHandler<GameComponentCollectionEventArgs>(components_ComponentRemoved);
|
||||
this.components.ComponentAdded += components_ComponentAdded;
|
||||
this.components.ComponentRemoved += components_ComponentRemoved;
|
||||
this.drawableGameComponents = new List<IGameComponent>();
|
||||
|
||||
Logger.Info("finished initializing new Game class");
|
||||
@ -98,31 +98,25 @@ namespace ANX.Framework
|
||||
this.components.ComponentAdded -= components_ComponentAdded;
|
||||
this.components.ComponentRemoved -= components_ComponentRemoved;
|
||||
|
||||
//TODO: implement
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#region CreateGameHost
|
||||
private void CreateGameHost()
|
||||
{
|
||||
Logger.Info("creating GameHost");
|
||||
var creator =
|
||||
AddInSystemFactory.Instance.GetDefaultCreator<IPlatformSystemCreator>();
|
||||
if (creator != null)
|
||||
{
|
||||
host = creator.CreateGameHost(this);
|
||||
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IPlatformSystemCreator>();
|
||||
if (creator == null)
|
||||
Logger.ErrorAndThrow<NullReferenceException>("Could not fetch PlatformSystem creator to create a game host.");
|
||||
|
||||
host.Activated += HostActivated;
|
||||
host.Deactivated += HostDeactivated;
|
||||
host.Suspend += HostSuspend;
|
||||
host.Resume += HostResume;
|
||||
host.Idle += HostIdle;
|
||||
host.Exiting += HostExiting;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error("could not fetch PlatformSystem creator to create a game host...");
|
||||
throw new NullReferenceException("could not fetch PlatformSystem creator");
|
||||
}
|
||||
host = creator.CreateGameHost(this);
|
||||
|
||||
host.Activated += HostActivated;
|
||||
host.Deactivated += HostDeactivated;
|
||||
host.Suspend += HostSuspend;
|
||||
host.Resume += HostResume;
|
||||
host.Idle += HostIdle;
|
||||
host.Exiting += HostExiting;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -233,9 +227,7 @@ namespace ANX.Framework
|
||||
public void Tick()
|
||||
{
|
||||
if (this.ShouldExit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: calculation of times is wrong
|
||||
//TODO: encapsulate timing stuff in GameTimer class
|
||||
@ -244,10 +236,7 @@ namespace ANX.Framework
|
||||
{
|
||||
while (elapsedUpdate < targetElapsedTime)
|
||||
{
|
||||
// TODO: search replacement
|
||||
#if !WINDOWSMETRO
|
||||
Thread.Sleep(TargetElapsedTime.Milliseconds - elapsedUpdate.Milliseconds);
|
||||
#endif
|
||||
ThreadHelper.Sleep(TargetElapsedTime.Milliseconds - elapsedUpdate.Milliseconds);
|
||||
elapsedUpdate = TimeSpan.FromTicks(clock.Timestamp - elapsedUpdate.Ticks);
|
||||
}
|
||||
|
||||
@ -281,9 +270,8 @@ namespace ANX.Framework
|
||||
{
|
||||
this.graphicsDeviceManager = this.Services.GetService(typeof(IGraphicsDeviceManager)) as IGraphicsDeviceManager;
|
||||
if (this.graphicsDeviceManager != null)
|
||||
{
|
||||
this.graphicsDeviceManager.CreateDevice();
|
||||
}
|
||||
|
||||
this.Initialize();
|
||||
this.inRun = true;
|
||||
this.BeginRun();
|
||||
@ -406,11 +394,7 @@ namespace ANX.Framework
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.host != null)
|
||||
{
|
||||
return this.host.Window;
|
||||
}
|
||||
return null;
|
||||
return (host != null) ? host.Window : null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,12 +466,31 @@ namespace ANX.Framework
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
//TODO: dispose everything to dispose :-)
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
//TODO: dispose everything to dispose :-)
|
||||
if (disposing)
|
||||
{
|
||||
IDisposable disposable;
|
||||
var array = new IGameComponent[components.Count];
|
||||
components.CopyTo(array, 0);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
disposable = (IDisposable)array[i];
|
||||
if (disposable != null)
|
||||
disposable.Dispose();
|
||||
}
|
||||
|
||||
disposable = (IDisposable)graphicsDeviceManager;
|
||||
if (disposable != null)
|
||||
disposable.Dispose();
|
||||
|
||||
if (Disposed != null)
|
||||
Disposed(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnActivated(Object sender, EventArgs args)
|
||||
|
@ -6,56 +6,48 @@ using System;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
public abstract class GameHost
|
||||
{
|
||||
internal event EventHandler<EventArgs> Activated;
|
||||
internal event EventHandler<EventArgs> Deactivated;
|
||||
internal event EventHandler<EventArgs> Exiting;
|
||||
internal event EventHandler<EventArgs> Idle;
|
||||
internal event EventHandler<EventArgs> Resume;
|
||||
internal event EventHandler<EventArgs> Suspend;
|
||||
public abstract class GameHost
|
||||
{
|
||||
internal event EventHandler<EventArgs> Activated;
|
||||
internal event EventHandler<EventArgs> Deactivated;
|
||||
internal event EventHandler<EventArgs> Exiting;
|
||||
internal event EventHandler<EventArgs> Idle;
|
||||
internal event EventHandler<EventArgs> Resume;
|
||||
internal event EventHandler<EventArgs> Suspend;
|
||||
|
||||
public GameHost(Game game)
|
||||
{
|
||||
public abstract GameWindow Window { get; }
|
||||
|
||||
}
|
||||
public GameHost(Game game)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void Run();
|
||||
public abstract void Run();
|
||||
public abstract void Exit();
|
||||
|
||||
public abstract GameWindow Window { get; }
|
||||
protected void OnActivated()
|
||||
{
|
||||
InvokeIfNotNull(this.Activated);
|
||||
}
|
||||
|
||||
public abstract void Exit();
|
||||
protected void OnDeactivated()
|
||||
{
|
||||
InvokeIfNotNull(this.Deactivated);
|
||||
}
|
||||
|
||||
protected void OnActivated()
|
||||
{
|
||||
if (this.Activated != null)
|
||||
{
|
||||
this.Activated(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
protected void OnIdle()
|
||||
{
|
||||
InvokeIfNotNull(this.Idle);
|
||||
}
|
||||
|
||||
protected void OnDeactivated()
|
||||
{
|
||||
if (this.Deactivated != null)
|
||||
{
|
||||
this.Deactivated(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
protected void OnExiting()
|
||||
{
|
||||
InvokeIfNotNull(this.Exiting);
|
||||
}
|
||||
|
||||
protected void OnIdle()
|
||||
{
|
||||
if (this.Idle != null)
|
||||
{
|
||||
this.Idle(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnExiting()
|
||||
{
|
||||
if (this.Exiting != null)
|
||||
{
|
||||
this.Exiting(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void InvokeIfNotNull(EventHandler<EventArgs> eventHandler)
|
||||
{
|
||||
if (eventHandler != null)
|
||||
eventHandler(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,90 +1,77 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
public class VertexDeclaration : GraphicsResource
|
||||
{
|
||||
private int vertexStride;
|
||||
private VertexElement[] elements;
|
||||
public class VertexDeclaration : GraphicsResource
|
||||
{
|
||||
private VertexElement[] elements;
|
||||
|
||||
public VertexDeclaration(params VertexElement[] elements)
|
||||
{
|
||||
this.elements = elements;
|
||||
public int VertexStride
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public VertexDeclaration(params VertexElement[] elements)
|
||||
{
|
||||
this.elements = elements;
|
||||
|
||||
for (int i = 0; i < this.elements.Length; i++)
|
||||
{
|
||||
this.vertexStride += GetElementStride(this.elements[i].VertexElementFormat);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.elements.Length; i++)
|
||||
VertexStride += GetElementStride(this.elements[i].VertexElementFormat);
|
||||
}
|
||||
|
||||
public VertexDeclaration(int vertexStride, params VertexElement[] elements)
|
||||
{
|
||||
this.elements = elements;
|
||||
this.vertexStride = vertexStride;
|
||||
}
|
||||
public VertexDeclaration(int vertexStride, params VertexElement[] elements)
|
||||
{
|
||||
this.elements = elements;
|
||||
VertexStride = vertexStride;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public VertexElement[] GetVertexElements()
|
||||
{
|
||||
if (elements != null)
|
||||
return elements.Clone() as VertexElement[];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public int VertexStride
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vertexStride;
|
||||
}
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public VertexElement[] GetVertexElements()
|
||||
{
|
||||
if (elements != null)
|
||||
{
|
||||
return elements.Clone() as VertexElement[];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
|
||||
{
|
||||
// Nothing to dispose
|
||||
}
|
||||
|
||||
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private int GetElementStride(VertexElementFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case VertexElementFormat.NormalizedShort2:
|
||||
case VertexElementFormat.Byte4:
|
||||
case VertexElementFormat.Color:
|
||||
case VertexElementFormat.HalfVector2:
|
||||
case VertexElementFormat.Short2:
|
||||
case VertexElementFormat.Single:
|
||||
return 4;
|
||||
case VertexElementFormat.HalfVector4:
|
||||
case VertexElementFormat.NormalizedShort4:
|
||||
case VertexElementFormat.Short4:
|
||||
case VertexElementFormat.Vector2:
|
||||
return 8;
|
||||
case VertexElementFormat.Vector3:
|
||||
return 12;
|
||||
case VertexElementFormat.Vector4:
|
||||
return 16;
|
||||
default:
|
||||
throw new ArgumentException("unknown VertexElementFormat size '" + format.ToString() + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
private int GetElementStride(VertexElementFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case VertexElementFormat.NormalizedShort2:
|
||||
case VertexElementFormat.Byte4:
|
||||
case VertexElementFormat.Color:
|
||||
case VertexElementFormat.HalfVector2:
|
||||
case VertexElementFormat.Short2:
|
||||
case VertexElementFormat.Single:
|
||||
return 4;
|
||||
case VertexElementFormat.HalfVector4:
|
||||
case VertexElementFormat.NormalizedShort4:
|
||||
case VertexElementFormat.Short4:
|
||||
case VertexElementFormat.Vector2:
|
||||
return 8;
|
||||
case VertexElementFormat.Vector3:
|
||||
return 12;
|
||||
case VertexElementFormat.Vector4:
|
||||
return 16;
|
||||
default:
|
||||
throw new ArgumentException("unknown VertexElementFormat size '" + format + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,12 +172,27 @@ namespace ANX.Framework
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (disposing)
|
||||
{
|
||||
if (game != null)
|
||||
if (game.Services.GetService(typeof(IGraphicsDeviceService)) == this)
|
||||
game.Services.RemoveService(typeof(IGraphicsDeviceService));
|
||||
|
||||
if (graphicsDevice != null)
|
||||
{
|
||||
graphicsDevice.Dispose();
|
||||
graphicsDevice = null;
|
||||
}
|
||||
|
||||
if (Disposed != null)
|
||||
Disposed(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
protected GraphicsDeviceInformation FindBestDevice(bool anySuitableDevice)
|
||||
|
@ -104,7 +104,7 @@ namespace ANX.Framework.NonXNA
|
||||
this.assembly = TypeHelper.GetAssemblyFrom(creatorType);
|
||||
this.creatorType = creatorType;
|
||||
Type = AddInSystemFactory.GetAddInType(creatorType);
|
||||
this.supportedPlatforms = (ISupportedPlatforms)Activator.CreateInstance(supportedPlatformsType);
|
||||
this.supportedPlatforms = TypeHelper.Create<ISupportedPlatforms>(supportedPlatformsType);
|
||||
Version = assembly.GetName().Version;
|
||||
}
|
||||
#endregion
|
||||
@ -122,8 +122,8 @@ namespace ANX.Framework.NonXNA
|
||||
if (instance == null && IsSupported)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = Activator.CreateInstance(creatorType) as ICreator;
|
||||
{
|
||||
instance = TypeHelper.Create<ICreator>(creatorType); ;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -131,9 +131,7 @@ namespace ANX.Framework.NonXNA
|
||||
}
|
||||
|
||||
if (instance != null)
|
||||
{
|
||||
AddInSystemFactory.Instance.AddCreator(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -97,6 +97,17 @@ namespace ANX.Framework.NonXNA
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ErrorAndThrow
|
||||
public static void ErrorAndThrow<T>(string message) where T : Exception, new ()
|
||||
{
|
||||
string text = CurrentTimeStamp + "| Error: " + message + BuildStackTrace();
|
||||
WriteToConsole(text);
|
||||
WriteToFile(text);
|
||||
|
||||
throw (T)Activator.CreateInstance(typeof(T), message);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region BuildStackTrace
|
||||
private static string BuildStackTrace()
|
||||
{
|
||||
|
@ -65,13 +65,17 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
foreach (string file in assembliesInPath)
|
||||
{
|
||||
if (file.EndsWith("OpenTK.dll") ||
|
||||
file.EndsWith("OpenTK.GLControl.dll") ||
|
||||
file.EndsWith("OpenTK.Compatibility.dll") ||
|
||||
file.EndsWith("SharpDX.dll") ||
|
||||
file.EndsWith("SharpDX.Direct3D11.dll") ||
|
||||
file.EndsWith("SharpDX.Direct3D10.dll") ||
|
||||
file.EndsWith("SharpDX.D3DCompiler.dll") ||
|
||||
file.EndsWith("SharpDX.DXGI.dll") ||
|
||||
file.EndsWith("SharpDX.XInput.dll") ||
|
||||
file.EndsWith("SharpDX.DirectInput.dll"))
|
||||
file.EndsWith("SharpDX.DirectInput.dll") ||
|
||||
file.EndsWith("WaveUtils.dll") ||
|
||||
file.EndsWith("SharpDX.XAudio2.dll"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -166,10 +170,11 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isTypeValidInputDevice = TypeHelper.IsAnyTypeAssignableFrom(InputDeviceFactory.ValidInputDeviceCreators, type);
|
||||
bool isTypeValidInputDevice = TypeHelper.IsAnyTypeAssignableFrom(InputDeviceFactory.ValidInputDeviceCreators,
|
||||
type);
|
||||
if (isTypeValidInputDevice && isTypeCreatable)
|
||||
{
|
||||
var inputCreator = Activator.CreateInstance(type) as IInputDeviceCreator;
|
||||
var inputCreator = TypeHelper.Create<IInputDeviceCreator>(type);
|
||||
InputDeviceFactory.Instance.AddCreator(type, inputCreator);
|
||||
}
|
||||
}
|
||||
|
@ -158,5 +158,12 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
#endif
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Create
|
||||
public static T Create<T>(Type type)
|
||||
{
|
||||
return (T)Activator.CreateInstance(type);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,52 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.NonXNA
|
||||
{
|
||||
public interface INativeGraphicsDevice : IDisposable
|
||||
{
|
||||
void Clear(ref Color color);
|
||||
void Clear(ClearOptions options, Vector4 color, float depth, int stencil);
|
||||
public interface INativeGraphicsDevice : IDisposable
|
||||
{
|
||||
void Clear(ref Color color);
|
||||
void Clear(ClearOptions options, Vector4 color, float depth, int stencil);
|
||||
|
||||
void Present();
|
||||
void Present();
|
||||
|
||||
void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount);
|
||||
void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices,
|
||||
int startIndex, int primitiveCount);
|
||||
|
||||
void DrawInstancedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount, int instanceCount);
|
||||
void DrawInstancedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices,
|
||||
int startIndex, int primitiveCount, int instanceCount);
|
||||
|
||||
void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration, IndexElementSize indexFormat) where T : struct, IVertexType;
|
||||
void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices,
|
||||
Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration,
|
||||
IndexElementSize indexFormat) where T : struct, IVertexType;
|
||||
|
||||
void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct, IVertexType;
|
||||
void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount,
|
||||
VertexDeclaration vertexDeclaration) where T : struct, IVertexType;
|
||||
|
||||
void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset, int primitiveCount);
|
||||
void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset, int primitiveCount);
|
||||
|
||||
#if XNAEXT
|
||||
void SetConstantBuffer(int slot, ConstantBuffer constantBuffer);
|
||||
void SetConstantBuffer(int slot, ConstantBuffer constantBuffer);
|
||||
#endif
|
||||
|
||||
void SetVertexBuffers(VertexBufferBinding[] vertexBuffers);
|
||||
void SetVertexBuffers(VertexBufferBinding[] vertexBuffers);
|
||||
|
||||
void SetIndexBuffer(IndexBuffer indexBuffer);
|
||||
void SetIndexBuffer(IndexBuffer indexBuffer);
|
||||
|
||||
void SetViewport(Viewport viewport);
|
||||
void SetViewport(Viewport viewport);
|
||||
|
||||
void SetRenderTargets(params RenderTargetBinding[] renderTargets);
|
||||
void SetRenderTargets(params RenderTargetBinding[] renderTargets);
|
||||
|
||||
void GetBackBufferData<T>(Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct;
|
||||
void GetBackBufferData<T>(T[] data) where T : struct;
|
||||
void GetBackBufferData<T>(T[] data, int startIndex, int elementCount) where T : struct;
|
||||
void GetBackBufferData<T>(Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct;
|
||||
void GetBackBufferData<T>(T[] data) where T : struct;
|
||||
void GetBackBufferData<T>(T[] data, int startIndex, int elementCount) where T : struct;
|
||||
|
||||
void ResizeBuffers(PresentationParameters presentationParameters);
|
||||
void ResizeBuffers(PresentationParameters presentationParameters);
|
||||
|
||||
bool VSync { get; set; }
|
||||
}
|
||||
bool VSync { get; set; }
|
||||
}
|
||||
}
|
||||
|
17
ANX.Framework/NonXNA/ThreadHelper.cs
Normal file
17
ANX.Framework/NonXNA/ThreadHelper.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace ANX.Framework.NonXNA
|
||||
{
|
||||
internal static class ThreadHelper
|
||||
{
|
||||
public static void Sleep(int milliseconds)
|
||||
{
|
||||
#if WINDOWSMETRO
|
||||
// TODO: search replacement
|
||||
#else
|
||||
Thread.Sleep(milliseconds);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
@ -54,10 +54,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -54,10 +54,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -54,10 +54,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
|
@ -56,10 +56,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -18,6 +18,7 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
{
|
||||
[PercentageComplete(90)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("AstrorEnales")]
|
||||
public class Creator : IRenderSystemCreator
|
||||
{
|
||||
#region Public
|
||||
@ -79,8 +80,7 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
#endregion
|
||||
|
||||
#region CreateGraphicsDevice
|
||||
INativeGraphicsDevice IRenderSystemCreator.CreateGraphicsDevice(
|
||||
PresentationParameters presentationParameters)
|
||||
INativeGraphicsDevice IRenderSystemCreator.CreateGraphicsDevice(PresentationParameters presentationParameters)
|
||||
{
|
||||
AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
|
||||
return new GraphicsDeviceWindowsGL3(presentationParameters);
|
||||
@ -145,8 +145,9 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
#endregion
|
||||
|
||||
#if XNAEXT
|
||||
#region CreateConstantBuffer
|
||||
public INativeConstantBuffer CreateConstantBuffer(GraphicsDevice graphics, ConstantBuffer managedBuffer, BufferUsage usage)
|
||||
#region CreateConstantBuffer (TODO)
|
||||
public INativeConstantBuffer CreateConstantBuffer(GraphicsDevice graphics, ConstantBuffer managedBuffer,
|
||||
BufferUsage usage)
|
||||
{
|
||||
AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
|
||||
|
||||
@ -250,7 +251,7 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
public ReadOnlyCollection<GraphicsAdapter> GetAdapterList()
|
||||
{
|
||||
AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
|
||||
|
||||
|
||||
var result = new List<GraphicsAdapter>();
|
||||
foreach (DisplayDevice device in DisplayDevice.AvailableDisplays)
|
||||
{
|
||||
@ -316,9 +317,11 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
}
|
||||
#endregion
|
||||
|
||||
public bool IsLanguageSupported(EffectSourceLanguage sourceLanguage)
|
||||
#region IsLanguageSupported
|
||||
public bool IsLanguageSupported(EffectSourceLanguage sourceLanguage)
|
||||
{
|
||||
return sourceLanguage == EffectSourceLanguage.GLSL_FX || sourceLanguage == EffectSourceLanguage.GLSL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Current == null || Current.nativeContext == null)
|
||||
return false;
|
||||
return Current.nativeContext.IsCurrent;
|
||||
}
|
||||
}
|
||||
@ -78,11 +80,6 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
Current = this;
|
||||
ResetDevice(presentationParameters);
|
||||
}
|
||||
|
||||
~GraphicsDeviceWindowsGL3()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ResetDevice
|
||||
@ -471,16 +468,16 @@ namespace ANX.RenderSystem.Windows.GL3
|
||||
activeEffect = null;
|
||||
boundRenderTargets = null;
|
||||
|
||||
if (nativeContext != null)
|
||||
{
|
||||
nativeContext.Dispose();
|
||||
nativeContext = null;
|
||||
}
|
||||
if (nativeWindowInfo != null)
|
||||
{
|
||||
nativeWindowInfo.Dispose();
|
||||
nativeWindowInfo = null;
|
||||
}
|
||||
if (nativeContext != null)
|
||||
{
|
||||
nativeContext.Dispose();
|
||||
nativeContext = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -57,10 +57,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -57,10 +57,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -57,10 +57,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
|
@ -59,10 +59,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK.Compatibility, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\OpenTK\OpenTK.Compatibility.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -2,9 +2,9 @@
|
||||
using System.IO;
|
||||
using ANX.Framework.Audio;
|
||||
using ANX.Framework.NonXNA.SoundSystem;
|
||||
using OpenTK.Audio;
|
||||
using OpenTK.Audio.OpenAL;
|
||||
using WaveUtils;
|
||||
using ALFormat = OpenTK.Audio.ALFormat;
|
||||
using ALFormat = OpenTK.Audio.OpenAL.ALFormat;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using ANX.Framework.Audio;
|
||||
using ANX.Framework.NonXNA.SoundSystem;
|
||||
using OpenTK.Audio;
|
||||
using OpenTK.Audio.OpenAL;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
|
Loading…
x
Reference in New Issue
Block a user