Skip to content
/ minidot Public

Mini Godot Engine – Home-made @godotengine with minimal feature. Developed for school OpenGL.

License

Notifications You must be signed in to change notification settings

Zij-J/minidot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minidot

alt text 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.

Features

Node tree with 2D & 3D node coexists alt text alt text

  • another mesh_list_2d/3d in RenderServer 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 helps Node2D/Node3D cache parent node, Camera3D register to Viewport (transform manager), etc.

Hierarchical Transformation with Dirty Flag alt text alt text

  • imlemented by operator overloading with Vector and Transform
  • support translation & rotation, e.g., Tank class in main.cpp

One mesh sharing by multiple MeshInstance, i.e., Flyweight

alt text

  • Templated Polymorphism Reference Counting, successfully implemented, in templates/ref.h

Multi-light source Cel Shaing by Phong Shaing with Rim. alt text alt text

  • beside built in BoxMesh, ArrayMesh allows external 3D models be rendered within the framework, e.g., main.c imports rubber_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!

Download & Execute

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.

Compile from source

  1. 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).

  2. Ensure your opengl32, libfreeglut, and glew32 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 .dlls. They are in: C:\Windows\System32\opengl32.dll, C:\msys64\ucrt64\bin\libfreeglut.dll, and C:\msys64\ucrt64\bin\glew32.dll. My PATH includes C:\Windows\System32 and C:\msys64\ucrt64\bin so I'm good to go.

  3. Use Make and the Makefile. Open terminal within the project root. Enter make. It shall successfully builds the executable main. 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 get main.exe.

    Tip: Try speed up the compilation by make -j<number> to utilize your multicore CPU!

    For example, make -j8.

  4. Ensure your C++ compiler can find all header files downloaded in /GL folder.

    My /GL folder is C:\msys64\ucrt64\include\GL.

    If compiler fails to find them, modify ./Makefile. Fine line GLUT_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"

  5. Ensure your C++ compiler can find static libraries of libfreeglut and libglew32

    My static libraries are C:\msys64\ucrt64\lib\libfreeglut.dll.a and C:\msys64\ucrt64\lib\libglew.dll.a.

    If compiler fails to find them, modify ./Makefile. Fine line GLUT_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"

  6. Still get problems? Feel free to open an Issue on Github. I'll help as much as I can!

Controls

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.

P.S.

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.