blob: 0425b113a2801414a05334a5aa5c4cfae63ab69b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
3D triangle renderer
====================
Short interactive C program for rendering 3D triangles.
Compiling
---------
The only requirements are the SDL2 devel files.
```sh
make
```
Controls
--------
- **W,A,S,D** for moving.
- **M** for toggling mouse-lock.
- **T** for toggling line drawing.
- **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:
1. **M** *factor* - multiply factor. Vertices added afterwards will have their coordinates multiplied.
2. **v** *x* *y* *z* - add vertex.
3. **f** *v1* *v2* *v3* - add triangle face with following vertices.
4. **F** *v1* *v2* *v3* *color* - add triangle face with color and following vertices.
5. **C** *color* - triangles added afterwards will have this color.
Lines that start with any other character will be ignored.
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.
|