Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#146]: Implement logic to render selected layers in Editor #154

Conversation

JacobDomagala
Copy link
Owner

Fixes #146

@JacobDomagala JacobDomagala self-assigned this Nov 12, 2023
Copy link

✅ UBUNTU COMPILE RESULT - SUCCESS! ✅

Copy link

✅ WINDOWS COMPILE RESULT - SUCCESS! ✅

Copy link

⚡ Static analysis result ⚡

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

Looper/editor/editor.hpp

Lines 121 to 126 in 1b68d11

DrawGrid();
void
DrawBoundingBoxes();
void

!Line: 121 - style: inconclusive: Technically the member function 'looper::Editor::DrawGrid' can be const. [functionConst]
!Line: 729 - note: Technically the member function 'looper::Editor::DrawGrid' can be const.
!Line: 121 - note: Technically the member function 'looper::Editor::DrawGrid' can be const.

Looper/editor/editor.hpp

Lines 220 to 225 in 1b68d11

SetMouseOnObject();
void
SetupPathfinderNodes();
void

!Line: 220 - style: inconclusive: Technically the member function 'looper::Editor::SetMouseOnObject' can be const. [functionConst]
!Line: 249 - note: Technically the member function 'looper::Editor::SetMouseOnObject' can be const.
!Line: 220 - note: Technically the member function 'looper::Editor::SetMouseOnObject' can be const.

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

InputManager::InternalKeyCallback(GLFWwindow* window, int32_t key, int32_t scancode,
int32_t action, int32_t mods)
{
Logger::Trace("GLFW key {} {} scan code - {}", action, key, scancode);
keyMap_[key] = action;

!Line: 28 - style: Parameter 'window' can be declared as pointer to const. However it seems that 'InternalKeyCallback' is a callback function, if 'window' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
!Line: 96 - note: You might need to cast the function pointer here
!Line: 28 - note: Parameter 'window' can be declared as pointer to const

InputManager::InternalCharCallback(GLFWwindow* window, uint32_t key)
{
Logger::Trace("GLFW char {}", key);
auto event = CharEvent{key};

!Line: 40 - style: Parameter 'window' can be declared as pointer to const. However it seems that 'InternalCharCallback' is a callback function, if 'window' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
!Line: 97 - note: You might need to cast the function pointer here
!Line: 40 - note: Parameter 'window' can be declared as pointer to const

InputManager::InternalMouseButtonCallback(GLFWwindow* window, int32_t button, int32_t action,
int32_t mods)
{
Logger::Trace("GLFW mouse button {} {} {}", button, action, mods);
mouseButtonMap_[button] = action;

!Line: 50 - style: Parameter 'window' can be declared as pointer to const. However it seems that 'InternalMouseButtonCallback' is a callback function, if 'window' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
!Line: 98 - note: You might need to cast the function pointer here
!Line: 50 - note: Parameter 'window' can be declared as pointer to const

InputManager::InternalCursorPositionCallback(GLFWwindow* window, double xPos, double yPos)
{
Logger::Trace("GLFW cursor pos {} {}", xPos, yPos);
mousePosition_ = glm::vec2(xPos, yPos);
auto event = CursorPositionEvent{xPos, yPos};

!Line: 61 - style: Parameter 'window' can be declared as pointer to const. However it seems that 'InternalCursorPositionCallback' is a callback function, if 'window' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
!Line: 99 - note: You might need to cast the function pointer here
!Line: 61 - note: Parameter 'window' can be declared as pointer to const

InputManager::InternalMouseScrollCallback(GLFWwindow* window, double xOffset, double yOffset)
{
Logger::Trace("GLFW scroll {} {}", xOffset, yOffset);
auto event = MouseScrollEvent{xOffset, yOffset};

!Line: 72 - style: Parameter 'window' can be declared as pointer to const. However it seems that 'InternalMouseScrollCallback' is a callback function, if 'window' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
!Line: 100 - note: You might need to cast the function pointer here
!Line: 72 - note: Parameter 'window' can be declared as pointer to const

InputManager::InternalWindowFocusCallback(GLFWwindow* window, int32_t focused)
{
Logger::Trace("GLFW window focus {}", focused);
auto event = WindowFocusEvent{focused};

!Line: 82 - style: Parameter 'window' can be declared as pointer to const. However it seems that 'InternalWindowFocusCallback' is a callback function, if 'window' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
!Line: 101 - note: You might need to cast the function pointer here
!Line: 82 - note: Parameter 'window' can be declared as pointer to const

Buffer::CopyDataWithStaging(void* data, size_t dataSize) const
{
VkBuffer stagingBuffer = {};
VkDeviceMemory stagingBufferMemory = {};
Buffer::CreateBuffer(dataSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,

!Line: 57 - style: Parameter 'data' can be declared as pointer to const [constParameterPointer]

Buffer::CopyDataToImageWithStaging(VkImage image, void* data, size_t dataSize,
const std::vector< VkBufferImageCopy >& copyRegions)
{
VkBuffer stagingBuffer = {};
VkDeviceMemory stagingBufferMemory = {};
Buffer::CreateBuffer(dataSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT,

!Line: 74 - style: Parameter 'data' can be declared as pointer to const [constParameterPointer]

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

TransitionImageLayout(VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels);
void
CopyBufferToImage(uint8_t* data);
private:

!Line: 78 - style: inconclusive: Technically the member function 'looper::renderer::Texture::TransitionImageLayout' can be const. [functionConst]
!Line: 434 - note: Technically the member function 'looper::renderer::Texture::TransitionImageLayout' can be const.
!Line: 78 - note: Technically the member function 'looper::renderer::Texture::TransitionImageLayout' can be const.

CopyBufferToImage(uint8_t* data);
private:
TextureID id_ = {};
TextureType m_type = {};
VkImage m_textureImage = {};

!Line: 81 - style: inconclusive: Technically the member function 'looper::renderer::Texture::CopyBufferToImage' can be const. [functionConst]
!Line: 378 - note: Technically the member function 'looper::renderer::Texture::CopyBufferToImage' can be const.
!Line: 81 - note: Technically the member function 'looper::renderer::Texture::CopyBufferToImage' can be const.

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

Hit(int32_t /*dmg*/) override
{
}
private:
void

!Line: 61 - style: The function 'Hit' overrides a function in a base class but is identical to the overridden function [uselessOverride]
!Line: 22 - note: Virtual function in base class
!Line: 61 - note: Function in derived class

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

CreateShaderModule(VkDevice device, std::vector< char >&& shaderByteCode)
{
VkShaderModuleCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
createInfo.codeSize = shaderByteCode.size();
// NOLINTNEXTLINE

!Line: 14 - error: function 'CreateShaderModule' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace,-warnings-as-errors]

queue_.push_back({prec, work});
}
void
WorkQueue::RunWorkUnits()
{

!Line: 11 - error: use emplace_back instead of push_back [hicpp-use-emplace,modernize-use-emplace,-warnings-as-errors]

TypeToString(ObjectType type)
{
std::string typeStr;
switch (type)
{

!Line: 6 - error: function 'TypeToString' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace,-warnings-as-errors]

do
{
updateTime -= animationDurationMs;
animationValue +=
currentState_.m_currentAnimationEnd - currentState_.m_currentAnimationBegin;

!Line: 90 - error: avoid do-while loops [cppcoreguidelines-avoid-do-while,-warnings-as-errors]

renderData.indices.at(layer).resize(MAX_SPRITES_PER_LAYER * INDICES_PER_SPRITE);
}
renderData.perInstance.resize(MAX_NUM_SPRITES);
CreateRenderPipeline();

!Line: 746 - error: performing an implicit widening conversion to type 'size_type' (aka 'unsigned long') of a multiplication performed in type 'uint32_t' (aka 'unsigned int') [bugprone-implicit-widening-of-multiplication-result,-warnings-as-errors]
!Line: 746 - note: make conversion explicit to silence this warning
!Line: 746 - note: perform multiplication in a wider type

@JacobDomagala JacobDomagala merged commit 506c46c into master Nov 13, 2023
2 of 3 checks passed
@JacobDomagala JacobDomagala deleted the 146-editor-add-option-to-only-render-object-from-a-given-render-layer branch November 13, 2023 09:29
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.

Editor: Add option to only render object from a given render layer
1 participant