Merge branch 'master' into culling

This commit is contained in:
Jérôme Leclercq
2016-11-07 11:26:48 +01:00
85 changed files with 2580 additions and 1234 deletions

View File

@@ -906,5 +906,5 @@ namespace Nz
}
return true;
};
}
}

View File

@@ -94,6 +94,7 @@ namespace Nz
void InstancedRenderable::UpdateData(InstanceData* instanceData) const
{
NazaraAssert(instanceData, "Invalid instance data");
NazaraUnused(instanceData);
}
InstancedRenderableLibrary::LibraryMap InstancedRenderable::s_library;

View File

@@ -149,22 +149,22 @@ namespace Nz
lua_close(m_state);
}
void LuaInstance::ArgCheck(bool condition, unsigned int argNum, const char* error)
void LuaInstance::ArgCheck(bool condition, unsigned int argNum, const char* error) const
{
luaL_argcheck(m_state, condition, argNum, error);
}
void LuaInstance::ArgCheck(bool condition, unsigned int argNum, const String& error)
void LuaInstance::ArgCheck(bool condition, unsigned int argNum, const String& error) const
{
luaL_argcheck(m_state, condition, argNum, error.GetConstBuffer());
}
int LuaInstance::ArgError(unsigned int argNum, const char* error)
int LuaInstance::ArgError(unsigned int argNum, const char* error) const
{
return luaL_argerror(m_state, argNum, error);
}
int LuaInstance::ArgError(unsigned int argNum, const String& error)
int LuaInstance::ArgError(unsigned int argNum, const String& error) const
{
return luaL_argerror(m_state, argNum, error.GetConstBuffer());
}

View File

@@ -146,7 +146,7 @@ namespace Nz
if (!m_buffer)
m_buffer = std::make_unique<ByteArray>();
m_buffer->Resize(static_cast<std::size_t>(cursorPos));
m_buffer->Resize(minCapacity);
m_memoryStream.SetBuffer(m_buffer.get(), openMode);
m_memoryStream.SetCursorPos(cursorPos);

View File

@@ -385,7 +385,7 @@ namespace Nz
* \remark Produces a NazaraError because it is a special stream
*/
bool TcpClient::SetCursorPos(UInt64 offset)
bool TcpClient::SetCursorPos(UInt64 /*offset*/)
{
NazaraError("SetCursorPos() cannot be used on sequential streams");
return false;

View File

@@ -437,6 +437,10 @@ namespace Nz
return result;
#else
NazaraUnused(fdarray);
NazaraUnused(nfds);
NazaraUnused(timeout);
if (error)
*error = SocketError_NotSupported;

View File

@@ -2,8 +2,8 @@
// This file is part of the "Nazara Engine - Physics 2D module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Physics3D/Config.hpp>
#if NAZARA_PHYSICS_MANAGE_MEMORY
#include <Nazara/Physics2D/Config.hpp>
#if NAZARA_PHYSICS2D_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?

View File

@@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Physics3D/Config.hpp>
#if NAZARA_PHYSICS_MANAGE_MEMORY
#if NAZARA_PHYSICS3D_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?

View File

@@ -795,6 +795,7 @@ namespace Nz
NazaraAssert(attachmentIndex < m_impl->attachments.size(), "Invalid attachment index");
NazaraAssert(!m_impl->attachments[attachmentIndex].isBuffer, "Invalid attachment state");
NazaraUnused(texture);
NazaraUnused(attachmentIndex);
InvalidateTargets();
}

View File

@@ -331,19 +331,19 @@ namespace Nz
Emit(mat.specular.b / 255.f);
EmitLine();
if (mat.alpha != 1.f)
if (!NumberEquals(mat.alpha, 1.f))
{
Emit("d ");
EmitLine(mat.alpha);
}
if (mat.refractionIndex != 1.f)
if (!NumberEquals(mat.refractionIndex, 1.f))
{
Emit("ni ");
EmitLine(mat.refractionIndex);
}
if (mat.shininess != 1.f)
if (!NumberEquals(mat.shininess, 1.f))
{
Emit("ns ");
EmitLine(mat.shininess);

View File

@@ -128,17 +128,17 @@ namespace Nz
UInt32 faceReserve = 0;
UInt32 vertexReserve = 0;
unsigned int matCount = 0;
auto GetMaterial = [&] (const String& meshName, const String& matName) -> Mesh*
auto GetMaterial = [&] (const String& mesh, const String& mat) -> Mesh*
{
auto& map = meshesByName[meshName];
auto it = map.find(matName);
auto& map = meshesByName[mesh];
auto it = map.find(mat);
if (it == map.end())
it = map.insert(std::make_pair(matName, MatPair(Mesh(), matCount++))).first;
it = map.insert(std::make_pair(mat, MatPair(Mesh(), matCount++))).first;
Mesh& mesh = it->second.first;
Mesh& meshData = it->second.first;
mesh.faces.reserve(faceReserve);
mesh.vertices.reserve(vertexReserve);
meshData.faces.reserve(faceReserve);
meshData.vertices.reserve(vertexReserve);
faceReserve = 0;
vertexReserve = 0;
@@ -550,19 +550,19 @@ namespace Nz
EmitLine(pair.second.size());
EmitLine();
for (std::size_t meshIndex : pair.second)
for (std::size_t index : pair.second)
{
const Mesh& mesh = m_meshes[meshIndex];
const Mesh& mesh = m_meshes[index];
Emit("g ");
EmitLine(mesh.name);
EmitLine();
Emit("# face count: ");
EmitLine(mesh.faces.size());
Emit("# vertex count: ");
EmitLine(mesh.vertices.size());
for (const Face& face : mesh.faces)
{
Emit('f');

View File

@@ -52,7 +52,7 @@ namespace Nz
}
Image::Image(const Image& image) :
RefCounted(),
AbstractImage(image),
Resource(),
m_sharedImage(image.m_sharedImage)
{

View File

@@ -75,6 +75,7 @@ namespace Nz
Font* SimpleTextDrawer::GetFont(std::size_t index) const
{
NazaraAssert(index == 0, "Font index out of range");
NazaraUnused(index);
return m_font;
}

View File

@@ -11,7 +11,7 @@
namespace Nz
{
SoftwareBuffer::SoftwareBuffer(Buffer* /*parent*/, BufferType type)
SoftwareBuffer::SoftwareBuffer(Buffer* /*parent*/, BufferType /*type*/)
{
}

View File

@@ -154,7 +154,7 @@ namespace Nz
// On attend que la fenêtre soit créée
mutex.Lock();
m_thread = Thread(WindowThread, &m_handle, win32StyleEx, title.GetWideString().data(), win32Style, x, y, width, height, this, &mutex, &condition);
m_thread = Thread(WindowThread, &m_handle, win32StyleEx, title, win32Style, x, y, width, height, this, &mutex, &condition);
condition.Wait(&mutex);
mutex.Unlock();
#else
@@ -789,15 +789,25 @@ namespace Nz
case WM_MOVE:
{
#if !NAZARA_UTILITY_THREADED_WINDOW
if (m_sizemove)
break;
#endif
RECT windowRect;
GetWindowRect(m_handle, &windowRect);
WindowEvent event;
event.type = WindowEventType_Moved;
event.position.x = windowRect.left;
event.position.y = windowRect.top;
m_parent->PushEvent(event);
Vector2i position(windowRect.left, windowRect.top);
if (m_position != position)
{
m_position = position;
WindowEvent event;
event.type = WindowEventType_Moved;
event.position.x = position.x;
event.position.y = position.y;
m_parent->PushEvent(event);
}
break;
}
@@ -1178,10 +1188,10 @@ namespace Nz
}
#if NAZARA_UTILITY_THREADED_WINDOW
void WindowImpl::WindowThread(HWND* handle, DWORD styleEx, const wchar_t* title, DWORD style, unsigned int x, unsigned int y, unsigned int width, unsigned int height, WindowImpl* window, Mutex* mutex, ConditionVariable* condition)
void WindowImpl::WindowThread(HWND* handle, DWORD styleEx, const String& title, DWORD style, unsigned int x, unsigned int y, unsigned int width, unsigned int height, WindowImpl* window, Mutex* mutex, ConditionVariable* condition)
{
HWND& winHandle = *handle;
winHandle = CreateWindowExW(styleEx, className, title, style, x, y, width, height, nullptr, nullptr, GetModuleHandle(nullptr), window);
winHandle = CreateWindowExW(styleEx, className, title.GetWideString().data(), style, x, y, width, height, nullptr, nullptr, GetModuleHandle(nullptr), window);
mutex->Lock();
condition->Signal();

View File

@@ -89,7 +89,7 @@ namespace Nz
static LRESULT CALLBACK MessageHandler(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
static UInt32 RetrieveStyle(HWND window);
#if NAZARA_UTILITY_THREADED_WINDOW
static void WindowThread(HWND* handle, DWORD styleEx, const wchar_t* title, DWORD style, unsigned int x, unsigned int y, unsigned int width, unsigned int height, WindowImpl* window, Mutex* mutex, ConditionVariable* condition);
static void WindowThread(HWND* handle, DWORD styleEx, const String& title, DWORD style, unsigned int x, unsigned int y, unsigned int width, unsigned int height, WindowImpl* window, Mutex* mutex, ConditionVariable* condition);
#endif
HCURSOR m_cursor;

View File

@@ -335,6 +335,7 @@ namespace Nz
void Window::ProcessEvents(bool block)
{
NazaraAssert(m_impl, "Window not created");
NazaraUnused(block);
#if !NAZARA_UTILITY_THREADED_WINDOW
m_impl->ProcessEvents(block);