fixed TOC
[qbasicapps.git] / graphics / 3D / 3D Synthezier / doc / index.html
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <title>3D Synthezier</title>
5 <!-- 2018-06-24 Sun 03:07 -->
6 <meta charset="utf-8">
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 <meta name="generator" content="Org-mode">
9 <meta name="author" content="Svjatoslav Agejenko">
10 <link href="https://bootswatch.com/3/darkly/bootstrap.min.css" rel="stylesheet">
11 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
12 <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
13 <style type="text/css">
14 footer {background-color: #111 !important;}
15 pre {background-color: #111; color: #ccc;}
16 </style>
17 <style type="text/css">
18 /* org mode styles on top of twbs */
19
20 html {
21     position: relative;
22     min-height: 100%;
23 }
24
25 body {
26     font-size: 18px;
27     margin-bottom: 105px;
28 }
29
30 footer {
31     position: absolute;
32     bottom: 0;
33     width: 100%;
34     height: 101px;
35     background-color: #f5f5f5;
36 }
37
38 footer > div {
39     padding: 10px;
40 }
41
42 footer p {
43     margin: 0 0 5px;
44     text-align: center;
45     font-size: 16px;
46 }
47
48 #table-of-contents {
49     margin-top: 20px;
50     margin-bottom: 20px;
51 }
52
53 blockquote p {
54     font-size: 18px;
55 }
56
57 pre {
58     font-size: 16px;
59 }
60
61 .footpara {
62     display: inline-block;
63 }
64
65 figcaption {
66   font-size: 16px;
67   color: #666;
68   font-style: italic;
69   padding-bottom: 15px;
70 }
71
72 /* from twbs docs */
73
74 .bs-docs-sidebar.affix {
75     position: static;
76 }
77 @media (min-width: 768px) {
78     .bs-docs-sidebar {
79         padding-left: 20px;
80     }
81 }
82
83 /* All levels of nav */
84 .bs-docs-sidebar .nav > li > a {
85     display: block;
86     padding: 4px 20px;
87     font-size: 14px;
88     font-weight: 500;
89     color: #999;
90 }
91 .bs-docs-sidebar .nav > li > a:hover,
92 .bs-docs-sidebar .nav > li > a:focus {
93     padding-left: 19px;
94     color: #A1283B;
95     text-decoration: none;
96     background-color: transparent;
97     border-left: 1px solid #A1283B;
98 }
99 .bs-docs-sidebar .nav > .active > a,
100 .bs-docs-sidebar .nav > .active:hover > a,
101 .bs-docs-sidebar .nav > .active:focus > a {
102     padding-left: 18px;
103     font-weight: bold;
104     color: #A1283B;
105     background-color: transparent;
106     border-left: 2px solid #A1283B;
107 }
108
109 /* Nav: second level (shown on .active) */
110 .bs-docs-sidebar .nav .nav {
111     display: none; /* Hide by default, but at >768px, show it */
112     padding-bottom: 10px;
113 }
114 .bs-docs-sidebar .nav .nav > li > a {
115     padding-top: 1px;
116     padding-bottom: 1px;
117     padding-left: 30px;
118     font-size: 12px;
119     font-weight: normal;
120 }
121 .bs-docs-sidebar .nav .nav > li > a:hover,
122 .bs-docs-sidebar .nav .nav > li > a:focus {
123     padding-left: 29px;
124 }
125 .bs-docs-sidebar .nav .nav > .active > a,
126 .bs-docs-sidebar .nav .nav > .active:hover > a,
127 .bs-docs-sidebar .nav .nav > .active:focus > a {
128     padding-left: 28px;
129     font-weight: 500;
130 }
131
132 /* Nav: third level (shown on .active) */
133 .bs-docs-sidebar .nav .nav .nav {
134     padding-bottom: 10px;
135 }
136 .bs-docs-sidebar .nav .nav .nav > li > a {
137     padding-top: 1px;
138     padding-bottom: 1px;
139     padding-left: 40px;
140     font-size: 12px;
141     font-weight: normal;
142 }
143 .bs-docs-sidebar .nav .nav .nav > li > a:hover,
144 .bs-docs-sidebar .nav .nav .nav > li > a:focus {
145     padding-left: 39px;
146 }
147 .bs-docs-sidebar .nav .nav .nav > .active > a,
148 .bs-docs-sidebar .nav .nav .nav > .active:hover > a,
149 .bs-docs-sidebar .nav .nav .nav > .active:focus > a {
150     padding-left: 38px;
151     font-weight: 500;
152 }
153
154 /* Show and affix the side nav when space allows it */
155 @media (min-width: 992px) {
156     .bs-docs-sidebar .nav > .active > ul {
157         display: block;
158     }
159     /* Widen the fixed sidebar */
160     .bs-docs-sidebar.affix,
161     .bs-docs-sidebar.affix-bottom {
162         width: 213px;
163     }
164     .bs-docs-sidebar.affix {
165         position: fixed; /* Undo the static from mobile first approach */
166         top: 20px;
167     }
168     .bs-docs-sidebar.affix-bottom {
169         position: absolute; /* Undo the static from mobile first approach */
170     }
171     .bs-docs-sidebar.affix .bs-docs-sidenav,.bs-docs-sidebar.affix-bottom .bs-docs-sidenav {
172         margin-top: 0;
173         margin-bottom: 0
174     }
175 }
176 @media (min-width: 1200px) {
177     /* Widen the fixed sidebar again */
178     .bs-docs-sidebar.affix-bottom,
179     .bs-docs-sidebar.affix {
180         width: 263px;
181     }
182 }
183 </style>
184 <script type="text/javascript">
185 $(function() {
186     'use strict';
187
188     $('.bs-docs-sidebar li').first().addClass('active');
189
190     $(document.body).scrollspy({target: '.bs-docs-sidebar'});
191
192     $('.bs-docs-sidebar').affix();
193 });
194 </script>
195 </head>
196 <body>
197 <div id="content" class="container">
198 <div class="row"><div class="col-md-9"><h1 class="title">3D Synthezier</h1>
199
200 <div id="outline-container-sec-1" class="outline-2">
201 <h2 id="sec-1"><span class="section-number-2">1</span> General</h2>
202 <div class="outline-text-2" id="text-1">
203 <ul class="org-ul">
204 <li>This software is part of <a href="../../../../index.html">QBasic apps package</a>.
205 </li>
206
207 <li>This program is free software: you can redistribute it and/or modify
208 it under the terms of the <a href="https://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a> as
209 published by the Free Software Foundation, either version 3 of the
210 License, or (at your option) any later version.
211 </li>
212
213 <li>Program author:
214 <ul class="org-ul">
215 <li>Svjatoslav Agejenko
216 </li>
217 <li>Homepage: <a href="http://svjatoslav.eu">http://svjatoslav.eu</a>
218 </li>
219 <li>Email: <a href="mailto://svjatoslav@svjatoslav.eu">mailto://svjatoslav@svjatoslav.eu</a>
220 </li>
221 </ul>
222 </li>
223
224 <li><a href="http://www.svjatoslav.eu/projects/">Other software projects hosted at svjatoslav.eu</a>
225 </li>
226 </ul>
227 </div>
228
229 <div id="outline-container-sec-1-1" class="outline-3">
230 <h3 id="sec-1-1"><span class="section-number-3">1.1</span> Source code</h3>
231 <div class="outline-text-3" id="text-1-1">
232 <ul class="org-ul">
233 <li><a href="http://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=snapshot;h=HEAD;sf=tgz">Download latest snapshot in TAR GZ format</a>
234 </li>
235
236 <li><a href="http://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=summary">Browse Git repository online</a>
237 </li>
238
239 <li>Clone Git repository using command:
240 <pre class="example">
241 git clone http://www2.svjatoslav.eu/git/qbasicapps.git
242 </pre>
243 </li>
244 </ul>
245 </div>
246 </div>
247 </div>
248
249 <div id="outline-container-sec-2" class="outline-2">
250 <h2 id="sec-2"><span class="section-number-2">2</span> Operating principle</h2>
251 <div class="outline-text-2" id="text-2">
252 <p>
253 Parses scene definition language and creates 3D world based on
254 it. Result will be in a <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">wavefront obj file</a>, witch can be then
255 visualized using external renderer.
256 </p>
257
258 <p>
259 Basic concept of defining scene is:
260 </p>
261 <ul class="org-ul">
262 <li>Simple and primitive objects are created on point and polygon level.
263 </li>
264 <li>More complex ones can be created my combinig already existing ones,
265 while applying various transformations on them.
266 </li>
267 </ul>
268
269 <p>
270 Objects with all its subobjects can be rotated, mirrored or resized
271 omong any axis. Generator has built in cache for data input and output
272 to minimize file access.
273 </p>
274 </div>
275 </div>
276
277 <div id="outline-container-sec-3" class="outline-2">
278 <h2 id="sec-3"><span class="section-number-2">3</span> System requirements</h2>
279 <div class="outline-text-2" id="text-3">
280 <table class="table table-striped table-bordered table-hover table-condensed">
281
282
283 <colgroup>
284 <col  class="left">
285
286 <col  class="right">
287 </colgroup>
288 <thead>
289 <tr>
290 <th scope="col" class="text-left">software</th>
291 <th scope="col" class="text-right">preferred version</th>
292 </tr>
293 </thead>
294 <tbody>
295 <tr>
296 <td class="text-left">DOS</td>
297 <td class="text-right">6.22</td>
298 </tr>
299
300 <tr>
301 <td class="text-left">QBasic</td>
302 <td class="text-right">4.5</td>
303 </tr>
304 </tbody>
305 </table>
306 </div>
307 </div>
308 <div id="outline-container-sec-4" class="outline-2">
309 <h2 id="sec-4"><span class="section-number-2">4</span> Installation</h2>
310 <div class="outline-text-2" id="text-4">
311 <ul class="org-ul">
312 <li>Unpack ZIP file in any folder.
313 </li>
314 <li>update include path inside  bin/3dparse.bas
315 </li>
316 </ul>
317 </div>
318 <div id="outline-container-sec-4-0-1" class="outline-4">
319 <h4 id="sec-4-0-1"><span class="section-number-4">4.0.1</span> Directory layout</h4>
320 <div class="outline-text-4" id="text-4-0-1">
321 <ul class="org-ul">
322 <li>bin
323 <ul class="org-ul">
324 <li>3dparse.bas - 3D generator main executable
325 </li>
326 <li>city1.3d - city with square-like buildings
327 </li>
328 <li>city2.3d - city with hexangular buildings
329 </li>
330 <li>result.mtl - shared material library
331 </li>
332 <li>*.bat - quick launch scripts
333 </li>
334 </ul>
335 </li>
336
337 <li>include - 3D objects used to compose the scene
338 </li>
339 </ul>
340 </div>
341 </div>
342 </div>
343 <div id="outline-container-sec-5" class="outline-2">
344 <h2 id="sec-5"><span class="section-number-2">5</span> Scene description language</h2>
345 <div class="outline-text-2" id="text-5">
346 <p>
347 (read examples&#x2026;)
348 </p>
349
350
351 <pre class="example">
352 here
353 </pre>
354 <p>
355 defines new segment
356 </p>
357
358 <pre class="example">
359 p  x y z
360 </pre>
361 <p>
362 defines new point
363 </p>
364
365 <pre class="example">
366 f  p1 p2 p3 p4
367 </pre>
368 <p>
369 defines new polygon,  p4  may be unused
370 </p>
371
372
373 <pre class="example">
374 warn  &lt;message&gt;
375 </pre>
376 <p>
377 displays warning message, and wait for key
378 </p>
379
380 <pre class="example">
381 end
382 </pre>
383 <p>
384 terminates parser
385 </p>
386
387 <pre class="example">
388 mtl  material
389 </pre>
390 <p>
391 selects material
392 </p>
393
394 <pre class="example">
395 mtlrnd  material ...
396 </pre>
397 <p>
398 selects random material from list
399 </p>
400
401 <pre class="example">
402 obj  object xz45 xy20 x+3 y*2
403 </pre>
404 <p>
405 includes sub object, can be rotated moved or resized, across X Y Z. If
406 object name begin vith ~ then it will be loaded from current
407 directory.  if object name ends with ~ then object will be parsed
408 directly from file, and not chached, to allow loading of greater than
409 500 lines files.
410 </p>
411
412
413 <figure>
414 <p><img src="rotation.png" class="img-responsive" alt="rotation.png">
415 </p>
416 </figure>
417
418
419 <pre class="example">
420 rnd  p^1^2^3 p^7^2^1
421 </pre>
422 <p>
423 select random command to execute, ^ will be converted to spaces.
424 </p>
425
426 <pre class="example">
427 # whatever text
428 </pre>
429 <p>
430 comment
431 </p>
432
433 <pre class="example">
434 out  file
435 </pre>
436 <p>
437 specify output file name, must be first command
438 </p>
439
440 <pre class="example">
441 set  variable  contents
442 </pre>
443 <p>
444 set variable contents, variable must be number, contents can be
445 string. max variables is 100. first is 0.
446 </p>
447
448 <pre class="example">
449 anycommand %1 anything
450 </pre>
451 <p>
452 inserts variable 1 contents info line
453 </p>
454
455 <pre class="example">
456 cmp  flag string1 string2
457 </pre>
458 <p>
459 compares strings, and inserts TRUE to flag, if they are equal, else inserts FALSE. max 9 falgs, 0 first. Each subobject has its own flags.
460 </p>
461
462 <pre class="example">
463 ?flag anycommand
464 </pre>
465 <p>
466 executes command if flag is true.
467 </p>
468
469 <p>
470 exapmle: ?3 obj car z*2 xy45
471 </p>
472
473 <pre class="example">
474 dum
475 </pre>
476 <p>
477 dummy function, does notheing
478 </p>
479 </div>
480 </div>
481
482 <div id="outline-container-sec-6" class="outline-2">
483 <h2 id="sec-6"><span class="section-number-2">6</span> Usage</h2>
484 <div class="outline-text-2" id="text-6">
485 <p>
486 Make sure you have QB binaries in your PATH.  Execute
487 </p>
488 <pre class="example">
489 bin/city1.bat
490 </pre>
491 <p>
492 or
493 </p>
494 <pre class="example">
495 bin/city2.bat
496 </pre>
497 <p>
498 to generate example cities. After parsing is finished, appropriate
499 *.obj files will appear in the bin directory holding generated scene.
500 Visualize scene with your favourite renderer.
501 </p>
502 </div>
503 </div>
504 <div id="outline-container-sec-7" class="outline-2">
505 <h2 id="sec-7"><span class="section-number-2">7</span> Examples</h2>
506 <div class="outline-text-2" id="text-7">
507 <p>
508 Download Blender files:
509 </p>
510 <table class="table table-striped table-bordered table-hover table-condensed">
511
512
513 <colgroup>
514 <col  class="left">
515
516 <col  class="left">
517 </colgroup>
518 <thead>
519 <tr>
520 <th scope="col" class="text-left">file</th>
521 <th scope="col" class="text-left">size</th>
522 </tr>
523 </thead>
524 <tbody>
525 <tr>
526 <td class="text-left"><a href="rectangular city.blend">rectangular city.blend</a></td>
527 <td class="text-left">3.6 MB</td>
528 </tr>
529
530 <tr>
531 <td class="text-left"><a href="hexagonal city.blend">hexagonal city.blend</a></td>
532 <td class="text-left">21 MB</td>
533 </tr>
534 </tbody>
535 </table>
536
537 <p>
538 They were produced by importing generated <a href="https://en.wikipedia.org/wiki/Wavefront_.obj_file">wavefront obj files</a> into
539 <a href="https://www.blender.org/">Blender</a>.
540 </p>
541 </div>
542
543 <div id="outline-container-sec-7-1" class="outline-3">
544 <h3 id="sec-7-1"><span class="section-number-3">7.1</span> Rectangular city</h3>
545 <div class="outline-text-3" id="text-7-1">
546
547 <figure>
548 <p><img src="rectangular city, 1.jpeg" class="img-responsive" alt="rectangular city, 1.jpeg">
549 </p>
550 </figure>
551
552
553 <figure>
554 <p><img src="rectangular city, 2.jpeg" class="img-responsive" alt="rectangular city, 2.jpeg">
555 </p>
556 </figure>
557
558
559 <figure>
560 <p><img src="rectangular city, 3.jpeg" class="img-responsive" alt="rectangular city, 3.jpeg">
561 </p>
562 </figure>
563 </div>
564 </div>
565 <div id="outline-container-sec-7-2" class="outline-3">
566 <h3 id="sec-7-2"><span class="section-number-3">7.2</span> Hexagonal city</h3>
567 <div class="outline-text-3" id="text-7-2">
568
569 <figure>
570 <p><img src="hexagonal city, 1.jpeg" class="img-responsive" alt="hexagonal city, 1.jpeg">
571 </p>
572 </figure>
573
574
575 <figure>
576 <p><img src="hexagonal city, 2.jpeg" class="img-responsive" alt="hexagonal city, 2.jpeg">
577 </p>
578 </figure>
579
580
581 <figure>
582 <p><img src="hexagonal city, 3.jpeg" class="img-responsive" alt="hexagonal city, 3.jpeg">
583 </p>
584 </figure>
585 </div>
586 </div>
587 </div>
588 </div><div class="col-md-3"><nav id="table-of-contents">
589 <div id="text-table-of-contents" class="bs-docs-sidebar">
590 <ul class="nav">
591 <li><a href="#sec-1">1. General</a>
592 <ul class="nav">
593 <li><a href="#sec-1-1">1.1. Source code</a></li>
594 </ul>
595 </li>
596 <li><a href="#sec-2">2. Operating principle</a></li>
597 <li><a href="#sec-3">3. System requirements</a></li>
598 <li><a href="#sec-4">4. Installation</a></li>
599 <li><a href="#sec-5">5. Scene description language</a></li>
600 <li><a href="#sec-6">6. Usage</a></li>
601 <li><a href="#sec-7">7. Examples</a>
602 <ul class="nav">
603 <li><a href="#sec-7-1">7.1. Rectangular city</a></li>
604 <li><a href="#sec-7-2">7.2. Hexagonal city</a></li>
605 </ul>
606 </li>
607 </ul>
608 </div>
609 </nav>
610 </div></div></div>
611 <footer id="postamble" class="">
612 <div><p class="author">Author: Svjatoslav Agejenko</p>
613 <p class="date">Created: 2018-06-24 Sun 03:07</p>
614 <p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 25.1.1 (<a href="http://orgmode.org">Org-mode</a> 8.2.10)</p>
615 </div>
616 </footer>
617 </body>
618 </html>