https://github.com/cedricschwyter/nautilus
another graphics engine
https://github.com/cedricschwyter/nautilus
3d-graphics cpp graphics-engine graphics-library graphics-programming linux macos opengl renderer vulkan windows
Last synced: 7 months ago
JSON representation
another graphics engine
- Host: GitHub
- URL: https://github.com/cedricschwyter/nautilus
- Owner: cedricschwyter
- License: gpl-3.0
- Created: 2020-02-04T18:02:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-30T20:35:10.000Z (about 5 years ago)
- Last Synced: 2024-07-20T04:37:16.562Z (over 1 year ago)
- Topics: 3d-graphics, cpp, graphics-engine, graphics-library, graphics-programming, linux, macos, opengl, renderer, vulkan, windows
- Language: C++
- Homepage: https://d3psi.github.io/nautilus/
- Size: 99.1 MB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# nautilus

[](https://travis-ci.com/D3PSI/nautilus)
[](https://ci.appveyor.com/project/D3PSI/nautilus/branch/master)



[](https://circleci.com/gh/D3PSI/nautilus)
[](https://github.com/D3PSI/nautilus/graphs/commit-activity)
[](https://github.com/D3PSI/nautilus/issues/)
[](https://github.com/D3PSI/nautilus/issues?q=is%3Aissue+is%3Aclosed)
[](https://github.com/D3PSI/nautilus/compare)
[](https://GitHub.com/D3PSI/nautilus/pull/)
[](https://GitHub.com/D3PSI/nautilus/pull/)
[](http://perso.crans.org/besson/LICENSE.html)
[](https://github.com/D3PSI/nautilus)
This repository includes a complete render engine with multiple graphics APIs, including the Khronos APIs OpenGL and Vulkan. It is currently in the construction phase aka. pre-alpha stage.
# Installation
## Dependencies
You must have the Vulkan SDK installed and added to your PATH environment variable on Windows and macOS systems for the installation process to work. CMake will not find Vulkan otherwise.
The project further depends on libraries like ASSIMP, GLFW, GLM, irrklang and IMGUI, which are installed through your systems package manager if possible or compiled with the project itself. They are mostly included in the repository as a submodule, making dependency management really easy. The project is thus fully cross-platform (at least amongst the platforms that support the API's)
## Linux
The project comes with an install script for Linux systems. It offers support for Debian, Fedora and Arch/Manjaro. Download and run the installer:
git clone https://github.com/D3PSI/nautilus.git
cd nautilus/
sudo bash nautilus-install.sh
## Windows
Generate the Visual Studio build files with CMake. Download and install the CMake GUI from [their official website](cmake.org/download). Clone the repository and initialize all submodules by cloning the repository recursively:
git clone --recursive https://github.com/D3PSI/nautilus.git
Then generate the Visual Studio build files, either via the command line:
cmake -G "Visual Studio 16 2019" -S nautilus/ -B nautilus/build
or the GUI by specifying the project root directory as the source directory and the `build/` folder in the project root directory as the output directory. Click configure and then generate. If there are any errors, make sure you have all the [dependencies](#dependencies) installed correctly.
Open the generated Visual Studio solution file in Microsoft Visual Studio, change the configuration to Release and the architexture to x64. You should now be able to build and run the examples which can be found in `build/bin/`.
## macOS
For macOS you can also run the integrated installer from the repository after cloning, just like the [Linux installation instructions](#linux) say:
git clone https://github.com/D3PSI/nautilus.git
cd nautilus/
bash nautilus-install.sh
## Getting started
The nautilus-project is a graphics, windowing, sound and physics library with focus to user simplicity. There are various different examples whose source can be found in the `examples` subdirectory of the repository. The library works on a basic concept: The `NautilusCore` object and attachable `NautilusShell` objects.
To create a basic window with your favorite graphics API (OpenGL in the example) create a new derived class from the `NautilusShellOpenGL` (other possibilities include `NautilusShellVulkan`) object and override the required functions `onAttach` and `onRender`:
class ExampleShell
: public NautilusShellOpenGL {
using NautilusShellOpenGL::NautilusShellOpenGL;
public:
/**
* Gets executed when the shell is attached to the core
*/
void onAttach(void) {
// statements to execute on attachment here
}
/**
* Gets executed at the specified frequency to compute rendering operations
*/
void onRender(void) {
// OpenGL rendering statements here
}
};
You can then instantiate a `NautilusShell` object from the class implementation you have just written and attach it with optional settings to the `NautilusCore` object:
NautilusShell* shell;
/**
* Initializes everything
* @return Returns a nautilus::NautilusStatus status code
*/
nautilus::NautilusStatus run(void) {
shell = new ExampleShell();
shell->setShellContext(NAUTILUS_SHELL_CONTEXT_WINDOWED);
shell->setShellTitle("Dev Example 1");
shell->setShellExtent(1280, 720);
shell->setShellIcon("res/images/icons/nautilus.png");
NautilusCore::attachShell(shell);
return nautilus::NAUTILUS_STATUS_OK;
}
The `NautilusCore`-object is implemented as a singleton, meaning there will only ever be one instance of the class which you never have to instantiate (you can just use the functions defined in the class straight-out-of-the-box):
/**
* Main entry point for the application
*/
int main() {
return run();;
}
You can create as many different shell objects and derived classes of it, as long as you always write the necessary function implementations. A `NautilusShell` object essentially represents a window containing a graphics context from the chosen graphics API.
### Linking the library
To use the library in your own C++ project is really simple: The only file you have to manually include in your sourcecode is `#include `. Put the either self-compiled or pre-compiled binary library file (Windows: `nautilus.lib`, Linux: `libnautilus.a`) in the same folder as your `CMakeLists.txt`. In your `CMakeLists.txt` link against the `nautilus` library target and include the necessary include directories (the `include`-subfolder of the repository):
include_directories("path/to/include")
target_link_libraries(myProject nautilus)
### Note
At the time of writing this guide, the `nautilus`-library is still a header-only capable library, meaning you do not have to link the binary library file to the project to make it work as long as you link to the `nautilus`-subfolder as the include directory instead of the dedicated `include` directory. The instructions are here for the potential future case of a non-header-only library.
## Troubleshoot
In the worst case scenario, the compilation of the entire project takes about 20 to 30 minutes on a single thread (view continuous integration services for more information). To accelerate the process you can run the compilation on multiple threads:
make -j
where `` is at max the amount of supported threads of your CPU. This depends strongly on the manufacturer, whether hyperthreading is supported and other factors. Usually a good number to start is to just input the value 4 as this is supported on a wide variety of systems.