diff --git a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj
index a389eda0..76582904 100644
--- a/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj
+++ b/ANX.Framework.Content.Pipeline/ANX.Framework.Content.Pipeline_WindowsMetro.csproj
@@ -193,7 +193,7 @@
{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}
ANX.Framework
-
+
{1986B0ED-3D28-4FEE-82D0-BCC39C87C18C}
WaveUtils
diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj
index 8c78fd0f..fbe609bc 100644
--- a/ANX.Framework/ANX.Framework.csproj
+++ b/ANX.Framework/ANX.Framework.csproj
@@ -441,6 +441,7 @@
+
diff --git a/ANX.Framework/ANX.Framework_Linux.csproj b/ANX.Framework/ANX.Framework_Linux.csproj
index 758baee9..88f3f685 100644
--- a/ANX.Framework/ANX.Framework_Linux.csproj
+++ b/ANX.Framework/ANX.Framework_Linux.csproj
@@ -441,6 +441,7 @@
+
diff --git a/ANX.Framework/ANX.Framework_PSVita.csproj b/ANX.Framework/ANX.Framework_PSVita.csproj
index 4072afa4..5c0ddec5 100644
--- a/ANX.Framework/ANX.Framework_PSVita.csproj
+++ b/ANX.Framework/ANX.Framework_PSVita.csproj
@@ -443,6 +443,7 @@
+
diff --git a/ANX.Framework/ANX.Framework_WindowsMetro.csproj b/ANX.Framework/ANX.Framework_WindowsMetro.csproj
index 2577c67f..59746c94 100644
--- a/ANX.Framework/ANX.Framework_WindowsMetro.csproj
+++ b/ANX.Framework/ANX.Framework_WindowsMetro.csproj
@@ -444,6 +444,7 @@
+
diff --git a/ANX.Framework/Graphics/OcclusionQuery.cs b/ANX.Framework/Graphics/OcclusionQuery.cs
index 2a232959..bf43af28 100644
--- a/ANX.Framework/Graphics/OcclusionQuery.cs
+++ b/ANX.Framework/Graphics/OcclusionQuery.cs
@@ -1,8 +1,7 @@
-#region Using Statements
using System;
using System.Runtime.InteropServices;
-
-#endregion // Using Statements
+using ANX.Framework.NonXNA;
+using ANX.Framework.NonXNA.RenderSystem;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@@ -10,76 +9,92 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
- public class OcclusionQuery : GraphicsResource, IGraphicsResource
- {
- private bool hasBegun;
- private bool completeCallPending;
+ public class OcclusionQuery : GraphicsResource, IGraphicsResource
+ {
+ #region Private
+ private bool hasBegun;
+ private bool completeCallPending;
- public OcclusionQuery(GraphicsDevice graphicsDevice)
- : base(graphicsDevice)
- {
- throw new NotImplementedException();
- }
+ private IOcclusionQuery nativeQuery;
+ #endregion
- public void Begin()
- {
- if (this.hasBegun)
- {
- throw new InvalidOperationException("Begin cannot be called again until End is called.");
- }
+ #region Public
+ public bool IsComplete
+ {
+ get
+ {
+ return nativeQuery.IsComplete;
+ }
+ }
- if (this.completeCallPending)
- {
- throw new InvalidOperationException("Begin may not be called on this query object again before IsComplete is checked.");
- }
+ public int PixelCount
+ {
+ get
+ {
+ if (this.completeCallPending)
+ throw new InvalidOperationException("The status of the query data is unknown. Use the IsComplete " +
+ "property to determine if the data is available before attempting to retrieve it.");
- this.hasBegun = true;
- this.completeCallPending = true;
+ return nativeQuery.PixelCount;
+ }
+ }
+ #endregion
- throw new NotImplementedException();
- }
+ #region Constructor
+ public OcclusionQuery(GraphicsDevice graphicsDevice)
+ : base(graphicsDevice)
+ {
+ var creator = AddInSystemFactory.Instance.GetDefaultCreator();
+ nativeQuery = creator.CreateOcclusionQuery();
+ }
- public void End()
- {
- if (!this.hasBegun)
- {
- throw new InvalidOperationException("Begin must be called before End can be called.");
- }
+ ~OcclusionQuery()
+ {
+ Dispose(true);
+ }
+ #endregion
- throw new NotImplementedException();
- }
+ #region Begin
+ public void Begin()
+ {
+ if (hasBegun)
+ throw new InvalidOperationException("Begin cannot be called again until End is called.");
- public override void Dispose()
- {
- throw new NotImplementedException();
- }
+ if (completeCallPending)
+ throw new InvalidOperationException("Begin may not be called on this query object again before IsComplete " +
+ "is checked.");
- protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
- {
- throw new NotImplementedException();
- }
+ hasBegun = true;
+ completeCallPending = true;
- public bool IsComplete
- {
- get
- {
- this.completeCallPending = false;
+ nativeQuery.Begin();
+ }
+ #endregion
- throw new NotImplementedException();
- }
- }
+ #region End
+ public void End()
+ {
+ if (this.hasBegun == false)
+ throw new InvalidOperationException("Begin must be called before End can be called.");
- public int PixelCount
- {
- get
- {
- if (this.completeCallPending)
- {
- throw new InvalidOperationException("The status of the query data is unknown. Use the IsComplete property to determine if the data is available before attempting to retrieve it.");
- }
+ nativeQuery.End();
+ }
+ #endregion
- throw new NotImplementedException();
- }
- }
- }
+ #region Dispose
+ public override void Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
+ {
+ if (nativeQuery != null)
+ {
+ nativeQuery.Dispose();
+ nativeQuery = null;
+ }
+ }
+ #endregion
+ }
}
diff --git a/ANX.Framework/NonXNA/RenderSystem/IOcclusionQuery.cs b/ANX.Framework/NonXNA/RenderSystem/IOcclusionQuery.cs
new file mode 100644
index 00000000..1b34e968
--- /dev/null
+++ b/ANX.Framework/NonXNA/RenderSystem/IOcclusionQuery.cs
@@ -0,0 +1,17 @@
+using System;
+
+// 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.RenderSystem
+{
+ public interface IOcclusionQuery : IDisposable
+ {
+ bool IsComplete { get; }
+ int PixelCount { get; }
+
+ void Begin();
+ void End();
+ }
+}
diff --git a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs
index 472569f9..51c64e8a 100644
--- a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs
+++ b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs
@@ -11,33 +11,29 @@ namespace ANX.Framework.NonXNA
{
public interface IRenderSystemCreator : ICreator
{
- INativeGraphicsDevice CreateGraphicsDevice(
- PresentationParameters presentationParameters);
+ INativeGraphicsDevice CreateGraphicsDevice(PresentationParameters presentationParameters);
- INativeTexture2D CreateTexture(GraphicsDevice graphics,
- SurfaceFormat surfaceFormat, int width, int height, int mipCount);
+ INativeTexture2D CreateTexture(GraphicsDevice graphics, SurfaceFormat surfaceFormat, int width, int height, int mipCount);
- INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics,
- int width, int height, bool mipMap, SurfaceFormat preferredFormat,
- DepthFormat preferredDepthFormat, int preferredMultiSampleCount,
+ INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap,
+ SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount,
RenderTargetUsage usage);
- INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
- IndexBuffer managedBuffer, IndexElementSize size, int indexCount,
- BufferUsage usage);
+ INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexBuffer managedBuffer, IndexElementSize size,
+ int indexCount, BufferUsage usage);
- INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
- VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration,
- int vertexCount, BufferUsage usage);
+ INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexBuffer managedBuffer,
+ VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage);
#if XNAEXT
INativeConstantBuffer CreateConstantBuffer(GraphicsDevice graphics, ConstantBuffer managedBuffer, BufferUsage usage);
#endif
- INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
- Stream byteCode);
- INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
- Stream vertexShaderByteCode, Stream pixelShaderByteCode);
+ INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream byteCode);
+ INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream vertexShaderByteCode,
+ Stream pixelShaderByteCode);
+
+ IOcclusionQuery CreateOcclusionQuery();
bool IsLanguageSupported(EffectSourceLanguage sourceLanguage);
diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs
index 02edb1c8..154310ef 100644
--- a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs
+++ b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs
@@ -247,5 +247,12 @@ namespace ANX.RenderSystem.Windows.DX10
{
return sourceLanguage == EffectSourceLanguage.HLSL_FX || sourceLanguage == EffectSourceLanguage.HLSL;
}
+
+ #region CreateOcclusionQuery (TODO)
+ public IOcclusionQuery CreateOcclusionQuery()
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
}
}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj
index 06d494fa..fd1e14e9 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj
+++ b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj
@@ -56,6 +56,7 @@
+
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj
index 6b1e011a..c73eb47e 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj
+++ b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj
@@ -56,6 +56,7 @@
+
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj
index 5177132c..ceea511e 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj
+++ b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj
@@ -57,6 +57,7 @@
+
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj
index 1ec351ad..4b10a143 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj
+++ b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj
@@ -58,6 +58,7 @@
+
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
index 1f1ff71d..c2ce4eb9 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
+++ b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
@@ -323,5 +323,12 @@ namespace ANX.RenderSystem.Windows.GL3
return sourceLanguage == EffectSourceLanguage.GLSL_FX || sourceLanguage == EffectSourceLanguage.GLSL;
}
#endregion
+
+ #region CreateOcclusionQuery
+ public IOcclusionQuery CreateOcclusionQuery()
+ {
+ return new OcclusionQueryGL3();
+ }
+ #endregion
}
}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/OcclusionQueryGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/OcclusionQueryGL3.cs
new file mode 100644
index 00000000..1acc355d
--- /dev/null
+++ b/RenderSystems/ANX.Framework.Windows.GL3/OcclusionQueryGL3.cs
@@ -0,0 +1,73 @@
+using ANX.Framework.NonXNA.Development;
+using ANX.Framework.NonXNA.RenderSystem;
+using OpenTK.Graphics.OpenGL;
+
+// 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.RenderSystem.Windows.GL3
+{
+ [PercentageComplete(100)]
+ [TestState(TestStateAttribute.TestState.Untested)]
+ [Developer("AstrorEnales")]
+ public class OcclusionQueryGL3 : IOcclusionQuery
+ {
+ private uint[] handle;
+
+ #region Public
+ public bool IsComplete
+ {
+ get
+ {
+ int state;
+ GL.GetQueryObject(handle[0], GetQueryObjectParam.QueryResultAvailable, out state);
+ return state != 0;
+ }
+ }
+
+ public int PixelCount
+ {
+ get
+ {
+ int result;
+ GL.GetQueryObject(handle[0], GetQueryObjectParam.QueryResult, out result);
+ return result;
+ }
+ }
+ #endregion
+
+ #region Constructor
+ public OcclusionQueryGL3()
+ {
+ handle = new uint[1];
+ GL.GenQueries(1, handle);
+ }
+ #endregion
+
+ #region Begin
+ public void Begin()
+ {
+ //GLCore.ColorMask(false, false, false, false);
+ //GLCore.DepthMask(false);
+ GL.BeginQuery(QueryTarget.SamplesPassed, handle[0]);
+ }
+ #endregion
+
+ #region End
+ public void End()
+ {
+ GL.EndQuery(QueryTarget.SamplesPassed);
+ //GLCore.DepthMask(true);
+ //GLCore.ColorMask(true, true, true, true);
+ }
+ #endregion
+
+ #region Dispose
+ public void Dispose()
+ {
+ GL.DeleteQueries(1, handle);
+ }
+ #endregion
+ }
+}
diff --git a/RenderSystems/ANX.RenderSystem.PsVita/Creator.cs b/RenderSystems/ANX.RenderSystem.PsVita/Creator.cs
index 0544bdae..32cbb038 100644
--- a/RenderSystems/ANX.RenderSystem.PsVita/Creator.cs
+++ b/RenderSystems/ANX.RenderSystem.PsVita/Creator.cs
@@ -160,5 +160,11 @@ namespace ANX.RenderSystem.PsVita
return false;
}
+ #region CreateOcclusionQuery (TODO)
+ public IOcclusionQuery CreateOcclusionQuery()
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
}
}
diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs
index 7ec5c34d..60514f08 100644
--- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs
+++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs
@@ -243,5 +243,11 @@ namespace ANX.RenderSystem.Windows.DX11
return sourceLanguage == EffectSourceLanguage.HLSL_FX || sourceLanguage == EffectSourceLanguage.HLSL;
}
+ #region CreateOcclusionQuery (TODO)
+ public IOcclusionQuery CreateOcclusionQuery()
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
}
}
diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs
index f87c3e97..947e901c 100644
--- a/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs
+++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs
@@ -262,5 +262,22 @@ namespace ANX.RenderSystem.Windows.Metro
preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage);
}
#endregion
+
+ #region CreateOcclusionQuery (TODO)
+ public IOcclusionQuery CreateOcclusionQuery()
+ {
+ throw new NotImplementedException();
+ }
+ #endregion
+
+ #region IRenderSystemCreator Member
+
+
+ public bool IsLanguageSupported(EffectSourceLanguage sourceLanguage)
+ {
+ throw new NotImplementedException();
+ }
+
+ #endregion
}
}
diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj
index 6bce05c7..0d774601 100644
--- a/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj
+++ b/SoundSystems/ANX.SoundSystem.OpenAL/ANX.SoundSystem.OpenAL_WindowsMetro.csproj
@@ -74,7 +74,7 @@
{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}
ANX.Framework
-
+
{1986B0ED-3D28-4FEE-82D0-BCC39C87C18C}
WaveUtils