Refactored mathematics module

Added AABBs
Added code examples
Added experimental support for texture arrays (1D/2D)
Added initialisers (new way of initialising modules)
Added global headers (Plus a global header generator script)
Added pattern support for directory
Added support for spinlocks critical section on Windows
Added NzRenderWindow::SetFramerateLimit
Core project now includes Mathematics files
Fixed color implementation using double
Fixed declaration needing renderer include
Fixed MLT not clearing nextFree(File/Line) after Free
Fixed move operators not being noexcept
Fixed thread-safety (Now working correctly - If I'm lucky)
Moved Resource to core
New interface for modules
New interface for the renderer
Put some global functions to anonymous namespace
Removed empty modules
Renamed ThreadCondition to ConditionVariable
Replaced redirect to cerr log option by duplicate to cout
Setting mouse position relative to a window will make this window ignore
the event
Shaders sending methods no longer takes the uniform variable name (it's
using ID instead)
Using new OpenGL 4.3 header
This commit is contained in:
Lynix
2012-08-08 04:44:17 +02:00
parent 06eda4eba9
commit b442ab0bd2
142 changed files with 6861 additions and 2326 deletions

View File

@@ -161,6 +161,32 @@ NzString NzShader::GetSourceCode(nzShaderType type) const
return m_impl->GetSourceCode(type);
}
int NzShader::GetUniformLocation(const NzString& name) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
#endif
return m_impl->GetUniformLocation(name);
}
bool NzShader::HasUniform(const NzString& name) const
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
#endif
return m_impl->GetUniformLocation(name) != -1;
}
bool NzShader::IsCompiled() const
{
#if NAZARA_RENDERER_SAFE
@@ -282,7 +308,7 @@ bool NzShader::Lock()
return m_impl->Lock();
}
bool NzShader::SendBoolean(const NzString& name, bool value)
bool NzShader::SendBoolean(int location, bool value)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -290,57 +316,43 @@ bool NzShader::SendBoolean(const NzString& name, bool value)
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendBoolean(name, value);
return m_impl->SendBoolean(location, value);
}
bool NzShader::SendDouble(const NzString& name, double value)
bool NzShader::SendDouble(int location, double value)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (!NazaraRenderer->HasCapability(nzRendererCap_FP64))
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
#endif
return m_impl->SendDouble(name, value);
}
bool NzShader::SendFloat(const NzString& name, float value)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
#endif
return m_impl->SendFloat(name, value);
}
bool NzShader::SendInteger(const NzString& name, int value)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
if (location == -1)
{
NazaraError("Shader not created");
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendInteger(name, value);
return m_impl->SendDouble(location, value);
}
bool NzShader::SendMatrix(const NzString& name, const NzMatrix4d& matrix)
bool NzShader::SendFloat(int location, float value)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -349,30 +361,61 @@ bool NzShader::SendMatrix(const NzString& name, const NzMatrix4d& matrix)
return false;
}
if (!NazaraRenderer->HasCapability(nzRendererCap_FP64))
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendFloat(location, value);
}
bool NzShader::SendInteger(int location, int value)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendInteger(location, value);
}
bool NzShader::SendMatrix(int location, const NzMatrix4d& matrix)
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
#endif
return m_impl->SendMatrix(name, matrix);
}
bool NzShader::SendMatrix(const NzString& name, const NzMatrix4f& matrix)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendMatrix(name, matrix);
return m_impl->SendMatrix(location, matrix);
}
bool NzShader::SendVector(const NzString& name, const NzVector2d& vector)
bool NzShader::SendMatrix(int location, const NzMatrix4f& matrix)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -381,30 +424,61 @@ bool NzShader::SendVector(const NzString& name, const NzVector2d& vector)
return false;
}
if (!NazaraRenderer->HasCapability(nzRendererCap_FP64))
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendMatrix(location, matrix);
}
bool NzShader::SendTexture(int location, const NzTexture* texture)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendTexture(location, texture);
}
bool NzShader::SendVector(int location, const NzVector2d& vector)
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
#endif
return m_impl->SendVector(name, vector);
}
bool NzShader::SendVector(const NzString& name, const NzVector2f& vector)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendVector(name, vector);
return m_impl->SendVector(location, vector);
}
bool NzShader::SendVector(const NzString& name, const NzVector3d& vector)
bool NzShader::SendVector(int location, const NzVector2f& vector)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -413,30 +487,42 @@ bool NzShader::SendVector(const NzString& name, const NzVector3d& vector)
return false;
}
if (!NazaraRenderer->HasCapability(nzRendererCap_FP64))
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendVector(location, vector);
}
bool NzShader::SendVector(int location, const NzVector3d& vector)
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
#endif
return m_impl->SendVector(name, vector);
}
bool NzShader::SendVector(const NzString& name, const NzVector3f& vector)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendVector(name, vector);
return m_impl->SendVector(location, vector);
}
bool NzShader::SendVector(const NzString& name, const NzVector4d& vector)
bool NzShader::SendVector(int location, const NzVector3f& vector)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -445,17 +531,42 @@ bool NzShader::SendVector(const NzString& name, const NzVector4d& vector)
return false;
}
if (!NazaraRenderer->HasCapability(nzRendererCap_FP64))
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendVector(location, vector);
}
bool NzShader::SendVector(int location, const NzVector4d& vector)
{
#if NAZARA_RENDERER_SAFE
if (!NzRenderer::HasCapability(nzRendererCap_FP64))
{
NazaraError("FP64 is not supported");
return false;
}
if (!m_impl)
{
NazaraError("Shader not created");
return false;
}
if (location == -1)
{
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendVector(name, vector);
return m_impl->SendVector(location, vector);
}
bool NzShader::SendVector(const NzString& name, const NzVector4f& vector)
bool NzShader::SendVector(int location, const NzVector4f& vector)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
@@ -463,22 +574,15 @@ bool NzShader::SendVector(const NzString& name, const NzVector4f& vector)
NazaraError("Shader not created");
return false;
}
#endif
return m_impl->SendVector(name, vector);
}
bool NzShader::SendTexture(const NzString& name, NzTexture* texture)
{
#if NAZARA_RENDERER_SAFE
if (!m_impl)
if (location == -1)
{
NazaraError("Shader not created");
NazaraError("Invalid location");
return false;
}
#endif
return m_impl->SendTexture(name, texture);
return m_impl->SendVector(location, vector);
}
void NzShader::Unlock()