Add end-of-line spaces checker

This commit is contained in:
SirLynix 2024-01-26 10:43:00 +01:00
parent 63c61c0827
commit 6757de1be8
90 changed files with 170 additions and 126 deletions

View File

@ -125,7 +125,7 @@ namespace Nz
class ChipmunkMotorConstraint2D;
using ChipmunkMotorConstraint2DHandle = ObjectHandle<ChipmunkMotorConstraint2D>;
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkMotorConstraint2D : public ChipmunkConstraint2D
{
public:
@ -159,7 +159,7 @@ namespace Nz
class ChipmunkPivotConstraint2D;
using ChipmunkPivotConstraint2DHandle = ObjectHandle<ChipmunkPivotConstraint2D>;
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkPivotConstraint2D : public ChipmunkConstraint2D
{
public:
@ -178,7 +178,7 @@ namespace Nz
class ChipmunkRatchetConstraint2D;
using ChipmunkRatchetConstraint2DHandle = ObjectHandle<ChipmunkRatchetConstraint2D>;
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkRatchetConstraint2D : public ChipmunkConstraint2D
{
public:

View File

@ -64,7 +64,7 @@ namespace Nz
return static_cast<T&>(*m_components[componentIndex]);
}
template<typename T>
const T& ApplicationBase::GetComponent() const
{

View File

@ -26,7 +26,7 @@ namespace Nz
ApplicationUpdater& operator=(const ApplicationUpdater&) = delete;
ApplicationUpdater& operator=(ApplicationUpdater&&) = delete;
};
template<typename F>
class ApplicationUpdaterFunctor : public ApplicationUpdater
{

View File

@ -312,7 +312,7 @@ namespace Nz
{
return Color(r / 255.f, g / 255.f, b / 255.f);
}
/*!
* \brief Converts RGBA8 representation to Color (RGBA32F)
* \return Color resulting

View File

@ -37,7 +37,7 @@ namespace Nz
inline /*constexpr*/ Result<OpenModeFlags, std::string> File::DecodeOpenMode(std::string_view openModeStr)
{
OpenModeFlags openModes = 0;
if (openModeStr.find('r') != std::string_view::npos)
{
openModes |= OpenMode::Read;

View File

@ -56,7 +56,7 @@ namespace Nz
return OverrideModuleConfig(T{}, parameters);
}
};
template<typename Module, typename... Modules>
template<typename... ModuleConfig>
ModuleTuple<Module, Modules...>::ModuleTuple(const CommandLineParameters& parameters, ModuleConfig&&... configs) :
@ -97,7 +97,7 @@ namespace Nz
m_modules(CommandLineParameters{}, std::forward<ModuleConfig>(configs)...)
{
}
template<typename... ModuleList>
template<typename... ModuleConfig>
Modules<ModuleList...>::Modules(const CommandLineParameters& parameters, ModuleConfig&&... configs) :

View File

@ -25,7 +25,7 @@ namespace Nz
{
HandleInner<EndOfStream>(std::forward<Args>(args)...);
}
template<typename EndToken, typename... Args>
void ParameterFile::HandleInner(Args&&... args)
{
@ -113,7 +113,7 @@ namespace Nz
keyValue.handler = BuildBlockHandler(keyValues, std::forward<Rest>(rest)...);
}
}
template<typename V, typename... Rest>
auto ParameterFile::GetSingleHandler(V&& value, Rest&&... rest) -> ValueHandler
{

View File

@ -180,7 +180,7 @@ namespace Nz
return true;
}
/*!
* \ingroup math
* \brief Converts the string to number

View File

@ -75,7 +75,7 @@ namespace Nz
});
}
}
template<typename F>
bool VirtualDirectory::GetDirectoryEntry(std::string_view path, F&& callback)
{
@ -260,7 +260,7 @@ namespace Nz
{
return m_isUprootAllowed;
}
inline auto VirtualDirectory::StoreDirectory(std::string_view path, std::shared_ptr<VirtualDirectoryResolver> resolver) -> DirectoryEntry&
{
assert(!path.empty());
@ -318,7 +318,7 @@ namespace Nz
{
return StoreFile(path, std::make_shared<MemoryView>(data, size));
}
template<typename F> bool VirtualDirectory::GetEntryInternal(std::string_view name, bool allowResolve, F&& callback)
{
if (name == ".")

View File

@ -12,7 +12,7 @@ namespace Nz
{
m_worldInstance = std::make_shared<WorldInstance>(); //< FIXME: Use pools
}
inline GraphicsComponent::GraphicsComponent(std::shared_ptr<InstancedRenderable> renderable, UInt32 renderMask, bool initiallyVisible) :
GraphicsComponent(initiallyVisible)
{

View File

@ -31,7 +31,7 @@ namespace Nz
class Light;
class PointLight;
class SpotLight;
class NAZARA_GRAPHICS_API ForwardPipelinePass : public FramePipelinePass, TransferInterface
{
public:

View File

@ -25,7 +25,7 @@ namespace Nz
return inputIndex;
}
inline std::size_t FramePass::AddOutput(std::size_t attachmentId)
{
assert(attachmentId != InvalidAttachmentId);

View File

@ -34,7 +34,7 @@ namespace Nz
template<> struct TypeToMaterialPropertyType<Vector2<Int32>> { static constexpr MaterialPropertyType PropertyType = MaterialPropertyType::Int2; };
template<> struct TypeToMaterialPropertyType<Vector3<Int32>> { static constexpr MaterialPropertyType PropertyType = MaterialPropertyType::Int3; };
template<> struct TypeToMaterialPropertyType<Vector4<Int32>> { static constexpr MaterialPropertyType PropertyType = MaterialPropertyType::Int4; };
template<> struct TypeToMaterialPropertyType<UInt32> { static constexpr MaterialPropertyType PropertyType = MaterialPropertyType::UInt; };
template<> struct TypeToMaterialPropertyType<Vector2<UInt32>> { static constexpr MaterialPropertyType PropertyType = MaterialPropertyType::UInt2; };
template<> struct TypeToMaterialPropertyType<Vector3<UInt32>> { static constexpr MaterialPropertyType PropertyType = MaterialPropertyType::UInt3; };

View File

@ -11,7 +11,7 @@ namespace Nz
{
return m_submeshes.size();
}
inline void Model::SetMaterial(std::size_t subMeshIndex, std::shared_ptr<MaterialInstance> material)
{
assert(subMeshIndex < m_submeshes.size());

View File

@ -23,7 +23,7 @@ namespace Nz
return lightData;
}
// PredefinedPointLightData
constexpr PredefinedPointLightData PredefinedPointLightData::Build()
{

View File

@ -29,7 +29,7 @@ namespace Nz
OptionValuePropertyHandler& operator=(const OptionValuePropertyHandler&) = delete;
OptionValuePropertyHandler& operator=(OptionValuePropertyHandler&&) = delete;
private:
std::size_t m_propertyIndex;
std::string m_propertyName;

View File

@ -30,7 +30,7 @@ namespace Nz
UniformValuePropertyHandler& operator=(const UniformValuePropertyHandler&) = delete;
UniformValuePropertyHandler& operator=(UniformValuePropertyHandler&&) = delete;
private:
std::size_t m_propertyIndex;
std::size_t m_offset;

View File

@ -10,7 +10,7 @@ namespace Nz
RenderTextureBlit(textureSize, std::move(targetTexture), filter, PipelineStage::FragmentShader, MemoryAccess::ShaderRead, TextureLayout::ColorInput)
{
}
RenderTextureBlit::RenderTextureBlit(const Vector2ui& textureSize, std::shared_ptr<Texture> texture, SamplerFilter filter, PipelineStage targetPipelineStage, MemoryAccessFlags targetMemoryFlags, TextureLayout targetLayout) :
m_targetTexture(std::move(texture)),
m_targetMemoryFlags(targetMemoryFlags),

View File

@ -25,7 +25,7 @@ namespace Nz
class Texture;
class VertexDeclaration;
class WorldInstance;
struct SpriteChainRendererData : public ElementRendererData
{
struct DrawCall

View File

@ -111,7 +111,7 @@ namespace Nz
private:
std::vector<ChildCollider> m_childs;
};
class NAZARA_JOLTPHYSICS3D_API JoltConvexHullCollider3D final : public JoltCollider3D
{
public:
@ -122,7 +122,7 @@ namespace Nz
JoltColliderType3D GetType() const override;
};
class NAZARA_JOLTPHYSICS3D_API JoltMeshCollider3D final : public JoltCollider3D
{
public:
@ -148,7 +148,7 @@ namespace Nz
};
/*********************************** Decorated ******************************************/
class NAZARA_JOLTPHYSICS3D_API JoltTranslatedRotatedCollider3D final : public JoltCollider3D
{
public:
@ -164,7 +164,7 @@ namespace Nz
private:
std::shared_ptr<JoltCollider3D> m_collider;
};
}
#include <Nazara/JoltPhysics3D/JoltCollider3D.inl>

View File

@ -612,7 +612,7 @@ namespace Nz
{
return value <= other.value;
}
template<AngleUnit Unit, typename T>
constexpr bool Angle<Unit, T>::operator>(Angle other) const
{

View File

@ -539,7 +539,7 @@ namespace Nz
return *this;
}
/*!
* \brief Multiplies the lengths of this box with the scalar (the box center doesn't move)
* \return A reference to this box where lengths are the product of these lengths and the scalar

View File

@ -237,17 +237,17 @@ namespace Nz
m11*matrix.m12 + m12*matrix.m22 + m13*matrix.m32,
m11*matrix.m13 + m12*matrix.m23 + m13*matrix.m33,
T(0.0),
m21*matrix.m11 + m22*matrix.m21 + m23*matrix.m31,
m21*matrix.m12 + m22*matrix.m22 + m23*matrix.m32,
m21*matrix.m13 + m22*matrix.m23 + m23*matrix.m33,
T(0.0),
m31*matrix.m11 + m32*matrix.m21 + m33*matrix.m31,
m31*matrix.m12 + m32*matrix.m22 + m33*matrix.m32,
m31*matrix.m13 + m32*matrix.m23 + m33*matrix.m33,
T(0.0),
m41*matrix.m11 + m42*matrix.m21 + m43*matrix.m31 + matrix.m41,
m41*matrix.m12 + m42*matrix.m22 + m43*matrix.m32 + matrix.m42,
m41*matrix.m13 + m42*matrix.m23 + m43*matrix.m33 + matrix.m43,
@ -502,7 +502,7 @@ namespace Nz
if (det == T(0.0))
return false;
// http://stackoverflow.com/questions/1148309/inverting-a-4x4-matrix
T inv[16];
inv[0] = m22 * m33 -

View File

@ -527,7 +527,7 @@ namespace Nz
if (z != quat.z)
return z < quat.z;
}
template<typename T>
constexpr bool Quaternion<T>::operator<=(const Quaternion& quat) const
{
@ -543,7 +543,7 @@ namespace Nz
if (z != quat.z)
return z <= quat.z;
}
template<typename T>
constexpr bool Quaternion<T>::operator>(const Quaternion& quat) const
{

View File

@ -513,7 +513,7 @@ namespace Nz
return *this;
}
template<typename T>
constexpr Vector4<T>& Vector4<T>::operator%=(const Vector4& vec)
{

View File

@ -206,7 +206,7 @@ namespace Nz
m_buffer = std::move(packet.m_buffer);
m_memoryStream = std::move(packet.m_memoryStream);
m_netCode = packet.m_netCode;
///< Redirect memory stream to the moved buffer
if (m_buffer)
{

View File

@ -30,7 +30,7 @@ namespace Nz
{
m_headers.insert_or_assign(std::move(header), std::move(value));
}
inline bool WebRequest::OnBodyResponse(const char* data, std::size_t length)
{
if (!m_dataCallback)

View File

@ -84,7 +84,7 @@ namespace Nz
NazaraErrorFmt("unhandled BlendFunc {0:#x})", UnderlyingCast(blendFunc));
return {};
}
inline GLenum ToOpenGL(FaceFilling side)
{
switch (side)

View File

@ -18,7 +18,7 @@ namespace Nz
return *this;
}
inline void Image::ArrayToRegion(ImageType type, unsigned int baseLayer, unsigned int layerCount, Boxui& region)
{
switch (type)

View File

@ -21,7 +21,7 @@ namespace Nz
m_skinningMatrixUpdated(false)
{
}
inline Joint::Joint(Joint&& joint) noexcept :
Node(std::move(joint)),
m_inverseBindMatrix(joint.m_inverseBindMatrix),

View File

@ -406,7 +406,7 @@ namespace Nz
EnsureDerivedUpdate();
return globalScale / m_derivedScale;
}
inline Node& Node::operator=(const Node& node)
{
SetParent(node.m_parent, false, Invalidation::DontInvalidate);

View File

@ -94,7 +94,7 @@ namespace Nz
RichTextDrawer& operator=(RichTextDrawer&& drawer) noexcept;
static constexpr std::size_t InvalidBlockIndex = std::numeric_limits<std::size_t>::max();
private:
struct Block;

View File

@ -27,7 +27,7 @@ namespace Nz
template<typename T> SparsePtr<T> GetComponentPtr(VertexComponent component, std::size_t componentIndex = 0);
inline const VertexBuffer* GetVertexBuffer() const;
inline UInt32 GetVertexCount() const;
template<typename T> bool HasComponentOfType(VertexComponent component) const;
void Unmap();

View File

@ -57,7 +57,7 @@ namespace Nz
static std::vector<Vk::PhysicalDevice> s_physDevices;
static Vk::Instance s_instance;
static ParameterList s_initializationParameters;
};
};
}
#endif // NAZARA_VULKANRENDERER_VULKAN_HPP

View File

@ -56,7 +56,7 @@ namespace Nz
void InsertDebugLabel(std::string_view label, const Color& color) override;
inline Vk::CommandBuffer& GetCommandBuffer();
void NextSubpass() override;
void PreTransferBarrier() override;

View File

@ -22,7 +22,7 @@ namespace Nz
public:
Loader() = delete;
~Loader() = delete;
static bool EnumerateInstanceExtensionProperties(std::vector<VkExtensionProperties>* properties, const char* layerName = nullptr);
static bool EnumerateInstanceLayerProperties(std::vector<VkLayerProperties>* properties);

View File

@ -166,7 +166,7 @@ namespace Nz::Vk
m_surface = VK_NULL_HANDLE;
}
}
inline VkResult Surface::GetLastErrorCode() const
{
return m_lastErrorCode;

View File

@ -19,7 +19,7 @@ namespace Nz::Vk
public:
struct Image;
Swapchain() = default;
Swapchain(const Swapchain&) = delete;
Swapchain(Swapchain&&) = default;

View File

@ -60,7 +60,7 @@ namespace Nz
private:
template<typename F> bool DispatchEvent(std::size_t widgetIndex, F&& functor);
void OnEventMouseButtonPressed(const WindowEventHandler* eventHandler, const WindowEvent::MouseButtonEvent& event);
void OnEventMouseButtonRelease(const WindowEventHandler* eventHandler, const WindowEvent::MouseButtonEvent& event);
void OnEventMouseEntered(const WindowEventHandler* eventHandler);

View File

@ -63,7 +63,7 @@ namespace Nz
bool m_isHovered;
bool m_isPressed;
};
class NAZARA_WIDGETS_API SimpleCheckboxWidgetStyle : public CheckboxWidgetStyle
{
public:
@ -109,7 +109,7 @@ namespace Nz
entt::entity m_checkEntity;
bool m_isHovered;
};
class NAZARA_WIDGETS_API SimpleImageButtonWidgetStyle : public ImageButtonWidgetStyle
{
public:
@ -150,7 +150,7 @@ namespace Nz
bool m_isHovered;
bool m_isPressed;
};
class NAZARA_WIDGETS_API SimpleLabelWidgetStyle : public LabelWidgetStyle
{
public:
@ -179,7 +179,7 @@ namespace Nz
std::shared_ptr<TextSprite> m_textSprite;
entt::entity m_entity;
};
class NAZARA_WIDGETS_API SimpleProgressBarWidgetStyle : public ProgressBarWidgetStyle
{
public:

View File

@ -127,7 +127,7 @@ namespace Nz
ButtonWidgetStyle& operator=(const ButtonWidgetStyle&) = delete;
ButtonWidgetStyle& operator=(ButtonWidgetStyle&&) = default;
};
class NAZARA_WIDGETS_API CheckboxWidgetStyle : public BaseWidgetStyle
{
public:
@ -147,7 +147,7 @@ namespace Nz
CheckboxWidgetStyle& operator=(const CheckboxWidgetStyle&) = delete;
CheckboxWidgetStyle& operator=(CheckboxWidgetStyle&&) = default;
};
class NAZARA_WIDGETS_API ImageButtonWidgetStyle : public BaseWidgetStyle
{
public:
@ -186,7 +186,7 @@ namespace Nz
LabelWidgetStyle& operator=(const LabelWidgetStyle&) = delete;
LabelWidgetStyle& operator=(LabelWidgetStyle&&) = default;
};
class NAZARA_WIDGETS_API ProgressBarWidgetStyle : public BaseWidgetStyle
{
public:
@ -233,7 +233,7 @@ namespace Nz
ScrollbarWidgetStyle& operator=(const ScrollbarWidgetStyle&) = delete;
ScrollbarWidgetStyle& operator=(ScrollbarWidgetStyle&&) = default;
};
class NAZARA_WIDGETS_API ScrollbarButtonWidgetStyle : public BaseWidgetStyle
{
public:

View File

@ -87,7 +87,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = wav.totalPCMFrameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, wav.sampleRate, samples.get());
}

View File

@ -242,7 +242,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = frameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, sampleRate, samples.get());
}

View File

@ -166,7 +166,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = frameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, info->rate, samples.get());
}

View File

@ -112,7 +112,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = frameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, info.hz, info.buffer);
}

View File

@ -30,7 +30,7 @@ namespace Nz
Music(*Audio::Instance()->GetDefaultDevice())
{
}
Music::Music(AudioDevice& device) :
SoundEmitter(device),
m_streaming(false),

View File

@ -89,7 +89,7 @@ namespace Nz
else
return std::make_shared<BulletNullCollider3D>();
}
std::shared_ptr<BulletCollider3D> BulletCollider3D::CreateGeomFromPrimitive(const Primitive& primitive)
{
switch (primitive.type)

View File

@ -190,7 +190,7 @@ namespace Nz
cpDampedSpringSetStiffness(m_constraint, newStiffness);
}
ChipmunkDampedRotarySpringConstraint2D::ChipmunkDampedRotarySpringConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const RadianAnglef& restAngle, float stiffness, float damping) :
ChipmunkConstraint2D(first.GetWorld(), cpDampedRotarySpringNew(first.GetHandle(), second.GetHandle(), restAngle.value, stiffness, damping))
{

View File

@ -621,7 +621,7 @@ namespace Nz
DestroyBody();
}
void ChipmunkRigidBody2D::DestroyBody()
{
UnregisterFromSpace();

View File

@ -785,7 +785,7 @@ namespace Nz
return "Whirlpool";
}
void WhirlpoolHasher::ProcessBuffer()
{
NAZARA_USE_ANONYMOUS_NAMESPACE

View File

@ -195,7 +195,7 @@ namespace Nz
pthread_cond_t TaskSchedulerImpl::s_cvEmpty;
pthread_cond_t TaskSchedulerImpl::s_cvNotEmpty;
pthread_barrier_t TaskSchedulerImpl::s_barrier;
#if defined(NAZARA_PLATFORM_MACOS)
//Code from https://blog.albertarmea.com/post/47089939939/using-pthreadbarrier-on-mac-os-x
int TaskSchedulerImpl::pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)

View File

@ -18,7 +18,7 @@ namespace Nz
/*!
* Write bits to the stream (if any) and reset the current bit cursor
* \see ResetWriteBitPosition
*/
void SerializationContext::FlushBits()

View File

@ -114,7 +114,7 @@ namespace Nz
{
return utf8::distance(str.data(), str.data() + str.size());
}
bool EndsWith(std::string_view lhs, std::string_view rhs, CaseIndependent)
{
NAZARA_USE_ANONYMOUS_NAMESPACE

View File

@ -26,7 +26,7 @@ namespace Nz::PlatformImpl
}
else
commandLine += program;
ReplaceStr(commandLine, L'/', L'\\');
commandLine += L' ';
};

View File

@ -30,7 +30,7 @@ namespace Nz
FramePass& debugDrawPass = frameGraph.AddPass("Debug draw pass");
debugDrawPass.AddInput(inputOuputs.inputAttachments[0]);
debugDrawPass.AddOutput(inputOuputs.outputAttachments[0]);
if (inputOuputs.depthStencilInput != InvalidAttachmentIndex)
debugDrawPass.SetDepthStencilInput(inputOuputs.depthStencilInput);

View File

@ -125,7 +125,7 @@ namespace Nz::Loaders
std::size_t proxyId = m_current->passList->AddAttachmentProxy(proxyName, it->second);
m_current->attachmentsByName.emplace(std::move(proxyName), proxyId);
}
void HandlePass(ParameterFileSection section, std::string passName)
{
struct InputOutput

View File

@ -150,7 +150,7 @@ namespace Nz
return lightIndex;
}
std::size_t ForwardFramePipeline::RegisterRenderable(std::size_t worldInstanceIndex, std::size_t skeletonInstanceIndex, const InstancedRenderable* instancedRenderable, UInt32 renderMask, const Recti& scissorBox)
{
std::size_t renderableIndex;

View File

@ -43,7 +43,7 @@ namespace Nz
textureInfo.type = ImageType::E2D;
textureInfo.usageFlags = TextureUsage::ShaderSampling | TextureUsage::TransferSource | TextureUsage::TransferDestination;
textureInfo.levelCount = 1; //< FIXME: Disable mipmaps for now
std::shared_ptr<Texture> newTexture;
try
{

View File

@ -109,7 +109,7 @@ namespace Nz
size = Vector2f(m_size, section.size);
texCoords = Vector2f(m_textureCoords.width, section.textureCoord);
}
vertices->color = m_color;
vertices->position = topLeftCorner;
vertices->uv = topLeftUV;

View File

@ -52,7 +52,7 @@ namespace Nz
for (std::size_t i = 0; i < m_directions.size(); ++i)
{
DirectionData& direction = m_directions[i];
ViewerInstance& viewerInstance = direction.viewer.GetViewerInstance();
viewerInstance.UpdateEyePosition(m_light.GetPosition());
viewerInstance.UpdateViewMatrix(Matrix4f::TransformInverse(m_light.GetPosition(), s_dirRotations[i]));

View File

@ -36,7 +36,7 @@ namespace Nz
{
// TODO: Replace the blit to swapchain by a graph.BindExternalSwapchain?
std::size_t linkAttachment = graph.AddDummyAttachment();
FramePass& blitPass = graph.AddPass("Blit to swapchain");
blitPass.AddInput(attachmentIndex);
blitPass.SetInputAccess(0, TextureLayout::TransferSource, PipelineStage::Transfer, MemoryAccess::MemoryRead);

View File

@ -192,7 +192,7 @@ namespace Nz
});
std::size_t size = structData.fieldOffsets.GetSize() - offset;
if (member.tag.empty())
continue;

View File

@ -184,7 +184,7 @@ namespace Nz
if (UInt32 bindingIndex = material.GetEngineBindingIndex(EngineShaderBinding::ShadowmapPoint); bindingIndex != Material::InvalidBindingIndex)
{
std::size_t textureBindingBaseIndex = m_textureBindingCache.size();
for (std::size_t j = 0; j < renderState.shadowMapsPoint.size(); ++j)
{
const Texture* texture = renderState.shadowMapsPoint[j];
@ -202,7 +202,7 @@ namespace Nz
SafeCast<UInt32>(renderState.shadowMapsPoint.size()), &m_textureBindingCache[textureBindingBaseIndex]
};
}
if (UInt32 bindingIndex = material.GetEngineBindingIndex(EngineShaderBinding::ShadowmapSpot); bindingIndex != Material::InvalidBindingIndex)
{
std::size_t textureBindingBaseIndex = m_textureBindingCache.size();

View File

@ -292,7 +292,7 @@ namespace Nz
CameraComponent& entityCamera = m_registry.get<CameraComponent>(entity);
Vector3f cameraPosition = entityNode.GetPosition(CoordSys::Global);
ViewerInstance& viewerInstance = entityCamera.GetViewerInstance();
viewerInstance.UpdateEyePosition(cameraPosition);
viewerInstance.UpdateViewMatrix(Nz::Matrix4f::TransformInverse(cameraPosition, entityNode.GetRotation(CoordSys::Global)));
@ -355,7 +355,7 @@ namespace Nz
assert(m_cameraEntities.find(entity) == m_cameraEntities.end());
m_cameraEntities.emplace(entity, cameraEntity);
});
m_graphicsConstructObserver.each([&](entt::entity entity)
{
GraphicsComponent& entityGfx = m_registry.get<GraphicsComponent>(entity);

View File

@ -78,7 +78,7 @@ namespace Nz
vertices += 4 * spriteCount;
}
}
const std::shared_ptr<MaterialInstance>& Tilemap::GetMaterial(std::size_t i) const
{
assert(i < m_layers.size());

View File

@ -92,7 +92,7 @@ namespace Nz
for (const auto& [optionHash, optionValue] : config.optionValues)
{
std::uint32_t hash = optionHash;
std::visit([&](auto&& arg)
{
states.optionValues[hash] = arg;

View File

@ -127,7 +127,7 @@ namespace Nz
{
m_character->Activate(false);
}
JoltCharacter& JoltCharacter::operator=(JoltCharacter&& character) noexcept
{
Destroy();

View File

@ -186,7 +186,7 @@ namespace Nz
for (unsigned int slice = 0; slice < sliceCount; ++slice)
{
Quaternionf rot(RadianAnglef(2.f * Pi<float> * slice / sliceCount), Nz::Vector3f::Down());
Vector3f top(0.f, halfHeight, 0.f);
for (unsigned int i = 0; i < cornerStepCount; ++i)
{
@ -354,7 +354,7 @@ namespace Nz
}
/******************************** JoltMeshCollider3D *********************************/
JoltMeshCollider3D::JoltMeshCollider3D(SparsePtr<const Vector3f> vertices, std::size_t vertexCount, SparsePtr<const UInt16> indices, std::size_t indexCount)
{
std::unique_ptr<JPH::MeshShapeSettings> settings = std::make_unique<JPH::MeshShapeSettings>();

View File

@ -210,7 +210,7 @@ namespace Nz
const FunctionRef<std::optional<float>(const JoltPhysWorld3D::PointCollisionInfo& hitInfo)>& m_callback;
bool m_didHit;
};
class ShapeCallbackHitResult : public JPH::CollideShapeCollector
{
public:

View File

@ -144,7 +144,7 @@ namespace Nz
void AbstractSocket::SetReceiveBufferSize(std::size_t size)
{
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
SocketImpl::SetReceiveBufferSize(m_handle, size);
}
@ -156,7 +156,7 @@ namespace Nz
void AbstractSocket::SetSendBufferSize(std::size_t size)
{
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
SocketImpl::SetSendBufferSize(m_handle, size);
}
@ -249,7 +249,7 @@ namespace Nz
m_lastError = abstractSocket.m_lastError;
m_state = abstractSocket.m_state;
m_type = abstractSocket.m_type;
abstractSocket.m_handle = SocketImpl::InvalidHandle;
return *this;

View File

@ -710,7 +710,7 @@ namespace Nz
#else
int byteSent = sendmsg(handle, &msgHdr, 0);
#endif
if (byteSent == -1)
{
int errorCode = errno;
@ -892,7 +892,7 @@ namespace Nz
if (error)
*error = SocketError::NoError;
#if not defined(MSG_NOSIGNAL) // -> https://github.com/intel/parameter-framework/pull/133/files
//There is no MSG_NOSIGNAL on macos
const int set = 1;
@ -1017,7 +1017,7 @@ namespace Nz
int SocketImpl::TranslateNetProtocolToAF(NetProtocol protocol)
{
NazaraAssert(protocol <= NetProtocol::Max, "Protocol has value out of enum");
constexpr EnumArray<NetProtocol, int> addressFamily {
AF_UNSPEC, //< NetProtocol::Any
AF_INET, //< NetProtocol::IPv4
@ -1031,7 +1031,7 @@ namespace Nz
int SocketImpl::TranslateSocketTypeToSock(SocketType type)
{
NazaraAssert(type <= SocketType::Max, "Socket type has value out of enum");
constexpr EnumArray<SocketType, int> socketType {
SOCK_RAW, //< SocketType::Raw
SOCK_STREAM, //< SocketType::TCP

View File

@ -445,7 +445,7 @@ namespace Nz
return 0;
#endif
}
SocketState SocketImpl::PollConnection(SocketHandle handle, const IpAddress& /*address*/, UInt64 msTimeout, SocketError* error)
{
// Wait until socket is available for writing or an error occurs (ie when connection succeeds or fails)
@ -1041,7 +1041,7 @@ namespace Nz
int SocketImpl::TranslateSocketTypeToSock(SocketType type)
{
NazaraAssert(type <= SocketType::Max, "Socket type has value out of enum");
constexpr EnumArray<SocketType, int> socketType {
SOCK_RAW, //< SocketType::Raw
SOCK_STREAM, //< SocketType::TCP

View File

@ -84,11 +84,11 @@ namespace Nz
for (std::size_t i = 0; i < bindingCount; ++i)
{
const Binding& binding = bindings[i];
std::visit([&](auto&& arg)
{
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, SampledTextureBinding>)
HandleTextureBinding(binding.bindingIndex, arg);
else if constexpr (std::is_same_v<T, SampledTextureBindings>)

View File

@ -333,7 +333,7 @@ namespace Nz::GL
{
// WGL_ARB_pixel_format and WGL_EXT_pixel_format are the same, except for the symbol
auto wglChoosePixelFormat = (currentContext->wglChoosePixelFormatARB) ? currentContext->wglChoosePixelFormatARB : currentContext->wglChoosePixelFormatEXT;
if (wglChoosePixelFormat)
{
std::array<int, 10 * 2 + 1> attributes = {

View File

@ -16,7 +16,7 @@ namespace Nz
width(0)
{
}
VideoMode::VideoMode(unsigned int w, unsigned int h) :
VideoMode(w, h, GetDesktopMode().bitsPerPixel)
{

View File

@ -35,7 +35,7 @@ namespace Nz
auto debugDrawShader = m_renderDevice.InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, *shaderModule, {});
if (!debugDrawShader)
throw std::runtime_error("failed to instantiate debug draw shader");
RenderPipelineLayoutInfo layoutInfo;
layoutInfo.bindings.assign({
{

View File

@ -109,7 +109,7 @@ namespace Nz
NazaraUnused(parameters);
Image tempImage(image); //< We're using COW here to prevent Image copy unless required
int componentCount = ConvertToIntegerFormat(tempImage);
if (componentCount == 0)
{
@ -229,7 +229,7 @@ namespace Nz
{ ".png", &SavePNG },
{ ".tga", &SaveTGA }
});
bool FormatQuerier(std::string_view extension)
{
return s_formatHandlers.find(extension) != s_formatHandlers.end();

View File

@ -33,7 +33,7 @@ namespace Nz
entitySkeleton.SetSkeletonParent(&entityNode);
});
m_skeletonConstructObserver.each([&](entt::entity entity)
{
NodeComponent& entityNode = m_registry.get<NodeComponent>(entity);

View File

@ -129,7 +129,7 @@ namespace Nz
});
NazaraAssert(s_declarations[VertexLayout::XY_Color]->GetStride() == sizeof(VertexStruct_XY_Color), "Invalid stride for declaration VertexLayout::XY_Color");
// VertexLayout::XY_UV : VertexStruct_XY_UV
s_declarations[VertexLayout::XY_UV] = NewDeclaration(VertexInputRate::Vertex, {
{
@ -292,7 +292,7 @@ namespace Nz
});
NazaraAssert(s_declarations[VertexLayout::XYZ_Normal_UV_Tangent_Skinning]->GetStride() == sizeof(VertexStruct_XYZ_Normal_UV_Tangent_Skinning), "Invalid stride for declaration VertexLayout::XYZ_Normal_UV_Tangent_Skinning");
// VertexLayout::XYZ_SizeRot : VertexStruct_XYZ_SizeRot
s_declarations[VertexLayout::UV_SizeSinCos] = NewDeclaration(VertexInputRate::Vertex, {
{

View File

@ -47,7 +47,7 @@ namespace Nz
ErrorFlags flags(ErrorMode::ThrowException);
m_mapper.Map(vertexBuffer, 0, vertexBuffer.GetVertexCount());
}
VertexMapper::~VertexMapper() = default;
void VertexMapper::Unmap()

View File

@ -53,7 +53,7 @@ namespace Nz
ToVulkan(attachmentRef.attachmentLayout)
});
}
std::size_t inputAttachmentIndex = vkAttachmentReferences.size();
for (const AttachmentReference& attachmentRef : subpassInfo.inputAttachments)
{

View File

@ -48,7 +48,7 @@ namespace Nz
for (std::size_t i = 0; i < bindingCount; ++i)
{
const Binding& binding = bindings[i];
VkWriteDescriptorSet& writeOp = writeOps.emplace_back();
writeOp.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeOp.dstSet = m_descriptorSet;

View File

@ -27,7 +27,7 @@ namespace Nz
VkImageViewCreateInfo createInfoView = {};
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
InitViewForFormat(m_textureInfo.pixelFormat, createInfoView);
VkImageCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
createInfo.format = createInfoView.format;
@ -229,7 +229,7 @@ namespace Nz
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
createInfoView.image = m_image;
createInfoView.subresourceRange = m_subresourceRange;
switch (m_textureViewInfo.type)
{
case ImageType::E1D:

View File

@ -48,7 +48,7 @@ namespace Nz
EnableBackground(true);
}
void AbstractTextAreaWidget::Clear()
{
AbstractTextDrawer& textDrawer = GetTextDrawer();

View File

@ -112,7 +112,7 @@ namespace Nz
const UInt8 s_defaultThemeScrollbarCenterImage[] = {
#include <Nazara/Widgets/Resources/DefaultTheme/ScrollbarCenter.png.h>
};
const UInt8 s_defaultThemeScrollbarGrabbedImage[] = {
#include <Nazara/Widgets/Resources/DefaultTheme/ScrollbarCenterGrabbed.png.h>
};

View File

@ -12,7 +12,7 @@ namespace Nz
{
Layout();
}
void RichTextAreaWidget::AppendText(std::string_view text)
{
//m_text += text;

View File

@ -26,7 +26,7 @@ namespace Nz
const WidgetTheme::Config& themeConfig = GetTheme()->GetConfig();
m_scrollCenterButton = Add<ScrollbarButtonWidget>();
m_scrollCenterButton->OnButtonReleased.Connect([this](const ScrollbarButtonWidget*)
{
m_style->OnButtonRelease();
@ -40,7 +40,7 @@ namespace Nz
m_grabbedValue = GetValue();
m_style->OnButtonGrab();
});
m_scrollCenterButton->OnButtonMoved.Connect([this](const ScrollbarButtonWidget*, int x, int /*y*/)
{
int deltaX = x - m_grabbedPosition;
@ -65,7 +65,7 @@ namespace Nz
m_grabbedValue = GetValue();
m_style->OnButtonGrab();
});
m_scrollCenterButton->OnButtonMoved.Connect([this](const ScrollbarButtonWidget* button, int /*x*/, int y)
{
int deltaY = SafeCast<int>(m_grabbedPosition - (button->GetPosition().y + y));
@ -87,7 +87,7 @@ namespace Nz
{
SetValue(GetValue() - 0.1f * (GetMaximumValue() - GetMinimumValue()));
});
m_scrollNextButton->OnButtonTrigger.Connect([this](const ImageButtonWidget*)
{
SetValue(GetValue() + 0.1f * (GetMaximumValue() - GetMinimumValue()));
@ -139,7 +139,7 @@ namespace Nz
{
m_style->OnHoverBegin();
}
void ScrollbarWidget::OnMouseExit()
{
m_style->OnHoverEnd();

View File

@ -393,7 +393,7 @@ namespace Nz
{
m_textSprite->Update(drawer);
}
/************************************************************************/
SimpleProgressBarWidgetStyle::SimpleProgressBarWidgetStyle(ProgressBarWidget* progressBarWidget, StyleConfig config) :

View File

@ -38,7 +38,7 @@ namespace Nz
Layout();
}
void TextAreaWidget::AppendText(std::string_view text)
{
m_text += text;
@ -83,7 +83,7 @@ namespace Nz
m_text.clear();
OnTextChanged(this, m_text);
}
void TextAreaWidget::Erase(std::size_t firstGlyph, std::size_t lastGlyph)
{
if (firstGlyph > lastGlyph)

View File

@ -845,6 +845,50 @@ on_run(function ()
end
})
-- No space should lies before a linefeed
table.insert(checks, {
Name = "end of line spaces",
Check = function (moduleName)
local files = table.join(
os.files("include/Nazara/" .. moduleName .. "/**.hpp"),
os.files("include/Nazara/" .. moduleName .. "/**.inl"),
os.files("src/Nazara/" .. moduleName .. "/**.hpp"),
os.files("src/Nazara/" .. moduleName .. "/**.inl"),
os.files("src/Nazara/" .. moduleName .. "/**.cpp")
)
local fixes = {}
for _, filePath in pairs(files) do
local lines = GetFile(filePath)
local fileFixes = {}
for i = 1, #lines do
local content = lines[i]:match("^(%s*[^%s]*)%s+$")
if content then
table.insert(fileFixes, { line = i, newContent = content })
end
end
if #fileFixes > 0 then
print(filePath .. " has line ending with spaces")
table.insert(fixes, {
File = filePath,
Func = function (lines)
for _, fix in ipairs(fileFixes) do
lines[fix.line] = fix.newContent
end
UpdateFile(filePath, lines)
end
})
end
end
return fixes
end
})
local shouldFix = option.get("fix") or false
for _, check in pairs(checks) do