Simple model loader using SDL and OpenGL (outdated, check vulkan-engine)
Find a file
2021-04-15 15:43:46 +03:00
.vscode OSX c_cpp_properties config 2021-04-08 23:52:51 +03:00
build gitignores and tasks 2019-11-28 15:41:52 +02:00
resources Wrong textures, but import works 2020-08-18 16:13:48 +03:00
src Strongly typed enums 2021-04-15 15:43:46 +03:00
.clang-format New toolchain 2021-04-08 23:45:53 +03:00
.clang-tidy New toolchain 2021-04-08 23:45:53 +03:00
.gitignore New toolchain 2021-04-08 23:45:53 +03:00
CMakeLists.txt Cleaning up CMakeLists.txt 2021-04-09 00:36:23 +03:00
conanfile.txt New toolchain 2021-04-08 23:45:53 +03:00
demo_screenshot.png Loading/deleting/modifying models through ImGui 2021-03-19 18:37:28 +02:00
imgui.ini Added MainMenuBar, docking model view 2021-03-22 22:08:46 +02:00
README.md Updated README for the new toolchain 2021-04-09 00:30:42 +03:00

Simple graphics

Simple graphics engine using SDL2 and OpenGL. Allows you to load 3D models into a demo scene.

Currently has two ways to load models:

  • Using my custom loader for obj and mtl files;
  • Using Assimp to load fbx (other formats will be added in future).

Here's a screenshot of a demo scene, that contains 2 models: city model that is loaded from obj and mtl files and AK-47 that is loaded from fbx file and albedo (diffuse) map.

Demo scene

The Assimp library is quite slow, especially when loading obj files. So I wrote my own loader that parses obj and mtl files using Boost::Spirit::X3 parsing library. For the demo scene, this changed the city model loading time from ~800ms to ~13ms in RELEASE mode. In future, I plan to add custom fbx loader too, so I can get rid of Assimp entirely.

Dependencies

I use conan package manager to pull all the necessary dependecies. This project's dependencies can be seen in conanfile.txt.

Compilation info

To compile the project, first you'll need to install conan to manage the dependencies:

pip install conan

If you don't have pip installed, refer to this conan installation guide.

Next, we're creating two profiles for Debug and Release:

cd build
conan install .. -s build_type=Debug -if Debug
conan install .. -s build_type=Release -if Release

After that, the easiest way to build the application is by using VS Code CMake Tools extension.

Building manually

If you're using other editor or don't want to use the CMake Tools extension, you'll have to build the project manually. First, use CMake to generate the appropriate build files (replace Release with Debug if needed):

cd Release
cmake ../.. -DCMAKE_BUILD_TYPE=RELEASE

Using generated files, you can compile the project. On OSX/Linux use:

cmake --build .

On Windows, you have to specify the build type:

cmake --build . --config RELEASE

Now, enjoy your freshly minted binaries inside the bin folder!

Launching the app

Internal code uses relative paths for loading models and shaders, so make sure that your working directory is the project root. Here's an example of how you can run the binaries:

./build/Release/bin/simple-graphics

Cleaning up build files

If you want to clean up the build files and binaries, you can use git from the project root directory:

git clean -dfX build