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

UI Refactoring #64

Merged
merged 40 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
88b077a
Feat: Roboto font
brenocq Aug 4, 2023
35dd8e9
Merge branch 'dev' into ui-redesign
brenocq Dec 30, 2023
9265138
Refactor: Noto Sans and UI colors
brenocq Jan 2, 2024
d04ccf7
Refactor: ImGui style
brenocq Jan 2, 2024
06cb8e3
Feat: Topbar Atta logo
brenocq Jan 3, 2024
40a0d8e
Feat: Starting grid pipeline
brenocq Jan 3, 2024
e6813b5
Feat: Infinite world grid
brenocq Jan 5, 2024
7c5a8de
Feat: Destroy world grid mesh
brenocq Jan 5, 2024
85a820e
Refactor: Starting widget gizmo
brenocq Mar 3, 2024
d881747
Fix: Viewport compilation
brenocq Jun 12, 2024
c8de137
Fix: Crash when vulkan not supported
brenocq Jun 24, 2024
c79aa8a
Merge branch 'dev' into ui-redesign
brenocq Jan 16, 2025
afba14c
Chore(UI): Upgrade ImGui to version v1.91.7
brenocq Jan 16, 2025
23fac49
Feat(UI): ImPlot3D integration
brenocq Jan 16, 2025
e07a76e
Refactor(UI): ImGui style/colors
brenocq Jan 16, 2025
af97896
Chore: Use ImPlot3D main branch
brenocq Jan 16, 2025
22cc26e
Refactor(UI): ImGui grab rounding
brenocq Jan 16, 2025
dee8723
Chore: Fix web build
brenocq Jan 18, 2025
a0b2467
Refactor: UI colors
brenocq Jan 18, 2025
674a8bc
Chore: Move editor and widgets files
brenocq Jan 18, 2025
9fb1abc
Chore: Move windows files
brenocq Jan 18, 2025
de0611e
Chore: Move module windows files
brenocq Jan 18, 2025
52aa7fd
Chore: Move window file
brenocq Jan 18, 2025
67fccc8
Refactor: Move docking setup to editor class
brenocq Jan 18, 2025
15276bb
Chore: Move time profiler tool to windows folder
brenocq Jan 18, 2025
61ebe80
Chore: Move top/tool bars to panels folder
brenocq Jan 18, 2025
5a7e322
Chore: Move drawers files
brenocq Jan 18, 2025
3c94830
Refactor: Move viewports to UI module
brenocq Jan 19, 2025
25c7249
Feat: Render main viewport
brenocq Jan 19, 2025
b397396
Feat: Create viewports
brenocq Jan 19, 2025
3a76b81
Fix: Remove viewport
brenocq Jan 19, 2025
38d70c9
Fix: Make sure new viewports are docked
brenocq Jan 19, 2025
7fe0be0
Chore: Generate compile commands
brenocq Jan 19, 2025
a8676f0
Fix: Show viewport modals
brenocq Jan 19, 2025
47fb44a
Merge branch 'ui-redesign' of github.com:brenocq/atta into ui-redesign
brenocq Jan 19, 2025
ff49bfe
Refactor: File viewport gfx to ui
brenocq Jan 19, 2025
d74f3d8
Fix: Viewport entity click
brenocq Jan 19, 2025
5edf760
Feat: Show gizmo for selected entity
brenocq Jan 19, 2025
a4ac94f
Fix: Guizmo interaction
brenocq Jan 19, 2025
d1ead43
Chore: Update resources link
brenocq Jan 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install cmake xorg-dev curl
sudo apt-get install cmake xorg-dev curl
- name: Build
run: ./build.sh --jobs 2 --compiler ${{ matrix.config.compiler }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updateReadmeButtons.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Update readme buttons

on:
on:
project_card:
types: [created, deleted, moved]
project:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- uses: mymindstorm/setup-emsdk@v13

- name: Checkout atta
uses: actions/checkout@v2

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ tags
imgui.ini

# Debugging/Profile
.cache/
perf.*
.gdb_history
profile/
compile_commands.json
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14)

project(atta VERSION 0.3.1 LANGUAGES CXX C)
project(atta VERSION 0.3.2 LANGUAGES CXX C)

OPTION(ATTA_BUILD_TESTS
"Set to ON to build also the test executables"
Expand All @@ -11,17 +11,18 @@ OPTION(ATTA_WEB_BUILD_MODULE
OPTION(ATTA_BUILD_DOCS
"Build the documentation"
OFF)
option(ATTA_STATIC_PROJECT_FILE
"Project to be linked statically to atta"
option(ATTA_STATIC_PROJECT_FILE
"Project to be linked statically to atta"
"")
option(ATTA_PROFILE
"Set to ON to enable code profiling"
option(ATTA_PROFILE
"Set to ON to enable code profiling"
ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(ATTA_VERSION_SAFE atta-${CMAKE_PROJECT_VERSION})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/atta/cmakeConfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/atta/cmakeConfig.h)

Expand Down Expand Up @@ -123,7 +124,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
list(APPEND ATTA_OPTIONS -Wno-unused-parameter)
# Script C linkage
list(APPEND ATTA_OPTIONS -Wno-return-type-c-linkage)
# Math anonymous union
# Math anonymous union
#list(APPEND ATTA_OPTIONS -Wno-nested-anon-types -Wno-gnu-anonymous-struct)
# Glad opengl definitions
#list(APPEND ATTA_OPTIONS -Wno-macro-redefined)
Expand Down Expand Up @@ -218,7 +219,7 @@ if(ATTA_STATIC_PROJECT)
endif()

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/src/atta/script/scripts.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/atta/script/scripts.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/atta/script/scripts.h"
)

Expand All @@ -236,7 +237,7 @@ if(NOT (ATTA_SYSTEM_NAME MATCHES "Web") AND NOT ATTA_STATIC_PROJECT_FILE)
########## Install files ##########

# Install atta executable
install(TARGETS atta
install(TARGETS atta
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PRIVATE_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ATTA_VERSION_SAFE}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ATTA_VERSION_SAFE}
Expand Down
22 changes: 22 additions & 0 deletions src/atta/event/events/meshDestroy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//--------------------------------------------------
// Atta Event Module
// meshDestroy.h
// Date: 2024-01-05
// By Breno Cunha Queiroz
//--------------------------------------------------
#ifndef ATTA_EVENT_EVENTS_MESH_DESTROY_H
#define ATTA_EVENT_EVENTS_MESH_DESTROY_H
#include <atta/event/event.h>

namespace atta::event {

class MeshDestroy : public EventTyped<SID("MeshDestroy")> {
public:
MeshDestroy(StringId sid_) : sid(sid_) {}

const StringId sid;
};

} // namespace atta::event

#endif // ATTA_EVENT_EVENTS_MESH_DESTROY_H
1 change: 1 addition & 0 deletions src/atta/file/project/projectSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <atta/resource/resources/mesh.h>

#include <atta/graphics/interface.h>
#include <atta/ui/interface.h>
#include <atta/utils/config.h>

#include <atta/physics/engines/bulletEngine.h>
Expand Down
23 changes: 12 additions & 11 deletions src/atta/file/project/projectSerializerDeserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,21 @@ void ProjectSerializer::deserializeComponentModule(Section& section) {

void ProjectSerializer::deserializeGraphicsModule(Section& section) {
if (section.contains("viewports")) {
std::vector<graphics::Viewport> viewports = std::vector<graphics::Viewport>(section["viewports"]);
graphics::clearViewports();
for (auto& viewport : viewports) {
std::shared_ptr<graphics::Viewport> v = std::make_shared<graphics::Viewport>();
*v = viewport;
graphics::addViewport(v);
}
std::vector<ui::Viewport> viewports = std::vector<ui::Viewport>(section["viewports"]);
LOG_WARN("file::ProjectSerializer", "Deserializing viewports was not implemented yet");
// ui::clearViewports();
// for (auto& viewport : viewports) {
// std::shared_ptr<ui::Viewport> v = std::make_shared<ui::Viewport>();
// *v = viewport;
// ui::addViewport(v);
// }
}
if (section.contains("graphicsFPS"))
graphics::setGraphicsFPS(float(section["graphicsFPS"]));
if (section.contains("viewportFPS"))
graphics::setViewportFPS(float(section["viewportFPS"]));
if (section.contains("viewportRendering"))
graphics::setViewportRendering(bool(section["viewportRendering"]));
//if (section.contains("viewportFPS"))
// graphics::setViewportFPS(float(section["viewportFPS"]));
//if (section.contains("viewportRendering"))
// graphics::setViewportRendering(bool(section["viewportRendering"]));
}

void ProjectSerializer::deserializeResourceModule(Section& section) {
Expand Down
15 changes: 8 additions & 7 deletions src/atta/file/project/projectSerializerSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ void ProjectSerializer::serializeComponentModule(Section& section) {
}

void ProjectSerializer::serializeGraphicsModule(Section& section) {
std::vector<std::shared_ptr<graphics::Viewport>> pviewports = graphics::getViewports();
std::vector<graphics::Viewport> viewports;
for (auto pv : pviewports)
viewports.push_back(*pv);
section["viewports"] = viewports;
// std::vector<std::shared_ptr<ui::Viewport>> pviewports = ui::getViewports();
// std::vector<ui::Viewport> viewports;
// for (auto& pv : pviewports)
// viewports.push_back(*pv);
// section["viewports"] = viewports;
LOG_WARN("file::ProjectSerializer", "Serializing viewports was not implemented yet");
section["graphicsFPS"] = graphics::getGraphicsFPS();
section["viewportFPS"] = graphics::getViewportFPS();
section["viewportRendering"] = graphics::getViewportRendering();
// section["viewportFPS"] = graphics::getViewportFPS();
// section["viewportRendering"] = graphics::getViewportRendering();
}

void ProjectSerializer::serializeResourceModule(Section& section) {
Expand Down
8 changes: 4 additions & 4 deletions src/atta/graphics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ set(ATTA_GRAPHICS_MODULE_SOURCE

compute/entityClick.cpp

renderers/renderer.cpp
renderers/common/drawerPipeline.cpp
renderers/common/gridPipeline.cpp
renderers/common/selectedPipeline.cpp
renderers/fastRenderer.cpp
renderers/pbrRenderer.cpp
renderers/phongRenderer.cpp
renderers/common/selectedPipeline.cpp
renderers/common/drawerPipeline.cpp
renderers/renderer.cpp

windows/window.cpp
windows/nullWindow.cpp
Expand All @@ -43,7 +44,6 @@ set(ATTA_GRAPHICS_MODULE_SOURCE
renderQueue.cpp
shader.cpp
vertexBuffer.cpp
viewport.cpp
)

if(ATTA_VULKAN_SUPPORT)
Expand Down
13 changes: 6 additions & 7 deletions src/atta/graphics/apis/openGL/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ void Framebuffer::bind(bool clear) {
clearColor[i] = (GLint)std::round(_clearColor[i]);
glClearBufferiv(GL_COLOR, 0, clearColor);
}

if (_depthAttachmentIndex != -1 && _stencilAttachmentIndex != -1) {
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_STENCIL_TEST);
glStencilMask(0x00);
} else if (_depthAttachmentIndex != -1) {
if (_depthAttachmentIndex != -1) {
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
}
if (_stencilAttachmentIndex != -1) {
glClear(GL_STENCIL_BUFFER_BIT);
glStencilMask(0x00);
glEnable(GL_STENCIL_TEST);
}
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/atta/graphics/apis/vulkan/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace atta::graphics::vk {

Instance::Instance() {
Instance::Instance() : _instance(VK_NULL_HANDLE) {
// Application info
VkApplicationInfo appInfo{};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
Expand Down Expand Up @@ -46,7 +46,8 @@ Instance::Instance() {

// Create instance
VkResult result = vkCreateInstance(&createInfo, nullptr, &_instance);
if (result != VK_SUCCESS)
_wasCreated = result == VK_SUCCESS;
if (!_wasCreated)
LOG_ERROR("gfx::vk::Instance", "Failed to create vulkan instance! Code: $0", common::toString(result));
}

Expand All @@ -55,6 +56,8 @@ Instance::~Instance() {
vkDestroyInstance(_instance, nullptr);
}

bool Instance::wasCreated() const { return _wasCreated; }

VkInstance Instance::getHandle() const { return _instance; }

void Instance::printAvailableExtensions() {
Expand Down
3 changes: 3 additions & 0 deletions src/atta/graphics/apis/vulkan/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Instance {
Instance();
~Instance();

bool wasCreated() const;

VkInstance getHandle() const;

private:
Expand All @@ -29,6 +31,7 @@ class Instance {
std::vector<const char*> getEnabledLayers();

VkInstance _instance;
bool _wasCreated;
VkDebugUtilsMessengerEXT debugMessenger;
};

Expand Down
22 changes: 10 additions & 12 deletions src/atta/graphics/apis/vulkan/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,22 @@ Pipeline::Pipeline(const gfx::Pipeline::CreateInfo& info) : gfx::Pipeline(info),
// Color blend
VkPipelineColorBlendAttachmentState colorBlendAttachment{};
colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
colorBlendAttachment.blendEnable = VK_FALSE; // XXX blend is disabled for now
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.blendEnable = VK_FALSE;
if (gfx::Image::getNumChannels(_framebuffer->getImage(0)->getFormat()) == 4) {
colorBlendAttachment.blendEnable = VK_TRUE;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
}

VkPipelineColorBlendStateCreateInfo colorBlending{};
colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
colorBlending.logicOpEnable = VK_FALSE;
colorBlending.logicOp = VK_LOGIC_OP_COPY;
colorBlending.attachmentCount = 1;
colorBlending.pAttachments = &colorBlendAttachment;
colorBlending.blendConstants[0] = 0.0f;
colorBlending.blendConstants[1] = 0.0f;
colorBlending.blendConstants[2] = 0.0f;
colorBlending.blendConstants[3] = 0.0f;

// Dynamic state
std::vector<VkDynamicState> dynamicStates = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR};
Expand Down
5 changes: 5 additions & 0 deletions src/atta/graphics/apis/vulkan/vulkanAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ void VulkanAPI::generateProcessedTexture(GenerateProcessedTextureInfo gptInfo) {

void* VulkanAPI::getImGuiImage(StringId sid) const { return nullptr; }

bool VulkanAPI::isSupported() {
vk::Instance instance;
return instance.wasCreated();
}

std::shared_ptr<vk::Instance> VulkanAPI::getInstance() const { return _instance; }

std::shared_ptr<vk::PhysicalDevice> VulkanAPI::getPhysicalDevice() const { return _physicalDevice; }
Expand Down
2 changes: 2 additions & 0 deletions src/atta/graphics/apis/vulkan/vulkanAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class VulkanAPI final : public GraphicsAPI {

void* getImGuiImage(StringId sid) const override;

static bool isSupported();

std::shared_ptr<vk::Instance> getInstance() const;
std::shared_ptr<vk::PhysicalDevice> getPhysicalDevice() const;
std::shared_ptr<vk::Device> getDevice() const;
Expand Down
Loading
Loading