3D Renderer
3dsim is a little program for rendering 3D triangles.
Compiling
The only requirement are the SDL2 devel files.
$ make
Controls
- W,A,S,D for moving.
- M for toggling mouse-lock.
- arrows for rotating camera.
- J,K for moving vertically.
- I for object importing.
- =/- for increasing/decreasing speed.
Object files
Object files are a modified/simplified version of standard .obj files. Available potions are the following:
- M factor - multiply factor. Vertices added will have their coordinates multiplied.
- v x y z - add vertex.
- f v1 v2 v3 - add triangle face with following vertices.
- F v1 v2 v3 color - add triangle face with color and following vertices.
Lines that start with any other character will be ignored.
Download
To clone the git repo run:
$ git clone git://git.savcik.xyz/3dsim
Rendered Car
TO-DO List
- use matrix math instead of trigonometric formulas.
- crop triangles close to screen.
- fix Z depth.
- faster drawing.
- config file with controls and defines.
- organize functions in files properly.