Giter VIP home page Giter VIP logo

littleenginevk's Introduction

Little Engine

A simple 3D game engine using C++20 and Vulkan.

Build Status

Demo video (running le-example)

little-engine.example.mp4

Features

  • PBR materials
  • HDR lighting
  • GLTF mesh importer
  • Skinned meshes and animations
  • Fonts and text
  • Dynamic rendering (Vulkan)
  • In-game UI
  • Dear ImGui
  • AABB collisions
  • Shadow mapping
  • Audio

Requirements

Runtime

  • OS with desktop environment and Vulkan loader (libvulkan1.so / vulkan1.dll)
    • Windows 10
    • Linux: X, Wayland (untested)
    • Mac OSX: untested, will require MoltenVk
  • GPU supporting Vulkan 1.3+, its driver, and loader

Development

  • CMake 3.23+
  • C++20 compiler and stdlib
  • OS with desktop environment and Vulkan loader (libvulkan1.so / vulkan1.dll)
    • Windows 10
    • Linux: X, Wayland (untested)
    • Mac OSX: untested, will require MoltenVk
  • GPU supporting Vulkan 1.3+, its driver, and loader
  • glslc for compiling glsl shaders to SPIR-V
  • (Optional) Vulkan SDK for validation layers (contains glslc)

Usage

LittleEngine (le::little-engine) is a library intended to be built from source and linked statically, it currently does not support any installation / packaging. Link to it via CMake: target_link_libraries(foo PRIVATE le::little-engine).

LittleEngine Scene (le::le-scene) is an optional wrapper that provides Entity, Component, Scene, Runtime, and other convenience facilities.

Default shaders are provided as GLSL sources in shaders/. (These can be compiled to SPIR-V into your data directory using LittleEngine's tools.)

See example for a basic example that renders an animated skinned mesh and some text, and responds to input. The demo video above showcases this very example.

Building

  • Clone this repository somewhere.
  • Use CMake and a generator of your choice to configure an out-of-source build (build and out are ignored in git).
  • If using CMake 3.20+ / Visual Studio in CMake mode / CMake Tools with VSCode, CMakePresets.json can be utilized (and/or extended via CMakeUserPresets.json) for convenience.
    • Use cmake --preset <name> to configure and cmake --build --preset <name> to build on the command line.
    • Visual Studio CMake and VS Code CMake Tools should pick up the presets by themselves.
  • For other scenarios, use CMake GUI or the command line to configure and generate a build.
    • Command line: cmake -S . -B out && cmake --build out.
    • If using an IDE generator, use CMake GUI to configure and generate a build, then open the project/solution in the IDE and build/debug as usual.

Tools

LittleEngine provides some basic tools separate from the engine for building data. There are two main aspects to building data:

Shaders

The engine expects shaders to be in SPIR-V binary format. Custom shaders can be used as long as the shader layouts are compatible, and custom descriptor sets are updated every frame, if any. The engine uses a single global pipeline layout and buffered descriptor sets per camera and per render object.

Meshes

The engine uses custom formats for materials, animations, skeletons, and meshes. GLTF support is built-in, and meshes from such assets can be imported using le::importer. Contributions for importing other formats are welcome.

Note: if your game / app only uses programmatically generated geometry, this step is not required as you won't be loading any mesh data. Images can be loaded as textures directly, the JSON that's generated by the importer is optional.

glsl2spirv

This tool uses glslc by default to compile GLSL shaders to SPIR-V. It takes the source and desitnation directories as optional arguments, and reproduces the source file tree at the destination, with each compiled shader being suffixed with .spv. This suffix is optional in Uris in-game, the shader assets will automatically add them if not present.

If shaders are frequently modified, it is recommended to have a custom target in CMake that invokes glsl2spirv, to ensure a build run always uses up-to-date shaders.

le-importer

This tool imports GLTF meshes into LittleEngine meshes, geometries, materials, textures, animations, and skeletons.

External Dependencies

Misc

Original repository

LICENCE

littleenginevk's People

Contributors

karnkaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

littleenginevk's Issues

Update readme

Add info about new libraries, new API usage, Android support (with caveats), CMake presets, contributors, original repo URL, etc.

Start adding standalone pages to Doxygen docs.

Revise context ownership of app objects

graphics::RenderContext owns pipelines, samplers, etc: move as much as makes sense to the user side (engine will handle ownership, not graphics).

Remove all uses of View and CView.

Android window implementation

Implement single touch position capture as a proxy for mouse button 0 press.

Review any other API aspects that need implementation.

Shader upgrade

Compile glsl to spir-v (at least in Debug)

Shader Compiler:

  • true singleton: never invoked in release
  • requires glslc in PATH (/ tools? Find tools directory like data)
  • if (system("glslc --version") == 0), go online
  • replicate shell script logic in C++

Shader:

  • store extension and mode (GLSL / SPV)
  • use FileMonitor to recompile, rebuild on GPU (, and trigger pipeline reconstruction) on glsl file modified

Pipeline:

  • Recreate on shader recompile

Refactor FileReader

Use filesystem for Android too: provide API to obtain sdcard path etc.

Create a new type to handle Android AAssets (move currently ifdefd logic in FileReader here).

Android internal/external storage paths are in AActivity: https://stackoverflow.com/a/6287820

**gfx lib**

One liners

  • pipeline fixed info
  • sampler create info

Macro

  • Pipeline
  • memory: store all allocated buffers and images and clear on destruction, remove redundant alloc check: vma does it already
  • wrapper type that defer destroys
  • Descriptor Sets
    • ubo: vp, model
    • SSBO: models
    • push: object index

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.