Cleanup pass
This commit is contained in:
parent
ec310b9577
commit
06038a4d81
|
|
@ -74,8 +74,8 @@ namespace Nz
|
|||
Box& Transform(const Matrix4<T>& matrix, bool applyTranslation = true);
|
||||
Box& Translate(const Vector3<T>& translation);
|
||||
|
||||
T& operator[](unsigned int i);
|
||||
T operator[](unsigned int i) const;
|
||||
T& operator[](std::size_t i);
|
||||
T operator[](std::size_t i) const;
|
||||
|
||||
Box operator*(T scalar) const;
|
||||
Box operator*(const Vector3<T>& vec) const;
|
||||
|
|
|
|||
|
|
@ -735,24 +735,15 @@ namespace Nz
|
|||
* \brief Returns the ith element of the box
|
||||
* \return A reference to the ith element of the box
|
||||
*
|
||||
* \remark Access to index greather than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 6 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T& Box<T>::operator[](unsigned int i)
|
||||
T& Box<T>::operator[](std::size_t i)
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 6)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 6)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 6, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
|
@ -761,24 +752,15 @@ namespace Nz
|
|||
* \brief Returns the ith element of the box
|
||||
* \return A value to the ith element of the box
|
||||
*
|
||||
* \remark Access to index greather than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 6 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Box<T>::operator[](unsigned int i) const
|
||||
T Box<T>::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 6)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 6)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 6, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ namespace Nz
|
|||
|
||||
Rect& Translate(const Vector2<T>& translation);
|
||||
|
||||
T& operator[](unsigned int i);
|
||||
T operator[](unsigned int i) const;
|
||||
T& operator[](std::size_t i);
|
||||
T operator[](std::size_t i) const;
|
||||
|
||||
Rect operator*(T scalar) const;
|
||||
Rect operator*(const Vector2<T>& vec) const;
|
||||
|
|
|
|||
|
|
@ -578,23 +578,14 @@ namespace Nz
|
|||
* \return A reference to the ith element of the rectangle
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T& Rect<T>::operator[](unsigned int i)
|
||||
T& Rect<T>::operator[](std::size_t i)
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
|
@ -603,24 +594,15 @@ namespace Nz
|
|||
* \brief Returns the ith element of the rectangle
|
||||
* \return A value to the ith element of the rectangle
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Rect<T>::operator[](unsigned int i) const
|
||||
T Rect<T>::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ namespace Nz
|
|||
|
||||
String ToString() const;
|
||||
|
||||
T& operator[](unsigned int i);
|
||||
T operator[](unsigned int i) const;
|
||||
T& operator[](std::size_t i);
|
||||
T operator[](std::size_t i) const;
|
||||
|
||||
Sphere operator*(T scalar) const;
|
||||
Sphere& operator=(const Sphere& other) = default;
|
||||
|
|
|
|||
|
|
@ -466,24 +466,15 @@ namespace Nz
|
|||
* \brief Returns the ith element of the sphere
|
||||
* \return A reference to the ith element of the sphere
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T& Sphere<T>::operator[](unsigned int i)
|
||||
T& Sphere<T>::operator[](std::size_t i)
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
|
@ -492,24 +483,15 @@ namespace Nz
|
|||
* \brief Returns the ith element of the sphere
|
||||
* \return A value to the ith element of the sphere
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Sphere<T>::operator[](unsigned int i) const
|
||||
T Sphere<T>::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@ namespace Nz
|
|||
|
||||
Reference operator*() const;
|
||||
|
||||
Reference operator[](unsigned int index) const;
|
||||
Reference operator[](std::size_t index) const;
|
||||
|
||||
IndexIterator& operator=(const IndexIterator& iterator);
|
||||
|
||||
IndexIterator operator+(unsigned int indexCount) const;
|
||||
IndexIterator operator-(unsigned int indexCount) const;
|
||||
IndexIterator operator+(std::size_t indexCount) const;
|
||||
IndexIterator operator-(std::size_t indexCount) const;
|
||||
|
||||
IndexIterator& operator+=(unsigned int indexCount);
|
||||
IndexIterator& operator-=(unsigned int indexCount);
|
||||
IndexIterator& operator+=(std::size_t indexCount);
|
||||
IndexIterator& operator-=(std::size_t indexCount);
|
||||
|
||||
IndexIterator& operator++();
|
||||
IndexIterator operator++(int);
|
||||
|
|
@ -50,10 +50,10 @@ namespace Nz
|
|||
friend bool operator>=(const IndexIterator& lhs, const IndexIterator& rhs);
|
||||
|
||||
private:
|
||||
IndexIterator(IndexMapper* mapper, unsigned int index);
|
||||
IndexIterator(IndexMapper* mapper, std::size_t index);
|
||||
|
||||
IndexMapper* m_mapper;
|
||||
unsigned int m_index;
|
||||
std::size_t m_index;
|
||||
};
|
||||
|
||||
class IndexIterator::Reference
|
||||
|
|
@ -70,10 +70,10 @@ namespace Nz
|
|||
operator UInt32() const;
|
||||
|
||||
private:
|
||||
Reference(IndexMapper* mapper, unsigned int index);
|
||||
Reference(IndexMapper* mapper, std::size_t index);
|
||||
|
||||
IndexMapper* m_mapper;
|
||||
unsigned int m_index;
|
||||
std::size_t m_index;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Nz
|
|||
{
|
||||
}
|
||||
|
||||
inline IndexIterator::IndexIterator(IndexMapper* mapper, unsigned int index) :
|
||||
inline IndexIterator::IndexIterator(IndexMapper* mapper, std::size_t index) :
|
||||
m_mapper(mapper),
|
||||
m_index(index)
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
|||
return Reference(m_mapper, m_index);
|
||||
}
|
||||
|
||||
inline IndexIterator::Reference IndexIterator::operator[](unsigned int index) const
|
||||
inline IndexIterator::Reference IndexIterator::operator[](std::size_t index) const
|
||||
{
|
||||
return Reference(m_mapper, m_index+index);
|
||||
}
|
||||
|
|
@ -44,24 +44,24 @@ namespace Nz
|
|||
return *this;
|
||||
}
|
||||
|
||||
inline IndexIterator IndexIterator::operator+(unsigned int indexCount) const
|
||||
inline IndexIterator IndexIterator::operator+(std::size_t indexCount) const
|
||||
{
|
||||
return IndexIterator(m_mapper, m_index + indexCount);
|
||||
}
|
||||
|
||||
inline IndexIterator IndexIterator::operator-(unsigned int indexCount) const
|
||||
inline IndexIterator IndexIterator::operator-(std::size_t indexCount) const
|
||||
{
|
||||
return IndexIterator(m_mapper, m_index - indexCount);
|
||||
}
|
||||
|
||||
inline IndexIterator& IndexIterator::operator+=(unsigned int indexCount)
|
||||
inline IndexIterator& IndexIterator::operator+=(std::size_t indexCount)
|
||||
{
|
||||
m_index += indexCount;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline IndexIterator& IndexIterator::operator-=(unsigned int indexCount)
|
||||
inline IndexIterator& IndexIterator::operator-=(std::size_t indexCount)
|
||||
{
|
||||
m_index += indexCount;
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ namespace Nz
|
|||
|
||||
/**************************IndexIterator::Reference*************************/
|
||||
|
||||
inline IndexIterator::Reference::Reference(IndexMapper* mapper, unsigned int index) :
|
||||
inline IndexIterator::Reference::Reference(IndexMapper* mapper, std::size_t index) :
|
||||
m_mapper(mapper),
|
||||
m_index(index)
|
||||
{
|
||||
|
|
@ -148,7 +148,7 @@ namespace Nz
|
|||
|
||||
inline IndexIterator::Reference& IndexIterator::Reference::operator=(const IndexIterator::Reference& reference)
|
||||
{
|
||||
m_mapper->Set(m_index, reference); // Conversion implicite en UInt32
|
||||
m_mapper->Set(m_index, reference); // Implicit conversion to UInt32
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ namespace Nz
|
|||
class IndexIterator;
|
||||
class SubMesh;
|
||||
|
||||
using IndexMapperGetter = UInt32 (*)(const void* buffer, unsigned int i);
|
||||
using IndexMapperSetter = void (*)(void* buffer, unsigned int i, UInt32 value);
|
||||
|
||||
class NAZARA_UTILITY_API IndexMapper
|
||||
{
|
||||
public:
|
||||
|
|
@ -29,11 +26,11 @@ namespace Nz
|
|||
IndexMapper(const SubMesh* subMesh, BufferAccess access = BufferAccess_ReadOnly);
|
||||
~IndexMapper() = default;
|
||||
|
||||
UInt32 Get(unsigned int i) const;
|
||||
UInt32 Get(std::size_t i) const;
|
||||
const IndexBuffer* GetBuffer() const;
|
||||
unsigned int GetIndexCount() const;
|
||||
std::size_t GetIndexCount() const;
|
||||
|
||||
void Set(unsigned int i, UInt32 value);
|
||||
void Set(std::size_t i, UInt32 value);
|
||||
|
||||
void Unmap();
|
||||
|
||||
|
|
@ -45,10 +42,13 @@ namespace Nz
|
|||
// Méthodes STD
|
||||
|
||||
private:
|
||||
using Getter = UInt32(*)(const void* buffer, std::size_t i);
|
||||
using Setter = void(*)(void* buffer, std::size_t i, UInt32 value);
|
||||
|
||||
BufferMapper<IndexBuffer> m_mapper;
|
||||
IndexMapperGetter m_getter;
|
||||
IndexMapperSetter m_setter;
|
||||
unsigned int m_indexCount;
|
||||
Getter m_getter;
|
||||
Setter m_setter;
|
||||
std::size_t m_indexCount;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Nz
|
|||
|
||||
bool Advance();
|
||||
|
||||
UInt32 operator[](unsigned int i) const;
|
||||
UInt32 operator[](std::size_t i) const;
|
||||
|
||||
void Unmap();
|
||||
|
||||
|
|
@ -32,8 +32,8 @@ namespace Nz
|
|||
PrimitiveMode m_primitiveMode;
|
||||
UInt32 m_triangleIndices[3];
|
||||
IndexMapper m_indexMapper;
|
||||
unsigned int m_currentIndex;
|
||||
unsigned int m_indexCount;
|
||||
std::size_t m_currentIndex;
|
||||
std::size_t m_indexCount;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
|
|||
|
||||
if (animatedMesh)
|
||||
{
|
||||
mesh->CreateSkeletal(joints.size());
|
||||
mesh->CreateSkeletal(UInt32(joints.size()));
|
||||
|
||||
Skeleton* skeleton = mesh->GetSkeleton();
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
|
|||
mesh->CreateStatic();
|
||||
|
||||
// aiMaterial index in scene => Material index and data in Mesh
|
||||
std::unordered_map<unsigned int, std::pair<std::size_t, ParameterList>> materials;
|
||||
std::unordered_map<unsigned int, std::pair<UInt32, ParameterList>> materials;
|
||||
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; ++i)
|
||||
{
|
||||
|
|
@ -300,7 +300,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
|
|||
if (aiGetMaterialInteger(aiMat, AI_MATKEY_TWOSIDED, &iValue) == aiReturn_SUCCESS)
|
||||
matData.SetParameter(MaterialData::FaceCulling, !iValue);
|
||||
|
||||
matIt = materials.insert(std::make_pair(iMesh->mMaterialIndex, std::make_pair(materials.size(), std::move(matData)))).first;
|
||||
matIt = materials.insert(std::make_pair(iMesh->mMaterialIndex, std::make_pair(UInt32(materials.size()), std::move(matData)))).first;
|
||||
}
|
||||
|
||||
subMesh->SetMaterialIndex(matIt->first);
|
||||
|
|
@ -308,7 +308,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters)
|
|||
mesh->AddSubMesh(subMesh);
|
||||
}
|
||||
|
||||
mesh->SetMaterialCount(std::max<UInt32>(materials.size(), 1));
|
||||
mesh->SetMaterialCount(std::max<UInt32>(UInt32(materials.size()), 1));
|
||||
for (const auto& pair : materials)
|
||||
mesh->SetMaterialData(pair.second.first, pair.second.second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Nz
|
|||
{
|
||||
struct HashMD5_state
|
||||
{
|
||||
UInt32 count[2]; /* message length in bits, lsw first */
|
||||
std::size_t count[2]; /* message length in bits, lsw first */
|
||||
UInt32 abcd[4]; /* digest buffer */
|
||||
UInt8 buf[64]; /* accumulate block */
|
||||
};
|
||||
|
|
@ -280,9 +280,9 @@ namespace Nz
|
|||
void HashMD5::Append(const UInt8* data, std::size_t len)
|
||||
{
|
||||
const UInt8 *p = data;
|
||||
int left = len;
|
||||
std::size_t left = len;
|
||||
int offset = (m_state->count[0] >> 3) & 63;
|
||||
UInt32 nbits = len << 3;
|
||||
std::size_t nbits = len << 3;
|
||||
|
||||
if (len <= 0)
|
||||
return;
|
||||
|
|
@ -296,7 +296,7 @@ namespace Nz
|
|||
/* Process an initial partial block. */
|
||||
if (offset)
|
||||
{
|
||||
int copy = (offset + len > 64 ? 64 - offset : len);
|
||||
std::size_t copy = (offset + len > 64 ? 64 - offset : len);
|
||||
|
||||
std::memcpy(m_state->buf + offset, p, copy);
|
||||
if (offset + copy < 64)
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ namespace Nz
|
|||
{
|
||||
struct HashWhirlpool_state
|
||||
{
|
||||
int bufferBits; // current number of bits on the buffer */
|
||||
int bufferPos; // current (possibly incomplete) byte slot on the buffer */
|
||||
std::size_t bufferBits; // current number of bits on the buffer */
|
||||
std::size_t bufferPos; // current (possibly incomplete) byte slot on the buffer */
|
||||
UInt8 bitLength[32]; // global number of hashed bits (256-bit counter) */
|
||||
UInt8 buffer[64]; // buffer of data to hash */
|
||||
UInt64 hash[8]; // the hashing state */
|
||||
|
|
@ -877,8 +877,8 @@ namespace Nz
|
|||
UInt32 b;
|
||||
UInt8* buffer = m_state->buffer;
|
||||
UInt8* bitLength = m_state->bitLength;
|
||||
int bufferBits = m_state->bufferBits;
|
||||
int bufferPos = m_state->bufferPos;
|
||||
std::size_t bufferBits = m_state->bufferBits;
|
||||
std::size_t bufferPos = m_state->bufferPos;
|
||||
|
||||
// tally the length of the added data
|
||||
UInt64 value = len;
|
||||
|
|
@ -968,8 +968,8 @@ namespace Nz
|
|||
|
||||
UInt8 *buffer = m_state->buffer;
|
||||
UInt8 *bitLength = m_state->bitLength;
|
||||
int bufferBits = m_state->bufferBits;
|
||||
int bufferPos = m_state->bufferPos;
|
||||
std::size_t bufferBits = m_state->bufferBits;
|
||||
std::size_t bufferPos = m_state->bufferPos;
|
||||
UInt8 *digest = result;
|
||||
|
||||
// append a '1'-bit
|
||||
|
|
|
|||
|
|
@ -2115,7 +2115,7 @@ namespace Nz
|
|||
|
||||
return ptr - m_sharedString->string.get();
|
||||
}
|
||||
catch (utf8::not_enough_room& e)
|
||||
catch (utf8::not_enough_room& /*e*/)
|
||||
{
|
||||
// Returns npos
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ namespace Nz
|
|||
Vector2f uv;
|
||||
};
|
||||
|
||||
std::size_t s_maxQuads = std::numeric_limits<UInt16>::max() / 6;
|
||||
std::size_t s_vertexBufferSize = 4 * 1024 * 1024; // 4 MiB
|
||||
UInt32 s_maxQuads = std::numeric_limits<UInt16>::max() / 6;
|
||||
UInt32 s_vertexBufferSize = 4 * 1024 * 1024; // 4 MiB
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ namespace Nz
|
|||
|
||||
if (cpShape* shape = cpSpacePointQueryNearest(m_handle, { from.x, from.y }, maxDistance, filter, &queryInfo))
|
||||
{
|
||||
result->closestPoint.Set(queryInfo.point.x, queryInfo.point.y);
|
||||
result->distance = queryInfo.distance;
|
||||
result->fraction.Set(queryInfo.gradient.x, queryInfo.gradient.y);
|
||||
result->closestPoint.Set(Nz::Vector2<cpFloat>(queryInfo.point.x, queryInfo.point.y));
|
||||
result->distance = float(queryInfo.distance);
|
||||
result->fraction.Set(Nz::Vector2<cpFloat>(queryInfo.gradient.x, queryInfo.gradient.y));
|
||||
result->nearestBody = static_cast<Nz::RigidBody2D*>(cpShapeGetUserData(shape));
|
||||
|
||||
return true;
|
||||
|
|
@ -90,9 +90,9 @@ namespace Nz
|
|||
ResultType results = static_cast<ResultType>(data);
|
||||
|
||||
RaycastHit hitInfo;
|
||||
hitInfo.fraction = alpha;
|
||||
hitInfo.hitNormal.Set(normal.x, normal.y);
|
||||
hitInfo.hitPos.Set(point.x, point.y);
|
||||
hitInfo.fraction = float(alpha);
|
||||
hitInfo.hitNormal.Set(Nz::Vector2<cpFloat>(normal.x, normal.y));
|
||||
hitInfo.hitPos.Set(Nz::Vector2<cpFloat>(point.x, point.y));
|
||||
hitInfo.nearestBody = static_cast<Nz::RigidBody2D*>(cpShapeGetUserData(shape));
|
||||
|
||||
results->emplace_back(std::move(hitInfo));
|
||||
|
|
@ -116,9 +116,9 @@ namespace Nz
|
|||
|
||||
if (cpShape* shape = cpSpaceSegmentQueryFirst(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, &queryInfo))
|
||||
{
|
||||
hitInfo->fraction = queryInfo.alpha;
|
||||
hitInfo->hitNormal.Set(queryInfo.normal.x, queryInfo.normal.y);
|
||||
hitInfo->hitPos.Set(queryInfo.point.x, queryInfo.point.y);
|
||||
hitInfo->fraction = float(queryInfo.alpha);
|
||||
hitInfo->hitNormal.Set(Nz::Vector2<cpFloat>(queryInfo.normal.x, queryInfo.normal.y));
|
||||
hitInfo->hitPos.Set(Nz::Vector2<cpFloat>(queryInfo.point.x, queryInfo.point.y));
|
||||
hitInfo->nearestBody = static_cast<Nz::RigidBody2D*>(cpShapeGetUserData(queryInfo.shape));
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ namespace Nz
|
|||
cpVect vel = cpBodyGetVelocity(m_handle);
|
||||
|
||||
Destroy();
|
||||
Create(mass, moment);
|
||||
Create(float(mass), float(moment));
|
||||
|
||||
cpBodySetAngle(m_handle, rot);
|
||||
cpBodySetPosition(m_handle, pos);
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ namespace Nz
|
|||
|
||||
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
|
||||
|
||||
IndexBufferRef indexBuffer = IndexBuffer::New(largeIndices, indexCount, parameters.storage, 0);
|
||||
VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent_Skinning), vertexCount, parameters.storage, 0);
|
||||
IndexBufferRef indexBuffer = IndexBuffer::New(largeIndices, UInt32(indexCount), parameters.storage, 0);
|
||||
VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent_Skinning), UInt32(vertexCount), parameters.storage, 0);
|
||||
|
||||
// Index buffer
|
||||
IndexMapper indexMapper(indexBuffer, BufferAccess_DiscardAndWrite);
|
||||
|
|
@ -236,7 +236,7 @@ namespace Nz
|
|||
// Index buffer
|
||||
bool largeIndices = (vertexCount > std::numeric_limits<UInt16>::max());
|
||||
|
||||
IndexBufferRef indexBuffer = IndexBuffer::New(largeIndices, indexCount, parameters.storage, 0);
|
||||
IndexBufferRef indexBuffer = IndexBuffer::New(largeIndices, UInt32(indexCount), parameters.storage, 0);
|
||||
|
||||
IndexMapper indexMapper(indexBuffer, BufferAccess_DiscardAndWrite);
|
||||
IndexIterator index = indexMapper.begin();
|
||||
|
|
@ -251,7 +251,7 @@ namespace Nz
|
|||
indexMapper.Unmap();
|
||||
|
||||
// Vertex buffer
|
||||
VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent), vertexCount, parameters.storage, 0);
|
||||
VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent), UInt32(vertexCount), parameters.storage, 0);
|
||||
BufferMapper<VertexBuffer> vertexMapper(vertexBuffer, BufferAccess_WriteOnly);
|
||||
|
||||
MeshVertex* vertices = static_cast<MeshVertex*>(vertexMapper.GetPointer());
|
||||
|
|
|
|||
|
|
@ -233,8 +233,8 @@ namespace Nz
|
|||
}
|
||||
|
||||
// Création des buffers
|
||||
IndexBufferRef indexBuffer = IndexBuffer::New(vertexCount > std::numeric_limits<UInt16>::max(), indices.size(), parameters.storage, 0);
|
||||
VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent), vertexCount, parameters.storage, 0);
|
||||
IndexBufferRef indexBuffer = IndexBuffer::New(vertexCount > std::numeric_limits<UInt16>::max(), UInt32(indices.size()), parameters.storage, 0);
|
||||
VertexBufferRef vertexBuffer = VertexBuffer::New(VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent), UInt32(vertexCount), parameters.storage, 0);
|
||||
|
||||
// Remplissage des indices
|
||||
IndexMapper indexMapper(indexBuffer, BufferAccess_WriteOnly);
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ namespace Nz
|
|||
|
||||
if (p < 0)
|
||||
{
|
||||
p += m_positions.size() - 1;
|
||||
p += static_cast<int>(m_positions.size() - 1);
|
||||
if (p < 0)
|
||||
{
|
||||
Error("Vertex index out of range (" + String::Number(p) + " < 0");
|
||||
|
|
@ -239,7 +239,7 @@ namespace Nz
|
|||
|
||||
if (n < 0)
|
||||
{
|
||||
n += m_normals.size() - 1;
|
||||
n += static_cast<int>(m_normals.size() - 1);
|
||||
if (n < 0)
|
||||
{
|
||||
Error("Normal index out of range (" + String::Number(n) + " < 0");
|
||||
|
|
@ -250,7 +250,7 @@ namespace Nz
|
|||
|
||||
if (t < 0)
|
||||
{
|
||||
t += m_texCoords.size() - 1;
|
||||
t += static_cast<int>(m_texCoords.size() - 1);
|
||||
if (t < 0)
|
||||
{
|
||||
Error("Texture coordinates index out of range (" + String::Number(t) + " < 0");
|
||||
|
|
|
|||
|
|
@ -12,38 +12,38 @@ namespace Nz
|
|||
{
|
||||
namespace
|
||||
{
|
||||
UInt32 GetterSequential(const void* buffer, unsigned int i)
|
||||
UInt32 GetterSequential(const void* buffer, std::size_t i)
|
||||
{
|
||||
NazaraUnused(buffer);
|
||||
|
||||
return i;
|
||||
return static_cast<UInt32>(i);
|
||||
}
|
||||
|
||||
UInt32 Getter16(const void* buffer, unsigned int i)
|
||||
UInt32 Getter16(const void* buffer, std::size_t i)
|
||||
{
|
||||
const UInt16* ptr = static_cast<const UInt16*>(buffer);
|
||||
return ptr[i];
|
||||
}
|
||||
|
||||
UInt32 Getter32(const void* buffer, unsigned int i)
|
||||
UInt32 Getter32(const void* buffer, std::size_t i)
|
||||
{
|
||||
const UInt32* ptr = static_cast<const UInt32*>(buffer);
|
||||
return ptr[i];
|
||||
}
|
||||
|
||||
void Setter16(void* buffer, unsigned int i, UInt32 value)
|
||||
void Setter16(void* buffer, std::size_t i, UInt32 value)
|
||||
{
|
||||
UInt16* ptr = static_cast<UInt16*>(buffer);
|
||||
ptr[i] = static_cast<UInt16>(value);
|
||||
}
|
||||
|
||||
void Setter32(void* buffer, unsigned int i, UInt32 value)
|
||||
void Setter32(void* buffer, std::size_t i, UInt32 value)
|
||||
{
|
||||
UInt32* ptr = static_cast<UInt32*>(buffer);
|
||||
ptr[i] = value;
|
||||
}
|
||||
|
||||
void SetterError(void*, unsigned int, UInt32)
|
||||
void SetterError(void*, std::size_t, UInt32)
|
||||
{
|
||||
NazaraError("Index buffer opened with read-only access");
|
||||
}
|
||||
|
|
@ -113,15 +113,9 @@ namespace Nz
|
|||
{
|
||||
}
|
||||
|
||||
UInt32 IndexMapper::Get(unsigned int i) const
|
||||
UInt32 IndexMapper::Get(std::size_t i) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (i >= m_indexCount)
|
||||
{
|
||||
NazaraError("Index out of range (" + String::Number(i) + " >= " + String::Number(m_indexCount) + ')');
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < m_indexCount, "Index out of range");
|
||||
|
||||
return m_getter(m_mapper.GetPointer(), i);
|
||||
}
|
||||
|
|
@ -131,20 +125,14 @@ namespace Nz
|
|||
return m_mapper.GetBuffer();
|
||||
}
|
||||
|
||||
unsigned int IndexMapper::GetIndexCount() const
|
||||
std::size_t IndexMapper::GetIndexCount() const
|
||||
{
|
||||
return m_indexCount;
|
||||
}
|
||||
|
||||
void IndexMapper::Set(unsigned int i, UInt32 value)
|
||||
void IndexMapper::Set(std::size_t i, UInt32 value)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (i >= m_indexCount)
|
||||
{
|
||||
NazaraError("Index out of range (" + String::Number(i) + " >= " + String::Number(m_indexCount) + ')');
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < m_indexCount, "Index out of range");
|
||||
|
||||
m_setter(m_mapper.GetPointer(), i, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Nz
|
|||
NazaraAssert(subMesh, "Invalid submesh");
|
||||
NazaraAssert(subMesh->GetAnimationType() == m_impl->animationType, "Submesh animation type doesn't match mesh animation type");
|
||||
|
||||
m_impl->subMeshes.push_back(subMesh);
|
||||
m_impl->subMeshes.emplace_back(subMesh);
|
||||
|
||||
InvalidateAABB();
|
||||
}
|
||||
|
|
@ -92,10 +92,10 @@ namespace Nz
|
|||
NazaraAssert(subMesh, "Invalid submesh");
|
||||
NazaraAssert(subMesh->GetAnimationType() == m_impl->animationType, "Submesh animation type doesn't match mesh animation type");
|
||||
|
||||
UInt32 index = m_impl->subMeshes.size();
|
||||
std::size_t index = m_impl->subMeshes.size();
|
||||
|
||||
m_impl->subMeshes.push_back(subMesh);
|
||||
m_impl->subMeshMap[identifier] = index;
|
||||
m_impl->subMeshes.emplace_back(subMesh);
|
||||
m_impl->subMeshMap[identifier] = static_cast<UInt32>(index);
|
||||
|
||||
InvalidateAABB();
|
||||
}
|
||||
|
|
@ -349,11 +349,11 @@ namespace Nz
|
|||
|
||||
if (!m_impl->aabbUpdated)
|
||||
{
|
||||
UInt32 subMeshCount = m_impl->subMeshes.size();
|
||||
std::size_t subMeshCount = m_impl->subMeshes.size();
|
||||
if (subMeshCount > 0)
|
||||
{
|
||||
m_impl->aabb.Set(m_impl->subMeshes[0]->GetAABB());
|
||||
for (UInt32 i = 1; i < subMeshCount; ++i)
|
||||
for (std::size_t i = 1; i < subMeshCount; ++i)
|
||||
m_impl->aabb.ExtendTo(m_impl->subMeshes[i]->GetAABB());
|
||||
}
|
||||
else
|
||||
|
|
@ -407,7 +407,7 @@ namespace Nz
|
|||
{
|
||||
NazaraAssert(m_impl, "Mesh should be created first");
|
||||
|
||||
return m_impl->materialData.size();
|
||||
return static_cast<UInt32>(m_impl->materialData.size());
|
||||
}
|
||||
|
||||
Skeleton* Mesh::GetSkeleton()
|
||||
|
|
@ -466,7 +466,7 @@ namespace Nz
|
|||
{
|
||||
NazaraAssert(m_impl, "Mesh should be created first");
|
||||
|
||||
return m_impl->subMeshes.size();
|
||||
return static_cast<UInt32>(m_impl->subMeshes.size());
|
||||
}
|
||||
|
||||
UInt32 Mesh::GetSubMeshIndex(const String& identifier) const
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ namespace Nz
|
|||
m_workingBounds.MakeZero(); //< Compute bounds as float to speedup bounds computation (as casting between floats and integers is costly)
|
||||
|
||||
if (m_font)
|
||||
m_lines.emplace_back(Line{Rectf(0.f, 0.f, 0.f, m_font->GetSizeInfo(m_characterSize).lineHeight), 0});
|
||||
m_lines.emplace_back(Line{Rectf(0.f, 0.f, 0.f, float(m_font->GetSizeInfo(m_characterSize).lineHeight)), 0});
|
||||
else
|
||||
m_lines.emplace_back(Line{Rectf::Zero(), 0});
|
||||
}
|
||||
|
|
@ -354,7 +354,7 @@ namespace Nz
|
|||
{
|
||||
glyph.atlas = nullptr;
|
||||
|
||||
glyph.bounds.Set(m_drawPos.x, m_drawPos.y, float(advance), sizeInfo.lineHeight);
|
||||
glyph.bounds.Set(m_drawPos.x, m_drawPos.y, float(advance), float(sizeInfo.lineHeight));
|
||||
|
||||
glyph.corners[0].Set(glyph.bounds.GetCorner(RectCorner_LeftTop));
|
||||
glyph.corners[1].Set(glyph.bounds.GetCorner(RectCorner_RightTop));
|
||||
|
|
@ -377,7 +377,7 @@ namespace Nz
|
|||
m_drawPos.x = 0;
|
||||
m_drawPos.y += sizeInfo.lineHeight;
|
||||
|
||||
m_lines.emplace_back(Line{Rectf(0.f, sizeInfo.lineHeight * m_lines.size(), 0.f, sizeInfo.lineHeight), m_glyphs.size() + 1});
|
||||
m_lines.emplace_back(Line{Rectf(0.f, float(sizeInfo.lineHeight * m_lines.size()), 0.f, float(sizeInfo.lineHeight)), m_glyphs.size() + 1});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,12 +72,12 @@ namespace Nz
|
|||
|
||||
if (!m_impl->aabbUpdated)
|
||||
{
|
||||
UInt32 jointCount = m_impl->joints.size();
|
||||
std::size_t jointCount = m_impl->joints.size();
|
||||
if (jointCount > 0)
|
||||
{
|
||||
Vector3f pos = m_impl->joints[0].GetPosition();
|
||||
m_impl->aabb.Set(pos.x, pos.y, pos.z, 0.f, 0.f, 0.f);
|
||||
for (UInt32 i = 1; i < jointCount; ++i)
|
||||
for (std::size_t i = 1; i < jointCount; ++i)
|
||||
m_impl->aabb.ExtendTo(m_impl->joints[i].GetPosition());
|
||||
}
|
||||
else
|
||||
|
|
@ -219,7 +219,7 @@ namespace Nz
|
|||
}
|
||||
#endif
|
||||
|
||||
return m_impl->joints.size();
|
||||
return static_cast<UInt32>(m_impl->joints.size());
|
||||
}
|
||||
|
||||
int Skeleton::GetJointIndex(const String& jointName) const
|
||||
|
|
@ -411,16 +411,9 @@ namespace Nz
|
|||
String name = m_impl->joints[i].GetName();
|
||||
if (!name.IsEmpty())
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
auto it = m_impl->jointMap.find(name);
|
||||
if (it != m_impl->jointMap.end())
|
||||
{
|
||||
NazaraWarning("Joint name \"" + name + "\" is already present in joint map for joint #" + String::Number(it->second));
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(m_impl->jointMap.find(name) == m_impl->jointMap.end(), "Joint name \"" + name + "\" is already present in joint map");
|
||||
|
||||
m_impl->jointMap[name] = i;
|
||||
m_impl->jointMap[name] = static_cast<UInt32>(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,18 +66,9 @@ namespace Nz
|
|||
return true;
|
||||
}
|
||||
|
||||
UInt32 TriangleIterator::operator[](unsigned int i) const
|
||||
UInt32 TriangleIterator::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (i >= 3)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 3)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 3, "Index out of range");
|
||||
|
||||
return m_triangleIndices[i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue