Added conditional rendering

Former-commit-id: 30c062a469ad5f534b95a33c07c92c89036aacf7
This commit is contained in:
Lynix
2013-09-06 17:38:34 +02:00
parent e60b1c010e
commit 10f7d185a6
5 changed files with 121 additions and 15 deletions

View File

@@ -51,6 +51,16 @@ enum nzFaceFilling
nzFaceFilling_Max = nzFaceFilling_Fill
};
enum nzGpuQueryCondition
{
nzGpuQueryCondition_Region_NoWait,
nzGpuQueryCondition_Region_Wait,
nzGpuQueryCondition_NoWait,
nzGpuQueryCondition_Wait,
nzGpuQueryCondition_Max = nzGpuQueryCondition_Wait
};
enum nzGpuQueryMode
{
nzGpuQueryMode_AnySamplesPassed,
@@ -97,6 +107,7 @@ enum nzPixelBufferType
enum nzRendererCap
{
nzRendererCap_AnisotropicFilter,
nzRendererCap_ConditionalRendering,
nzRendererCap_FP64,
nzRendererCap_HardwareBuffer,
nzRendererCap_Instancing,

View File

@@ -29,6 +29,7 @@
enum nzOpenGLExtension
{
nzOpenGLExtension_AnisotropicFilter,
nzOpenGLExtension_ConditionalRender,
nzOpenGLExtension_DebugOutput,
nzOpenGLExtension_DrawInstanced,
nzOpenGLExtension_FP64,
@@ -90,8 +91,8 @@ class NAZARA_API NzOpenGL
static GLuint GetCurrentBuffer(nzBufferType type);
static GLuint GetCurrentProgram();
static const NzRenderTarget* GetCurrentTarget();
static NzRecti GetCurrentScissorBox();
static const NzRenderTarget* GetCurrentTarget();
static GLuint GetCurrentTexture();
static GLuint GetCurrentTexture(unsigned int textureUnit);
static unsigned int GetCurrentTextureUnit();
@@ -110,8 +111,8 @@ class NAZARA_API NzOpenGL
static bool IsSupported(const NzString& string);
static void SetBuffer(nzBufferType type, GLuint id);
static void SetScissorBox(const NzRecti& scissorBox);
static void SetProgram(GLuint id);
static void SetScissorBox(const NzRecti& scissorBox);
static void SetTarget(const NzRenderTarget* renderTarget);
static void SetTexture(GLuint id);
static void SetTexture(unsigned int textureUnit, GLuint id);
@@ -135,6 +136,7 @@ class NAZARA_API NzOpenGL
static GLenum FaceCulling[nzFaceCulling_Max+1];
static GLenum FaceFilling[nzFaceFilling_Max+1];
static GLenum PrimitiveMode[nzPrimitiveMode_Max+1];
static GLenum QueryCondition[nzGpuQueryCondition_Max+1];
static GLenum QueryMode[nzGpuQueryMode_Max+1];
static GLenum RendererComparison[nzRendererComparison_Max+1];
static GLenum RendererParameter[nzRendererParameter_Max+1];
@@ -152,6 +154,7 @@ class NAZARA_API NzOpenGL
NAZARA_API extern PFNGLACTIVETEXTUREPROC glActiveTexture;
NAZARA_API extern PFNGLATTACHSHADERPROC glAttachShader;
NAZARA_API extern PFNGLBEGINCONDITIONALRENDERPROC glBeginConditionalRender;
NAZARA_API extern PFNGLBEGINQUERYPROC glBeginQuery;
NAZARA_API extern PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation;
NAZARA_API extern PFNGLBINDBUFFERPROC glBindBuffer;
@@ -201,6 +204,7 @@ NAZARA_API extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
NAZARA_API extern PFNGLDRAWTEXTURENVPROC glDrawTexture;
NAZARA_API extern PFNGLENABLEPROC glEnable;
NAZARA_API extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
NAZARA_API extern PFNGLENDCONDITIONALRENDERPROC glEndConditionalRender;
NAZARA_API extern PFNGLENDQUERYPROC glEndQuery;
NAZARA_API extern PFNGLFLUSHPROC glFlush;
NAZARA_API extern PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer;

View File

@@ -12,6 +12,7 @@
#include <Nazara/Math/Matrix4.hpp>
#include <Nazara/Math/Rect.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/GpuQuery.hpp>
#include <Nazara/Renderer/RenderStates.hpp>
#include <Nazara/Renderer/TextureSampler.hpp>
#include <Nazara/Utility/Enums.hpp>
@@ -35,6 +36,8 @@ class NAZARA_API NzRenderer
NzRenderer() = delete;
~NzRenderer() = delete;
static void BeginCondition(const NzGpuQuery& query, nzGpuQueryCondition condition);
static void Clear(nzUInt32 flags = nzRendererClear_Color | nzRendererClear_Depth);
static void DrawFullscreenQuad();
@@ -45,6 +48,8 @@ class NAZARA_API NzRenderer
static void Enable(nzRendererParameter parameter, bool enable);
static void EndCondition();
static void Flush();
static NzVertexBuffer* GetInstanceBuffer();