Fixed broken links.
[qbasicapps.git] / graphics / 3D / 3D Synthezier / doc / index.org
1 #+TITLE:  3D Synthezier
2
3 -----
4 - This software is part of [[../../../../index.html][QBasic apps package]].
5
6 Parses scene definition language and creates 3D world based on
7 it. Result will be in a [[https://en.wikipedia.org/wiki/Wavefront_.obj_file][wavefront obj file]], witch can be then
8 visualized using external renderer.
9
10 Basic concept of defining scene is:
11 - Simple and primitive objects are created on point and polygon level.
12 - More complex ones can be created my combinig already existing ones,
13   while applying various transformations on them.
14
15 Objects with all its subobjects can be rotated, mirrored or resized
16 omong any axis. Generator has built in cache for data input and output
17 to minimize file access.
18
19 * System requirements
20 | software | preferred version |
21 |----------+-------------------|
22 | DOS      |              6.22 |
23 | QBasic   |               4.5 |
24 * Installation
25 + Unpack ZIP file in any folder.
26 + update include path inside  bin/3dparse.bas
27 *** Directory layout
28 + bin
29   + 3dparse.bas - 3D generator main executable
30   + city1.3d - city with square-like buildings
31   + city2.3d - city with hexangular buildings
32   + result.mtl - shared material library
33   + *.bat - quick launch scripts
34
35 + include - 3D objects used to compose the scene
36 * Scene description language
37 (read examples...)
38
39
40 : here
41 defines new segment
42
43 : p  x y z
44 defines new point
45
46 : f  p1 p2 p3 p4
47 defines new polygon,  p4  may be unused
48
49
50 : warn  <message>
51 displays warning message, and wait for key
52
53 : end
54 terminates parser
55
56 : mtl  material
57 selects material
58
59 : mtlrnd  material ...
60 selects random material from list
61
62 : obj  object xz45 xy20 x+3 y*2
63 includes sub object, can be rotated moved or resized, across X Y Z. If
64 object name begin vith ~ then it will be loaded from current
65 directory.  if object name ends with ~ then object will be parsed
66 directly from file, and not chached, to allow loading of greater than
67 500 lines files.
68
69 [[file:rotation.png]]
70
71
72 : rnd  p^1^2^3 p^7^2^1
73 select random command to execute, ^ will be converted to spaces.
74
75 : # whatever text
76 comment
77
78 : out  file
79 specify output file name, must be first command
80
81 : set  variable  contents
82 set variable contents, variable must be number, contents can be
83 string. max variables is 100. first is 0.
84
85 : anycommand %1 anything
86 inserts variable 1 contents info line
87
88 : cmp  flag string1 string2
89 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.
90
91 : ?flag anycommand
92 executes command if flag is true.
93
94 exapmle: ?3 obj car z*2 xy45
95
96 : dum
97 dummy function, does notheing
98
99 * Usage
100 Make sure you have QB binaries in your PATH.  Execute
101 : bin/city1.bat
102 or
103 : bin/city2.bat
104 to generate example cities. After parsing is finished, appropriate
105 *.obj files will appear in the bin directory holding generated scene.
106 Visualize scene with your favourite renderer.
107 * Examples
108 Download Blender files:
109 | file                   | size   |
110 |------------------------+--------|
111 | [[file:rectangular city.blend][rectangular city.blend]] | 3.6 MB |
112 | [[file:hexagonal city.blend][hexagonal city.blend]]   | 21 MB  |
113
114 They were produced by importing generated [[https://en.wikipedia.org/wiki/Wavefront_.obj_file][wavefront obj files]] into
115 [[https://www.blender.org/][Blender]].
116
117 ** Rectangular city
118 [[file:rectangular city, 1.jpeg]]
119
120 [[file:rectangular city, 2.jpeg]]
121
122 [[file:rectangular city, 3.jpeg]]
123 ** Hexagonal city
124 [[file:hexagonal city, 1.jpeg]]
125
126 [[file:hexagonal city, 2.jpeg]]
127
128 [[file:hexagonal city, 3.jpeg]]
129
130 * (document settings) :noexport:
131 ** use dark style for TWBS-HTML exporter
132 #+HTML_HEAD: <link href="https://bootswatch.com/4/darkly/bootstrap.min.css" rel="stylesheet">
133 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
134 #+HTML_HEAD: <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>"
135 #+HTML_HEAD: <style type="text/css">
136 #+HTML_HEAD:   footer {background-color: #111 !important;}
137 #+HTML_HEAD:   pre {background-color: #111; color: #ccc;}
138 #+HTML_HEAD: </style>