Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Torch (Windows)

on:
push:
branches: [dev]
pull_request:
branches: [dev]
workflow_dispatch:

jobs:
build:
name: Build on Windows with MSVC
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup MSVC Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1

- name: Configure project with CMake (Release)
run: |
cmake -B out/build -DCMAKE_BUILD_TYPE=Release -S .

- name: Build project
run: |
cmake --build out/build --config Release
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build & Release Torch Engine

on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v1.0.0

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Set up CMake
uses: lukka/get-cmake@latest

- name: Configure build (Release)
run: cmake -B out/build -DCMAKE_BUILD_TYPE=Release -S .

- name: Build project
run: cmake --build out/build --config Release

- name: Prepare release package
run: |
mkdir release-package
cp out/build/Release/Sandbox.exe release-package/
# Ensure assets and shaders are indeed simple directories or submodules handled by `submodules: 'true'`
cp -r assets release-package/
cp -r shaders release-package/
cp LICENSE README.md release-package/
powershell Compress-Archive -Path release-package\* -DestinationPath torch-release.zip

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: torch-release
path: torch-release.zip

- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: torch-release.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[submodule "thirdParty/glfw"]
path = thirdParty/glfw
url = https://github.com/glfw/glfw
[submodule "thirdParty/imgui"]
path = thirdParty/imgui
url = https://github.com/willproj/imgui
[submodule "thirdParty/glm"]
path = thirdParty/glm
url = https://github.com/icaven/glm
Expand All @@ -23,3 +20,7 @@
[submodule "thirdParty/ImGuizmo"]
path = thirdParty/ImGuizmo
url = https://github.com/willproj/ImGuizmo
[submodule "thirdParty/imgui"]
path = thirdParty/imgui
url = https://github.com/TheYangYang/imgui.git
branch = docking
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ else()
message("Platform: Unsupported")
endif()

# Find Vulkan package
find_package(Vulkan REQUIRED)

if(Vulkan_FOUND)
message("----FIND VULKAN----: ", ${Vulkan_INCLUDE_DIRS})
else()
message("----CANNOT FIND VULKAN----")
endif()
# [TEMPORARILY REMOVED]
# Vulkan detection - DISABLED
# find_package(Vulkan REQUIRED)
# if(Vulkan_FOUND)
# message("----FIND VULKAN----: ${Vulkan_INCLUDE_DIRS}")
# else()
# message("----CANNOT FIND VULKAN----")
# endif()

# Include directories
include_directories(
Expand Down
23 changes: 15 additions & 8 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Define the Engine library target
add_library(Core STATIC)

# Specify the source files for the Engine library
file(GLOB_RECURSE ENGINE_SOURCES
# Get all .cpp files recursively under Core folder
file(GLOB_RECURSE ALL_ENGINE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/**/*.cpp
)

# Add the source files to the Engine library
# Filter out any source files inside a 'vkcore' folder
set(ENGINE_SOURCES "")
foreach(src_file IN LISTS ALL_ENGINE_SOURCES)
if(NOT src_file MATCHES "/vkcore/")
list(APPEND ENGINE_SOURCES ${src_file})
endif()
endforeach()

# Add the filtered source files to the Engine library
target_sources(Core PRIVATE ${ENGINE_SOURCES})

# Specify the precompiled header
target_precompile_headers(Core PRIVATE ${CMAKE_SOURCE_DIR}/pch/pch.h)

# Include directories for the Engine library
target_include_directories(Core PRIVATE ${CMAKE_SOURCE_DIR} ${Vulkan_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
# Include directories for the Engine library (Vulkan_INCLUDE_DIRS removed)
target_include_directories(Core PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

# Link the Logger library and Vulkan to the Engine library
target_link_libraries(Core PRIVATE Utils glfw glad Vulkan::Vulkan glm tinygltf yaml-cpp::yaml-cpp EnTT::EnTT)
# Link the Logger library and other dependencies (Vulkan removed)
target_link_libraries(Core PRIVATE Utils glfw glad glm tinygltf yaml-cpp::yaml-cpp EnTT::EnTT)
116 changes: 58 additions & 58 deletions core/graphics/TorchVulkanContext.h
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
#pragma once
#include <pch/pch.h>
#include "TorchGraphicsContext.h"
#include "core/vkcore/instance/VulkanInstance.h"
#include "core/vkcore/validationlayer/VulkanValidationLayers.h"
#include "core/vkcore/devices/VulkanPhysicalDevice.h"
#include "core/vkcore/devices/VulkanLogicDevice.h"
#include "core/vkcore/surface/VulkanWindowSurface.h"
#include "core/vkcore/swapchain/VulkanSwapChain.h"
#include "core/vkcore/imageviews/VulkanImageViews.h"
#include "core/vkcore/pipeline/VulkanGraphicsPipeline.h"
#include "core/vkcore/renderpass/VulkanRenderPass.h"
#include "core/vkcore/framebuffer/VulkanFramebuffer.h"
#include "core/vkcore/command/VulkanCommandBuffer.h"
#include "core/vkcore/command/VulkanCommandPool.h"
#include "core/vkcore/syncobjects/VulkanSyncObjects.h"
//#include "core/renderer/VertexBuffer.h"
// #pragma once
// #include <pch/pch.h>
// #include "TorchGraphicsContext.h"
// #include "core/vkcore/instance/VulkanInstance.h"
// #include "core/vkcore/validationlayer/VulkanValidationLayers.h"
// #include "core/vkcore/devices/VulkanPhysicalDevice.h"
// #include "core/vkcore/devices/VulkanLogicDevice.h"
// #include "core/vkcore/surface/VulkanWindowSurface.h"
// #include "core/vkcore/swapchain/VulkanSwapChain.h"
// #include "core/vkcore/imageviews/VulkanImageViews.h"
// #include "core/vkcore/pipeline/VulkanGraphicsPipeline.h"
// #include "core/vkcore/renderpass/VulkanRenderPass.h"
// #include "core/vkcore/framebuffer/VulkanFramebuffer.h"
// #include "core/vkcore/command/VulkanCommandBuffer.h"
// #include "core/vkcore/command/VulkanCommandPool.h"
// #include "core/vkcore/syncobjects/VulkanSyncObjects.h"
// //#include "core/renderer/VertexBuffer.h"

namespace core
{
class TorchVulkanContext : public TorchGraphicsContext
{
public:
TorchVulkanContext();
~TorchVulkanContext();
void DrawFrame() override;
void OnUpdate() override;
// namespace core
// {
// class TorchVulkanContext : public TorchGraphicsContext
// {
// public:
// TorchVulkanContext();
// ~TorchVulkanContext();
// void DrawFrame() override;
// void OnUpdate() override;

APIType GetAPIType() const override { return APIType::Vulkan; }
// APIType GetAPIType() const override { return APIType::Vulkan; }

// Getter methods
const VulkanInstance &GetInstance() const { return m_Instance; }
const VulkanPhysicalDevice &GetPhysicalDevice() const { return m_PhysicalDevice; }
const VulkanLogicDevice &GetLogicalDevice() const { return m_LogicDevice; }
const VulkanWindowSurface &GetSurface() const { return m_Surface; }
const VulkanSwapChain &GetSwapChain() const { return m_SwapChain; }
const VulkanImageViews &GetImageViews() const { return m_ImageViews; }
const VulkanGraphicsPipeline &GetGraphicsPipeline() const { return m_GraphicsPipeline; }
const VulkanRenderPass &GetRenderPass() const { return m_RenderPass; }
const VulkanFramebuffer &GetFramebuffer() const { return m_Framebuffer; }
const VulkanCommandBuffer &GetCommandBuffer() const { return m_CommandBuffer; }
const VulkanCommandPool &GetCommandPool() const { return m_CommandPool; }
const VulkanSyncObjects &GetSyncObjects() const { return m_SyncObjects; }
// // Getter methods
// const VulkanInstance &GetInstance() const { return m_Instance; }
// const VulkanPhysicalDevice &GetPhysicalDevice() const { return m_PhysicalDevice; }
// const VulkanLogicDevice &GetLogicalDevice() const { return m_LogicDevice; }
// const VulkanWindowSurface &GetSurface() const { return m_Surface; }
// const VulkanSwapChain &GetSwapChain() const { return m_SwapChain; }
// const VulkanImageViews &GetImageViews() const { return m_ImageViews; }
// const VulkanGraphicsPipeline &GetGraphicsPipeline() const { return m_GraphicsPipeline; }
// const VulkanRenderPass &GetRenderPass() const { return m_RenderPass; }
// const VulkanFramebuffer &GetFramebuffer() const { return m_Framebuffer; }
// const VulkanCommandBuffer &GetCommandBuffer() const { return m_CommandBuffer; }
// const VulkanCommandPool &GetCommandPool() const { return m_CommandPool; }
// const VulkanSyncObjects &GetSyncObjects() const { return m_SyncObjects; }

private:
void CreateInstance();
VulkanInstance m_Instance;
VulkanPhysicalDevice m_PhysicalDevice;
VulkanLogicDevice m_LogicDevice;
VulkanWindowSurface m_Surface;
VulkanSwapChain m_SwapChain;
VulkanImageViews m_ImageViews;
VulkanGraphicsPipeline m_GraphicsPipeline;
VulkanRenderPass m_RenderPass;
VulkanFramebuffer m_Framebuffer;
VulkanCommandBuffer m_CommandBuffer;
VulkanCommandPool m_CommandPool;
VulkanSyncObjects m_SyncObjects;
//VertexBuffer m_VertexBuffer;
// private:
// void CreateInstance();
// VulkanInstance m_Instance;
// VulkanPhysicalDevice m_PhysicalDevice;
// VulkanLogicDevice m_LogicDevice;
// VulkanWindowSurface m_Surface;
// VulkanSwapChain m_SwapChain;
// VulkanImageViews m_ImageViews;
// VulkanGraphicsPipeline m_GraphicsPipeline;
// VulkanRenderPass m_RenderPass;
// VulkanFramebuffer m_Framebuffer;
// VulkanCommandBuffer m_CommandBuffer;
// VulkanCommandPool m_CommandPool;
// VulkanSyncObjects m_SyncObjects;
// //VertexBuffer m_VertexBuffer;

uint32_t currentFrame = 0;
// uint32_t currentFrame = 0;

};
}
// };
// }
76 changes: 38 additions & 38 deletions core/renderer/Vertex.h
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
#pragma once
#include <pch/pch.h>


namespace core
{
struct Vertex
{
glm::vec2 position;
glm::vec3 color;

static VkVertexInputBindingDescription GetBindingDescription()
{
VkVertexInputBindingDescription bindingDescription{};
bindingDescription.binding = 0;
bindingDescription.stride = sizeof(Vertex);
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
return bindingDescription;
}

static std::array<VkVertexInputAttributeDescription, 2> FetAttributeDescriptions() {
std::array<VkVertexInputAttributeDescription, 2> attributeDescriptions{};

attributeDescriptions[0].binding = 0;
attributeDescriptions[0].location = 0;
attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
attributeDescriptions[0].offset = offsetof(Vertex, position);

attributeDescriptions[1].binding = 0;
attributeDescriptions[1].location = 1;
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
attributeDescriptions[1].offset = offsetof(Vertex, color);

return attributeDescriptions;
}

};
}
// #pragma once
// #include <pch/pch.h>


// namespace core
// {
// struct Vertex
// {
// glm::vec2 position;
// glm::vec3 color;

// static VkVertexInputBindingDescription GetBindingDescription()
// {
// VkVertexInputBindingDescription bindingDescription{};
// bindingDescription.binding = 0;
// bindingDescription.stride = sizeof(Vertex);
// bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
// return bindingDescription;
// }

// static std::array<VkVertexInputAttributeDescription, 2> FetAttributeDescriptions() {
// std::array<VkVertexInputAttributeDescription, 2> attributeDescriptions{};

// attributeDescriptions[0].binding = 0;
// attributeDescriptions[0].location = 0;
// attributeDescriptions[0].format = VK_FORMAT_R32G32_SFLOAT;
// attributeDescriptions[0].offset = offsetof(Vertex, position);

// attributeDescriptions[1].binding = 0;
// attributeDescriptions[1].location = 1;
// attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
// attributeDescriptions[1].offset = offsetof(Vertex, color);

// return attributeDescriptions;
// }

// };
// }
9 changes: 5 additions & 4 deletions editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Define the Engine library target
# Define the Editor library target
add_library(Editor STATIC)

# Specify the source files for the Editor library
Expand All @@ -16,7 +16,8 @@ target_sources(Editor PRIVATE ${ENGINE_SOURCES})
target_precompile_headers(Editor PRIVATE ${CMAKE_SOURCE_DIR}/pch/pch.h)

# Include directories for the Editor library
target_include_directories(Editor PRIVATE ${CMAKE_SOURCE_DIR} ${Vulkan_INCLUDE_DIRS})
# Removed ${Vulkan_INCLUDE_DIRS}
target_include_directories(Editor PRIVATE ${CMAKE_SOURCE_DIR})

# Link the Utils library and Vulkan to the Editor library
target_link_libraries(Editor PRIVATE Utils glfw glad Vulkan::Vulkan imgui Core yaml-cpp::yaml-cpp EnTT::EnTT ImGuizmo)
# Link the Utils library and other dependencies (Vulkan removed)
target_link_libraries(Editor PRIVATE Utils glfw glad imgui Core yaml-cpp::yaml-cpp EnTT::EnTT ImGuizmo)
Loading