c532d8f136e52c105f20cd301ffd26539ceda74b
[qbasicapps.git] / graphics / 3D / 3D Synthezier / doc / index.org
1 #+TITLE:  3D Synthezier
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 software is part of [[../../../../index.html][QBasic apps package]].
15
16 - This program is free software: you can redistribute it and/or modify
17   it under the terms of the [[https://www.gnu.org/licenses/lgpl.html][GNU Lesser General Public License]] as
18   published by the Free Software Foundation, either version 3 of the
19   License, or (at your option) any later version.
20
21 - Program author:
22   - Svjatoslav Agejenko
23   - Homepage: http://svjatoslav.eu
24   - Email: mailto://svjatoslav@svjatoslav.eu
25
26 - [[http://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
27
28 ** Source code
29 - [[http://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
30
31 - [[http://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=summary][Browse Git repository online]]
32
33 - Clone Git repository using command:
34   : git clone http://www2.svjatoslav.eu/git/qbasicapps.git
35
36 * Operating principle
37
38 Parses scene definition language and creates 3D world based on
39 it. Result will be in a [[https://en.wikipedia.org/wiki/Wavefront_.obj_file][wavefront obj file]], witch can be then
40 visualized using external renderer.
41
42 Basic concept of defining scene is:
43 - Simple and primitive objects are created on point and polygon level.
44 - More complex ones can be created my combinig already existing ones,
45   while applying various transformations on them.
46
47 Objects with all its subobjects can be rotated, mirrored or resized
48 omong any axis. Generator has built in cache for data input and output
49 to minimize file access.
50
51 * System requirements
52 | software | preferred version |
53 |----------+-------------------|
54 | DOS      |              6.22 |
55 | QBasic   |               4.5 |
56 * Installation
57 + Unpack ZIP file in any folder.
58 + update include path inside  bin/3dparse.bas
59 *** Directory layout
60 + bin
61   + 3dparse.bas - 3D generator main executable
62   + city1.3d - city with square-like buildings
63   + city2.3d - city with hexangular buildings
64   + result.mtl - shared material library
65   + *.bat - quick launch scripts
66
67 + include - 3D objects used to compose the scene
68 * Scene description language
69 (read examples...)
70
71
72 : here
73 defines new segment
74
75 : p  x y z
76 defines new point
77
78 : f  p1 p2 p3 p4
79 defines new polygon,  p4  may be unused
80
81
82 : warn  <message>
83 displays warning message, and wait for key
84
85 : end
86 terminates parser
87
88 : mtl  material
89 selects material
90
91 : mtlrnd  material ...
92 selects random material from list
93
94 : obj  object xz45 xy20 x+3 y*2
95 includes sub object, can be rotated moved or resized, across X Y Z. If
96 object name begin vith ~ then it will be loaded from current
97 directory.  if object name ends with ~ then object will be parsed
98 directly from file, and not chached, to allow loading of greater than
99 500 lines files.
100
101 [[file:rotation.png]]
102
103
104 : rnd  p^1^2^3 p^7^2^1
105 select random command to execute, ^ will be converted to spaces.
106
107 : # whatever text
108 comment
109
110 : out  file
111 specify output file name, must be first command
112
113 : set  variable  contents
114 set variable contents, variable must be number, contents can be
115 string. max variables is 100. first is 0.
116
117 : anycommand %1 anything
118 inserts variable 1 contents info line
119
120 : cmp  flag string1 string2
121 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.
122
123 : ?flag anycommand
124 executes command if flag is true.
125
126 exapmle: ?3 obj car z*2 xy45
127
128 : dum
129 dummy function, does notheing
130
131 * Usage
132 Make sure you have QB binaries in your PATH.  Execute
133 : bin/city1.bat
134 or
135 : bin/city2.bat
136 to generate example cities. After parsing is finished, appropriate
137 *.obj files will appear in the bin directory holding generated scene.
138 Visualize scene with your favourite renderer.
139 * Examples
140 Download Blender files:
141 | file                   | size   |
142 |------------------------+--------|
143 | [[file:rectangular city.blend][rectangular city.blend]] | 3.6 MB |
144 | [[file:hexagonal city.blend][hexagonal city.blend]]   | 21 MB  |
145
146 They were produced by importing generated [[https://en.wikipedia.org/wiki/Wavefront_.obj_file][wavefront obj files]] into
147 [[https://www.blender.org/][Blender]].
148
149 ** Rectangular city
150 [[file:rectangular city, 1.jpeg]]
151
152 [[file:rectangular city, 2.jpeg]]
153
154 [[file:rectangular city, 3.jpeg]]
155 ** Hexagonal city
156 [[file:hexagonal city, 1.jpeg]]
157
158 [[file:hexagonal city, 2.jpeg]]
159
160 [[file:hexagonal city, 3.jpeg]]