Code refactoring
[sixth-3d-demos.git] / doc / index.org
1 #+TITLE: Sixth 3D engine demos
2
3 * (document settings) :noexport:
4 ** use dark style for TWBS-HTML exporter
5 #+HTML_HEAD: <link href="https://bootswatch.com/3/darkly/bootstrap.min.css" rel="stylesheet">
6 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
7 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
8 #+HTML_HEAD: <style type="text/css">
9 #+HTML_HEAD:   footer {background-color: #111 !important;}
10 #+HTML_HEAD:   pre {background-color: #111; color: #ccc;}
11 #+HTML_HEAD: </style>
12
13 * General
14 - This program is free software: released under Creative Commons Zero
15   (CC0) license
16
17 - Program author:
18   - Svjatoslav Agejenko
19   - Homepage: https://svjatoslav.eu
20   - Email: mailto://svjatoslav@svjatoslav.eu
21
22 - [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
23
24 ** Source code
25 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
26
27 - [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=summary][Browse Git repository online]]
28
29 - Clone Git repository using command:
30   : git clone https://www2.svjatoslav.eu/git/sixth-3d-demos.git
31
32 * Overview
33 Goal of this project is to show off capabilities and API usage of
34 [[https://www3.svjatoslav.eu/projects/sixth-3d/][Sixth 3D]] engine.
35
36 All [[id:5f88b493-6ab3-4659-8280-803f75dbd5e0][example scenes in this repository]] render at interactive
37 framerates.
38
39 Download runnable JAR file: [[file:sixth-3d-demos.jar]]
40
41 To start demo application, use command:
42 : java -jar sixth-3d-demos.jar
43
44 * Navigating in space
45 | key                            | result                               |
46 |--------------------------------+--------------------------------------|
47 | cursor keys                    | move: left, right, forward, backward |
48 | mouse scroll wheel             | move: up, down                       |
49 | dragging with mouse            | look around                          |
50
51 * Example scenes in this repository
52 :PROPERTIES:
53 :ID:       5f88b493-6ab3-4659-8280-803f75dbd5e0
54 :END:
55 ** Raytracing through voxels
56 [[file:screenshots/raytracing fractal in voxel polygon hybrid scene.png]]
57
58 Test scene that is generated simultaneously using:
59 + conventional polygons
60   + for realtime navigation, and
61 + voxels
62   + for on-demand raytracing
63
64 Instead of storing voxels in dumb [X * Y * Z] array, dynamically
65 partitioned [[https://en.wikipedia.org/wiki/Octree][octree]] is used to compress data. Press "r" key anywhere in
66 the scene to raytrace current view through compressed voxel
67 datastructure.
68
69 ** Conway's Game of Life
70 The Game of Life, also known simply as Life, is a cellular automaton
71 devised by the British mathematician John Horton Conway in 1970.
72
73 + https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
74   + Game rules:
75     + 2 cell states: alive / dead
76     + Each cell sees 8 neighboring cells.
77     + If alive cell neighbors count is 2 or 3, then cell survives,
78       otherwise it dies.
79     + Dead cell becomes alive if neighbors count is exactly 3.
80
81 [[file:screenshots/life.png]]
82
83 Current application projects 2D game grid/matrix onto three
84 dimensional space. Extra dimension (height) is used to visualize
85 history (previous iterations) using glowing dots suspended in space.
86
87 Usage:
88 | key                            | result                               |
89 |--------------------------------+--------------------------------------|
90 | mouse click on the cell (cell) | toggles cell state                   |
91 | <space>                        | next iteration                       |
92 | ENTER                          | next iteeration with the history     |
93 | "c"                            | clear the matrix                     |
94
95 ** Text editors
96 [[file:screenshots/text editors.png]]
97
98 Initial test for creating user interfaces in 3D and:
99 + window focus handling
100 + picking objecs using mouse
101 + redirecting keyboard input to focused window
102
103
104 Window focus acts like a stack.
105
106 When window is clicked with the mouse, previously focused window (if
107 any) is pushed to the focus stack and new window receives focus. Red
108 frame appears around the window to indicate this.
109
110 When ESC key is pressed, window focus is returned to previous window
111 (if any).
112
113 When any window is focused, all keyboard input is redirected to that
114 window, including cursor keys. To be able to navigate around the world
115 again, window must be unfocused first using ESC key.
116
117
118 + TODO:
119   + Improve focus handling:
120     + Perhaps add shortcut to navigate world without exiting entire
121       stack of focus.
122     + Possibility to retain and reuse recently focused elements.
123     + Store user location in the world and view direction with the
124       focused window. So that when returning focus to far away object,
125       user is redirected also to proper location in the world.
126   + Possibility to store recently visited locations in the world and
127     return to them.
128 ** Mathematical formulas
129 [[file:screenshots/mathematical formulas.png]]
130
131 + TODO: instead of projecting 2D visualizations onto 3D space,
132   visualize some formula using all 3 dimensions avaliable.
133 ** Sinus heightmaps and sphere
134 [[file:screenshots/sinus heightmaps and sphere.png]]
135
136 Simple test scene. Easy to implement and looks nice.