Skip to content

Commit

Permalink
MetaParser, RHI, some render bugfixes (BoomingTech#276)
Browse files Browse the repository at this point in the history
* Refactor Editor Framework

* Fix naming typo, filed to field

* editor input refactor

* fix editor mac build

* Refactor rendering architecture

* Fix Linux Compile Error and Warnings

* Fix Linux Compile Error

* Fix render system problem when reloading current level

* Move camera update info in camera component tick to swap data context; Update...

* Jolt optimization

* Feature/add mustache support

* Update README.md

* rename

* replace robot texture

* fix compile error on Ubuntu.

* add .gitlab

* rename folder name

* Update .gitlab/.gitlab-ci.yml file

* fix JoltPhysics macOS std::aligned_alloc compile error

* fix editor ui creator bug

* change editor function name

* Fix motor

* Update README.md
  • Loading branch information
BoomingTechDev authored and KaygNas committed Feb 10, 2023
1 parent 66e61a9 commit 0b76278
Show file tree
Hide file tree
Showing 280 changed files with 12,634 additions and 691 deletions.
33 changes: 33 additions & 0 deletions .gitlab/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.job_rules_template: &job_rules
stage: build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"
&& $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"
&& $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "upstream"'

build_in_mac:
tags:
- mac
- shell
<<: *job_rules
script:
- ./build_macos.sh release

build_in_ubuntu:
image: cmake:3.23 # you can build it with Dockerfile offered in this project
tags:
- ubuntu
- docker
<<: *job_rules
script:
- ./build_linux.sh release

build_in_windows:
tags:
- windows
- shell
<<: *job_rules
script:
- ./build_windows.bat

15 changes: 15 additions & 0 deletions .gitlab/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:20.04
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive TZ=Asia/Shanghai apt install -y \
libxrandr-dev libxrender-dev libxinerama-dev libxcursor-dev \
libxi-dev libglvnd-dev libvulkan-dev clang libc++-dev libglew-dev \
libglfw3-dev vulkan-validationlayers mesa-vulkan-drivers wget \
build-essential libssl-dev
RUN cd && wget https://cmake.org/files/v3.23/cmake-3.23.1.tar.gz \
&& tar xf cmake-3.23.1.tar.gz \
&& cd cmake-3.23.1 \
&& ./bootstrap \
&& make \
&& make install \
&& ln -s /usr/local/bin/cmake /usr/bin/cmake

6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)

project(Pilot VERSION 0.1.0)
project(Piccolo VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -16,8 +16,8 @@ if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
)
endif()

set(PILOT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_INSTALL_PREFIX "${PILOT_ROOT_DIR}/bin")
set(PICCOLO_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_INSTALL_PREFIX "${PICCOLO_ROOT_DIR}/bin")
set(BINARY_ROOT_DIR "${CMAKE_INSTALL_PREFIX}/")


Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

| Build Type | Status |
| :---------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| **Build Windows** | [![Build Windows](https://github.com/BoomingTech/Pilot/actions/workflows/build_windows.yml/badge.svg)](https://github.com/BoomingTech/Pilot/actions/workflows/build_windows.yml) |
| **Build Linux** | [![Build Linux](https://github.com/BoomingTech/Pilot/actions/workflows/build_linux.yml/badge.svg)](https://github.com/BoomingTech/Pilot/actions/workflows/build_linux.yml) |
| **Build macOS** | [![Build macOS](https://github.com/BoomingTech/Pilot/actions/workflows/build_macos.yml/badge.svg)](https://github.com/BoomingTech/Pilot/actions/workflows/build_macos.yml) |
| **Build Windows** | [![Build Windows](https://github.com/BoomingTech/Piccolo/actions/workflows/build_windows.yml/badge.svg)](https://github.com/BoomingTech/Piccolo/actions/workflows/build_windows.yml) |
| **Build Linux** | [![Build Linux](https://github.com/BoomingTech/Piccolo/actions/workflows/build_linux.yml/badge.svg)](https://github.com/BoomingTech/Piccolo/actions/workflows/build_linux.yml) |
| **Build macOS** | [![Build macOS](https://github.com/BoomingTech/Piccolo/actions/workflows/build_macos.yml/badge.svg)](https://github.com/BoomingTech/Piccolo/actions/workflows/build_macos.yml) |

## Prerequisites

Expand Down Expand Up @@ -96,3 +96,14 @@ For Windows:
cmake -DCMAKE_TRY_COMPILE_TARGET_TYPE="STATIC_LIBRARY" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S . -B compile_db_temp -G "Unix Makefiles"
copy compile_db_temp\compile_commands.json .
```

### Using Physics Debug Renderer
Currently Physics Debug Renderer is only available on Windows. You can use the following command to generate the solution with the debugger project.

``` powershell
cmake -S . -B build -DENABLE_PHYSICS_DEBUG_RENDERER=ON
```

Note:
1. Please clean the build directory before regenerating the solution. We've encountered building problems in regenerating directly with previous CMakeCache.
2. Physics Debug Renderer will run when you start PiccoloEditor. We've synced the camera position between both scenes. But the initial camera mode in Physics Debug Renderer is wrong. Scrolling down the mouse wheel once will change the camera of Physics Debug Renderer to the correct mode.
2 changes: 1 addition & 1 deletion cmake/ShaderCompile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(compile_shader SHADERS TARGET_NAME SHADER_INCLUDE_FOLDER GENERATED_DIR
add_custom_command(
OUTPUT ${CPP_FILE}
COMMAND ${CMAKE_COMMAND} -DPATH=${SPV_FILE} -DHEADER="${CPP_FILE}"
-DGLOBAL="${GLOBAL_SHADER_VAR}" -P "${PILOT_ROOT_DIR}/cmake/GenerateShaderCPPFile.cmake"
-DGLOBAL="${GLOBAL_SHADER_VAR}" -P "${PICCOLO_ROOT_DIR}/cmake/GenerateShaderCPPFile.cmake"
DEPENDS ${SPV_FILE}
WORKING_DIRECTORY "${working_dir}")

Expand Down
2 changes: 1 addition & 1 deletion engine/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
generated/
!bin/
bin/
12 changes: 12 additions & 0 deletions engine/3rdparty/JoltPhysics/Jolt/Core/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ JPH_SUPPRESS_WARNINGS_STD_BEGIN
JPH_SUPPRESS_WARNINGS_STD_END
#include <stdlib.h>

#if defined(__APPLE__)
#include <AvailabilityMacros.h>
#endif

JPH_NAMESPACE_BEGIN

void *AlignedAlloc(size_t inSize, size_t inAlignment)
Expand All @@ -19,6 +23,14 @@ void *AlignedAlloc(size_t inSize, size_t inAlignment)
return _aligned_malloc(inSize, inAlignment);
#elif defined(JPH_PLATFORM_ANDROID)
return memalign(inAlignment, AlignUp(inSize, inAlignment));
#elif defined(__APPLE__) && (defined(MAC_OS_X_VERSION_10_16)) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16
// For C++14, usr/include/malloc/_malloc.h declares aligned_alloc()) only
// with the MacOSX11.0 SDK in Xcode 12 (which is what adds
// MAC_OS_X_VERSION_10_16), even though the function is marked
// availabe for 10.15. That's why the preprocessor checks for 10.16 but
// the __builtin_available checks for 10.15.
// People who use C++17 could call aligned_alloc with the 10.15 SDK already.
return aligned_alloc(inAlignment, AlignUp(inSize, inAlignment));
#else
return std::aligned_alloc(inAlignment, AlignUp(inSize, inAlignment));
#endif
Expand Down
20 changes: 11 additions & 9 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

set(ENGINE_ROOT_DIR "${PILOT_ROOT_DIR}/engine")
set(ENGINE_ROOT_DIR "${PICCOLO_ROOT_DIR}/engine")
set(THIRD_PARTY_DIR "${ENGINE_ROOT_DIR}/3rdparty")
set(ENGINE_ASSET_DIR "/asset")

Expand All @@ -22,42 +22,44 @@ endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options("/MP")
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT PilotEditor)
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT PiccoloEditor)
endif()

set(vulkan_include ${THIRD_PARTY_DIR}/VulkanSDK/include)

if(WIN32)
set(vulkan_lib ${THIRD_PARTY_DIR}/VulkanSDK/lib/Win32/vulkan-1.lib)
set(glslangValidator_executable ${THIRD_PARTY_DIR}/VulkanSDK/bin/Win32/glslangValidator.exe)
add_compile_definitions("PILOT_VK_LAYER_PATH=${THIRD_PARTY_DIR}/VulkanSDK/bin/Win32")
add_compile_definitions("PICCOLO_VK_LAYER_PATH=${THIRD_PARTY_DIR}/VulkanSDK/bin/Win32")
elseif(UNIX)
if(APPLE)
set(vulkan_lib ${THIRD_PARTY_DIR}/VulkanSDK/lib/MacOS/libvulkan.1.dylib)
set(glslangValidator_executable ${THIRD_PARTY_DIR}/VulkanSDK/bin/MacOS/glslangValidator)
add_compile_definitions("PILOT_VK_LAYER_PATH=${THIRD_PARTY_DIR}/VulkanSDK/bin/MacOS")
add_compile_definitions("PILOT_VK_ICD_FILENAMES=${THIRD_PARTY_DIR}/VulkanSDK/bin/MacOS/MoltenVK_icd.json")
add_compile_definitions("PICCOLO_VK_LAYER_PATH=${THIRD_PARTY_DIR}/VulkanSDK/bin/MacOS")
add_compile_definitions("PICCOLO_VK_ICD_FILENAMES=${THIRD_PARTY_DIR}/VulkanSDK/bin/MacOS/MoltenVK_icd.json")
else()
set(vulkan_lib ${THIRD_PARTY_DIR}/VulkanSDK/lib/Linux/libvulkan.so.1)
set(glslangValidator_executable ${THIRD_PARTY_DIR}/VulkanSDK/bin/Linux/glslangValidator)
add_compile_definitions("PILOT_VK_LAYER_PATH=${THIRD_PARTY_DIR}/VulkanSDK/bin/Linux")
add_compile_definitions("PICCOLO_VK_LAYER_PATH=${THIRD_PARTY_DIR}/VulkanSDK/bin/Linux")
endif()
else()
message(FATAL_ERROR "Unknown Platform")
endif()


set(SHADER_COMPILE_TARGET PilotShaderCompile)
set(SHADER_COMPILE_TARGET PiccoloShaderCompile)
add_subdirectory(shader)

add_subdirectory(3rdparty)

add_subdirectory(source/runtime)
add_subdirectory(source/editor)
add_subdirectory(source/meta_parser)
#add_subdirectory(source/test)

set(CODEGEN_TARGET "PilotPreCompile")
set(CODEGEN_TARGET "PiccoloPreCompile")
include(source/precompile/precompile.cmake)
set_target_properties("${CODEGEN_TARGET}" PROPERTIES FOLDER "Engine" )

add_dependencies(PilotRuntime "${CODEGEN_TARGET}")
add_dependencies(PiccoloRuntime "${CODEGEN_TARGET}")
add_dependencies("${CODEGEN_TARGET}" "PiccoloParser")
6 changes: 5 additions & 1 deletion engine/asset/level/1-1.level.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"gravity": 15,
"gravity": {
"x": 0,
"y": 0,
"z": -15
},
"character_name": "Player",
"objects": [
{
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion engine/asset/objects/character/player/player.object.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
},
"$typeName": "PhysicsControllerConfig"
},
"jump_height": 0,
"jump_height": 1,
"max_move_speed_ratio": 1,
"max_sprint_speed_ratio": 2,
"move_acceleration": 2,
Expand Down
Loading

0 comments on commit 0b76278

Please sign in to comment.