Rewritted ResourceLoader and moved it to core
Added creation constructor to NzImage Added member function functor Added option to build Nazara as one library (instead of many) Fixed some 2011 copyrights Made use of "using def = T" C++11 feature instead of some illigible typedefs Removed unused premake file
This commit is contained in:
@@ -44,7 +44,7 @@ namespace
|
||||
GL_STATIC_DRAW // nzBufferUsage_Static
|
||||
};
|
||||
|
||||
typedef nzUInt8* (*LockRoutine)(nzBufferType type, nzBufferAccess access, unsigned int offset, unsigned int size);
|
||||
using LockRoutine = nzUInt8* (*)(nzBufferType type, nzBufferAccess access, unsigned int offset, unsigned int size);
|
||||
|
||||
nzUInt8* LockBuffer(nzBufferType type, nzBufferAccess access, unsigned int offset, unsigned int size)
|
||||
{
|
||||
|
||||
@@ -354,9 +354,9 @@ bool NzOpenGL::Initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKPROC>(LoadEntry("glDebugMessageCallback"));
|
||||
glDebugMessageControl = reinterpret_cast<PFNGLDEBUGMESSAGECONTROLPROC>(LoadEntry("glDebugMessageControl"));
|
||||
glDebugMessageInsert = reinterpret_cast<PFNGLDEBUGMESSAGEINSERTPROC>(LoadEntry("glDebugMessageInsert"));
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKPROC>(LoadEntry("glDebugMessageCallback"));
|
||||
glGetDebugMessageLog = reinterpret_cast<PFNGLGETDEBUGMESSAGELOGPROC>(LoadEntry("glGetDebugMessageLog"));
|
||||
|
||||
openGLextensions[NzOpenGL::DebugOutput] = true;
|
||||
@@ -371,9 +371,9 @@ bool NzOpenGL::Initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKARBPROC>(LoadEntry("glDebugMessageCallbackARB"));
|
||||
glDebugMessageControl = reinterpret_cast<PFNGLDEBUGMESSAGECONTROLARBPROC>(LoadEntry("glDebugMessageControlARB"));
|
||||
glDebugMessageInsert = reinterpret_cast<PFNGLDEBUGMESSAGEINSERTARBPROC>(LoadEntry("glDebugMessageInsertARB"));
|
||||
glDebugMessageCallback = reinterpret_cast<PFNGLDEBUGMESSAGECALLBACKARBPROC>(LoadEntry("glDebugMessageCallbackARB"));
|
||||
glGetDebugMessageLog = reinterpret_cast<PFNGLGETDEBUGMESSAGELOGARBPROC>(LoadEntry("glGetDebugMessageLogARB"));
|
||||
|
||||
openGLextensions[NzOpenGL::DebugOutput] = true;
|
||||
@@ -590,9 +590,9 @@ PFNGLCOLORMASKPROC glColorMask = nullptr;
|
||||
PFNGLCULLFACEPROC glCullFace = nullptr;
|
||||
PFNGLCOMPILESHADERPROC glCompileShader = nullptr;
|
||||
PFNGLCOPYTEXSUBIMAGE2DPROC glCopyTexSubImage2D = nullptr;
|
||||
PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback = nullptr;
|
||||
PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl = nullptr;
|
||||
PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert = nullptr;
|
||||
PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback = nullptr;
|
||||
PFNGLDELETEBUFFERSPROC glDeleteBuffers = nullptr;
|
||||
PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers = nullptr;
|
||||
PFNGLDELETEPROGRAMPROC glDeleteProgram = nullptr;
|
||||
|
||||
@@ -147,10 +147,10 @@ namespace
|
||||
return new NzHardwareBuffer(parent, type);
|
||||
}
|
||||
|
||||
typedef std::tuple<const NzContext*, const NzIndexBuffer*, const NzVertexBuffer*, const NzVertexDeclaration*> VAO_Key;
|
||||
|
||||
constexpr unsigned int totalMatrixCount = nzMatrixCombination_Max+1;
|
||||
|
||||
using VAO_Key = std::tuple<const NzContext*, const NzIndexBuffer*, const NzVertexBuffer*, const NzVertexDeclaration*>;
|
||||
|
||||
std::map<VAO_Key, unsigned int> s_vaos;
|
||||
NzMatrix4f s_matrix[totalMatrixCount];
|
||||
int s_matrixLocation[totalMatrixCount];
|
||||
|
||||
@@ -14,15 +14,7 @@
|
||||
#include <stdexcept>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
NzShader::NzShader() :
|
||||
m_impl(nullptr),
|
||||
m_compiled(false)
|
||||
{
|
||||
}
|
||||
|
||||
NzShader::NzShader(nzShaderLanguage language) :
|
||||
m_impl(nullptr),
|
||||
m_compiled(false)
|
||||
NzShader::NzShader(nzShaderLanguage language)
|
||||
{
|
||||
Create(language);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <Nazara/Renderer/Shader.hpp>
|
||||
|
||||
class NzRenderer;
|
||||
class NzTexture;
|
||||
class NzVertexBuffer;
|
||||
class NzVertexDeclaration;
|
||||
|
||||
@@ -517,7 +517,7 @@ void NzTexture::Destroy()
|
||||
bool NzTexture::Download(NzImage* image) const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -576,7 +576,7 @@ bool NzTexture::Download(NzImage* image) const
|
||||
bool NzTexture::EnableMipmapping(bool enable)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -603,7 +603,7 @@ bool NzTexture::EnableMipmapping(bool enable)
|
||||
unsigned int NzTexture::GetAnisotropyLevel() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
@@ -626,7 +626,7 @@ unsigned int NzTexture::GetAnisotropyLevel() const
|
||||
nzUInt8 NzTexture::GetBPP() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
@@ -639,7 +639,7 @@ nzUInt8 NzTexture::GetBPP() const
|
||||
unsigned int NzTexture::GetDepth() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
@@ -652,7 +652,7 @@ unsigned int NzTexture::GetDepth() const
|
||||
nzTextureFilter NzTexture::GetFilterMode() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzTextureFilter_Unknown;
|
||||
@@ -689,7 +689,7 @@ nzTextureFilter NzTexture::GetFilterMode() const
|
||||
nzPixelFormat NzTexture::GetFormat() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzPixelFormat_Undefined;
|
||||
@@ -702,7 +702,7 @@ nzPixelFormat NzTexture::GetFormat() const
|
||||
unsigned int NzTexture::GetHeight() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
@@ -715,7 +715,7 @@ unsigned int NzTexture::GetHeight() const
|
||||
nzImageType NzTexture::GetType() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzImageType_2D;
|
||||
@@ -728,7 +728,7 @@ nzImageType NzTexture::GetType() const
|
||||
unsigned int NzTexture::GetWidth() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return 0;
|
||||
@@ -741,7 +741,7 @@ unsigned int NzTexture::GetWidth() const
|
||||
nzTextureWrap NzTexture::GetWrapMode() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return nzTextureWrap_Unknown;
|
||||
@@ -773,7 +773,7 @@ nzTextureWrap NzTexture::GetWrapMode() const
|
||||
bool NzTexture::IsCompressed() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -786,7 +786,7 @@ bool NzTexture::IsCompressed() const
|
||||
bool NzTexture::IsCubemap() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -799,7 +799,7 @@ bool NzTexture::IsCubemap() const
|
||||
bool NzTexture::IsTarget() const
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -915,7 +915,7 @@ bool NzTexture::LoadFromStream(NzInputStream& stream, const NzImageParams& param
|
||||
bool NzTexture::Lock()
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -930,7 +930,7 @@ bool NzTexture::Lock()
|
||||
bool NzTexture::SetAnisotropyLevel(unsigned int anistropyLevel)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -955,7 +955,7 @@ bool NzTexture::SetAnisotropyLevel(unsigned int anistropyLevel)
|
||||
bool NzTexture::SetFilterMode(nzTextureFilter filter)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1008,7 +1008,7 @@ bool NzTexture::SetFilterMode(nzTextureFilter filter)
|
||||
bool NzTexture::SetMipmapRange(nzUInt8 minLevel, nzUInt8 maxLevel)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1038,7 +1038,7 @@ bool NzTexture::SetMipmapRange(nzUInt8 minLevel, nzUInt8 maxLevel)
|
||||
bool NzTexture::SetWrapMode(nzTextureWrap wrap)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1175,7 +1175,7 @@ bool NzTexture::Update(const NzImage& image, const NzCubeui& cube, nzUInt8 level
|
||||
bool NzTexture::Update(const nzUInt8* pixels, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1191,7 +1191,7 @@ bool NzTexture::Update(const nzUInt8* pixels, nzUInt8 level)
|
||||
bool NzTexture::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1292,7 +1292,7 @@ bool NzTexture::Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int
|
||||
bool NzTexture::Update(const nzUInt8* pixels, const NzCubeui& cube, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1436,7 +1436,7 @@ bool NzTexture::UpdateFace(nzCubemapFace face, const NzImage& image, const NzRec
|
||||
bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1449,7 +1449,7 @@ bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, nzUInt8 le
|
||||
bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, const NzRectui& rect, nzUInt8 level)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return false;
|
||||
@@ -1527,7 +1527,7 @@ bool NzTexture::UpdateFace(nzCubemapFace face, const nzUInt8* pixels, const NzRe
|
||||
void NzTexture::Unlock()
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraError("Texture must be valid");
|
||||
return;
|
||||
@@ -1619,7 +1619,7 @@ bool NzTexture::IsTypeSupported(nzImageType type)
|
||||
void NzTexture::SetTarget(bool isTarget)
|
||||
{
|
||||
#if NAZARA_RENDERER_SAFE
|
||||
if (!IsValid())
|
||||
if (!m_impl)
|
||||
{
|
||||
NazaraInternalError("Texture must be valid");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user