Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yuki-koyama/bigger

bigg (bgfx + imgui + glfw + glm) + utils
https://github.com/yuki-koyama/bigger

bgfx glfw glm imgui utils

Last synced: 8 days ago
JSON representation

bigg (bgfx + imgui + glfw + glm) + utils

Awesome Lists containing this project

README

        

# bigger

![macOS](https://github.com/yuki-koyama/bigger/workflows/macOS/badge.svg)
![Ubuntu](https://github.com/yuki-koyama/bigger/workflows/Ubuntu/badge.svg)
[![GitHub license](https://img.shields.io/github/license/yuki-koyama/bigger)](https://github.com/yuki-koyama/bigger/blob/master/LICENSE)

bigg (bgfx + imgui + glfw + glm) + utils

This library, named `bigger`, is a prototype-oriented middleware library for 3D interactive applications. Based on a library named `bigg`, which stands for `bgfx` + `imgui` + `glfw` + `glm`, this library adds some higher-level utilities (such as renderable primitive classes) to make the prototyping of lightweight and cross-platform apps even easier.

![](./docs/screen_shot.png)

## Languages

- C++17
- GLSL 1.30

## Dependencies

- bigg [Unlicense]
- bgfx.cmake [CC0 1.0 Universal]
- bgfx [BSD 2-Clause]
- bimg [BSD 2-Clause]
- bx [BSD 2-Clause]
- Dear ImGui [MIT]
- GLFW [Zlib]
- GLM [MIT]
- random-util [MIT]
- string-util [MIT]
- tinyobjloader [MIT]

## Main Classes

- App __(needs to be overridden)__
- Camera
- Primitives
- Cube primitive
- Dynamic mesh primitive
- Mesh primitive
- Plane primitive
- Sphere primitive
- Materials
- Blinn-Phong material
- MatCap material

## App Event Cycle

- `bigger::App::runApp()`
- `bigg::Application::run()`
- `glfw` initialization
- `bgfx` initialization
- `imgui` initialization
- Reset
- `bigger::App::initialize()` __(needs to be overridden)__
- Main loop
- `glfw` event polling
- `imgui` event polling
- `bigger::App::update()`
- `bigger::App::updateApp()` __(needs to be overridden)__
- Update scene objects (`bigger::SceneObject::update()`)
- Render scene objects (`bigger::SceneObject::draw()`)
- `imgui` render
- `bgfx` submit
- `bigger::App::shutdown()`
- Release scene objects
- `bigger::App::releaseSharedResources()` __(needs to be overridden)__
- `imgui` shutdown
- `bgfx` shutdown
- `glfw` shutdown

## App Design

- Always two directional lights
- Other types of lights or more than two directional lights are not supported
- Intensive use of smart pointers
- Primitives and materials need to be dynamically instantiated and managed by smart pointers (i.e., either `std::shared_ptr` or `std::unique_ptr`)

## Usage

### Minimal Example

This is a minimal example of using `bigger::App`. This app just shows a blank window and do nothing.

```cpp
#include

class MinimalApp final : public bigger::App
{
public:

MinimalApp() {}

void initialize(int argc, char** argv) override {}
void updateApp() override {}
void releaseSharedResources() override {}
};

int main(int argc, char** argv)
{
MinimalApp app;
return app.runApp(argc, argv);
}
```

### Override App Class

The following three methods need to be overridden by the new app class:

- `bigger::App::initialize()`: Initializing the app and instantiating necessary objects living through the app life.
- `bigger::App::updateApp()`: Writing frame-wise update rules and calling `imgui` draw calls.
- `bigger::App::releaseSharedResources()`: Releasing shared resources maintained by the app class (such as vertex buffers).

### (TODO)

### Additional Notes: Screen Capture

`bgfx` provides screen capture functionalities, which of course can be directly called (see the official documentation and examples). For easier use, in `bigger` by default, just inserting the following one-line code into `update()` can capture the screen:

```
bgfx::requestScreenShot(BGFX_INVALID_HANDLE, "/path/to/output");
```

Note: On macOS, using the Metal backend somehow fails to capture the screen (not sure why; probably related to [this issue](https://github.com/bkaradzic/bgfx/issues/1833)). A possible quick fix is to use OpenGL.

## License

MIT License

## Contribution

Issue reports & pull requests are highly welcomed.