Show More
Commit Description:
Add basic infrastructure to store and display visitor count....
Commit Description:
Add basic infrastructure to store and display visitor count.
May eventually move to simulating visitors as entities. We'll see.
References:
File last commit:
Show/Diff file:
Action:
FNA/src/Graphics/OcclusionQuery.cs
87 lines | 1.4 KiB | text/x-csharp | CSharpLexer
87 lines | 1.4 KiB | text/x-csharp | CSharpLexer
r0 | #region License | |||
/* FNA - XNA4 Reimplementation for Desktop Platforms | ||||
r690 | * Copyright 2009-2022 Ethan Lee and the MonoGame Team | |||
r0 | * | |||
* Released under the Microsoft Public License. | ||||
* See LICENSE for details. | ||||
*/ | ||||
#endregion | ||||
#region Using Statements | ||||
using System; | ||||
#endregion | ||||
namespace Microsoft.Xna.Framework.Graphics | ||||
{ | ||||
public class OcclusionQuery : GraphicsResource | ||||
{ | ||||
#region Public Properties | ||||
public bool IsComplete | ||||
{ | ||||
get | ||||
{ | ||||
r690 | return FNA3D.FNA3D_QueryComplete( | |||
GraphicsDevice.GLDevice, | ||||
query | ||||
) == 1; | ||||
r0 | } | |||
} | ||||
public int PixelCount | ||||
{ | ||||
get | ||||
{ | ||||
r690 | return FNA3D.FNA3D_QueryPixelCount( | |||
GraphicsDevice.GLDevice, | ||||
query | ||||
); | ||||
r0 | } | |||
} | ||||
#endregion | ||||
r690 | #region Private FNA3D Variables | |||
r0 | ||||
r690 | private IntPtr query; | |||
r0 | ||||
#endregion | ||||
#region Public Constructor | ||||
public OcclusionQuery(GraphicsDevice graphicsDevice) | ||||
{ | ||||
GraphicsDevice = graphicsDevice; | ||||
r690 | query = FNA3D.FNA3D_CreateQuery(GraphicsDevice.GLDevice); | |||
r0 | } | |||
#endregion | ||||
#region Protected Dispose Method | ||||
protected override void Dispose(bool disposing) | ||||
{ | ||||
if (!IsDisposed) | ||||
{ | ||||
r690 | FNA3D.FNA3D_AddDisposeQuery(GraphicsDevice.GLDevice, query); | |||
r0 | } | |||
base.Dispose(disposing); | ||||
} | ||||
#endregion | ||||
#region Public Begin/End Methods | ||||
public void Begin() | ||||
{ | ||||
r690 | FNA3D.FNA3D_QueryBegin(GraphicsDevice.GLDevice, query); | |||
r0 | } | |||
public void End() | ||||
{ | ||||
r690 | FNA3D.FNA3D_QueryEnd(GraphicsDevice.GLDevice, query); | |||
r0 | } | |||
#endregion | ||||
} | ||||
} | ||||