Rather than using a traditional oriented system, this engine uses a more efficient Entity Component System. The implementation of the ECS system is custom to this engine.
Resources are loaded on startup from the resource
directory. Currently the following resources are loaded
.obj
files (and associated .mtl
files) are loaded from resources/models
(and all subdirectories if you wish to organize your models).png
and .jpg
files are loaded from resources/textures
.glsl
shader files are loaded from resources/shaders/vertex
and resources/shaders/fragment
resources/skyboxes
global_config.json
is loaded from resources/config
Processed models are put into a globally accessible meshes
map where the key is the file name (e.g. cube.obj
or houses/house1.obj
). Models are automatically resized to be between [-1, +1] in all dimensions, and are recentered to the origin.
Similarily, processed textures are put into a globally accessible textures
map.
Audio playback is handled by Audio.cpp
Shaders are compiled by calling Program::init
with the list of shader file names.
VFC is a supported optimization out of the box.
Shadow mapping code is included in the project in src/Systems/SystemShadow.cpp
. The depth map generated in that file is then used by src/Systems/SystemRender.cpp
to pass depth information along to shaders.
ImGui is included in this project to allow for the creation of GUIs.
irrKlang is included in this project, along with a wrapper in src/Audio.cpp
to call the library.
An axis aligned bounding box collision system exists to allow for some basic physics reactions. These bounding boxes can be automatically created from an entities model. Using the resize
, move
, and setRotationTo
methods in src/EntityHelper.cpp
updates the bounding boxes in an efficient manner.
Optionally, entities can be configured to be instanced rendered. This passes the Model matrix of the object as an attribute in the shader. Additional vec4 attributes can also be passed to an instance rendered object's shader.
Entities are contained within a scene. Scenes also contain information about the update function, and key handlers. This allows for easy and efficient swapping between different scenes that have entirely different behavior.
The engine allows for a normal / bump map to be configured as part of the renderable component. It will pass along vertex normal / binormal / tangents that were calculated when the model was imported.
mkdir build
cmake ..
to generate your makefile and make
to build./blz-3d-engine
The following libraries are included with the listed licenses from their parent projects
glad is used to provide an OpenGL context. It is included as licensed under the MIT license.
Dear ImGui is used to create simple user interfaces. It is included as licensed under the MIT license.
[irrKlang] is used to play back 2D and 3D audio.
It is not open source :(
The license for the software can be found here
For this reason, it is not included in this repository. You will have to download irrKlang yourself in order to build and run this engine.
Steps for doing so:
ext
folder of this repositorylib
, include
, and bin
folders from your irrKlang zip into the ext/irrKlang
folderext/irrKlang/bin/ikpMP3.so
to your build directoryext/irrKlang/bin/ikpMP3.so
to ext/irrKlang/bin/libikpMP3.so
Steps are similar
We got it working, but I'm not sure how. I think the 32 bit version of irrKlang was required
Rapid JSON is used to load in JSON resources at engine startup. It is included as licensed under the BSD license.
stb_image is used to load in all image asset files. It is included as a public domain resource.
tinyobjloader is used to load in OBJ model files. It is included as licensed under the MIT license.
This project includes code by
Most of the work on this engine was done by