Made scissor rect/viewport Recti instead of Rectui

Also greatly optimized Renderer::Get[ScissorRect|Viewport]


Former-commit-id: 87945543144216715520a4c3ab30629636995afd
This commit is contained in:
Lynix
2013-08-26 13:37:33 +02:00
parent 7d9eac7660
commit f679f323c2
10 changed files with 258 additions and 115 deletions

View File

@@ -31,7 +31,7 @@ class NAZARA_API NzAbstractViewer
virtual const NzMatrix4f& GetProjectionMatrix() const = 0;
virtual const NzRenderTarget* GetTarget() const = 0;
virtual const NzMatrix4f& GetViewMatrix() const = 0;
virtual const NzRectui& GetViewport() const = 0;
virtual const NzRecti& GetViewport() const = 0;
virtual float GetZFar() const = 0;
virtual float GetZNear() const = 0;
};

View File

@@ -36,7 +36,7 @@ class NAZARA_API NzCamera : public NzAbstractViewer, public NzNode, NzRenderTarg
const NzRenderTarget* GetTarget() const;
const NzRectf& GetTargetRegion() const;
const NzMatrix4f& GetViewMatrix() const;
const NzRectui& GetViewport() const;
const NzRecti& GetViewport() const;
float GetZFar() const;
float GetZNear() const;
@@ -44,7 +44,7 @@ class NAZARA_API NzCamera : public NzAbstractViewer, public NzNode, NzRenderTarg
void SetTarget(const NzRenderTarget* renderTarget);
void SetTarget(const NzRenderTarget& renderTarget);
void SetTargetRegion(const NzRectf& region);
void SetViewport(const NzRectui& viewport);
void SetViewport(const NzRecti& viewport);
void SetZFar(float zFar);
void SetZNear(float zNear);
@@ -64,7 +64,7 @@ class NAZARA_API NzCamera : public NzAbstractViewer, public NzNode, NzRenderTarg
mutable NzMatrix4f m_projectionMatrix;
mutable NzMatrix4f m_viewMatrix;
NzRectf m_targetRegion;
mutable NzRectui m_viewport;
mutable NzRecti m_viewport;
const NzRenderTarget* m_target;
mutable bool m_frustumUpdated;
mutable bool m_projectionMatrixUpdated;

View File

@@ -35,14 +35,14 @@ class NAZARA_API NzView : public NzAbstractViewer, public NzNode, NzRenderTarget
const NzRenderTarget* GetTarget() const;
const NzRectf& GetTargetRegion() const;
const NzMatrix4f& GetViewMatrix() const;
const NzRectui& GetViewport() const;
const NzRecti& GetViewport() const;
float GetZFar() const;
float GetZNear() const;
void SetTarget(const NzRenderTarget* renderTarget);
void SetTarget(const NzRenderTarget& renderTarget);
void SetTargetRegion(const NzRectf& region);
void SetViewport(const NzRectui& viewport);
void SetViewport(const NzRecti& viewport);
void SetZFar(float zFar);
void SetZNear(float zNear);
@@ -62,7 +62,7 @@ class NAZARA_API NzView : public NzAbstractViewer, public NzNode, NzRenderTarget
mutable NzMatrix4f m_projectionMatrix;
mutable NzMatrix4f m_viewMatrix;
NzRectf m_targetRegion;
mutable NzRectui m_viewport;
mutable NzRecti m_viewport;
const NzRenderTarget* m_target;
mutable bool m_frustumUpdated;
mutable bool m_projectionMatrixUpdated;

View File

@@ -13,9 +13,10 @@
#include <GL3/glcorearb.h>
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Math/Rect.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/RenderStates.hpp>
#include <Nazara/Utility/Enums.hpp>
// Inclusion des extensions
#include <GL3/glext.h>
@@ -47,6 +48,8 @@ enum nzOpenGLExtension
};
class NzContext;
class NzRenderTarget;
using NzOpenGLFunc = void (*)();
class NAZARA_API NzOpenGL
@@ -75,9 +78,11 @@ class NAZARA_API NzOpenGL
static void BindBuffer(nzBufferType type, GLuint id);
static void BindProgram(GLuint id);
static void BindScissorBox(const NzRecti& scissorBox);
static void BindTexture(nzImageType type, GLuint id);
static void BindTexture(unsigned int textureUnit, nzImageType type, GLuint id);
static void BindTextureUnit(unsigned int textureUnit);
static void BindViewport(const NzRecti& viewport);
static void DeleteBuffer(nzBufferType type, GLuint id);
static void DeleteProgram(GLuint id);
@@ -85,12 +90,16 @@ class NAZARA_API NzOpenGL
static GLuint GetCurrentBuffer(nzBufferType type);
static GLuint GetCurrentProgram();
static const NzRenderTarget* GetCurrentTarget();
static NzRecti GetCurrentScissorBox();
static GLuint GetCurrentTexture();
static GLuint GetCurrentTexture(unsigned int textureUnit);
static unsigned int GetCurrentTextureUnit();
static NzRecti GetCurrentViewport();
static NzOpenGLFunc GetEntry(const NzString& entryPoint);
static unsigned int GetGLSLVersion();
static NzString GetRendererName();
static unsigned int GetTextureUnit();
static NzString GetVendorName();
static unsigned int GetVersion();
@@ -101,10 +110,13 @@ 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 SetTarget(const NzRenderTarget* renderTarget);
static void SetTexture(GLuint id);
static void SetTexture(unsigned int textureUnit, GLuint id);
static void SetTextureUnit(unsigned int textureUnit);
static void SetViewport(const NzRecti& viewport);
static bool TranslateFormat(nzPixelFormat pixelFormat, Format* format, FormatType target);

View File

@@ -56,10 +56,10 @@ class NAZARA_API NzRenderer
static unsigned int GetMaxVertexAttribs();
static float GetPointSize();
static const NzRenderStates& GetRenderStates();
static NzRectui GetScissorRect();
static NzRecti GetScissorRect();
static const NzShaderProgram* GetShaderProgram();
static const NzRenderTarget* GetTarget();
static NzRectui GetViewport();
static NzRecti GetViewport();
static bool HasCapability(nzRendererCap capability);
@@ -81,7 +81,7 @@ class NAZARA_API NzRenderer
static void SetMatrix(nzMatrixType type, const NzMatrix4f& matrix);
static void SetPointSize(float size);
static void SetRenderStates(const NzRenderStates& states);
static void SetScissorRect(const NzRectui& viewport);
static void SetScissorRect(const NzRecti& rect);
static void SetShaderProgram(const NzShaderProgram* shader);
static void SetStencilCompareFunction(nzRendererComparison compareFunc);
static void SetStencilFailOperation(nzStencilOperation failOperation);
@@ -93,7 +93,7 @@ class NAZARA_API NzRenderer
static void SetTexture(nzUInt8 unit, const NzTexture* texture);
static void SetTextureSampler(nzUInt8 textureUnit, const NzTextureSampler& sampler);
static void SetVertexBuffer(const NzVertexBuffer* vertexBuffer);
static void SetViewport(const NzRectui& viewport);
static void SetViewport(const NzRecti& viewport);
static void Uninitialize();