Merge remote-tracking branch 'origin/master' into Font-Update
Former-commit-id: c62f6317f401e200eff303fcf5b8945302fd89c6
This commit is contained in:
commit
4e9bec804a
|
|
@ -10,6 +10,7 @@
|
|||
///FIXME: Est-ce que SparsePtr est vraiment le meilleur nom pour cette classe ?
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -46,6 +47,7 @@ class NzSparsePtr
|
|||
|
||||
NzSparsePtr operator+(int count) const;
|
||||
NzSparsePtr operator-(int count) const;
|
||||
std::ptrdiff_t operator-(const NzSparsePtr& ptr) const;
|
||||
|
||||
NzSparsePtr& operator+=(int count);
|
||||
NzSparsePtr& operator-=(int count);
|
||||
|
|
|
|||
|
|
@ -133,6 +133,12 @@ NzSparsePtr<T> NzSparsePtr<T>::operator-(int count) const
|
|||
return NzSparsePtr(m_ptr - count*m_stride, m_stride);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ptrdiff_t NzSparsePtr<T>::operator-(const NzSparsePtr& ptr) const
|
||||
{
|
||||
return (m_ptr - ptr.m_ptr)/m_stride;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzSparsePtr<T>& NzSparsePtr<T>::operator+=(int count)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <iostream>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Lua/Debug.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -247,27 +247,30 @@ bool NzBox<T>::Intersect(const NzBox& box, NzBox* intersection) const
|
|||
{
|
||||
T left = std::max(x, box.x);
|
||||
T right = std::min(x + width, box.x + box.width);
|
||||
if (left >= right)
|
||||
return false;
|
||||
|
||||
T top = std::max(y, box.y);
|
||||
T bottom = std::min(y + height, box.y + box.height);
|
||||
if (top >= bottom)
|
||||
return false;
|
||||
|
||||
T up = std::max(z, box.z);
|
||||
T down = std::min(z + depth, box.z + box.depth);
|
||||
|
||||
if (left < right && top < bottom && up < down)
|
||||
{
|
||||
if (intersection)
|
||||
{
|
||||
intersection->x = left;
|
||||
intersection->y = top;
|
||||
intersection->z = up;
|
||||
intersection->width = right - left;
|
||||
intersection->height = bottom - top;
|
||||
intersection->depth = down - up;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (up >= down)
|
||||
return false;
|
||||
|
||||
if (intersection)
|
||||
{
|
||||
intersection->x = left;
|
||||
intersection->y = top;
|
||||
intersection->z = up;
|
||||
intersection->width = right - left;
|
||||
intersection->height = bottom - top;
|
||||
intersection->depth = down - up;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -166,24 +166,24 @@ template<typename T>
|
|||
bool NzRect<T>::Intersect(const NzRect& rect, NzRect* intersection) const
|
||||
{
|
||||
T left = std::max(x, rect.x);
|
||||
T right = std::min(x+width, rect.x+rect.width);
|
||||
T top = std::max(y, rect.y);
|
||||
T bottom = std::min(y+height, rect.y+rect.height);
|
||||
|
||||
if (left < right && top < bottom)
|
||||
{
|
||||
if (intersection)
|
||||
{
|
||||
intersection->x = left;
|
||||
intersection->y = top;
|
||||
intersection->width = right-left;
|
||||
intersection->height = bottom-top;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
T right = std::min(x + width, rect.x + rect.width);
|
||||
if (left >= right)
|
||||
return false;
|
||||
|
||||
T top = std::max(y, rect.y);
|
||||
T bottom = std::min(y + height, rect.y + rect.height);
|
||||
if (top >= bottom)
|
||||
return false;
|
||||
|
||||
if (intersection)
|
||||
{
|
||||
intersection->x = left;
|
||||
intersection->y = top;
|
||||
intersection->width = right - left;
|
||||
intersection->height = bottom - top;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ bool NzFile::FillHash(NzAbstractHash* hash) const
|
|||
unsigned int size;
|
||||
while (remainingSize > 0)
|
||||
{
|
||||
size = (remainingSize >= NAZARA_CORE_FILE_BUFFERSIZE) ? NAZARA_CORE_FILE_BUFFERSIZE : static_cast<unsigned int>(remainingSize);
|
||||
size = std::min(remainingSize, static_cast<nzUInt64>(NAZARA_CORE_FILE_BUFFERSIZE));
|
||||
if (file.Read(&buffer[0], sizeof(char), size) != sizeof(char)*size)
|
||||
{
|
||||
NazaraError("Unable to read file");
|
||||
|
|
|
|||
|
|
@ -18,34 +18,348 @@ struct Character
|
|||
|
||||
#include <Nazara/Core/UnicodeData.hpp>
|
||||
|
||||
#else // Implémentation bidon
|
||||
#else // Implémentation supportant la table ASCII
|
||||
|
||||
NzUnicode::Category NzUnicode::GetCategory(char32_t character)
|
||||
{
|
||||
NazaraUnused(character);
|
||||
switch (character)
|
||||
{
|
||||
case '\x00':
|
||||
case '\x01':
|
||||
case '\x02':
|
||||
case '\x03':
|
||||
case '\x04':
|
||||
case '\x05':
|
||||
case '\x06':
|
||||
case '\x07':
|
||||
case '\x08':
|
||||
case '\x09':
|
||||
case '\x0A':
|
||||
case '\x0B':
|
||||
case '\x0C':
|
||||
case '\x0D':
|
||||
case '\x0E':
|
||||
case '\x0F':
|
||||
case '\x10':
|
||||
case '\x11':
|
||||
case '\x12':
|
||||
case '\x13':
|
||||
case '\x14':
|
||||
case '\x15':
|
||||
case '\x16':
|
||||
case '\x17':
|
||||
case '\x18':
|
||||
case '\x19':
|
||||
case '\x1A':
|
||||
case '\x1B':
|
||||
case '\x1C':
|
||||
case '\x1D':
|
||||
case '\x1E':
|
||||
case '\x1F':
|
||||
case '\x7F':
|
||||
return Category_Other_Control;
|
||||
|
||||
case ' ':
|
||||
return Category_Separator_Space;
|
||||
|
||||
case '!':
|
||||
case '"':
|
||||
case '#':
|
||||
case '$':
|
||||
case '%':
|
||||
case '&':
|
||||
case '\'':
|
||||
case '*':
|
||||
case ',':
|
||||
case '.':
|
||||
case '/':
|
||||
case ':':
|
||||
case ';':
|
||||
case '?':
|
||||
case '@':
|
||||
case '\\':
|
||||
return Category_Punctuation_Other;
|
||||
|
||||
case '(':
|
||||
case '[':
|
||||
case '{':
|
||||
return Category_Punctuation_Open;
|
||||
|
||||
case ')':
|
||||
case '}':
|
||||
case ']':
|
||||
return Category_Punctuation_Close;
|
||||
|
||||
case '+':
|
||||
case '<':
|
||||
case '=':
|
||||
case '>':
|
||||
case '|':
|
||||
case '~':
|
||||
return Category_Symbol_Math;
|
||||
|
||||
case '-':
|
||||
return Category_Punctuation_Dash;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
return Category_Number_DecimalDigit;
|
||||
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
case 'G':
|
||||
case 'H':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'K':
|
||||
case 'L':
|
||||
case 'M':
|
||||
case 'N':
|
||||
case 'O':
|
||||
case 'P':
|
||||
case 'Q':
|
||||
case 'R':
|
||||
case 'S':
|
||||
case 'T':
|
||||
case 'U':
|
||||
case 'V':
|
||||
case 'W':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
case 'Z':
|
||||
return Category_Number_DecimalDigit;
|
||||
|
||||
case '_':
|
||||
return Category_Punctuation_Connector;
|
||||
|
||||
case '^':
|
||||
case '`':
|
||||
return Category_Symbol_Modifier;
|
||||
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
case 'g':
|
||||
case 'h':
|
||||
case 'i':
|
||||
case 'j':
|
||||
case 'k':
|
||||
case 'l':
|
||||
case 'm':
|
||||
case 'n':
|
||||
case 'o':
|
||||
case 'p':
|
||||
case 'q':
|
||||
case 'r':
|
||||
case 's':
|
||||
case 't':
|
||||
case 'u':
|
||||
case 'v':
|
||||
case 'w':
|
||||
case 'x':
|
||||
case 'y':
|
||||
case 'z':
|
||||
return Category_Number_DecimalDigit;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Category_NoCategory;
|
||||
}
|
||||
|
||||
NzUnicode::Direction NzUnicode::GetDirection(char32_t character)
|
||||
{
|
||||
NazaraUnused(character);
|
||||
switch (character)
|
||||
{
|
||||
case '\x00':
|
||||
case '\x01':
|
||||
case '\x02':
|
||||
case '\x03':
|
||||
case '\x04':
|
||||
case '\x05':
|
||||
case '\x06':
|
||||
case '\x07':
|
||||
case '\x08':
|
||||
case '\x0E':
|
||||
case '\x0F':
|
||||
case '\x10':
|
||||
case '\x11':
|
||||
case '\x12':
|
||||
case '\x13':
|
||||
case '\x14':
|
||||
case '\x15':
|
||||
case '\x16':
|
||||
case '\x17':
|
||||
case '\x18':
|
||||
case '\x19':
|
||||
case '\x1A':
|
||||
case '\x1B':
|
||||
case '\x7F':
|
||||
return Direction_Boundary_Neutral;
|
||||
|
||||
case '\x09':
|
||||
case '\x0B':
|
||||
case '\x1F':
|
||||
return Direction_Segment_Separator;
|
||||
|
||||
case '\x0A':
|
||||
case '\x0D':
|
||||
case '\x1C':
|
||||
case '\x1D':
|
||||
case '\x1E':
|
||||
return Direction_Paragraph_Separator;
|
||||
|
||||
case '\x0C':
|
||||
case ' ':
|
||||
return Direction_White_Space;
|
||||
|
||||
case '!':
|
||||
case '"':
|
||||
case '&':
|
||||
case '\'':
|
||||
case '(':
|
||||
case ')':
|
||||
case '*':
|
||||
case ';':
|
||||
case '<':
|
||||
case '=':
|
||||
case '>':
|
||||
case '?':
|
||||
case '@':
|
||||
case '[':
|
||||
case '\\':
|
||||
case ']':
|
||||
case '^':
|
||||
case '_':
|
||||
case '`':
|
||||
case '{':
|
||||
case '|':
|
||||
case '}':
|
||||
case '~':
|
||||
return Direction_Other_Neutral;
|
||||
|
||||
case '#':
|
||||
case '$':
|
||||
case '%':
|
||||
return Direction_European_Terminator;
|
||||
|
||||
case '+':
|
||||
case '-':
|
||||
return Direction_European_Separator;
|
||||
|
||||
case ',':
|
||||
case '.':
|
||||
case '/':
|
||||
case ':':
|
||||
return Direction_Common_Separator;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
return Direction_European_Number;
|
||||
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
case 'G':
|
||||
case 'H':
|
||||
case 'I':
|
||||
case 'J':
|
||||
case 'K':
|
||||
case 'L':
|
||||
case 'M':
|
||||
case 'N':
|
||||
case 'O':
|
||||
case 'P':
|
||||
case 'Q':
|
||||
case 'R':
|
||||
case 'S':
|
||||
case 'T':
|
||||
case 'U':
|
||||
case 'V':
|
||||
case 'W':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
case 'Z':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
case 'g':
|
||||
case 'h':
|
||||
case 'i':
|
||||
case 'j':
|
||||
case 'k':
|
||||
case 'l':
|
||||
case 'm':
|
||||
case 'n':
|
||||
case 'o':
|
||||
case 'p':
|
||||
case 'q':
|
||||
case 'r':
|
||||
case 's':
|
||||
case 't':
|
||||
case 'u':
|
||||
case 'v':
|
||||
case 'w':
|
||||
case 'x':
|
||||
case 'y':
|
||||
case 'z':
|
||||
return Direction_Left_To_Right;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Direction_Boundary_Neutral;
|
||||
}
|
||||
|
||||
char32_t NzUnicode::GetLowercase(char32_t character)
|
||||
{
|
||||
return character;
|
||||
if (character >= 'A' && character <= 'Z')
|
||||
return character + ('a' - 'A');
|
||||
else
|
||||
return character;
|
||||
}
|
||||
|
||||
char32_t NzUnicode::GetTitlecase(char32_t character)
|
||||
{
|
||||
return character;
|
||||
return GetUppercase(character);
|
||||
}
|
||||
|
||||
char32_t NzUnicode::GetUppercase(char32_t character)
|
||||
{
|
||||
return character;
|
||||
if (character >= 'a' && character <= 'z')
|
||||
return character + ('A' - 'a');
|
||||
else
|
||||
return character;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ bool NzLuaInstance::IsOfType(int index, nzLuaType type) const
|
|||
return lua_isuserdata(m_state, index) == 1;
|
||||
}
|
||||
|
||||
NazaraError("Lua type unhandled (0x" + NzString::Number(type, 16) + ')');
|
||||
NazaraError("Lua type not handled (0x" + NzString::Number(type, 16) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace
|
|||
switch (source)
|
||||
{
|
||||
case GL_DEBUG_SOURCE_API:
|
||||
ss << "OpenGL";
|
||||
ss << "OpenGL API";
|
||||
break;
|
||||
|
||||
case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ bool NzRenderer::IsComponentTypeSupported(nzComponentType type)
|
|||
return false;
|
||||
}
|
||||
|
||||
NazaraError("Attribute type out of enum (0x" + NzString::Number(type, 16) + ')');
|
||||
NazaraError("Attribute type not handled (0x" + NzString::Number(type, 16) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,10 +254,10 @@ NzString NzShader::GetSourceCode(nzShaderStage stage) const
|
|||
unsigned int totalLength = 0;
|
||||
for (unsigned int shader : m_attachedShaders[stage])
|
||||
{
|
||||
GLint length;
|
||||
glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &length);
|
||||
GLint length;
|
||||
glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &length);
|
||||
|
||||
totalLength += length - 1;
|
||||
totalLength += length - 1;
|
||||
}
|
||||
|
||||
totalLength += (m_attachedShaders[stage].size()-1)*(sizeof(sep)/sizeof(char));
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ bool NzTriangleIterator::Advance()
|
|||
|
||||
case nzPrimitiveMode_TriangleStrip:
|
||||
m_triangleIndices[2] = m_indexMapper.Get(m_currentIndex++);
|
||||
m_triangleIndices[1] = m_triangleIndices[2];
|
||||
m_triangleIndices[0] = m_triangleIndices[1];
|
||||
m_triangleIndices[1] = m_triangleIndices[2];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue