Skip to content

attempt to implementing shadows#210

Draft
JacobDomagala wants to merge 1 commit into
masterfrom
implement_shadows
Draft

attempt to implementing shadows#210
JacobDomagala wants to merge 1 commit into
masterfrom
implement_shadows

Conversation

@JacobDomagala
Copy link
Copy Markdown
Owner

No description provided.

@github-actions
Copy link
Copy Markdown

✅ UBUNTU COMPILE RESULT - SUCCESS! ✅

@github-actions
Copy link
Copy Markdown

✅ WINDOWS COMPILE RESULT - SUCCESS! ✅

@github-actions
Copy link
Copy Markdown

⚡ Static analysis result ⚡

🔴 cppcheck found 2 issues! Click here to see details.

GetOccupiedNodes() const;
std::string editorGroup_ = "Default";
protected:
// should be overriden by derrived class

!Line: 110 - performance: Function 'GetOccupiedNodes()' should return member 'nodes_' by const reference. [returnByReference]

auto& renderData = Data::renderData_.at(GetCurrentlyBoundType());
std::array< VkDescriptorPoolSize, 1 > poolSizes{};
poolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
poolSizes[0].descriptorCount = static_cast< uint32_t >(renderData.swapChainImages.size());
VkDescriptorPoolCreateInfo poolInfo = {};

!Line: 242 - style: Variable 'renderData' can be declared as reference to const [constVariableReference]


🔴 clang-tidy found 87 issues! Click here to see details.

std::unordered_map< renderer::TextureID, VkDescriptorSet > textureDescriptors = {};
VkDescriptorSet
GetDescriptor(renderer::TextureID id, VkDescriptorPool descriptorPool,
VkDescriptorSetLayout descriptorSetLayout)
{

!Line: 25 - error: variable 'textureDescriptors' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

GetDescriptor(renderer::TextureID id, VkDescriptorPool descriptorPool,
VkDescriptorSetLayout descriptorSetLayout)
{
const auto desc = textureDescriptors.find(id);
VkDescriptorSet descriptor{};

!Line: 28 - error: function 'GetDescriptor' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

ImGui::SetCursorScreenPos(ImVec2(currentPos.x + sectionSize.x / 4.0f, currentPos.y));
ImGui::Image(
static_cast< ImTextureID >(GetDescriptor(gameObject.GetSprite().GetTexture()->GetID(),
renderer::EditorData::descriptorPool_,
renderer::EditorData::descriptorSetLayout_)),
{glm::min(sectionSize.x, 128.0f), glm::min(sectionSize.x, 128.0f)});

!Line: 384 - error: '/' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

const auto occupied = nodes.at(w + width * h).occupied_;
const auto index =
(w + width * offset) * numChannels; // Calculate the index for the start of this pixel
data[index + 0] = 255; // R
data[index + 1] = !occupied * 255; // G

!Line: 542 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

collisionTextureData_ = {std::move(data), {width, height}, numChannels};
// To avoid blurry edges
renderer::TextureProperties props;
props.magFilter = VK_FILTER_NEAREST;
props.minFilter = VK_FILTER_NEAREST;

!Line: 553 - error: use designated initializer list to initialize 'ImageData' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 28 - note: aggregate type is defined here

CreatePipeline(std::string_view vertexShader, std::string_view fragmentShader, PrimitiveType type)
{
auto& renderData = Data::renderData_.at(GetCurrentlyBoundType());
// Create switch in future if we support more types
auto& pipeLineLayout =

!Line: 51 - error: function 'CreatePipeline' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

scissor.offset = {0, 0};
scissor.extent = renderData.swapChainExtent;
VkPipelineViewportStateCreateInfo viewportState = {};
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.viewportCount = 1;

!Line: 93 - error: use designated initializer list to initialize 'VkOffset2D' [modernize-use-designated-initializers,-warnings-as-errors]

CreateVertexBuffer(size_t bufferSize, const std::vector< DataT >& vertices)
{
if (vertices.empty())
{
return {};
}

!Line: 224 - error: function 'CreateVertexBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateIndexBuffer(std::vector< IndexType >& indices, const size_t numObjects)
{
if (!numObjects)
{
return {};
}

!Line: 253 - error: function 'CreateIndexBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CalculateLightViewProj(RenderData& renderData)
{
glm::mat4 view = renderData.viewMat;
glm::mat4 proj = renderData.projMat;
if (view[3][3] == 0.0f)

!Line: 309 - error: function 'CalculateLightViewProj' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

const auto halfExtent = glm::sqrt(halfWidth * halfWidth + halfHeight * halfHeight) + 128.0f;
const auto lightDistance = halfExtent * 2.0f + 512.0f;
auto up = glm::vec3(0.0f, 1.0f, 0.0f);
if (glm::abs(glm::dot(lightDir, up)) > 0.99f)
{

!Line: 330 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

const auto lightDistance = halfExtent * 2.0f + 512.0f;
auto up = glm::vec3(0.0f, 1.0f, 0.0f);
if (glm::abs(glm::dot(lightDir, up)) > 0.99f)
{
up = glm::vec3(1.0f, 0.0f, 0.0f);

!Line: 331 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

CreateShadowSampler()
{
auto& renderData = Data::renderData_.at(boundApplication_);
if (renderData.shadowSampler != VK_NULL_HANDLE)
{

!Line: 349 - error: function 'CreateShadowSampler' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateShadowResources()
{
auto& renderData = Data::renderData_.at(boundApplication_);
const auto depthFormat = FindShadowDepthFormat();
CreateShadowSampler();

!Line: 381 - error: function 'CreateShadowResources' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateShadowRenderPass()
{
auto& renderData = Data::renderData_.at(boundApplication_);
VkAttachmentDescription depthAttachment = {};
depthAttachment.format = FindShadowDepthFormat();

!Line: 421 - error: function 'CreateShadowRenderPass' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateShadowFramebuffers()
{
auto& renderData = Data::renderData_.at(boundApplication_);
for (auto& framebuffer : renderData.shadowFramebuffers)
{

!Line: 476 - error: function 'CreateShadowFramebuffers' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateShadowPipeline()
{
auto& renderData = Data::renderData_.at(boundApplication_);
auto [vertexInfo, fragmentInfo] =
VulkanShader::CreateShader(Data::vk_device, "shadow.vert.spv", "shadow.frag.spv");
auto shaderStages = std::to_array({vertexInfo.shaderInfo, fragmentInfo.shaderInfo});

!Line: 507 - error: function 'CreateShadowPipeline' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

scissor.offset = {0, 0};
scissor.extent = renderData.shadowMapExtent;
VkPipelineViewportStateCreateInfo viewportState = {};
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
viewportState.viewportCount = 1;

!Line: 539 - error: use designated initializer list to initialize 'VkOffset2D' [modernize-use-designated-initializers,-warnings-as-errors]

CreateInstance()
{
if (ENABLE_VALIDATION && !CheckValidationLayerSupport())
{
utils::Assert(false, "validation layers asked but not supported!");
}

!Line: 624 - error: function 'CreateInstance' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateDevice()
{
uint32_t deviceCount = 0;
vkEnumeratePhysicalDevices(Data::vk_instance, &deviceCount, nullptr);
utils::Assert(deviceCount > 0, "failed to find GPUs with Vulkan support!");

!Line: 659 - error: function 'CreateDevice' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

const auto device = std::find_if(devices.begin(), devices.end(), [](const auto& device) {
return IsDeviceSuitable(device, Data::renderData_[boundApplication_].surface);
});
utils::Assert(device != devices.end(), "Unable to find suitable device!");

!Line: 668 - error: use a boost version of this algorithm [boost-use-ranges,-warnings-as-errors]

const auto device = std::find_if(devices.begin(), devices.end(), [](const auto& device) {
return IsDeviceSuitable(device, Data::renderData_[boundApplication_].surface);
});
utils::Assert(device != devices.end(), "Unable to find suitable device!");

!Line: 668 - error: use a ranges version of this algorithm [modernize-use-ranges,-warnings-as-errors]

CreateSwapchain()
{
auto& renderData = Data::renderData_.at(boundApplication_);
const auto swapChainSupport = QuerySwapChainSupport(Data::vk_physicalDevice, renderData.surface);
const auto surfaceFormat = ChooseSwapSurfaceFormat(swapChainSupport.formats);

!Line: 746 - error: function 'CreateSwapchain' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateColorResources()
{
auto& renderData = Data::renderData_.at(boundApplication_);
auto image = Texture::CreateImage(
renderData.swapChainExtent.width, renderData.swapChainExtent.height, 1,

!Line: 809 - error: function 'CreateColorResources' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateDepthResources()
{
const auto depthFormat = FindDepthFormat();
auto& renderData = Data::renderData_.at(boundApplication_);
const auto image = Texture::CreateImage(

!Line: 827 - error: function 'CreateDepthResources' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateImageViews()
{
auto& renderData = Data::renderData_.at(boundApplication_);
renderData.swapChainImageViews.resize(renderData.swapChainImages.size());

!Line: 845 - error: function 'CreateImageViews' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateRenderPass()
{
auto& renderData = Data::renderData_.at(boundApplication_);
VkAttachmentDescription colorAttachment = {};
colorAttachment.format = renderData.swapChainImageFormat;

!Line: 860 - error: function 'CreateRenderPass' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateFramebuffers()
{
auto& renderData = Data::renderData_.at(boundApplication_);
renderData.swapChainFramebuffers.resize(renderData.swapChainImageViews.size());

!Line: 939 - error: function 'CreateFramebuffers' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateCommandPool()
{
auto queueFamilyIndicesTwo =
FindQueueFamilies(Data::vk_physicalDevice, Data::renderData_[boundApplication_].surface);
VkCommandPoolCreateInfo poolInfo = {};

!Line: 966 - error: function 'CreateCommandPool' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

clearValues[1].depthStencil = {1.0f, 0};
VkRenderPassBeginInfo renderPassInfo{};
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
renderPassInfo.renderPass = renderData.renderPass;
renderPassInfo.renderArea.offset = {0, 0};

!Line: 1005 - error: use designated initializer list to initialize 'VkClearDepthStencilValue' [modernize-use-designated-initializers,-warnings-as-errors]

renderPassInfo.renderArea.offset = {0, 0};
renderPassInfo.renderArea.extent = renderData.swapChainExtent;
renderPassInfo.clearValueCount = static_cast< uint32_t >(clearValues.size());
renderPassInfo.pClearValues = clearValues.data();
renderPassInfo.framebuffer = renderData.swapChainFramebuffers[imageIndex];

!Line: 1010 - error: use designated initializer list to initialize 'VkOffset2D' [modernize-use-designated-initializers,-warnings-as-errors]

shadowClearValue.depthStencil = {1.0f, 0};
VkRenderPassBeginInfo shadowPassInfo = {};
shadowPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
shadowPassInfo.renderPass = renderData.shadowRenderPass;
shadowPassInfo.framebuffer = renderData.shadowFramebuffers.at(Data::currentFrame_);

!Line: 1022 - error: use designated initializer list to initialize 'VkClearDepthStencilValue' [modernize-use-designated-initializers,-warnings-as-errors]

shadowPassInfo.renderArea.offset = {0, 0};
shadowPassInfo.renderArea.extent = renderData.shadowMapExtent;
shadowPassInfo.clearValueCount = 1;
shadowPassInfo.pClearValues = &shadowClearValue;
vkCmdBeginRenderPass(Data::commandBuffers[Data::currentFrame_], &shadowPassInfo,

!Line: 1028 - error: use designated initializer list to initialize 'VkOffset2D' [modernize-use-designated-initializers,-warnings-as-errors]

shadowScissor.offset = {0, 0};
vkCmdSetViewport(Data::commandBuffers[Data::currentFrame_], 0, 1, &shadowViewport);
vkCmdSetScissor(Data::commandBuffers[Data::currentFrame_], 0, 1, &shadowScissor);
vkCmdBindPipeline(Data::commandBuffers[Data::currentFrame_], VK_PIPELINE_BIND_POINT_GRAPHICS,
renderData.shadowPipeline);

!Line: 1044 - error: use designated initializer list to initialize 'VkOffset2D' [modernize-use-designated-initializers,-warnings-as-errors]

CreateQuadIndexBuffer()
{
auto& renderData = Data::renderData_.at(boundApplication_);
for (size_t layer = 0; layer < static_cast< size_t >(NUM_LAYERS); ++layer)
{

!Line: 1121 - error: function 'CreateQuadIndexBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateQuadVertexBuffer()
{
auto& renderData = Data::renderData_.at(boundApplication_);
auto& vertices = renderData.vertices;
for (size_t layer = 0; layer < static_cast< size_t >(NUM_LAYERS); layer++)

!Line: 1139 - error: function 'CreateQuadVertexBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateSyncObjects()
{
imageAvailableSemaphores_.resize(MAX_FRAMES_IN_FLIGHT);
renderFinishedSemaphores_.resize(MAX_FRAMES_IN_FLIGHT);
inFlightFences_.resize(MAX_FRAMES_IN_FLIGHT);

!Line: 1160 - error: function 'CreateSyncObjects' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreatePipelineCache()
{
VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {};
pipelineCacheCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
vk_check_error(vkCreatePipelineCache(Data::vk_device, &pipelineCacheCreateInfo, nullptr,
&Data::renderData_.at(boundApplication_).pipelineCache),

!Line: 1193 - error: function 'CreatePipelineCache' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreateUniformBuffer()
{
auto& renderData = Data::renderData_[boundApplication_];
constexpr VkDeviceSize bufferSize = sizeof(UniformBufferObject);
for (size_t frame = 0; frame < MAX_FRAMES_IN_FLIGHT; frame++)

!Line: 1227 - error: function 'CreateUniformBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

CreatePerInstanceBuffer()
{
auto& renderData = Data::renderData_[boundApplication_];
constexpr VkDeviceSize SSBObufferSize = MAX_NUM_SPRITES * sizeof(PerInstanceBuffer);
for (size_t frame = 0; frame < MAX_FRAMES_IN_FLIGHT; frame++)

!Line: 1247 - error: function 'CreatePerInstanceBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

UpdateUniformBuffer()
{
auto& renderData = Data::renderData_.at(boundApplication_);
for (uint32_t frame = 0; frame < MAX_FRAMES_IN_FLIGHT; ++frame)
{

!Line: 1267 - error: function 'UpdateUniformBuffer' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

DestroyPipeline()
{
vkDeviceWaitIdle(Data::vk_device);
auto& renderData = Data::renderData_.at(boundApplication_);

!Line: 1332 - error: function 'DestroyPipeline' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

if (numObjects == static_cast< uint32_t >(layerIdx))
{
numObjects++;
}
++renderData->totalNumMeshes;

!Line: 1539 - error: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison,-warnings-as-errors]

return {idx, layer, layerIdx};
}
void
SubmitMeshData(const uint32_t idx, const TextureIDs& ids, const glm::mat4& modelMat,
const glm::vec4& color)

!Line: 1550 - error: use designated initializer list to initialize 'RenderInfo' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 141 - note: aggregate type is defined here

+ static_cast< size_t >(startingLine) * VERTICES_PER_LINE,
bufferSize);
vmaUnmapMemory(Data::vk_hAllocator, EditorData::lineVertexBuffer.allocation_);
}
}

!Line: 1623 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

if (Data::renderData_.find(type) != Data::renderData_.end())
{
auto& renderData = Data::renderData_.at(type);
for (size_t layer = 0; layer < static_cast< size_t >(NUM_LAYERS); ++layer)
{

!Line: 1686 - error: use 'contains' to check for membership [readability-container-contains,-warnings-as-errors]

objectsInfo_[object.GetID()] = {
fmt::format("[{}] {} ({:.2f}, {:.2f})", object.GetTypeString().c_str(),
object.GetName().c_str(), object.GetPosition().x, object.GetPosition().y),
false};
groups_[object.editorGroup_].emplace_back(object.GetID());

!Line: 331 - error: use designated initializer list to initialize 'ObjectInfo' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 149 - note: aggregate type is defined here

objectsInfo_[enemy.GetID()] = {
fmt::format("[{}] {} ({:.2f}, {:.2f})", enemy.GetTypeString().c_str(),
enemy.GetName().c_str(), enemy.GetPosition().x, enemy.GetPosition().y),
false};
groups_[enemy.editorGroup_].emplace_back(enemy.GetID());

!Line: 342 - error: use designated initializer list to initialize 'ObjectInfo' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 149 - note: aggregate type is defined here

objectsInfo_[player.GetID()] = {
fmt::format("[{}] {} ({:.2f}, {:.2f})", player.GetTypeString().c_str(),
player.GetName().c_str(), player.GetPosition().x, player.GetPosition().y),
false};
groups_[player.editorGroup_].emplace_back(player.GetID());

!Line: 353 - error: use designated initializer list to initialize 'ObjectInfo' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 149 - note: aggregate type is defined here

selectedObjects_.emplace_back(SelectedObjectInfo{ID, gameObject.GetHasCollision(),
gameObject.GetSprite().GetRenderInfo().layer,
gameObject.editorGroup_});
RecalculateCommonProperties();

!Line: 395 - error: use designated initializer list to initialize 'SelectedObjectInfo' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 155 - note: aggregate type is defined here

objectsInfo_[ID] = {fmt::format("[{}] {} ({:.2f}, {:.2f})", object.GetTypeString().c_str(),
object.GetName().c_str(), object.GetPosition().x,
object.GetPosition().y),
true};
groups_["Default"].push_back(ID);

!Line: 468 - error: use designated initializer list to initialize 'ObjectInfo' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 149 - note: aggregate type is defined here

std::find_if(animationPoints_.begin(), animationPoints_.end(),
[&updatedAnimationPoint](const auto animationPoint) {
return animationPoint.GetID() == updatedAnimationPoint.GetID();
});
if (updatedPointIt != animationPoints_.end())

!Line: 234 - error: use a boost version of this algorithm [boost-use-ranges,-warnings-as-errors]

std::find_if(animationPoints_.begin(), animationPoints_.end(),
[&updatedAnimationPoint](const auto animationPoint) {
return animationPoint.GetID() == updatedAnimationPoint.GetID();
});
if (updatedPointIt != animationPoints_.end())

!Line: 234 - error: use a ranges version of this algorithm [modernize-use-ranges,-warnings-as-errors]

[&updatedAnimationPoint](const auto animationPoint) {
return animationPoint.GetID() == updatedAnimationPoint.GetID();
});
if (updatedPointIt != animationPoints_.end())
{

!Line: 235 - error: the const qualified parameter 'animationPoint' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param,-warnings-as-errors]

std::find_if(animationPoints_.begin(), animationPoints_.end(),
[animationID](const auto& point) { return point.GetID() == animationID; });
/*auto it = std::find(animationPoints_.begin(), animationPoints_.end(), pathNodeMapPosition);*/
if (it != animationPoints_.end())
{

!Line: 252 - error: use a boost version of this algorithm [boost-use-ranges,-warnings-as-errors]

std::find_if(animationPoints_.begin(), animationPoints_.end(),
[animationID](const auto& point) { return point.GetID() == animationID; });
/*auto it = std::find(animationPoints_.begin(), animationPoints_.end(), pathNodeMapPosition);*/
if (it != animationPoints_.end())
{

!Line: 252 - error: use a ranges version of this algorithm [modernize-use-ranges,-warnings-as-errors]

{glm::vec3{-0.5f, 0.5f, LAYERS.at(renderLayer)}, glm::vec3{0.0f, 0.0f, 1.0f}},
{glm::vec3{0.5f, 0.5f, LAYERS.at(renderLayer)}, glm::vec3{1.0f, 0.0f, 1.0f}},
{glm::vec3(0.5f, -0.5f, LAYERS.at(renderLayer)), glm::vec3{1.0f, 1.0f, 1.0f}},
{glm::vec3{-0.5f, -0.5f, LAYERS.at(renderLayer)}, glm::vec3{0.0f, 1.0f, 1.0f}}};
const auto transformMat = ComputeModelMat();

!Line: 80 - error: use designated initializer list to initialize 'Vertex' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 20 - note: aggregate type is defined here

{glm::vec3{0.5f, 0.5f, LAYERS.at(renderLayer)}, glm::vec3{1.0f, 0.0f, 1.0f}},
{glm::vec3(0.5f, -0.5f, LAYERS.at(renderLayer)), glm::vec3{1.0f, 1.0f, 1.0f}},
{glm::vec3{-0.5f, -0.5f, LAYERS.at(renderLayer)}, glm::vec3{0.0f, 1.0f, 1.0f}}};
const auto transformMat = ComputeModelMat();
ComputeBoundingBox();

!Line: 81 - error: use designated initializer list to initialize 'Vertex' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 20 - note: aggregate type is defined here

{glm::vec3(0.5f, -0.5f, LAYERS.at(renderLayer)), glm::vec3{1.0f, 1.0f, 1.0f}},
{glm::vec3{-0.5f, -0.5f, LAYERS.at(renderLayer)}, glm::vec3{0.0f, 1.0f, 1.0f}}};
const auto transformMat = ComputeModelMat();
ComputeBoundingBox();

!Line: 82 - error: use designated initializer list to initialize 'Vertex' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 20 - note: aggregate type is defined here

{glm::vec3{-0.5f, -0.5f, LAYERS.at(renderLayer)}, glm::vec3{0.0f, 1.0f, 1.0f}}};
const auto transformMat = ComputeModelMat();
ComputeBoundingBox();
textures_ = {TextureLibrary::GetTexture(fileName)->GetID(),

!Line: 83 - error: use designated initializer list to initialize 'Vertex' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 20 - note: aggregate type is defined here

Looper/editor/gizmo.cpp

Lines 111 to 116 in da90be0

+ glm::vec2{0.0f, gizmoCenter_.GetSize().y / 2.0f + gizmoUp_.GetSize().x / 1.85f});
gizmoSide_.SetInitialPosition(
gizmoCenter_.GetPosition()
+ glm::vec2{

!Line: 111 - error: '/' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

Looper/editor/gizmo.cpp

Lines 117 to 122 in da90be0

glm::vec2(gizmoCenter_.GetSize().x / 2.0f + gizmoSide_.GetSize().x / 1.85f, 0.0f)});
}
void
Gizmo::CheckHovered(const glm::vec3& cameraPos, const glm::vec2& globalPosition)
{

!Line: 117 - error: '/' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

std::ifstream fileHandle(fileName.data(), std::ios::binary);
utils::Assert(fileHandle.is_open(),
fmt::format("FileManager::ReadBinaryFile -> {} can't be opened!", fileName));
const auto size = std::filesystem::file_size(fileName);

!Line: 26 - error: result of a `data()` call may not be null terminated, provide size information to the callee to prevent potential issues [bugprone-suspicious-stringview-data-usage,-warnings-as-errors]

return {std::move(textureData), {w, h}, n};
}
nlohmann::json
FileManager::LoadJsonFile(std::string_view pathToFile)
{

!Line: 82 - error: use designated initializer list to initialize 'ImageData' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 28 - note: aggregate type is defined here

IsMapped(VmaAllocation alloc)
{
VmaAllocationInfo allocInfo;
vmaGetAllocationInfo(Data::vk_hAllocator, alloc, &allocInfo);
return allocInfo.pMappedData != nullptr;

!Line: 13 - error: function 'IsMapped' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

FindMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties)
{
VkPhysicalDeviceMemoryProperties memProperties = {};
vkGetPhysicalDeviceMemoryProperties(Data::vk_physicalDevice, &memProperties);
for (uint32_t i = 0; i < memProperties.memoryTypeCount; i++)

!Line: 22 - error: function 'FindMemoryType' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

AllocateMemory(VkMemoryRequirements memReq, VkDeviceMemory& bufferMemory,
VkMemoryPropertyFlags properties)
{
VkMemoryAllocateInfo allocInfo = {};
allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
allocInfo.allocationSize = memReq.size;

!Line: 119 - error: function 'AllocateMemory' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

return {image, allocationInfo.deviceMemory, allocation};
}
VkImageView
Texture::CreateImageView(VkImage image, VkFormat format, VkImageAspectFlags aspectFlags,
uint32_t mipLevels, bool /*cubemap*/)

!Line: 118 - error: use designated initializer list to initialize 'VulkanImage' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 25 - note: aggregate type is defined here

blit.srcOffsets[0] = {0, 0, 0};
blit.srcOffsets[1] = {mipWidth, mipHeight, 1};
blit.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit.srcSubresource.mipLevel = i - 1;
blit.srcSubresource.baseArrayLayer = 0;
blit.srcSubresource.layerCount = 1;

!Line: 216 - error: use designated initializer list to initialize 'VkOffset3D' [modernize-use-designated-initializers,-warnings-as-errors]

blit.srcOffsets[1] = {mipWidth, mipHeight, 1};
blit.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit.srcSubresource.mipLevel = i - 1;
blit.srcSubresource.baseArrayLayer = 0;
blit.srcSubresource.layerCount = 1;
blit.dstOffsets[0] = {0, 0, 0};

!Line: 217 - error: use designated initializer list to initialize 'VkOffset3D' [modernize-use-designated-initializers,-warnings-as-errors]

blit.dstOffsets[0] = {0, 0, 0};
blit.dstOffsets[1] = {mipWidth > 1 ? mipWidth / 2 : 1, mipHeight > 1 ? mipHeight / 2 : 1, 1};
blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit.dstSubresource.mipLevel = i;
blit.dstSubresource.baseArrayLayer = 0;
blit.dstSubresource.layerCount = 1;

!Line: 222 - error: use designated initializer list to initialize 'VkOffset3D' [modernize-use-designated-initializers,-warnings-as-errors]

blit.dstOffsets[1] = {mipWidth > 1 ? mipWidth / 2 : 1, mipHeight > 1 ? mipHeight / 2 : 1, 1};
blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blit.dstSubresource.mipLevel = i;
blit.dstSubresource.baseArrayLayer = 0;
blit.dstSubresource.layerCount = 1;

!Line: 223 - error: use designated initializer list to initialize 'VkOffset3D' [modernize-use-designated-initializers,-warnings-as-errors]

region.imageOffset = {0, 0, 0};
region.imageExtent = {texWidth, texHeight, 1};
const auto size =
static_cast< size_t >(texWidth) * static_cast< size_t >(texHeight) * static_cast< size_t >(4);
Buffer::CopyDataToImageWithStaging(image, data, size, {region});

!Line: 351 - error: use designated initializer list to initialize 'VkOffset3D' [modernize-use-designated-initializers,-warnings-as-errors]

region.imageExtent = {texWidth, texHeight, 1};
const auto size =
static_cast< size_t >(texWidth) * static_cast< size_t >(texHeight) * static_cast< size_t >(4);
Buffer::CopyDataToImageWithStaging(image, data, size, {region});
}

!Line: 352 - error: use designated initializer list to initialize 'VkExtent3D' [modernize-use-designated-initializers,-warnings-as-errors]

if (s_loadedTextures.find(textureName) == s_loadedTextures.end())
{
SCOPED_TIMER(fmt::format("Texture: {} not found in library. Loading it", textureName));
LoadTexture(type, textureName);
}

!Line: 451 - error: use 'contains' to check for membership [readability-container-contains,-warnings-as-errors]

if (s_loadedTextures.find(textureName) == s_loadedTextures.end())
{
SCOPED_TIMER(fmt::format("Creating texture {}", textureName));
LoadTexture(type, textureName, props);
}
else

!Line: 488 - error: use 'contains' to check for membership [readability-container-contains,-warnings-as-errors]

if (s_loadedTextures.find(textureName) == s_loadedTextures.end())
{
SCOPED_TIMER(fmt::format("Creating texture {}", textureName));
LoadTexture(type, textureName, data, props);
}
else

!Line: 505 - error: use 'contains' to check for membership [readability-container-contains,-warnings-as-errors]

!Line: 83 - note: in instantiation of function template specialization 'fmt::format<tm>' requested here

return {{device, vertShaderStageInfo}, {device, fragShaderStageInfo}};
}
///////////////////////////////////////////////////////////////////
/////////////////////// QUAD SHADER ///////////////////////
///////////////////////////////////////////////////////////////////

!Line: 53 - error: use designated initializer list to initialize 'ShaderInfoWrapper' [modernize-use-designated-initializers,-warnings-as-errors]

!Line: 11 - note: aggregate type is defined here

std::transform(descriptorImageInfos.begin(), descriptorImageInfos.end(), viewAndSamplers.begin(),
descriptorImageInfos.begin(),
[](auto& descriptoInfo, const auto& viewAndSampler) {
descriptoInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
descriptoInfo.imageView = viewAndSampler.first;
descriptoInfo.sampler = viewAndSampler.second;

!Line: 166 - error: use a boost version of this algorithm [boost-use-ranges,-warnings-as-errors]

std::transform(descriptorImageInfos.begin(), descriptorImageInfos.end(), viewAndSamplers.begin(),
descriptorImageInfos.begin(),
[](auto& descriptoInfo, const auto& viewAndSampler) {
descriptoInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
descriptoInfo.imageView = viewAndSampler.first;
descriptoInfo.sampler = viewAndSampler.second;

!Line: 166 - error: use a ranges version of this algorithm [modernize-use-ranges,-warnings-as-errors]

connectedTo.push_back(x + (y - 1) * w);
}
if (y < h - 1)
{
connectedTo.push_back(x + (y + 1) * w);

!Line: 50 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

connectedTo.push_back(x + (y + 1) * w);
}
if (x > 0)
{
connectedTo.push_back((x - 1) + y * w);

!Line: 55 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

connectedTo.push_back((x - 1) + y * w);
}
if (x < w - 1)
{
connectedTo.push_back((x + 1) + y * w);

!Line: 60 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

connectedTo.push_back((x + 1) + y * w);
}
nodes_.emplace_back(glm::ivec2{x, y}, glm::vec2(x * grad, y * grad) + offset, x + y * w,
connectedTo);
}

!Line: 65 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

nodes_.emplace_back(glm::ivec2{x, y}, glm::vec2(x * grad, y * grad) + offset, x + y * w,
connectedTo);
}
}
initialized_ = true;

!Line: 68 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

+ static_cast< uint32_t >(tile.second) * levelHandle_->GetTileSize());
}
std::vector< NodeID >
PathFinder::GetPath(const glm::vec2& source, const glm::vec2& destination)
{

!Line: 125 - error: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses,-warnings-as-errors]

BroadcastEvent(const auto& listeners, auto& event)
{
for (auto* listener : listeners)
{
std::invoke(func, listener, event);

!Line: 14 - error: function 'BroadcastEvent' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant