- Notifications
You must be signed in to change notification settings - Fork23
bigg (bgfx + imgui + glfw + glm) + utils
License
yuki-koyama/bigger
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
bigg (bgfx + imgui + glfw + glm) + utils
This library, namedbigger
, is a prototype-oriented middleware library for 3D interactive applications. Based on a library namedbigg
, which stands forbgfx
+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.
- C++17
- GLSL 1.30
- bigghttps://github.com/Josh4428/bigg [Unlicense]
- bgfx.cmakehttps://github.com/widberg/bgfx.cmake [CC0 1.0 Universal]
- bgfxhttps://github.com/bkaradzic/bgfx [BSD 2-Clause]
- bimghttps://github.com/bkaradzic/bimg [BSD 2-Clause]
- bxhttps://github.com/bkaradzic/bx [BSD 2-Clause]
- Dear ImGuihttps://github.com/ocornut/imgui [MIT]
- GLFWhttps://github.com/glfw/glfw [Zlib]
- GLMhttps://github.com/g-truc/glm [MIT]
- bgfx.cmakehttps://github.com/widberg/bgfx.cmake [CC0 1.0 Universal]
- random-utilhttps://github.com/yuki-koyama/rand-util [MIT]
- string-utilhttps://github.com/yuki-koyama/string-util [MIT]
- tinyobjloaderhttps://github.com/tinyobjloader/tinyobjloader/ [MIT]
- App(needs to be overridden)
- Camera
- Primitives
- Cube primitive
- Dynamic mesh primitive
- Mesh primitive
- Plane primitive
- Sphere primitive
- Materials
- Blinn-Phong material
- MatCap material
bigger::App::runApp()
bigg::Application::run()
glfw
initializationbgfx
initializationimgui
initialization- Reset
bigger::App::initialize()
(needs to be overridden)- Main loop
glfw
event pollingimgui
event pollingbigger::App::update()
bigger::App::updateApp()
(needs to be overridden)- Update scene objects (
bigger::SceneObject::update()
) - Render scene objects (
bigger::SceneObject::draw()
)
imgui
renderbgfx
submit
bigger::App::shutdown()
- Release scene objects
bigger::App::releaseSharedResources()
(needs to be overridden)
imgui
shutdownbgfx
shutdownglfw
shutdown
- 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<T>
orstd::unique_ptr<T>
)
- Primitives and materials need to be dynamically instantiated and managed by smart pointers (i.e., either
This is a minimal example of usingbigger::App
. This app just shows a blank window and do nothing.
#include<bigger/app.hpp>classMinimalAppfinal : public bigger::App{public:MinimalApp() {}voidinitialize(int argc,char** argv)override {}voidupdateApp()override {}voidreleaseSharedResources()override {}};intmain(int argc,char** argv){ MinimalApp app;return app.runApp(argc, argv);}
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 callingimgui
draw calls.bigger::App::releaseSharedResources()
: Releasing shared resources maintained by the app class (such as vertex buffers).
bgfx
provides screen capture functionalities, which of course can be directly called (see the official documentation and examples). For easier use, inbigger
by default, just inserting the following one-line code intoupdate()
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 tothis issue). A possible quick fix is to use OpenGL.
MIT License
Issue reports & pull requests are highly welcomed.