/LunaSDK

Luna SDK is a C++ software development framework for real-time rendering applications.

Primary LanguageC++OtherNOASSERTION

This is an experimental project and is in actively development. The APIs, implementations and docs may subject to rapid changes. Please don't use this project in production environments.

Luna SDK

Luna SDK LOGO

Luna SDK is a C++ software development framework for real-time rendering applications like video games, interactive multimedia programs, data visualization programs and so on.

Specifications:

  • Self-implemented fundamental libraries, including platform abstraction layer, container library, math library and more. No dependency on C++ STL.
  • Full dynamic type reflection, including full support for generic types.
  • Serialization and deserialization based on reflection, including JSON and XML support.
  • Job system and thread pool for asynchronous computing.
  • Render Hardware Interface (RHI) targeting Direct3D 12, Vulkan and Metal.
  • Window management API.
  • Shader compiling APIs that compile HLSL shaders to DXIL, SPIR-V and Metal.
  • Low-latency Audio Hardware Interface (AHI).
  • Human Interface Device API providing APIs to access input / output devices.
  • Asset system and virtual file system for managing assets at runtime.
  • File loader for image files, font files and .OBJ files.
  • GPU-driven vector graphics rendering.
  • Well documented and CI tested.

Designed target platforms:

  • Windows (Direct3D 12+/Vulkan 1.0+)
  • macOS (Metal 2+)
  • Linux (Vulkan) (Not implemented yet.)
  • Android (Vulkan) (Not implemented yet.)
  • iOS (Metal) (Not implemented yet.)

Building

windows-build macos-build

Prerequisites

  • C++ toolchain on your platform:
    • Visual Studio 2019 or later on Windows (C++ desktop development & C++ game development workload).
    • XCode and command line tools on macOS.
    • clang or gcc on Linux (not implemented yet).
  • xmake building system, check here for installation instructions.
  • For Visual Studio Code users, install XMake(tboox) and C/C++(Microsoft) extensions on Visual Studio Code to improve development experience.

Visual Studio

  1. Clone or download this project.

  2. Double click setup.bat to perform project setup.

  3. Double click gen_vs2019.bat or execute the following commands:

    xmake project -y -k vsxmake2019 -m "debug;profile;release" Solution

    if you user other Visual Studio versions, change vsxmake2019 to your version, like vsxmake2021.

  4. Open solution file in /Solution/vsxmake2019/Luna.sln

  5. Build solution in Visual Studio.

Visual Studio Code

  1. Clone or download this project.
  2. Run setup.bat (on Windows) or setup.sh (on macOS) to perform project setup.
  3. Open Code editor on the project root directory, then choose xmake toolchain in Code editor.
  4. Configure the building option by executing xmake f {options}. Possible options include:
    1. -p for target platform, including windows and macosx. This can be set automatically for most of the time.
    2. -a for architecture, including x64 and arm64.
    3. -m for mode, including debug, profileand release.
    4. --rhi_debug=y if you want to enable the debug layer of the rendering backend (D3D12 debug layer or Vulkan validation layer).
    5. --rhi_api=XXX for choosing the rendering backend, including D3D12 (default on Windows), Vulkan (default on Linux) and Metal (default on macOS).
  5. Open terminal and execute xmake build for all projects, or xmake build {target} for a specific target, like Studio. You may also use Run and Debug tab to build project if you install the XMake extension.

XCode

  1. Clone or download this project.
  2. Run setup.sh to perform project setup.
  3. Run gen_xcode.sh on terminal:
    chmod +x ./gen_xcode.sh
    ./gen_xcode.sh
    
  4. Since the current version of xmake does not support running custom post-build scripts in XCode, you may need to copy images, shaders and other files to build/macosx/{arch}/release/Debug directory if the program fails to find them.
  5. Open Luna.xcodeproj on the root directory of Luna SDK.
  6. Build products in XCode.

System Requirements

The following requirements must be satisfied to run Luna SDK with Direct3D 12 rendering backend:

  • Windows 10 operating system, 64-bit.

The following requirements must be satisfied to run Luna SDK with Vulkan rendering backend:

  • Vulkan runtime must be present on the system, and must be supported by your GPU and driver.

    • Vulkan runtime is shipped as part of system components on most modern operations systems, including Windows, Linux and Android.
    • To check whether your GPU and driver supports Vulkan, consult this database.
    • Installation of Vulkan SDK is not required to build Luna SDK with Vulkan rendering backend.
  • VK_KHR_maintenance1 extension support, which is mandatory in Vulkan 1.1+.

  • VK_KHR_swapchain extension support, which should be supported on all platforms with display screens.

The following requirements must be satisfied to run Luna SDK with Metal rendering backend:

  • macOS 10.15 (Catalina) and later.

Docs

See Luna SDK Docs.

Feedback & Discussion

  • Issues page is available for bug report and feature request (not guaranteed to be satisfied).
  • Discussions page is available for discussions.
  • QQ group: 665068249 (Chinese only).

Contact Author

Third Party SDKs and References

Luna SDK uses the following third party SDKs:

  1. Dear ImGui for GUI rendering (MIT License).
  2. ImGuizmo for rendering gizmos using ImGui (MIT License).
  3. DirectX Shader Compiler for compiling HLSL shaders (University of Illinois Open Source License).
  4. GLFW for window management on Windows, macOS and Linux (zlib License).
  5. STB for image file reading/writing and ttf font file processing (public domain).
  6. Vulkan Memory Allocator for allocating device memory on Vulkan backend (MIT License).
  7. D3D12 Memory Allocator for allocating device memory on D3D12 backend (MIT License).
  8. miniaudio for cross-platform low-level platform audio interface (public domain).

All SDKs are either embedded in the project, or can be fetched automatically by xmake scripts, the user does not need to install them manually.

The following SDKs are not directly used Luna SDK, but part of their design and implementation is referred when developing similar functionalities in Luna SDK:

  1. jsondiffpatch.net when developing the variant differential library (MIT License).
  2. DirectXMath when developing the math library (MIT License).

Alternatives

Here are some alternative real-time rendering engines/frameworks that have similar design goals to Luna SDK.

  • Sakura Engine developed by SaeruHikari and other contributors (MIT License).
  • Horizon Engine developed by harukumo.
  • Piccolo Engine developed by Booming Tech and GAMES104 community contributors (MIT License).
  • CatDogEngine developed by T-rvw, Hinageshi01 and other contributors (GPL-2.0 License).

License

Luna SDK is licensed under the zlib/libpng license, see LICENSE.txt for more information.

Mascot

Say Hi to our mascot, a Luna SDK LOGO with two ellipses that look like eyes of one spherical robot.