Minor improvements

This commit is contained in:
Lynix
2024-01-29 18:34:46 +01:00
parent 0191256493
commit 2b88f50c21
19 changed files with 34 additions and 41 deletions

View File

@@ -7,6 +7,7 @@
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/StringExt.hpp>
#include <NazaraUtils/CallOnExit.hpp>
#include <array>
#include <cstring>
#include <Nazara/Core/Debug.hpp>

View File

@@ -39,7 +39,6 @@ namespace Nz
{
NAZARA_USE_ANONYMOUS_NAMESPACE
// std::thread::native_handle returns a void* with MSVC instead of a HANDLE
return PlatformImpl::GetThreadName(GetHandle(thread));
}
@@ -52,7 +51,6 @@ namespace Nz
{
NAZARA_USE_ANONYMOUS_NAMESPACE
// std::thread::native_handle returns a void* with MSVC instead of a HANDLE
PlatformImpl::SetThreadName(GetHandle(thread), name);
}
}

View File

@@ -47,11 +47,9 @@ namespace Nz
elements.emplace_back(registry.AllocateElement<RenderSpriteChain>(GetRenderLayer(), m_material, passFlags, renderPipeline, *elementData.worldInstance, vertexDeclaration, whiteTexture, m_spriteCount, m_vertices.data(), *elementData.scissorBox));
}
const std::shared_ptr<MaterialInstance>& LinearSlicedSprite::GetMaterial(std::size_t i) const
const std::shared_ptr<MaterialInstance>& LinearSlicedSprite::GetMaterial(std::size_t materialIndex) const
{
assert(i == 0);
NazaraUnused(i);
NazaraAssertFmt(materialIndex == 0, "material index out of range ({0} >= 1)", materialIndex);
return m_material;
}

View File

@@ -79,7 +79,7 @@ namespace Nz
const std::shared_ptr<MaterialInstance>& Model::GetMaterial(std::size_t subMeshIndex) const
{
assert(subMeshIndex < m_submeshes.size());
NazaraAssertFmt(subMeshIndex < m_submeshes.size(), "material index out of range ({0} >= {1})", subMeshIndex, m_submeshes.size());
const auto& subMeshData = m_submeshes[subMeshIndex];
return subMeshData.material;
}
@@ -91,7 +91,7 @@ namespace Nz
const std::vector<RenderPipelineInfo::VertexBufferData>& Model::GetVertexBufferData(std::size_t subMeshIndex) const
{
assert(subMeshIndex < m_submeshes.size());
NazaraAssertFmt(subMeshIndex < m_submeshes.size(), "submesh index out of range ({0} >= {1})", subMeshIndex, m_submeshes.size());
const auto& subMeshData = m_submeshes[subMeshIndex];
return subMeshData.vertexBufferData;
}

View File

@@ -42,11 +42,9 @@ namespace Nz
elements.emplace_back(registry.AllocateElement<RenderSpriteChain>(GetRenderLayer(), m_material, passFlags, renderPipeline, *elementData.worldInstance, vertexDeclaration, whiteTexture, m_spriteCount, m_vertices.data(), *elementData.scissorBox));
}
const std::shared_ptr<MaterialInstance>& SlicedSprite::GetMaterial(std::size_t i) const
const std::shared_ptr<MaterialInstance>& SlicedSprite::GetMaterial(std::size_t materialIndex) const
{
assert(i == 0);
NazaraUnused(i);
NazaraAssertFmt(materialIndex == 0, "material index out of range ({0} >= 1)", materialIndex);
return m_material;
}

View File

@@ -25,14 +25,14 @@ namespace Nz
*/
Tilemap::Tilemap(const Vector2ui& mapSize, const Vector2f& tileSize, std::size_t materialCount) :
m_layers(materialCount),
m_tiles(mapSize.x* mapSize.y),
m_tiles(mapSize.x * mapSize.y),
m_origin(0.f, 0.f),
m_tileSize(tileSize),
m_mapSize(mapSize),
m_isometricModeEnabled(false),
m_shouldRebuildVertices(false)
{
NazaraAssert(m_tiles.size() != 0U, "Invalid map size");
NazaraAssert(m_tiles.size() != 0U, "invalid map size");
NazaraAssert(m_tileSize.x > 0 && m_tileSize.y > 0, "Invalid tile size");
NazaraAssert(m_layers.size() != 0U, "Invalid material count");

View File

@@ -12,7 +12,7 @@ namespace Nz::GL
WGLLoader::WGLLoader(const Renderer::Config& config) :
m_baseContext(nullptr, *this)
{
if (!m_opengl32Lib.Load("opengl32" NAZARA_DYNLIB_EXTENSION))
if (!m_opengl32Lib.Load("opengl32.dll"))
throw std::runtime_error("Failed to load opengl32 library, is OpenGL installed on your system?");
if (!m_gdi32Lib.Load("gdi32.dll"))