Code refactoring
[sixth-3d-demos.git] / doc / index.html
index 680aad8..a1dd806 100644 (file)
@@ -3,12 +3,12 @@
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
-<!-- 2016-08-23 Tue 09:35 -->
-<meta  http-equiv="Content-Type" content="text/html;charset=utf-8" />
-<meta  name="viewport" content="width=device-width, initial-scale=1" />
+<!-- 2021-05-29 Sat 02:31 -->
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
 <title>Sixth 3D engine demos</title>
-<meta  name="generator" content="Org-mode" />
-<meta  name="author" content="Svjatoslav Agejenko" />
+<meta name="generator" content="Org mode" />
+<meta name="author" content="Svjatoslav Agejenko" />
 <style type="text/css">
  <!--/*--><![CDATA[/*><!--*/
   .title  { text-align: center;
@@ -40,7 +40,7 @@
   }
   pre.src {
     position: relative;
-    overflow: visible;
+    overflow: auto;
     padding-top: 1.2em;
   }
   pre.src:before {
     padding: 3px;
     border: 1px solid black;
   }
-  pre.src:hover:before { display: inline;}
-  pre.src-sh:before    { content: 'sh'; }
-  pre.src-bash:before  { content: 'sh'; }
+  pre.src:hover:before { display: inline; margin-top: 14px;}
+  /* Languages per Org manual */
+  pre.src-asymptote:before { content: 'Asymptote'; }
+  pre.src-awk:before { content: 'Awk'; }
+  pre.src-C:before { content: 'C'; }
+  /* pre.src-C++ doesn't work in CSS */
+  pre.src-clojure:before { content: 'Clojure'; }
+  pre.src-css:before { content: 'CSS'; }
+  pre.src-D:before { content: 'D'; }
+  pre.src-ditaa:before { content: 'ditaa'; }
+  pre.src-dot:before { content: 'Graphviz'; }
+  pre.src-calc:before { content: 'Emacs Calc'; }
   pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
-  pre.src-R:before     { content: 'R'; }
-  pre.src-perl:before  { content: 'Perl'; }
-  pre.src-java:before  { content: 'Java'; }
-  pre.src-sql:before   { content: 'SQL'; }
+  pre.src-fortran:before { content: 'Fortran'; }
+  pre.src-gnuplot:before { content: 'gnuplot'; }
+  pre.src-haskell:before { content: 'Haskell'; }
+  pre.src-hledger:before { content: 'hledger'; }
+  pre.src-java:before { content: 'Java'; }
+  pre.src-js:before { content: 'Javascript'; }
+  pre.src-latex:before { content: 'LaTeX'; }
+  pre.src-ledger:before { content: 'Ledger'; }
+  pre.src-lisp:before { content: 'Lisp'; }
+  pre.src-lilypond:before { content: 'Lilypond'; }
+  pre.src-lua:before { content: 'Lua'; }
+  pre.src-matlab:before { content: 'MATLAB'; }
+  pre.src-mscgen:before { content: 'Mscgen'; }
+  pre.src-ocaml:before { content: 'Objective Caml'; }
+  pre.src-octave:before { content: 'Octave'; }
+  pre.src-org:before { content: 'Org mode'; }
+  pre.src-oz:before { content: 'OZ'; }
+  pre.src-plantuml:before { content: 'Plantuml'; }
+  pre.src-processing:before { content: 'Processing.js'; }
+  pre.src-python:before { content: 'Python'; }
+  pre.src-R:before { content: 'R'; }
+  pre.src-ruby:before { content: 'Ruby'; }
+  pre.src-sass:before { content: 'Sass'; }
+  pre.src-scheme:before { content: 'Scheme'; }
+  pre.src-screen:before { content: 'Gnu Screen'; }
+  pre.src-sed:before { content: 'Sed'; }
+  pre.src-sh:before { content: 'shell'; }
+  pre.src-sql:before { content: 'SQL'; }
+  pre.src-sqlite:before { content: 'SQLite'; }
+  /* additional languages in org.el's org-babel-load-languages alist */
+  pre.src-forth:before { content: 'Forth'; }
+  pre.src-io:before { content: 'IO'; }
+  pre.src-J:before { content: 'J'; }
+  pre.src-makefile:before { content: 'Makefile'; }
+  pre.src-maxima:before { content: 'Maxima'; }
+  pre.src-perl:before { content: 'Perl'; }
+  pre.src-picolisp:before { content: 'Pico Lisp'; }
+  pre.src-scala:before { content: 'Scala'; }
+  pre.src-shell:before { content: 'Shell Script'; }
+  pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
+  /* additional language identifiers per "defun org-babel-execute"
+       in ob-*.el */
+  pre.src-cpp:before  { content: 'C++'; }
+  pre.src-abc:before  { content: 'ABC'; }
+  pre.src-coq:before  { content: 'Coq'; }
+  pre.src-groovy:before  { content: 'Groovy'; }
+  /* additional language identifiers from org-babel-shell-names in
+     ob-shell.el: ob-shell is the only babel language using a lambda to put
+     the execution function name together. */
+  pre.src-bash:before  { content: 'bash'; }
+  pre.src-csh:before  { content: 'csh'; }
+  pre.src-ash:before  { content: 'ash'; }
+  pre.src-dash:before  { content: 'dash'; }
+  pre.src-ksh:before  { content: 'ksh'; }
+  pre.src-mksh:before  { content: 'mksh'; }
+  pre.src-posh:before  { content: 'posh'; }
+  /* Additional Emacs modes also supported by the LaTeX listings package */
+  pre.src-ada:before { content: 'Ada'; }
+  pre.src-asm:before { content: 'Assembler'; }
+  pre.src-caml:before { content: 'Caml'; }
+  pre.src-delphi:before { content: 'Delphi'; }
+  pre.src-html:before { content: 'HTML'; }
+  pre.src-idl:before { content: 'IDL'; }
+  pre.src-mercury:before { content: 'Mercury'; }
+  pre.src-metapost:before { content: 'MetaPost'; }
+  pre.src-modula-2:before { content: 'Modula-2'; }
+  pre.src-pascal:before { content: 'Pascal'; }
+  pre.src-ps:before { content: 'PostScript'; }
+  pre.src-prolog:before { content: 'Prolog'; }
+  pre.src-simula:before { content: 'Simula'; }
+  pre.src-tcl:before { content: 'tcl'; }
+  pre.src-tex:before { content: 'TeX'; }
+  pre.src-plain-tex:before { content: 'Plain TeX'; }
+  pre.src-verilog:before { content: 'Verilog'; }
+  pre.src-vhdl:before { content: 'VHDL'; }
+  pre.src-xml:before { content: 'XML'; }
+  pre.src-nxml:before { content: 'XML'; }
+  /* add a generic configuration mode; LaTeX export needs an additional
+     (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
+  pre.src-conf:before { content: 'Configuration File'; }
 
   table { border-collapse:collapse; }
   caption.t-above { caption-side: top; }
   .footdef  { margin-bottom: 1em; }
   .figure { padding: 1em; }
   .figure p { text-align: center; }
+  .equation-container {
+    display: table;
+    text-align: center;
+    width: 100%;
+  }
+  .equation {
+    vertical-align: middle;
+  }
+  .equation-label {
+    display: table-cell;
+    text-align: right;
+    vertical-align: middle;
+  }
   .inlinetask {
     padding: 10px;
     border: 2px solid gray;
     { font-size: 10px; font-weight: bold; white-space: nowrap; }
   .org-info-js_search-highlight
     { background-color: #ffff00; color: #000000; font-weight: bold; }
+  .org-svg { width: 90%; }
   /*]]>*/-->
 </style>
-<link rel="stylesheet" type="text/css" href="http://thomasf.github.io/solarized-css/solarized-dark.min.css" />
+<link rel="stylesheet" type="text/css" href="https://thomasf.github.io/solarized-css/solarized-dark.min.css" />
 <script type="text/javascript">
-/*
-@licstart  The following is the entire license notice for the
-JavaScript code in this tag.
-
-Copyright (C) 2012-2013 Free Software Foundation, Inc.
-
-The JavaScript code in this tag is free software: you can
-redistribute it and/or modify it under the terms of the GNU
-General Public License (GNU GPL) as published by the Free Software
-Foundation, either version 3 of the License, or (at your option)
-any later version.  The code is distributed WITHOUT ANY WARRANTY;
-without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
-
-As additional permission under GNU GPL version 3 section 7, you
-may distribute non-source (e.g., minimized or compacted) forms of
-that code without the copy of the GNU GPL normally required by
-section 4, provided you include this license notice and a URL
-through which recipients can access the Corresponding Source.
-
-
-@licend  The above is the entire license notice
-for the JavaScript code in this tag.
-*/
+// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
 <!--/*--><![CDATA[/*><!--*/
- function CodeHighlightOn(elem, id)
- {
-   var target = document.getElementById(id);
-   if(null != target) {
-     elem.cacheClassElem = elem.className;
-     elem.cacheClassTarget = target.className;
-     target.className = "code-highlighted";
-     elem.className   = "code-highlighted";
-   }
- }
- function CodeHighlightOff(elem, id)
- {
-   var target = document.getElementById(id);
-   if(elem.cacheClassElem)
-     elem.className = elem.cacheClassElem;
-   if(elem.cacheClassTarget)
-     target.className = elem.cacheClassTarget;
- }
-/*]]>*///-->
+     function CodeHighlightOn(elem, id)
+     {
+       var target = document.getElementById(id);
+       if(null != target) {
+         elem.classList.add("code-highlighted");
+         target.classList.add("code-highlighted");
+       }
+     }
+     function CodeHighlightOff(elem, id)
+     {
+       var target = document.getElementById(id);
+       if(null != target) {
+         elem.classList.remove("code-highlighted");
+         target.classList.remove("code-highlighted");
+       }
+     }
+    /*]]>*///-->
+// @license-end
 </script>
 </head>
 <body>
@@ -149,54 +224,332 @@ for the JavaScript code in this tag.
 <h2>Table of Contents</h2>
 <div id="text-table-of-contents">
 <ul>
-<li><a href="#orgheadline1">1. Description</a></li>
+<li><a href="#org4f0e7fe">1. General</a>
+<ul>
+<li><a href="#orga46b71e">1.1. Source code</a></li>
+</ul>
+</li>
+<li><a href="#orgef4de6a">2. Overview</a></li>
+<li><a href="#org3f74fff">3. Navigating in space</a></li>
+<li><a href="#org3b10dd6">4. Example scenes in this repository</a>
+<ul>
+<li><a href="#org6ce2160">4.1. Raytracing through voxels</a></li>
+<li><a href="#org4a93a25">4.2. Conway's Game of Life</a></li>
+<li><a href="#org6ee86f3">4.3. Text editors</a></li>
+<li><a href="#orgdaa46bd">4.4. Mathematical formulas</a></li>
+<li><a href="#orga9bf86e">4.5. Sinus heightmaps and sphere</a></li>
+</ul>
+</li>
 </ul>
 </div>
 </div>
-<hr  />
-<ul class="org-ul">
-<li>This is a subproject of <a href="http://www2.svjatoslav.eu/gitbrowse/sixth-3d/doc/index.html">Sixth 3D</a></li>
-<li><a href="http://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=snapshot;h=HEAD;sf=tgz">download latest snapshot</a></li>
 
-<li>This program is free software; you can redistribute it and/or modify it under
-the terms of version 3 of the <a href="https://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a> or later as
-published by the Free Software Foundation.</li>
+<div id="outline-container-org4f0e7fe" class="outline-2">
+<h2 id="org4f0e7fe"><span class="section-number-2">1</span> General</h2>
+<div class="outline-text-2" id="text-1">
+<ul class="org-ul">
+<li>This program is free software: released under Creative Commons Zero
+(CC0) license</li>
 
 <li>Program author:
 <ul class="org-ul">
 <li>Svjatoslav Agejenko</li>
-<li>Homepage: <a href="http://svjatoslav.eu/">http://svjatoslav.eu/</a></li>
-<li>Email: <a href="mailto://svjatoslav@svjatoslav.eu/">mailto://svjatoslav@svjatoslav.eu/</a></li>
+<li>Homepage: <a href="https://svjatoslav.eu">https://svjatoslav.eu</a></li>
+<li>Email: <a href="mailto://svjatoslav@svjatoslav.eu">mailto://svjatoslav@svjatoslav.eu</a></li>
 </ul></li>
 
-<li><a href="http://svjatoslav.eu/programs.jsp">other applications hosted at svjatoslav.eu</a></li>
+<li><a href="https://www.svjatoslav.eu/projects/">Other software projects hosted at svjatoslav.eu</a></li>
 </ul>
+</div>
 
+<div id="outline-container-orga46b71e" class="outline-3">
+<h3 id="orga46b71e"><span class="section-number-3">1.1</span> Source code</h3>
+<div class="outline-text-3" id="text-1-1">
+<ul class="org-ul">
+<li><a href="https://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=snapshot;h=HEAD;sf=tgz">Download latest snapshot in TAR GZ format</a></li>
+
+<li><a href="https://www2.svjatoslav.eu/gitweb/?p=sixth-3d-demos.git;a=summary">Browse Git repository online</a></li>
+
+<li><p>
+Clone Git repository using command:
+</p>
+<pre class="example">
+git clone https://www2.svjatoslav.eu/git/sixth-3d-demos.git
+</pre></li>
+</ul>
+</div>
+</div>
+</div>
+
+<div id="outline-container-orgef4de6a" class="outline-2">
+<h2 id="orgef4de6a"><span class="section-number-2">2</span> Overview</h2>
+<div class="outline-text-2" id="text-2">
+<p>
+Goal of this project is to show off capabilities and API usage of
+<a href="https://www3.svjatoslav.eu/projects/sixth-3d/">Sixth 3D</a> engine.
+</p>
 
-<div id="outline-container-orgheadline1" class="outline-2">
-<h2 id="orgheadline1"><span class="section-number-2">1</span> Description</h2>
-<div class="outline-text-2" id="text-1">
 <p>
-Goal of this project is to show off capabilities of <a href="http://www2.svjatoslav.eu/gitbrowse/sixth-3d/doc/index.html">Sixth 3D</a> engine. Also to
-show examples of its usage.
+All <a href="#org3b10dd6">example scenes in this repository</a> render at interactive
+framerates.
+</p>
+
+<p>
+Download runnable JAR file: <a href="sixth-3d-demos.jar">sixth-3d-demos.jar</a>
+</p>
+
+<p>
+To start demo application, use command:
+</p>
+<pre class="example">
+java -jar sixth-3d-demos.jar
+</pre>
+</div>
+</div>
+
+<div id="outline-container-org3f74fff" class="outline-2">
+<h2 id="org3f74fff"><span class="section-number-2">3</span> Navigating in space</h2>
+<div class="outline-text-2" id="text-3">
+<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
+
+
+<colgroup>
+<col  class="org-left" />
+
+<col  class="org-left" />
+</colgroup>
+<thead>
+<tr>
+<th scope="col" class="org-left">key</th>
+<th scope="col" class="org-left">result</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="org-left">cursor keys</td>
+<td class="org-left">move: left, right, forward, backward</td>
+</tr>
+
+<tr>
+<td class="org-left">mouse scroll wheel</td>
+<td class="org-left">move: up, down</td>
+</tr>
+
+<tr>
+<td class="org-left">dragging with mouse</td>
+<td class="org-left">look around</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+
+<div id="outline-container-org3b10dd6" class="outline-2">
+<h2 id="org3b10dd6"><span class="section-number-2">4</span> Example scenes in this repository</h2>
+<div class="outline-text-2" id="text-4">
+</div>
+<div id="outline-container-org6ce2160" class="outline-3">
+<h3 id="org6ce2160"><span class="section-number-3">4.1</span> Raytracing through voxels</h3>
+<div class="outline-text-3" id="text-4-1">
+
+<div id="orgc8737da" class="figure">
+<p><img src="screenshots/raytracing fractal in voxel polygon hybrid scene.png" alt="raytracing fractal in voxel polygon hybrid scene.png" />
 </p>
+</div>
 
+<p>
+Test scene that is generated simultaneously using:
+</p>
+<ul class="org-ul">
+<li>conventional polygons
+<ul class="org-ul">
+<li>for realtime navigation, and</li>
+</ul></li>
+<li>voxels
+<ul class="org-ul">
+<li>for on-demand raytracing</li>
+</ul></li>
+</ul>
 
-<div class="figure">
-<p><a href="screenshots/index.html"><img src="screenshots.png" alt="screenshots.png" /></a>
+<p>
+Instead of storing voxels in dumb [X * Y * Z] array, dynamically
+partitioned <a href="https://en.wikipedia.org/wiki/Octree">octree</a> is used to compress data. Press "r" key anywhere in
+the scene to raytrace current view through compressed voxel
+datastructure.
 </p>
 </div>
+</div>
 
+<div id="outline-container-org4a93a25" class="outline-3">
+<h3 id="org4a93a25"><span class="section-number-3">4.2</span> Conway's Game of Life</h3>
+<div class="outline-text-3" id="text-4-2">
 <p>
-Sample scenes rendered at interactive framerates by Sixth 3D engine.
+The Game of Life, also known simply as Life, is a cellular automaton
+devised by the British mathematician John Horton Conway in 1970.
 </p>
+
+<ul class="org-ul">
+<li><a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life</a>
+<ul class="org-ul">
+<li>Game rules:
+<ul class="org-ul">
+<li>2 cell states: alive / dead</li>
+<li>Each cell sees 8 neighboring cells.</li>
+<li>If alive cell neighbors count is 2 or 3, then cell survives,
+otherwise it dies.</li>
+<li>Dead cell becomes alive if neighbors count is exactly 3.</li>
+</ul></li>
+</ul></li>
+</ul>
+
+
+<div id="org078306e" class="figure">
+<p><img src="screenshots/life.png" alt="life.png" />
+</p>
+</div>
+
+<p>
+Current application projects 2D game grid/matrix onto three
+dimensional space. Extra dimension (height) is used to visualize
+history (previous iterations) using glowing dots suspended in space.
+</p>
+
+<p>
+Usage:
+</p>
+<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
+
+
+<colgroup>
+<col  class="org-left" />
+
+<col  class="org-left" />
+</colgroup>
+<thead>
+<tr>
+<th scope="col" class="org-left">key</th>
+<th scope="col" class="org-left">result</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="org-left">mouse click on the cell (cell)</td>
+<td class="org-left">toggles cell state</td>
+</tr>
+
+<tr>
+<td class="org-left">&lt;space&gt;</td>
+<td class="org-left">next iteration</td>
+</tr>
+
+<tr>
+<td class="org-left">ENTER</td>
+<td class="org-left">next iteeration with the history</td>
+</tr>
+
+<tr>
+<td class="org-left">"c"</td>
+<td class="org-left">clear the matrix</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+
+<div id="outline-container-org6ee86f3" class="outline-3">
+<h3 id="org6ee86f3"><span class="section-number-3">4.3</span> Text editors</h3>
+<div class="outline-text-3" id="text-4-3">
+
+<div id="orgf87c091" class="figure">
+<p><img src="screenshots/text editors.png" alt="text editors.png" />
+</p>
+</div>
+
+<p>
+Initial test for creating user interfaces in 3D and:
+</p>
+<ul class="org-ul">
+<li>window focus handling</li>
+<li>picking objecs using mouse</li>
+<li>redirecting keyboard input to focused window</li>
+</ul>
+
+
+<p>
+Window focus acts like a stack.
+</p>
+
+<p>
+When window is clicked with the mouse, previously focused window (if
+any) is pushed to the focus stack and new window receives focus. Red
+frame appears around the window to indicate this.
+</p>
+
+<p>
+When ESC key is pressed, window focus is returned to previous window
+(if any).
+</p>
+
+<p>
+When any window is focused, all keyboard input is redirected to that
+window, including cursor keys. To be able to navigate around the world
+again, window must be unfocused first using ESC key.
+</p>
+
+
+<ul class="org-ul">
+<li>TODO:
+<ul class="org-ul">
+<li>Improve focus handling:
+<ul class="org-ul">
+<li>Perhaps add shortcut to navigate world without exiting entire
+stack of focus.</li>
+<li>Possibility to retain and reuse recently focused elements.</li>
+<li>Store user location in the world and view direction with the
+focused window. So that when returning focus to far away object,
+user is redirected also to proper location in the world.</li>
+</ul></li>
+<li>Possibility to store recently visited locations in the world and
+return to them.</li>
+</ul></li>
+</ul>
+</div>
+</div>
+<div id="outline-container-orgdaa46bd" class="outline-3">
+<h3 id="orgdaa46bd"><span class="section-number-3">4.4</span> Mathematical formulas</h3>
+<div class="outline-text-3" id="text-4-4">
+
+<div id="orgf582a24" class="figure">
+<p><img src="screenshots/mathematical formulas.png" alt="mathematical formulas.png" />
+</p>
+</div>
+
+<ul class="org-ul">
+<li>TODO: instead of projecting 2D visualizations onto 3D space,
+visualize some formula using all 3 dimensions avaliable.</li>
+</ul>
+</div>
+</div>
+<div id="outline-container-orga9bf86e" class="outline-3">
+<h3 id="orga9bf86e"><span class="section-number-3">4.5</span> Sinus heightmaps and sphere</h3>
+<div class="outline-text-3" id="text-4-5">
+
+<div id="org4fe1971" class="figure">
+<p><img src="screenshots/sinus heightmaps and sphere.png" alt="sinus heightmaps and sphere.png" />
+</p>
+</div>
+
+<p>
+Simple test scene. Easy to implement and looks nice.
+</p>
+</div>
 </div>
 </div>
 </div>
 <div id="postamble" class="status">
 <p class="author">Author: Svjatoslav Agejenko</p>
-<p class="date">Created: 2016-08-23 Tue 09:35</p>
-<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
+<p class="date">Created: 2021-05-29 Sat 02:31</p>
+<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
 </div>
 </body>
 </html>