Fix a bunch of warnings

This commit is contained in:
SirLynix 2023-05-30 12:34:38 +02:00
parent 9d422dfe45
commit 0c7efa05e2
9 changed files with 17 additions and 20 deletions

View File

@ -351,7 +351,6 @@
<Rule Id="C6246" Action="Warning" /> <Rule Id="C6246" Action="Warning" />
<Rule Id="C6248" Action="Warning" /> <Rule Id="C6248" Action="Warning" />
<Rule Id="C6250" Action="Warning" /> <Rule Id="C6250" Action="Warning" />
<Rule Id="C6255" Action="Warning" />
<Rule Id="C6258" Action="Warning" /> <Rule Id="C6258" Action="Warning" />
<Rule Id="C6259" Action="Warning" /> <Rule Id="C6259" Action="Warning" />
<Rule Id="C6260" Action="Warning" /> <Rule Id="C6260" Action="Warning" />

View File

@ -77,7 +77,7 @@ int main()
Nz::ElementRendererRegistry elementRegistry; Nz::ElementRendererRegistry elementRegistry;
Nz::ForwardFramePipeline framePipeline(elementRegistry); Nz::ForwardFramePipeline framePipeline(elementRegistry);
std::size_t cameraIndex = framePipeline.RegisterViewer(&camera, 0); [[maybe_unused]] std::size_t cameraIndex = framePipeline.RegisterViewer(&camera, 0);
std::size_t worldInstanceIndex1 = framePipeline.RegisterWorldInstance(modelInstance); std::size_t worldInstanceIndex1 = framePipeline.RegisterWorldInstance(modelInstance);
framePipeline.RegisterRenderable(worldInstanceIndex1, Nz::FramePipeline::NoSkeletonInstance, &model, 0xFFFFFFFF, scissorBox); framePipeline.RegisterRenderable(worldInstanceIndex1, Nz::FramePipeline::NoSkeletonInstance, &model, 0xFFFFFFFF, scissorBox);

View File

@ -113,8 +113,6 @@ int main()
//Nz::Mouse::SetRelativeMouseMode(true); //Nz::Mouse::SetRelativeMouseMode(true);
float elapsedTime = 0.f;
Nz::PidController<Nz::Vector3f> headingController(0.5f, 0.f, 0.05f); Nz::PidController<Nz::Vector3f> headingController(0.5f, 0.f, 0.05f);
Nz::PidController<Nz::Vector3f> upController(1.f, 0.f, 0.1f); Nz::PidController<Nz::Vector3f> upController(1.f, 0.f, 0.1f);

View File

@ -68,7 +68,7 @@ int main()
return true; return true;
}); });
entt::handle boxEntity = world.CreateEntity(); entt::handle boxColliderEntity = world.CreateEntity();
{ {
std::shared_ptr<Nz::GraphicalMesh> boxMesh = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(BoxDims), Nz::Vector3ui::Zero(), Nz::Matrix4f::Scale(Nz::Vector3f(-1.f)), Nz::Rectf(0.f, 0.f, 2.f, 2.f))); std::shared_ptr<Nz::GraphicalMesh> boxMesh = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(BoxDims), Nz::Vector3ui::Zero(), Nz::Matrix4f::Scale(Nz::Vector3f(-1.f)), Nz::Rectf(0.f, 0.f, 2.f, 2.f)));
@ -88,10 +88,10 @@ int main()
std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMesh)); std::shared_ptr<Nz::Model> boxModel = std::make_shared<Nz::Model>(std::move(boxMesh));
boxModel->SetMaterial(0, std::move(boxMat)); boxModel->SetMaterial(0, std::move(boxMat));
auto& boxGfx = boxEntity.emplace<Nz::GraphicsComponent>(); auto& boxGfx = boxColliderEntity.emplace<Nz::GraphicsComponent>();
boxGfx.AttachRenderable(std::move(boxModel)); boxGfx.AttachRenderable(std::move(boxModel));
boxEntity.emplace<Nz::NodeComponent>(); boxColliderEntity.emplace<Nz::NodeComponent>();
#if USE_JOLT #if USE_JOLT
float thickness = 1.f; float thickness = 1.f;
@ -128,9 +128,9 @@ int main()
Nz::JoltRigidBody3D::StaticSettings settings; Nz::JoltRigidBody3D::StaticSettings settings;
settings.geom = boxCollider; settings.geom = boxCollider;
auto& boxBody = boxEntity.emplace<Nz::JoltRigidBody3DComponent>(physSystem.CreateRigidBody(settings)); boxColliderEntity.emplace<Nz::JoltRigidBody3DComponent>(physSystem.CreateRigidBody(settings));
#else #else
auto& boxBody = boxEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(boxCollider)); auto& boxBody = boxColliderEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(boxCollider));
boxBody.SetMass(0.f); boxBody.SetMass(0.f);
#endif #endif
@ -186,9 +186,9 @@ int main()
settings.geom = sphereCollider; settings.geom = sphereCollider;
settings.mass = 4.f / 3.f * Nz::Pi<float> * Nz::IntegralPow(radius, 3); settings.mass = 4.f / 3.f * Nz::Pi<float> * Nz::IntegralPow(radius, 3);
auto& ballPhysics = ballEntity.emplace<Nz::JoltRigidBody3DComponent>(physSystem.CreateRigidBody(settings)); ballEntity.emplace<Nz::JoltRigidBody3DComponent>(physSystem.CreateRigidBody(settings));
#else #else
auto& ballPhysics = ballEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(sphereCollider)); ballEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(sphereCollider));
#endif #endif
} }
@ -434,7 +434,7 @@ int main()
#endif #endif
auto callback = [&](const decltype(lastHitInfo)& hitInfo) -> std::optional<float> auto callback = [&](const decltype(lastHitInfo)& hitInfo) -> std::optional<float>
{ {
if (hitInfo.hitEntity == boxEntity) if (hitInfo.hitEntity == boxColliderEntity)
{ {
Nz::Vector3f dirToCenter = Nz::Vector3f::Zero() - hitInfo.hitPosition; Nz::Vector3f dirToCenter = Nz::Vector3f::Zero() - hitInfo.hitPosition;
dirToCenter.Normalize(); dirToCenter.Normalize();
@ -450,7 +450,7 @@ int main()
if (physSystem.RaycastQuery(from, to, callback)) if (physSystem.RaycastQuery(from, to, callback))
{ {
if (lastHitInfo.hitBody && lastHitInfo.hitEntity != boxEntity) if (lastHitInfo.hitBody && lastHitInfo.hitEntity != boxColliderEntity)
{ {
#if USE_JOLT #if USE_JOLT
grabConstraint.emplace(*lastHitInfo.hitBody, lastHitInfo.hitPosition); grabConstraint.emplace(*lastHitInfo.hitBody, lastHitInfo.hitPosition);

View File

@ -12,7 +12,7 @@ int main(int argc, char* argv[])
{ {
// This "example" has only one purpose: Giving an empty project for you to test whatever you want // This "example" has only one purpose: Giving an empty project for you to test whatever you want
// If you wish to have multiple test projects, you only have to copy/paste this directory and change the name in the xmake.lua // If you wish to have multiple test projects, you only have to copy/paste this directory and change the name in the xmake.lua
Nz::Application<Nz::Audio, Nz::Core, Nz::Graphics, Nz::Network, Nz::ChipmunkPhysics2D, Nz::BulletPhysics3D, Nz::Renderer, Nz::Utility> app; Nz::Application<Nz::Audio, Nz::Core, Nz::Graphics, Nz::Network, Nz::ChipmunkPhysics2D, Nz::BulletPhysics3D, Nz::Renderer, Nz::Utility> app(argc, argv);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -20,7 +20,7 @@ namespace Nz
{ {
public: public:
IndexMapper(IndexBuffer& indexBuffer, UInt32 indexCount = 0); IndexMapper(IndexBuffer& indexBuffer, UInt32 indexCount = 0);
IndexMapper(SubMesh& subMes); IndexMapper(SubMesh& subMesh);
~IndexMapper() = default; ~IndexMapper() = default;
UInt32 Get(std::size_t i) const; UInt32 Get(std::size_t i) const;

View File

@ -643,7 +643,7 @@ namespace Nz
mergePass.AddOutput(renderTargetData.finalAttachment); mergePass.AddOutput(renderTargetData.finalAttachment);
mergePass.SetClearColor(0, Color::Black()); mergePass.SetClearColor(0, Color::Black());
mergePass.SetCommandCallback([&targetViewers](CommandBufferBuilder& builder, const FramePassEnvironment& env) mergePass.SetCommandCallback([&targetViewers](CommandBufferBuilder& builder, const FramePassEnvironment& /*env*/)
{ {
Graphics* graphics = Graphics::Instance(); Graphics* graphics = Graphics::Instance();
builder.BindRenderPipeline(*graphics->GetBlitPipeline(false)); builder.BindRenderPipeline(*graphics->GetBlitPipeline(false));

View File

@ -391,15 +391,15 @@ namespace Nz
SimpleScrollAreaWidgetStyle::SimpleScrollAreaWidgetStyle(ScrollAreaWidget* scrollAreaWidget) : SimpleScrollAreaWidgetStyle::SimpleScrollAreaWidgetStyle(ScrollAreaWidget* scrollAreaWidget) :
ScrollAreaWidgetStyle((BaseWidget*) scrollAreaWidget, 0) ScrollAreaWidgetStyle(scrollAreaWidget, 0)
{ {
} }
void SimpleScrollAreaWidgetStyle::Layout(const Vector2f& size) void SimpleScrollAreaWidgetStyle::Layout(const Vector2f& /*size*/)
{ {
} }
void SimpleScrollAreaWidgetStyle::UpdateRenderLayer(int baseRenderLayer) void SimpleScrollAreaWidgetStyle::UpdateRenderLayer(int /*baseRenderLayer*/)
{ {
} }

View File

@ -194,7 +194,7 @@ SCENARIO("ParameterList", "[CORE][PARAMETERLIST]")
THEN("We can get it back") THEN("We can get it back")
{ {
void* ptrToData; void* ptrToData = nullptr; //< to stfu compiler
CHECK_NOTHROW(ptrToData = parameterList.GetUserdataParameter("userData").GetValue()); CHECK_NOTHROW(ptrToData = parameterList.GetUserdataParameter("userData").GetValue());
Data* dataPtr = static_cast<Data*>(ptrToData); Data* dataPtr = static_cast<Data*>(ptrToData);