You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Simple 3D engines with planty of models (may be generated programmatically or loaded from files) and scene objects (they have their own properties such as position and rotation).
8
9
- Transform matrices with homogeneous coordinates: shifting, scaling, rotationg, perspective.
9
10
- Pruning of invisible edges with Roberts algorithm.
@@ -13,6 +14,7 @@
13
14
- Many helpful math (generating of transform matrices, matrices and vectors multiplication, dot production, normals, and reflected vectors calculations) and other functions.
14
15
15
16
## 2. Control
17
+
16
18
- Left/right arrow — scene rotating.
17
19
- Z/X keys — scene scaling.
18
20
- Q/E keys — change light intensity.
@@ -35,6 +37,7 @@ Programming language: C++. IDE: Qt Creator. Rendering created with standard faci
35
37
-`helper` — Some helpful math and other functions.
36
38
37
39
## 4. Interesting points
40
+
38
41
- During generation of dodecahedron initially pentagonal edges are created, which then are being splitted into 3 triangles.
39
42
- Sphere model is creating through recursive "inflation" of tetrahedron. Recursion depth is under control: depth 0 gives 12 verticies and 20 edges (usual tetrahedron), depth 1 — 42 verticies and 80 edges, depth 2 — 222 verticies and 320 edges.
40
43
- "Garlic" model was created from sphere transforming all the verticies this way: if Y greater than 0, than Y is increasing; if X or Z are close to 0, than other coordinate if decreasing. File `data.cpp`, function `createGarlic()`.
@@ -44,13 +47,15 @@ Programming language: C++. IDE: Qt Creator. Rendering created with standard faci
44
47
- To reduce rendering time when using Z-buffer and light shading, picture dimensions are divided by 2.
45
48
46
49
## 5. Structure of model file
50
+
47
51
The model files consist of 2 kinds of lines:
48
52
- Vertex description: `0 x y z` where x,y and z are float numbers.
49
53
- Triangle description: `1 a b c` where a, b and c are vertex indices.
50
54
51
55
Lines of different kinds may be passed in any order, only relative order of vertices must be the same to keep their indices.
0 commit comments