This is a custom-made and bare-bone engine that can render 3D geometric shapes. By default, the window will render a tesseract in 3D. See How to for specifying your own mesh.
First, clone this repository via:
git clone https://github.com/d22046/3d-mesh-renderer.git
The only dependencies that this renderer depends on is a version of python 3 and pygame. You can install Python here if not previously. The easiest way to install pygame is through pip, where the installation process can be found here. Then, simply run the following to install pygame:
pip install pygame
After installing python and pygame, you can run the renderer using the python3 command like so:
python3 renderer.py
- Use
W,A,S,Dto move around. - Press
Spaceto float up. - Press
Fto float down. - Use the arrow keys to rotate your field of view.
- Press
Rto reset to everything to their original position.
This section outlines the various commands you can tell the renderer about how to draw a mesh.
In renderer.py, in the function initiate, specify a new vertex by calling the Vertex constructor:
v = Vertex( x, y, z )
Where x, y, and z are the coordinates of v using the normal Euclidean coordinates plane. Then, tell the renderer to show v by adding it to the vertices list via vertices.append(v).
At the end of renderer.py, there is a section that prompts you to connect the vertices. Specify a connection using the draw_line function:
draw_line( n, m )
Where n and m are indexes in vertices. The draw_line function tells the renderer to connect the nth vertex to the mth vertex in vertices.