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__; return __LINE__;
} }
const Nz::Boxf& spaceshipAABB = spaceshipMesh->GetAABB();
std::shared_ptr<Nz::GraphicalMesh> gfxMesh = Nz::GraphicalMesh::BuildFromMesh(*spaceshipMesh); std::shared_ptr<Nz::GraphicalMesh> gfxMesh = Nz::GraphicalMesh::BuildFromMesh(*spaceshipMesh);
Nz::TextureSamplerInfo samplerInfo; Nz::TextureSamplerInfo samplerInfo;

View File

@ -351,7 +351,7 @@ int main()
Nz::JoltRigidBody3D::StaticSettings floorSettings; Nz::JoltRigidBody3D::StaticSettings floorSettings;
floorSettings.geom = translatedFloorCollider; 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); 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: public:
inline StateMachine(std::shared_ptr<State> originalState); inline StateMachine(std::shared_ptr<State> originalState);
StateMachine(const StateMachine&) = delete; StateMachine(const StateMachine&) = delete;
inline StateMachine(StateMachine&& fsm) = default; StateMachine(StateMachine&&) = default;
inline ~StateMachine(); inline ~StateMachine();
inline void ChangeState(std::shared_ptr<State> state); inline void ChangeState(std::shared_ptr<State> state);
@ -35,7 +35,7 @@ namespace Nz
inline bool Update(Time elapsedTime); inline bool Update(Time elapsedTime);
inline StateMachine& operator=(StateMachine&& fsm) = default; StateMachine& operator=(StateMachine&& fsm) = default;
StateMachine& operator=(const StateMachine&) = delete; StateMachine& operator=(const StateMachine&) = delete;
private: private:

View File

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

View File

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

View File

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

View File

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

View File

@ -12,13 +12,6 @@ namespace Nz
{ {
namespace NAZARA_ANONYMOUS_NAMESPACE 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) UInt32 Getter8(const void* buffer, std::size_t i)
{ {
const UInt8* ptr = static_cast<const UInt8*>(buffer); const UInt8* ptr = static_cast<const UInt8*>(buffer);

View File

@ -1,8 +1,10 @@
#include <ShaderNode/Previews/QuadPreview.hpp> #include <ShaderNode/Previews/QuadPreview.hpp>
#include <cassert> #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) if (role != InputRole::TexCoord)
{ {
PreviewValues dummy(1, 1); PreviewValues dummy(1, 1);

View File

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

View File

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