A custom game engine using C++ and Vulkan/Metal API.
Stellar Engine is a cross-platform game engine using Vulkan/Metal API. Inspired by Cherno's Hazel Engine
Currently it is at the very initial state of development. It supports Windows10(64 bit), Linux(64 bit) and macOS.
On Windows and Linux platforms, StellarEngine will use Vulkan API. And on macOS, it will use Metal API instead.
This project has 2 sub projects, the core engine
and a sandbox
. The core engine
contains all the rendering code, and the sandbox
can be viewed as a client(a game or a 3D application).
Platform | Graphics API | Language | Compiler |
---|---|---|---|
Windows | Vulkan | C++ | g++ |
Linux | Vulkan | C++ | g++ |
Mac | Metal | C++/Objective-C++ | clang++ |
StellarEngine uses GLFW
to create window on Windows, Linux and macOS.
StellarEngine uses glm
as main mathematics libray, including position vectors and camera transforms.
Note: On macOS, Apple's
simd
has different memory alignment than standardglm
alignments.
Data type | Size | Alignment |
---|---|---|
glm::vec2 |
8 | 4 |
glm::vec3 |
12 | 4 |
glm::vec4 |
16 | 4 |
glm::mat4 |
64 | 4 |
Data type | Size | Alignment |
---|---|---|
float2 |
8 | 8 |
float3 |
16 | 16 |
float4 |
16 | 16 |
float4x4 |
64 | 16 |
packed_float2 |
8 | 4 |
packed_float3 |
12 | 4 |
packed_float4 |
16 | 4 |
On windows and Linux, ImGui context will be Vulkan, and Metal on macOS.
StellarEngine does not use MoltenVK, instead, it uses Metal directly. Metal-cpp is a C++ interface for Metal API.
StellarEngine uses spdlog
for its core logging features. A wrapper is written to better organize its functions.
// core
STLR_CORE_TRACE("This is white text, {0}", example_arg)
STLR_CORE_INFO("This is green text, {0}", example_arg)
STLR_CORE_WARN("This is yellow text, {0}", example_arg)
STLR_CORE_ERROR("This is red text, {0}", example_arg)
STLR_CORE_FATAL("This is white text with red background, {0}", example_arg)
// client
STLR_TRACE("This is white text, {0}", example_arg)
STLR_INFO("This is green text, {0}", example_arg)
STLR_WARN("This is yellow text, {0}", example_arg)
STLR_ERROR("This is red text, {0}", example_arg)
STLR_FATAL("This is white text with red background, {0}", example_arg)
I will try to list as detailed as possible. However I have not tested the build on a fresh envrionment so you are welcomed to try it and provide some feedback.
-
Follow the Development Environment Tutorial (https://vulkan-tutorial.com/Development_environment)
-
C++17
-
Visual Studio Code (optional)
-
CMake
-
vkpkg
-
Windows:
- Visual Studio 2019
-
Linux:
- GNU GCC
- X11
-
macOS:
- Xcode (optional)
- Clang++
- pkg-config
Note: On macOS, if you want to enable
Address Sanitation(Valgrind)
you need to manually install clang from llvm as the default clang in/usr/bin
shipped by Apple does not support it.
- Create a build folder:
mkdir build && cd build
. - Configure the project:
cmake ..
.- On Windows, the default generator is Visual Studio.
- On macOS, it is recommended to use Xcode as generator:
cmake .. -G Xcode
, as it provides Metal API Validation Layer. And depending on your platform, whether an M1 or Intel, append-DCMAKE_OSX_ARCHITECTURES=x86_64 or arm64
.
- Build the project:
cmake --build . --config Debug/Release
- Go to
Run and Debug
, select a configuration according to your platform, then hit F5.
After building the project using cmake
, go to your build folder and open StellarEngine.xcodeproj
.
Select StellarEditor
from Scheme, then CMD + R
.
- Window abstraction
- Layer
- Events
- ImGui
- Triangle
- Shader library
- Camera
- Texture
- Renderer
- Metal-cpp
- macOS support
- Better 2D renderer
- Anti Aliasing
- DirectX 12
- Load model
- PBR
- IBL
- SSAO
- Deferred rendering
- Memory allocator
- Multi-threading
- Ray Tracing