top of page

MiniMinecraft

C++, Qt, OpenGL

Miniature version of the popular first-person computer game Minecraft.

Full source code: https://github.com/seiseiko/mini-mc

Features include:

Efficient terrain rendering
The world is rendering based on chunks. Given a world position, one could set/get block at according chunk while inside chunk, only local coordinate is used. I implemented the create() func only use one interleaved VBO. The related drawable class and shadeprogram are also altered. GL is now painting terrain based on chunks.
For efficiency, the adjacent block and adjacent chunk check are implemented.
The (x,z) mapping is approached by using 64 bit interger.

cube texturing

shadow-mapping:

The general implementation idea is first generate the shadow texutre during initializeGL, bind it to our
shadow frame buffer and tell gl not to draw the output.  Then during each paintGL(), calculate the current
light view transformation matrix and pass it to shader, then we can first render our shadow shader to get
the shadow map, and then render the final scene with the output shadow map.
Other details include:
Add shadow texture and buffer handle to mygl. Add related uniform handle to shader program.
Set the right offset of texture slot.
In lambert shader, perform perspective divide and clamp the final value from 0 to 1 for the shadow coord.
Bind shadow frame buffer and then bind default frame buffer during each rendering to get right output.

L-system
Parsing and draw the river using stack and a map from character to functions related to turtles.
Given certain grammar rule and axiom, start position, could parse and generate the river.
The river could correctly be generated without discontinuity.(see helplog for detailed solution)
Given flag, the main stream could be wider than branches. Could clean up surronding and gradualling carving to a certain height. (here is 135) Incorporate random numbers to influence path orientation and probability of branch generation.

height mapping

biomes

bottom of page