Fix some warnings

This commit is contained in:
SirLynix 2023-06-27 19:31:24 +02:00
parent b01ee18eaf
commit 96618cbb5b
11 changed files with 28 additions and 23 deletions

View File

@ -51,7 +51,6 @@ int main()
return __LINE__;
}
const Nz::Boxf& spaceshipAABB = spaceshipMesh->GetAABB();
std::shared_ptr<Nz::GraphicalMesh> gfxMesh = Nz::GraphicalMesh::BuildFromMesh(*spaceshipMesh);
Nz::TextureSamplerInfo samplerInfo;

View File

@ -351,7 +351,7 @@ int main()
Nz::JoltRigidBody3D::StaticSettings floorSettings;
floorSettings.geom = translatedFloorCollider;
auto& planeBody = floorEntity.emplace<Nz::JoltRigidBody3DComponent>(physSytem.CreateRigidBody(floorSettings));
floorEntity.emplace<Nz::JoltRigidBody3DComponent>(physSytem.CreateRigidBody(floorSettings));
std::shared_ptr<Nz::GraphicalMesh> boxMeshGfx = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(0.5f, 0.5f, 0.5f)), meshPrimitiveParams);

View File

@ -20,7 +20,7 @@ namespace Nz
public:
inline StateMachine(std::shared_ptr<State> originalState);
StateMachine(const StateMachine&) = delete;
inline StateMachine(StateMachine&& fsm) = default;
StateMachine(StateMachine&&) = default;
inline ~StateMachine();
inline void ChangeState(std::shared_ptr<State> state);
@ -35,7 +35,7 @@ namespace Nz
inline bool Update(Time elapsedTime);
inline StateMachine& operator=(StateMachine&& fsm) = default;
StateMachine& operator=(StateMachine&& fsm) = default;
StateMachine& operator=(const StateMachine&) = delete;
private:

View File

@ -379,7 +379,6 @@ namespace Nz
for (const auto& plane : m_planes)
{
bool outside = true;
std::size_t insidePoint = 0;
for (std::size_t i = 0; i < pointCount; ++i)
{
// If at least one point is outside of the frustum, we're intersecting

View File

@ -37,9 +37,11 @@ namespace Nz
case ImageType::E1D:
NazaraAssert(baseLayer == 0, "out of bounds");
NazaraAssert(layerCount <= 1, "out of bounds");
[[fallthrough]];
case ImageType::E2D:
NazaraAssert(baseLayer == 0, "out of bounds");
NazaraAssert(layerCount <= 1, "out of bounds");
[[fallthrough]];
case ImageType::E3D:
region.z = 0;
region.depth = 1;

View File

@ -334,7 +334,7 @@ namespace Nz
if (!gfx->IsVisible())
return;
for (std::size_t renderableIndex = 0; renderableIndex < LightComponent::MaxLightCount; ++renderableIndex)
for (std::size_t renderableIndex = 0; renderableIndex < GraphicsComponent::MaxRenderableCount; ++renderableIndex)
{
const auto& renderableEntry = gfx->GetRenderableEntry(renderableIndex);
if (!renderableEntry.renderable)
@ -515,7 +515,7 @@ namespace Nz
m_pipeline->UnregisterLight(lightEntity->lightIndices[lightIndex]);
}
}
m_newlyHiddenGfxEntities.clear();
m_newlyHiddenLightEntities.clear();
// Register lights for newly visible entities
for (LightEntity* lightEntity : m_newlyVisibleLightEntities)
@ -531,7 +531,7 @@ namespace Nz
lightEntity->lightIndices[renderableIndex] = m_pipeline->RegisterLight(lightEntry.light.get(), lightEntry.renderMask);
}
}
m_newlyVisibleGfxEntities.clear();
m_newlyVisibleLightEntities.clear();
//FIXME: Handle light visibility
}

View File

@ -41,6 +41,11 @@ namespace Nz
bool Window::Create(VideoMode mode, const std::string& title, WindowStyleFlags style)
{
#ifdef NAZARA_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable:4701) //< uninitialized variable maybe used (position)
#endif
// If the window is already open, we keep its position
bool opened = IsOpen();
Vector2i position;
@ -77,8 +82,11 @@ namespace Nz
destroyOnFailure.Reset();
m_eventHandler.Dispatch({ WindowEventType::Created });
m_eventHandler.Dispatch({ { WindowEventType::Created } });
#ifdef NAZARA_COMPILER_MSVC
#pragma warning(pop)
#endif
return true;
}
@ -100,7 +108,7 @@ namespace Nz
m_closed = false;
m_ownsWindow = false;
m_eventHandler.Dispatch({ WindowEventType::Created });
m_eventHandler.Dispatch({ { WindowEventType::Created } });
return true;
}
@ -109,7 +117,7 @@ namespace Nz
{
if (m_impl)
{
m_eventHandler.Dispatch({ WindowEventType::Destruction });
m_eventHandler.Dispatch({ { WindowEventType::Destruction } });
m_impl->Destroy();
m_impl.reset();

View File

@ -12,13 +12,6 @@ namespace Nz
{
namespace NAZARA_ANONYMOUS_NAMESPACE
{
UInt32 GetterSequential(const void* buffer, std::size_t i)
{
NazaraUnused(buffer);
return static_cast<UInt32>(i);
}
UInt32 Getter8(const void* buffer, std::size_t i)
{
const UInt8* ptr = static_cast<const UInt8*>(buffer);

View File

@ -1,8 +1,10 @@
#include <ShaderNode/Previews/QuadPreview.hpp>
#include <cassert>
PreviewValues QuadPreview::GetPreview(InputRole role, std::size_t roleIndex) const
PreviewValues QuadPreview::GetPreview(InputRole role, [[maybe_unused]] std::size_t roleIndex) const
{
assert(roleIndex == 0);
if (role != InputRole::TexCoord)
{
PreviewValues dummy(1, 1);

View File

@ -60,10 +60,12 @@ StructMemberInfo StructMemberEditDialog::GetMemberInfo() const
StructMemberInfo inputInfo;
inputInfo.name = m_memberName->text().toStdString();
if (m_typeList->currentIndex() < PrimitiveTypeCount)
inputInfo.type = static_cast<PrimitiveType>(m_typeList->currentIndex());
std::size_t index = Nz::SafeCast<std::size_t>(m_typeList->currentIndex());
if (index < PrimitiveTypeCount)
inputInfo.type = static_cast<PrimitiveType>(index);
else
inputInfo.type = static_cast<std::size_t>(m_typeList->currentIndex() - PrimitiveTypeCount);
inputInfo.type = Nz::SafeCast<std::size_t>(index - PrimitiveTypeCount);
return inputInfo;
}

View File

@ -151,7 +151,7 @@ int main()
GLint dataSize;
program.GetActiveUniformBlock(blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &dataSize);
if (fieldOffsets.GetAlignedSize() != dataSize)
if (fieldOffsets.GetAlignedSize() != std::size_t(dataSize))
std::cout << "size mismatch (computed " << fieldOffsets.GetAlignedSize() << ", reference has " << dataSize << ")" << std::endl;;
if (computedOffsets.size() != uniformIndices.size())