A Metal repo you can use to get started with your own renderer.
First install:
Then type the following in your terminal.
# 🐑 Clone the repo
git clone https://github.com/alaingalvan/metal-seed --recurse-submodules
# 💿 go inside the folder
cd metal-seed
# 👯 If you forget to `recurse-submodules` you can always run:
git submodule update --init
# 👷 Make a build folder
mkdir build
cd build
# 🍎 To build your XCode project on Mac OS
cmake .. -G Xcode
# 📱 To build your XCode project targeting iOS / iPad OS
cmake .. -G Xcode -DCMAKE_SYSTEM_NAME=iOS
# 🔨 Build project
cmake --build .
Refer to this blog post on designing C++ libraries and apps for more details on CMake, Git Submodules, etc.
As your project becomes more complex, you'll want to separate files and organize your application to something more akin to a game or renderer, check out this post on game engine architecture and this one on real time renderer architecture for more details.
├─ 📂 external/ # 👶 Dependencies
│ ├─ 📁 crosswindow/ # 🖼️ OS Windows
│ ├─ 📁 crosswindow-graphics/ # 🎨 Metal Layer Creation
│ └─ 📁 glm/ # ➕ Linear Algebra
├─ 📂 src/ # 🌟 Source Files
│ ├─ 📄 Utils.h # ⚙️ Utilities (Load Files, Check Shaders, etc.)
│ ├─ 📄 Renderer.h # 🔺 Triangle Draw Code
│ ├─ 📄 Renderer.mm # -
│ └─ 📄 Main.mm # 🏁 Application Main
├─ 📄 .gitignore # 👁️ Ignore certain files in git repo
├─ 📄 CMakeLists.txt # 🔨 Build Script
├─ 📄 license.md # ⚖️ Your License (Unlicense)
└─ 📃readme.md # 📖 Read Me!