1 : #VRML V2.0 utf8
2 :
3 : WorldInfo {
4 : info "Author: Martin Petricek"
5 : title "Tank"
6 : }
7 :
8 : PROTO BlackHole[] {
9 : Appearance {
10 : material Material {
11 : diffuseColor 0 0 0
12 : }
13 : }
14 : }
15 :
16 : #tank surface
17 : PROTO TankSurf [ ] {
18 : Appearance {
19 : material Material {
20 : diffuseColor 0.2 0.5 0
21 : ambientIntensity 0.2
22 : specularColor 0 1 0
23 : }
24 : }
25 : }
26 :
27 : #tank wheels
28 : PROTO TankWheelSurf [ ] {
29 : Appearance {
30 : material Material {
31 : diffuseColor 0 0.4 0
32 : ambientIntensity 0.3
33 : specularColor 0 0.3 0
34 : }
35 : }
36 : }
37 : #tank wheels dark
38 : PROTO TankWheelSurfDark [ ] {
39 : Appearance {
40 : material Material {
41 : diffuseColor 0 0.2 0
42 : ambientIntensity 0.3
43 : specularColor 0 0.3 0
44 : }
45 : }
46 : }
47 :
48 : DEF TankBottom Group {
49 : children [
50 : #back boxes
51 : Transform {
52 : translation -0.7 0.95 3.1
53 : children DEF TankBackBox Shape {
54 : appearance TankSurf {}
55 : geometry Box {
56 : size 1 0.06 1
57 : }
58 : }
59 : }
60 : Transform {
61 : translation 0.7 0.95 3.1
62 : children USE TankBackBox
63 : }
64 : Transform {
65 : translation 0 0.6 0.5
66 : children [
67 : Shape {
68 : appearance TankSurf {}
69 : #higher tank box
70 : geometry Box {
71 : size 2.7 0.65 6.7
72 : }
73 : }
74 : ]
75 : }
76 : Transform {
77 : translation 0 -0.4 0
78 : children [
79 : #lower tank box
80 : DEF TankWedge Shape {
81 : appearance TankSurf {}
82 : geometry IndexedFaceSet {
83 : coord Coordinate {
84 : point [
85 : -1.2 -0.65 -3.4,
86 : -1.2 -0.65 3.4,
87 : -1.2 0.65 4.1,
88 : -1.2 0.65 -4.1,
89 : 1.2 -0.65 -3.4,
90 : 1.2 -0.65 3.4,
91 : 1.2 0.65 4.1
92 : 1.2 0.65 -4.1,
93 : ]
94 : }
95 : coordIndex [
96 : 0 1 2 3 -1,
97 : 4 5 1 0 -1,
98 : 7 6 5 4 -1,
99 : 6 7 3 2 -1,
100 : 5 6 2 1 -1,
101 : 0 3 7 4 -1
102 : ]
103 : }
104 : }
105 : #middle tank box
106 : Transform {
107 : rotation 1 0 0 3.14
108 : scale 1.4 0.5 1
109 : translation 0 0.975 0
110 : children [
111 : USE TankWedge
112 : ]
113 : }
114 : ]
115 : }
116 :
117 : DEF TankWheelSide Group {
118 : children [
119 : DEF TankWheel Transform {
120 : rotation 0 0 1 1.57
121 : translation -1.4 -0.9 -3
122 : children [
123 : Shape {
124 : appearance TankWheelSurf {}
125 : geometry Cylinder{
126 : height 0.2
127 : radius 0.4
128 : bottom TRUE
129 : top TRUE
130 : }
131 : }
132 : Shape {
133 : appearance TankWheelSurfDark {}
134 : geometry Cylinder{
135 : height 0.25
136 : radius 0.32
137 : bottom TRUE
138 : top TRUE
139 : }
140 : }
141 : ]
142 : }
143 : Transform {
144 : translation 0 0 1.5
145 : children USE TankWheel
146 : }
147 : Transform {
148 : translation 0 0 3
149 : children USE TankWheel
150 : }
151 : Transform {
152 : translation 0 0 4.5
153 : children USE TankWheel
154 : }
155 : Transform {
156 : translation 0 0 6
157 : children USE TankWheel
158 : }
159 : #lower row
160 : Transform {
161 : translation 0 0.7 -0.5
162 : children USE TankWheel
163 : }
164 : Transform {
165 : translation 0 0.7 0.9
166 : children USE TankWheel
167 : }
168 : Transform {
169 : translation 0 0.7 2.3
170 : children USE TankWheel
171 : }
172 : Transform {
173 : translation 0 0.7 3.7
174 : children USE TankWheel
175 : }
176 : Transform {
177 : translation 0 0.7 5.1
178 : children USE TankWheel
179 : }
180 : Transform {
181 : translation 0 0.7 6.5
182 : children USE TankWheel
183 : }
184 :
185 : ]
186 : }
187 : Transform {
188 : translation 2.8 0 0
189 : children USE TankWheelSide
190 : }
191 : ]
192 : }
193 :
194 : Transform {
195 : translation -1.4 0 0
196 : children [
197 : DEF TankTrack Shape {
198 : appearance Appearance {
199 : material Material {
200 : diffuseColor 0.5 0.5 0.5
201 : shininess 0
202 : }
203 : }
204 : geometry Extrusion {
205 : creaseAngle 1.3
206 : beginCap FALSE
207 : endCap FALSE
208 : spine [
209 : 0 -1.3 -3.1,
210 :
211 : 0 -1.2 -3.3,
212 : 0 -1.1 -3.4,
213 : 0 -0.4 -3.85,
214 : 0 -0.2 -3.9,
215 : 0 0.0 -3.85
216 : 0 0.1 -3.75
217 :
218 : 0 0.2 -3.6,
219 : 0 0.2 3.6,
220 :
221 : 0 0.1 3.75
222 : 0 0.0 3.85
223 : 0 -0.2 3.9,
224 : 0 -0.4 3.85,
225 : 0 -1.1 3.4,
226 : 0 -1.2 3.3,
227 :
228 : 0 -1.3 3.1,
229 : 0 -1.3 -3.1
230 : ]
231 : crossSection [.02 .16, .02 -.16, -.02 -.16, -.02 .16, .02 .16]
232 : }
233 : }
234 : ]
235 : }
236 :
237 : Transform {
238 : translation 1.4 0 0
239 : children [
240 : USE TankTrack
241 : ]
242 : }
243 :
244 :
245 : Transform {
246 : translation 0.8 0.95 -2.2
247 : children [
248 : DEF TankEntrance Group {
249 : children [
250 : #interior
251 : # Shape {
252 : # appearance DEF TankInside Appearance {
253 : # material Material {
254 : # diffuseColor 0.3 0.3 0
255 : # ambientIntensity 0.3
256 : # specularColor 1 1 1
257 : # shininess 0.9
258 : # }
259 : # }
260 : # geometry Cylinder {
261 : # radius 0.4
262 : # top TRUE
263 : # height 0.05
264 : # bottom FALSE
265 : # }
266 : # }
267 : #rim
268 : Shape {
269 : appearance TankSurf {}
270 : geometry Cylinder {
271 : radius 0.5
272 : top TRUE
273 : height 0.03
274 : bottom FALSE
275 : }
276 : }
277 : #cover
278 : Transform {
279 : translation 0 0.04 0
280 : children [
281 : Shape {
282 : appearance TankSurf {}
283 : geometry Cylinder {
284 : radius 0.45
285 : top TRUE
286 : bottom FALSE
287 : height 0.09
288 : }
289 : }
290 : ]
291 : }
292 : #handle
293 : Transform {
294 : translation 0 0.1 -0.38
295 : children [
296 : Shape {
297 : appearance TankSurf {}
298 : geometry Box {
299 : size 0.08 0.03 0.25
300 : }
301 : }
302 : ]
303 : }
304 : #"axis" of rotation
305 : Transform {
306 : translation 0 0.05 0.42
307 : rotation 0 0 1 1.57
308 : children [
309 : Shape {
310 : appearance TankSurf {}
311 : geometry Cylinder {
312 : height 0.25
313 : radius 0.05
314 : }
315 : }
316 : ]
317 : }
318 : ]
319 : }
320 : ]
321 : }
322 :
323 : Transform {
324 : translation -0.8 0.95 -2.2
325 : children [
326 : USE TankEntrance
327 : ]
328 : }
329 :
330 : #turret
331 : Transform {
332 : translation 0 0.94 1
333 : children [
334 : DEF TankTop Group {
335 : children [
336 : #bottom thin
337 : Shape {
338 : appearance TankSurf {}
339 : geometry Cylinder {
340 : radius 1.4
341 : height 0.1
342 : top FALSE
343 : bottom FALSE
344 : }
345 : }
346 : #middle
347 : Transform { translation 0 0.55 0
348 : children [
349 : Shape {
350 : appearance TankSurf {}
351 : geometry Cylinder {
352 : radius 1.5
353 : height 1
354 : }
355 : }
356 : ]
357 : }
358 : #top cone
359 : Transform { translation 0 1.08 0
360 : children [
361 : Shape {
362 : appearance TankSurf {}
363 : geometry Cone {
364 : bottomRadius 1.5
365 : height 0.1
366 : bottom FALSE
367 : }
368 : }
369 : ]
370 : }
371 : #gun
372 : Transform {
373 : rotation 1 0 0 1.57
374 : translation 0 0.5 -2.7
375 : children [
376 : #hole
377 : Transform {
378 : translation 0 -1.5 0
379 : children [
380 : Shape {
381 : appearance BlackHole {}
382 : geometry Cylinder {
383 : radius 0.10
384 : height 0.001
385 : top FALSE
386 : side FALSE
387 : }
388 : }
389 : ]
390 : }
391 : Transform {
392 : translation 0 -1.4 0
393 : children [
394 : Shape {
395 : appearance TankSurf {}
396 : geometry Cylinder {
397 : radius 0.15
398 : height 0.2
399 : }
400 : }
401 : ]
402 : }
403 : Shape {
404 : appearance TankSurf {}
405 : geometry Cylinder {
406 : radius 0.12
407 : height 3
408 : top FALSE
409 : }
410 : }
411 : Shape {
412 : appearance TankSurf {}
413 : geometry Cylinder {
414 : radius 0.14
415 : height 1.1
416 : }
417 : }
418 : ]
419 : }
420 : #backwedge
421 : Transform {
422 : rotation 1 1 1 2.09
423 : translation 0 0.69 1.75
424 : children [
425 : Shape {
426 : appearance TankSurf {}
427 : geometry IndexedFaceSet {
428 : coord Coordinate {
429 : point [
430 : -0.35 -1.75 -1.45,
431 : -0.35 -1.75 1.45,
432 : -0.35 0.15 0.8,
433 : -0.35 0.15 -0.8,
434 : 0.35 -1.75 -1.45,
435 : 0.35 -1.75 1.45,
436 : 0.35 0.15 0.8
437 : 0.35 0.15 -0.8,
438 : ]
439 : }
440 : coordIndex [
441 : 0 1 2 3 -1,
442 : 4 5 1 0 -1,
443 : 7 6 5 4 -1,
444 : 6 7 3 2 -1,
445 : 5 6 2 1 -1,
446 : 0 3 7 4 -1
447 : ]
448 : }
449 : }
450 : ]
451 : }
452 : #gun rack part
453 : Transform {
454 : translation 0 0.5 -1.3
455 : rotation 0 0 1 1.57
456 : children [
457 : Shape {
458 : appearance TankSurf {}
459 : geometry Cylinder {
460 : radius 0.4
461 : height 0.3
462 : bottom TRUE
463 : top TRUE
464 : }
465 : }
466 : Shape {
467 : appearance TankSurf {}
468 : geometry Box {
469 : size 0.7 0.5 0.5
470 : }
471 : }
472 : ]
473 : }
474 : #turret entrances
475 : Transform {
476 : translation -0.7 1.1 0.45
477 : children [
478 : USE TankEntrance
479 : ]
480 : }
481 : Transform {
482 : translation 0.7 1.1 0.45
483 : children [
484 : USE TankEntrance
485 : ]
486 : }
487 : ]
488 : }
489 : ]
490 : }
491 :
492 : #front utils
493 :
494 : #cannon
495 : Transform {
496 : translation 0.7 0.65 -3.68
497 : children [
498 : Transform {
499 : rotation 1 0 0 -1.57
500 : translation 0 0 -0.25
501 : children [
502 : Shape {
503 : appearance TankSurf {}
504 : geometry Cylinder {
505 : radius 0.03
506 : height 0.5
507 : bottom FALSE
508 : }
509 : }
510 : Shape {
511 : appearance BlackHole {}
512 : geometry Cylinder {
513 : radius 0.02
514 : height 0.502
515 : bottom FALSE
516 : side FALSE
517 : }
518 : }
519 : ]
520 : }
521 : Shape {
522 : appearance TankSurf {}
523 : geometry Sphere {
524 : radius 0.2
525 : }
526 : }
527 : ]
528 : }
529 :
530 : Transform {
531 : translation 0 0 0
532 : children Shape {
533 : appearance NULL
534 : }
535 : }
536 :
537 : #window
538 : Transform {
539 : translation 0 0.7 -3.6
540 : children [
541 : Shape {
542 : appearance TankSurf {}
543 : geometry Box {
544 : size 0.6 0.3 0.3
545 : }
546 : }
547 : Shape {
548 : appearance BlackHole {}
549 : geometry Box {
550 : size 0.4 0.1 0.31
551 : }
552 : }
553 : ]
554 : }
555 :
556 : DEF TankLight Transform {
557 : translation 1.3 0.5 -3.9
558 : rotation 1 0 0 -1.57
559 : children [
560 : Shape {
561 : appearance TankSurf {}
562 : geometry Cylinder {
563 : bottom FALSE
564 : height 0.2
565 : radius 0.15
566 : }
567 : }
568 : Shape {
569 : appearance Appearance {
570 : material Material {
571 : diffuseColor 0.9 0.9 0.9
572 : emissiveColor 1 1 1
573 : }
574 : }
575 : geometry Cylinder {
576 : bottom FALSE
577 : side FALSE
578 : height 0.205
579 : radius 0.12
580 : }
581 : }
582 : ]
583 : }
584 :
585 : Transform {
586 : translation -2.6 0 0
587 : children USE TankLight
588 : }
589 :
590 : DEF TankLightBack Transform {
591 : translation 1.3 0.5 3.85
592 : rotation 1 0 0 -1.57
593 : children [
594 : Shape {
595 : appearance TankSurf {}
596 : geometry Cylinder {
597 : top FALSE
598 : height 0.2
599 : radius 0.09
600 : }
601 : }
602 : Shape {
603 : appearance Appearance {
604 : material Material {
605 : diffuseColor 0.9 0 0
606 : emissiveColor 1 0 0
607 : }
608 : }
609 : geometry Cylinder {
610 : top FALSE
611 : side FALSE
612 : height 0.205
613 : radius 0.06
614 : }
615 : }
616 : ]
617 : }
618 :
619 : Transform {
620 : translation -2.6 0 0
621 : children USE TankLightBack
622 : }