Minidot is a demake @godotengine built under old immediate mode freeglut (i.e.
glBegin
's and glEnd
's) and C++.
Though old, Minidot have a complete node tree system and a global vertex-fragment shader. All built from scratch by myself.
The repo contains a tank game demo with cel shading, written in main.cpp
, phong_vertex.glsl
, and phong_fragment.glsl
.
Node tree with 2D & 3D node coexists
- another
mesh_list_2d
/3d
inRenderServer
records and renders meshes to prevent tree traversal in every frame. - useful for 3D scene's HUD, e.g., red sight in First Person View
Demake Delegate, aka signal system, aka Observer
- delegate
tree_entered
helpsNode2D
/Node3D
cache parent node,Camera3D
register toViewport
(transform manager), etc.
Hierarchical Transformation with Dirty Flag
- imlemented by operator overloading with
Vector
andTransform
- support translation & rotation, e.g.,
Tank
class inmain.cpp
One mesh sharing by multiple MeshInstance, i.e., Flyweight
- Templated Polymorphism Reference Counting, successfully implemented, in
templates/ref.h
Multi-light source Cel Shaing by Phong Shaing with Rim.
- beside built in
BoxMesh
,ArrayMesh
allows external 3D models be rendered within the framework, e.g.,main.c
importsrubber_duck.smf
.
I keep Minidot source files as simple and reabilable as I can, so Minidot could be developed under YAGNI. Hope it help if you're interested in any of these features!
Github's Release contains the executable and all dependencies needed for Windows. Windows users can directly download and execute the demo from there.
As for other operating system users, please try compiling from source.
-
Download freeglut and glew for your operating system.
For Windows, I use MSYS2 as C/C++ environment and install them following this(freeglut) and this(glew).
-
Ensure your
opengl32
,libfreeglut
, andglew32
shared library files are reachable by executable in project root, i.e., in folders included in PATH or in project root too.For example, my shared library files are
.dll
s. They are in:C:\Windows\System32\opengl32.dll
,C:\msys64\ucrt64\bin\libfreeglut.dll
, andC:\msys64\ucrt64\bin\glew32.dll
. My PATH includesC:\Windows\System32
andC:\msys64\ucrt64\bin
so I'm good to go. -
Use Make and the Makefile. Open terminal within the project root. Enter
make
. It shall successfully builds the executablemain
. If it fails, please try step 4 and 5 to see if the error messages be lessened or not.I use Make provided by MSYS2. Enter
mingw32-make
and you will getmain.exe
.Tip: Try speed up the compilation by
make -j<number>
to utilize your multicore CPU!For example,
make -j8
. -
Ensure your C++ compiler can find all header files downloaded in
/GL
folder.My
/GL
folder isC:\msys64\ucrt64\include\GL
.If compiler fails to find them, modify
./Makefile
. Fine lineGLUT_INCLUDE_ARGU := -I"./GLUT_env"
. Change./GLUT_env
to the path containing/GL
headers.For me, the line should be
GLUT_INCLUDE_ARGU := -I"C:\msys64\ucrt64\include"
-
Ensure your C++ compiler can find static libraries of
libfreeglut
andlibglew32
My static libraries are
C:\msys64\ucrt64\lib\libfreeglut.dll.a
andC:\msys64\ucrt64\lib\libglew.dll.a
.If compiler fails to find them, modify
./Makefile
. Fine lineGLUT_LIB_ARGU := -L"./GLUT_env"
. Change./GLUT_env
to the path containing those static libraries.For me, the line should be
GLUT_LIB_ARGU := -L"C:\msys64\ucrt64\lib"
-
Still get problems? Feel free to open an Issue on Github. I'll help as much as I can!
w
, a
, s
, d
: move your red tank related to world position
left
, right
: rotate the cannon base of your tank
up
, down
: adjust fire angle of your cannon
space
: fire your cannon
q
, e
: move world camera forward/backward
z
, c
: move world camera leftward/rightward
r
, v
: move world camera upward/downward
f
: toggle the camera between first person view and third person view.
x
: toggle center light color between pink and white.
Making a big and serious C++ project is hard!
So many details need to be handled. So many design decisions need to be made.
So many time need to be spent.
Thanks for @godotengine creaters and communities sharing your blood and tears, for free.
Predecessors, you have my greatest respect.