Prefer HTTPS. Publish example Blender files.
[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 - [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]]
27
28 ** Source code
29 - [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]]
30
31 - [[https://www2.svjatoslav.eu/gitweb/?p=qbasicapps.git;a=summary][Browse Git repository online]]
32
33 - Clone Git repository using command:
34   : git clone https://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 | tested 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 ** here
71  : here
72  defines new segment
73 ** p
74  : p  x y z
75  defines new point
76 ** f
77  : f  p1 p2 p3 p4
78  defines new polygon,  p4  may be unused
79 ** warn
80  : warn  <message>
81  displays warning message, and wait for key
82 ** end
83  : end
84  terminates parser
85 ** mtl
86  : mtl  material
87  selects material
88 ** mtlrnd
89  : mtlrnd  material ...
90  selects random material from list
91 ** obj
92  : obj  object xz45 xy20 x+3 y*2
93  includes sub object, can be rotated moved or resized, across X Y Z. If
94  object name begin vith ~ then it will be loaded from current
95  directory.  if object name ends with ~ then object will be parsed
96  directly from file, and not chached, to allow loading of greater than
97  500 lines files.
98
99  [[file:rotation.png]]
100 ** rnd
101  : rnd  p^1^2^3 p^7^2^1
102  select random command to execute, ^ will be converted to spaces.
103 ** #
104  : # whatever text
105  comment
106 ** out
107  : out  file
108  specify output file name, must be first command
109 ** set
110  : set  variable  contents
111  set variable contents, variable must be number, contents can be
112  string. max variables is 100. first is 0.
113 ** variables usage
114  : anycommand %1 anything
115  inserts variable 1 contents info line
116 ** cmp
117  : cmp  flag string1 string2
118  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.
119 ** ?
120  : ?flag anycommand
121  executes command if flag is true.
122
123  exapmle: ?3 obj car z*2 xy45
124 ** dum
125  : dum
126  dummy function, does notheing
127
128 * Usage
129 Make sure you have QB binaries in your PATH.  Execute
130 : bin/city1.bat
131 or
132 : bin/city2.bat
133 to generate example cities. After parsing is finished, appropriate
134 *.obj files will appear in the bin directory holding generated scene.
135 Visualize scene with your favourite renderer.
136 * Examples
137 Download Blender files:
138 | file                   | size   |
139 |------------------------+--------|
140 | [[file:rectangular city.blend][rectangular city.blend]] | 3.6 MB |
141 | [[file:hexagonal city.blend][hexagonal city.blend]]   | 21 MB  |
142
143 They were produced by importing generated [[https://en.wikipedia.org/wiki/Wavefront_.obj_file][wavefront obj files]] into
144 [[https://www.blender.org/][Blender]].
145
146 ** Rectangular city
147 [[file:rectangular city, 1.jpeg]]
148
149 [[file:rectangular city, 2.jpeg]]
150
151 [[file:rectangular city, 3.jpeg]]
152 ** Hexagonal city
153 [[file:hexagonal city, 1.jpeg]]
154
155 [[file:hexagonal city, 2.jpeg]]
156
157 [[file:hexagonal city, 3.jpeg]]