OpenGL 4.50 3D engine
Very basic 3D engine, encapsulating some of the openGL functions for a more friendly interface Should work on any OSes (depending of "tinyDir" compliance)
- Hot swapable shaders : (n <=> next shader, p <=> previous shader, r <=> reload shader).
- Available shaders : _ basicMonkey <=> only changes color throught time _ TestMirror1 shader <=> changes color throught time && point light colored && normal vertices creation
- ZQSD movements (french keyboard user, sorry qwerty for once you're not the star of the show)
- tweakable FOV with mouse's scroll inputs
- Skybox with cubesampler
- mirror reflection
- OpenGL shaders encapsulation, allowing for easier usage
- .stl & .off mesh loader
- texture loader
- some funky shaders and basic models :p
Compile it as your usual CMAKE project with :
- terminal commands : mkdir build; cd build; cmake ..
- For Visual Studio use instead "cmake.exe -G Visual Studio 14 2015 Win64 ../VisualStudioProjectOutput" ... and comment out the "-std=c++17" part in CMakeLists.txt as Microsoft seems to still be living in the past and refuses to implement typical c++17 and Wextra . Apologizes to MSVC users, I don't have VS to test all of this by myself.
- Or simply use some modern IDE like QtCreator and drag and drop / open the CMakeLists.txt file
!!! WARNING !!! Shaders are loaded and compiled at runtime. Thus they have to be next to the executable following the same file structure as in the src.
TIP : if you're using cmake directly (<=> not visual studio) instead of copy pasting manually your shaders, you can simply run cmake again, it will take care of copy pasting every resource folder (shaders, models, resources, etc) Tldr : modify shaders => use cmake again
You can Download and play around with the Embryo Demo :
TESTED WITH :
- Windows 10 fresh install + Default QtCreator compiler and MSVC, no depedancies whatsoever
- Windows 8/10 + MSYS2_MinGW_x86_64 + QtCreator (follow instructions : https://wiki.qt.io/MSYS2 ) + Cmake + MSYS2 packages : mingw64/mingw-w64-x86_64-glm (0.9.8.3-1) && mingw64/mingw-w64-x86_64-glfw (3.2.1-2) For windows you'll need to compile and install your own SOIL (http://www.lonesock.net/soil.html) using Mingw-w64 bash, make, make install BUT it will install files incorrectly .... You'll need to manually copy libSOIL.a to "msys64\mingw64\lib" and SOIL.h to "mingw64\include" because reasons
- Debian Jessie + Gcc + QtCreator + Cmake + SOIL compiled by hand + glfw installed from packages
KNOWN BUGS :
- "glDebugMessageCallback(debug, nullptr);" refuses to compile on some windows compiler. Please just comment it and try again, I ain't wasting my time fighting MSVC shenanigans for now.
- mirror's reflection isn't working correctly. => everything is fliped on the Y axis.... If you get too high you'll get behind the reflection of the floor turning the mirror gray. But in theory the drawScene() alrogithm should work for multiple mirrors, even if they're facing each others allowing for a "tunnel of mirror" effect. The basic idea behind the alrogithm is to draw everything that is not a mirror / portal first, then only active the stencil to get the "shape" of the mirror and then redraw the whole scene using the stencil mask. So we end up redrawing only on mirrors and portals. If you feel like helping me please swap the commented and uncommented code of the Camera Camera::mirrorCamera(glm::mat4 mirrorModelMatrix, glm::vec3 v) method.
- If you put an object behind mirror it will appear in said mirror's reflection. At the moment the camera used to render mirror's reflections is not culling correctly close objects.
- A random pink screen appears sometimes, don't know why yet, seems to be a View Matrix corruption. I don't have time to investigate it throughly.
- Regression : sometimes Default Shader doesn't compute normals / light correctly, probably a uniform variables problem.
- Implement an oblique nearPlan X MirrorPlane overlaping method.
- implement graph scene => including Scene, Object, Material ... Everything should already be in place in theory just need to uncomment them and debug them. But the basic code architecture is there. If you're feeling adventurous you may take a look at them.
- modify the drawScene() in order to use a "Render To Texture" for reflections/portals after a couple of reflection instead of the stencil method in order to save some performances
- finish to add "simple" roll support for the camera or go full Quaternion
- Reimplement Textures support (checkboard floor in the demo is rendered using fragment shader)
- Implement more mesh loaders