1 : #VRML V2.0 utf8
2 :
3 : # "All work and no play makes Jack a dull boy."
4 :
5 : WorldInfo {
6 : info "Author: Tomash Kazmar"
7 : title "Old 'Underwood Noiseless' Typwriter"
8 : }
9 :
10 : PROTO TWPlastic []
11 : {
12 : Appearance {
13 : material Material {
14 : diffuseColor .15 .15 .15
15 : specularColor .5 .5 .5
16 : ambientIntensity 0
17 : emissiveColor .14 .14 .14
18 : }
19 : }
20 : }
21 :
22 : PROTO TWSteel []
23 : {
24 : Appearance {
25 : material Material {
26 : diffuseColor .373 .31 .251
27 : specularColor .475 .475 .373
28 : ambientIntensity .122
29 : shininess .1
30 : emissiveColor .129 .129 .129
31 : }
32 : }
33 : }
34 :
35 : PROTO TWKey [exposedField SFInt32 lod 1, exposedField MFString char ["a.png"],
36 : exposedField SFNode steel TWSteel {}]
37 : {
38 : Switch {
39 : whichChoice IS lod
40 : choice [
41 : DEF Full Group {
42 : children [
43 : DEF Inner Shape {
44 : geometry Cylinder {
45 : bottom FALSE
46 : top TRUE
47 : side FALSE
48 : radius 0.00798
49 : height 0.001
50 : }
51 : appearance Appearance {
52 : material Material {
53 : diffuseColor .76 .66 .38
54 : shininess .1
55 : emissiveColor .2 .18 .1
56 : ambientIntensity 0
57 : specularColor .15 .15 .15
58 : }
59 : }
60 : }
61 : DEF Outer Shape {
62 : geometry Cylinder {
63 : bottom FALSE
64 : top FALSE
65 : side TRUE
66 : radius 0.008
67 : height 0.002
68 : }
69 : appearance IS steel
70 : }
71 : Shape {
72 : geometry Extrusion {
73 : beginCap FALSE
74 : endCap FALSE
75 : creaseAngle 1.0
76 : scale 0.001 0.0015
77 : spine [0 0 0, 0 -0.01 0, 0 0 -0.18]
78 : crossSection [0.7 0.7, 1.0 0, 0.7 -0.7, 0 -1.0,
79 : -0.7 -0.7, -1.0 0, -0.7 0.7, 0 1.0
80 : 0.7 0.7]
81 : }
82 : appearance IS steel
83 : }
84 : ]
85 : }
86 : LOD {
87 : range [1 20]
88 : level [
89 : USE Full
90 : Group {
91 : children [
92 : USE Inner
93 : USE Outer
94 : Transform {
95 : children Shape {
96 : geometry Box {
97 : size 0.002 0.003 0.18
98 : }
99 : appearance IS steel
100 : }
101 : translation -0.001 -0.005 -0.09
102 : }
103 : ]
104 : }
105 : Shape {}
106 : ]
107 : }
108 : ]
109 : }
110 : }
111 :
112 : PROTO TWScrew [exposedField SFNode steel TWSteel {}]
113 : {
114 : Group {
115 : children [
116 : Shape {
117 : geometry Cylinder {
118 : bottom FALSE
119 : height 0.001
120 : radius 0.005
121 : }
122 : appearance IS steel
123 : }
124 : Shape {
125 : geometry IndexedFaceSet {
126 : coord Coordinate {
127 : point [
128 : -0.005 0.00051 0.0005,
129 : -0.005 0.00051 -0.0005,
130 : 0.005 0.00051 0.0005,
131 : 0.005 0.00051 -0.0005
132 : ]
133 : }
134 : coordIndex [0 2 3 1 -1]
135 : }
136 : appearance Appearance { # cut simulation
137 : material Material {
138 : diffuseColor 0 0 0
139 : specularColor .29 .298 .29
140 : ambientIntensity 0
141 : shininess .063
142 : transparency .224 # <<-
143 : }
144 : }
145 : }
146 : ]
147 : }
148 : }
149 :
150 : PROTO TWSpacebar [exposedField SFInt32 lod 1, exposedField SFNode steel TWSteel {}]
151 : {
152 : Switch {
153 : whichChoice IS lod
154 : choice [
155 : DEF Full Group {
156 : children [
157 : DEF CBox Shape {
158 : geometry Box {
159 : size 0.18 0.008 0.01
160 : }
161 : appearance TWPlastic {}
162 : }
163 : DEF LeftPart Shape {
164 : geometry Extrusion {
165 : beginCap TRUE
166 : endCap TRUE
167 : solid TRUE
168 : creaseAngle 0.3
169 : spine [-0.09 -0.004 -0.005, -0.09 -0.004 0.005]
170 : scale 0.01 0.01
171 : crossSection [-1 0, 0 0, 0 -0.8, -0.1 -0.7, -0.2 -0.6,
172 : -0.3 -0.53, -0.4 -0.47, -0.5 -0.41,
173 : -0.6 -0.36, -0.7 -0.32, -0.8 -0.28,
174 : -0.9 -0.26, -1 -0.20, -1 0]
175 : }
176 : appearance TWPlastic {}
177 : }
178 : Transform {
179 : children USE LeftPart
180 : rotation 0 1 0 3.14
181 : translation 0 0 0
182 : }
183 : DEF LeftStick Shape {
184 : geometry Extrusion {
185 : beginCap FALSE
186 : endCap FALSE
187 : creaseAngle 1.0
188 : scale 0.001 0.0015
189 : spine [-0.07 0 0, -0.07 -0.01 0, -0.07 0 -0.22]
190 : crossSection [0.7 0.7, 1.0 0, 0.7 -0.7, 0 -1.0,
191 : -0.7 -0.7, -1.0 0, -0.7 0.7, 0 1.0
192 : 0.7 0.7]
193 : }
194 : appearance IS steel
195 : }
196 : Transform {
197 : children USE LeftStick
198 : translation 0.14 0 0
199 : }
200 :
201 : ]
202 : }
203 : LOD {
204 : range [1 20]
205 : level [
206 : USE Full
207 : Group {
208 : children [
209 : USE CBox
210 : Transform {
211 : children DEF LeftSimple Shape {
212 : geometry Box {
213 : size 0.002 0.003 0.20
214 : }
215 : appearance IS steel
216 : }
217 : translation -0.071 -0.005 -0.10
218 : }
219 : Transform {
220 : children USE LeftSimple
221 : translation 0.071 -0.005 -0.10
222 : }
223 : ]
224 : }
225 : Shape {}
226 : ]
227 : }
228 : ]
229 : }
230 : }
231 :
232 : PROTO TWTopBox [exposedField SFInt32 lod 1, exposedField SFNode plastic TWPlastic {}]
233 : {
234 : Switch {
235 : whichChoice IS lod
236 : choice [
237 : DEF Full Transform {
238 : scale 0.012 0.009 0.011
239 : children [
240 : Shape {
241 : geometry Extrusion {
242 : spine [ 0.97 0 0.26, 0.87 0 0.50, 0.70 0 0.70, 0.50 0 0.87,
243 : 0.26 0 0.97, 0.00 0 1.00, -0.26 0 0.97, -0.50 0 0.87,
244 : -0.70 0 0.70, -0.87 0 0.50, -0.97 0 0.26]
245 : creaseAngle 1.5
246 : scale 1 0.5
247 : solid TRUE
248 : ccw FALSE
249 : crossSection [0 0, 0 -6, 3.6 -6, 3.8 -6.2, 4 -7.8, 4.2 -8, 8.5 -8,
250 : 9.5 -5, 10 -2, 10.3 -2, 10.5 0, 0 0]
251 : }
252 : appearance IS plastic
253 : }
254 : ]
255 : }
256 : LOD {
257 : range [1 5 20]
258 : level [
259 : USE Full
260 : Transform {
261 : scale 0.012 0.009 0.011
262 : children [
263 : Shape {
264 : geometry Extrusion {
265 : spine [ 0.97 0 0.26, 0.87 0 0.50, 0.50 0 0.87, 0.00 0 1.00,
266 : -0.50 0 0.87, -0.87 0 0.50, -0.97 0 0.26]
267 : creaseAngle 1.5
268 : scale 1 0.5
269 : solid TRUE
270 : ccw FALSE
271 : crossSection [0 0, 0 -6, 4 -6, 4 -8, 8.5 -8, 10 -2, 10.5 0, 0 0]
272 : }
273 : appearance IS plastic
274 : }
275 : ]
276 : }
277 : Transform {
278 : scale 0.012 0.009 0.011
279 : children [
280 : Shape {
281 : geometry Extrusion {
282 : spine [ 0.97 0 0.26, 0.70 0 0.70, -0.70 0 0.70, -0.97 0 0.26]
283 : creaseAngle 1.5
284 : scale 1 0.5
285 : solid TRUE
286 : ccw FALSE
287 : crossSection [0 0, 0 -6, 4 -6, 4 -8, 8.5 -8, 10 -2, 10.5 0, 0 0]
288 : }
289 : appearance IS plastic
290 : }
291 : ]
292 : }
293 : Shape {}
294 : ]
295 : }
296 : ]
297 : }
298 :
299 : }
300 :
301 : PROTO TWTape [exposedField SFInt32 lod 1, exposedField SFNode steel TWSteel {}]
302 : {
303 : Group {
304 : children [
305 : Shape {
306 : geometry Cylinder {
307 : height 0.015
308 : radius 0.03
309 : }
310 : appearance TWPlastic {}
311 : }
312 : Switch {
313 : whichChoice IS lod
314 : choice [
315 : DEF TinyTopie Transform {
316 : children Shape {
317 : geometry Cylinder {
318 : bottom FALSE
319 : height 0.01
320 : radius 0.005
321 : }
322 : appearance IS steel
323 : }
324 : translation 0 0.008 0
325 : }
326 : LOD {
327 : range [5]
328 : level [
329 : USE TinyTopie
330 : Shape {}
331 : ]
332 : }
333 : ]
334 : }
335 : ]
336 : }
337 : }
338 :
339 : PROTO TWRoller [exposedField SFInt32 lod 1, exposedField SFNode steel TWSteel {}]
340 : {
341 : Group {
342 : children [
343 : Shape { # cylinder
344 : geometry Cylinder {
345 : height 0.249
346 : radius 0.015
347 : }
348 : appearance Appearance {
349 : material Material {
350 : diffuseColor 0 0 0
351 : specularColor .631 .69 1
352 : ambientIntensity 0
353 : }
354 : }
355 : }
356 : Switch {
357 : whichChoice IS lod
358 : choice [
359 : DEF Full Group {
360 : children [
361 : Transform {
362 : children DEF LeftStick Shape { # left steel stick to cap
363 : geometry Cylinder {
364 : top FALSE
365 : bottom FALSE
366 : height 0.02
367 : radius 0.004
368 : }
369 : appearance IS steel
370 : }
371 : translation 0 0.135 0
372 : }
373 : Transform { # right ...
374 : children USE LeftStick
375 : translation 0 -0.135 0
376 : }
377 : ]
378 : }
379 : LOD {
380 : range [5]
381 : level [
382 : USE Full
383 : Shape {}
384 : ]
385 : }
386 : ]
387 : }
388 : Transform {
389 : children DEF LeftCap Shape { # left handle of cylinder
390 : geometry Cylinder {
391 : height 0.008
392 : radius 0.017
393 : }
394 : appearance TWPlastic {}
395 : }
396 : translation 0 0.15 0
397 : }
398 : Transform { # right ...
399 : children USE LeftCap
400 : translation 0 -0.15 0
401 : }
402 : ]
403 : }
404 : }
405 :
406 : PROTO TWReturn [exposedField SFInt32 lod 1, exposedField SFNode steel TWSteel {}]
407 : {
408 : Switch {
409 : whichChoice IS lod
410 : choice [
411 : DEF Full Group {
412 : children Shape {
413 : geometry Extrusion {
414 : creaseAngle 2
415 : spine [0 0 0, 0 0.01 0.01, 0 0.015 0.02, 0 0.018 0.03, 0 0.02 0.04, 0 0.016 0.075,
416 : 0.0001 0.018 0.082, 0.0003 0.023 0.089, 0.00031 0.025 0.09, 0.00035 0.03 0.092,
417 : 0.001 0.045 0.094, 0 0.060 0.0942, -0.004 0.065 0.0942, -0.012 0.066 0.0942]
418 : scale 0.002 0.006
419 : crossSection [1 1, 1 -1, -1 -1, -1 1, 1 1]
420 : }
421 : appearance IS steel
422 : }
423 : }
424 : LOD {
425 : range [1 5]
426 : level [
427 : USE Full
428 : Shape {
429 : geometry Extrusion {
430 : creaseAngle 2
431 : spine [0 0 0, 0 0.02 0.04, 0 0.016 0.075, 0.0003 0.023 0.089,
432 : 0.001 0.045 0.094, -0.012 0.066 0.0942]
433 : scale 0.002 0.006
434 : crossSection [1 1, 1 -1, -1 -1, -1 1, 1 1]
435 : }
436 : appearance IS steel
437 : }
438 : Shape {}
439 : ]
440 : }
441 : ]
442 : }
443 : }
444 :
445 : PROTO TWRearScale [exposedField SFNode steel TWSteel {}]
446 : {
447 : Group {
448 : children [
449 : Shape {
450 : geometry Box {
451 : size 0.25 0.01 0.002
452 : }
453 : appearance TWPlastic {}
454 : }
455 : Transform {
456 : children DEF LeftStuff Shape {
457 : geometry Extrusion {
458 : solid TRUE
459 : creaseAngle 1
460 : spine [0 -0.033 0.043, 0 -0.001 0.007, 0 0 0, 0 0.001 -0.007]
461 : scale 0.005 0.002
462 : crossSection [-1 0, -1 1, 1 1, 1 -1, -1 0, -1 0]
463 : }
464 : appearance IS steel
465 : }
466 : translation -0.127 0 0
467 : }
468 : Transform {
469 : children USE LeftStuff
470 : translation 0.127 0 0
471 : }
472 : ]
473 : }
474 : }
475 :
476 : PROTO TWWindow [exposedField SFNode steel TWSteel {}]
477 : {
478 : Group {
479 : children [
480 : Transform {
481 : children Shape {
482 : geometry Extrusion {
483 : beginCap FALSE
484 : endCap FALSE
485 : creaseAngle 0.3
486 : scale 0.001 0.001
487 : spine [-0.005 0 0, 0.005 0 0, 0.005 0.01 0, -0.005 0.01 0, -0.005 0 0]
488 : crossSection [1 1, 1 -1, -1 -1, -1 1, 1 1]
489 : }
490 : appearance IS steel
491 : }
492 : translation 0 0 0.001
493 : }
494 : Transform {
495 : children DEF LeftStick Shape {
496 : geometry Box {
497 : size 0.119 0.008 0.001
498 : }
499 : appearance IS steel
500 : }
501 : translation -0.065 0.004 0.0005
502 : }
503 : Transform {
504 : children USE LeftStick
505 : translation 0.065 0.004 0.0005
506 : }
507 : Transform {
508 : children DEF LeftHandle Shape {
509 : geometry Box {
510 : size 0.001 0.008 0.024
511 : }
512 : appearance IS steel
513 : }
514 : translation -0.125 0.004 -0.011
515 : }
516 : Transform {
517 : children USE LeftHandle
518 : translation 0.125 0.004 -0.011
519 : }
520 : ]
521 : }
522 : }
523 :
524 : PROTO TWFrontHandle [ exposedField SFInt32 lod 1, exposedField SFNode plastic TWPlastic {}]
525 : {
526 : Switch {
527 : whichChoice IS lod
528 : choice [
529 : DEF Full Group {
530 : children Shape {
531 : geometry Extrusion {
532 : beginCap FALSE
533 : endCap FALSE
534 : solid TRUE
535 : ccw FALSE
536 : creaseAngle 0.3
537 : spine [-0.1225 0 0.00, -0.1225 0 0.07, -0.1225 0 0.140,
538 : -0.1170 0 0.147,
539 : -0.1125 0 0.15, -0.080 0 0.15, -0.056 0 0.15, -0.025 0 0.15
540 : 0 0 0.15,
541 : 0.025 0 0.15, 0.056 0 0.15, 0.080 0 0.15, 0.1125 0 0.15,
542 : 0.1170 0 0.147,
543 : 0.1225 0 0.140, 0.1225 0 0.07, 0.1225 0 0.00]
544 : crossSection [-0.0025 0, 0.0025 0, 0.0025 0.01, -0.0025 0.01, -0.0025 0]
545 : }
546 : appearance IS plastic
547 : }
548 : }
549 : LOD {
550 : range [ 1 ]
551 : level [
552 : USE Full
553 : Group {
554 : children Shape {
555 : geometry Extrusion {
556 : beginCap FALSE
557 : endCap FALSE
558 : solid TRUE
559 : ccw FALSE
560 : creaseAngle 0.3
561 : spine [-0.1225 0 0.00, -0.1225 0 0.150, 0.1225 0 0.150, 0.1225 0 0.00]
562 : crossSection [-0.0025 0, 0.0025 0, 0.0025 0.01, -0.0025 0.01, -0.0025 0]
563 : }
564 : appearance IS plastic
565 : }
566 : }
567 : ]
568 : }
569 : ]
570 : }
571 : }
572 :
573 : PROTO TWMiddleBox [ exposedField SFInt32 lod 1, exposedField SFNode plastic TWPlastic {}
574 : exposedField SFNode steel TWSteel {}
575 : ]
576 : {
577 : Group {
578 : children [
579 : Transform {
580 : children TWTopBox { lod IS lod, plastic IS plastic }
581 : translation 0 0.18 -0.11
582 : }
583 : Switch {
584 : whichChoice IS lod
585 : choice [
586 : DEF Full Group {
587 : children [
588 : DEF TMBottom Transform { # middle bottom
589 : children DEF MBottom Shape {
590 : geometry Box {
591 : size 0.248 0.004 0.10
592 : }
593 : appearance IS plastic
594 : }
595 : translation 0 0.002 -0.05
596 : }
597 : DEF TLMSide Transform { # left middle side
598 : children DEF LMSide Shape {
599 : geometry Box {
600 : size 0.004 0.18 0.10
601 : }
602 : appearance IS plastic
603 : }
604 : translation -0.123 0.09 -0.05
605 : }
606 : DEF TRMSide Transform { # right middle side
607 : children USE LMSide
608 : translation 0.123 0.09 -0.05
609 : }
610 : Transform { # middle top
611 : children [
612 : USE MBottom
613 : Transform {
614 : children TWScrew {steel IS steel}
615 : translation -0.115 0.002 0.04
616 : }
617 : Transform {
618 : children TWScrew {steel IS steel}
619 : translation 0.115 0.002 0.04
620 : }
621 : ]
622 : translation 0 0.178 -0.06
623 : scale 1 1 1.2
624 : }
625 : Transform { # front
626 : children [
627 : Shape {
628 : geometry Box {
629 : size 0.248 0.108 0.004
630 : }
631 : appearance IS plastic
632 : }
633 : Transform {
634 : children TWScrew {steel IS steel}
635 : rotation 1 0 0 1.57
636 : translation -0.11 0.04 0.002
637 : scale 0.5 1.5 0.5
638 : }
639 : Transform {
640 : children TWScrew {steel IS steel}
641 : rotation 1 0 0 1.57
642 : translation -0.11 -0.04 0.002
643 : scale 0.5 1.5 0.5
644 : }
645 : Transform {
646 : children TWScrew {steel IS steel}
647 : rotation 1 0 0 1.57
648 : translation 0.11 0.04 0.002
649 : scale 0.5 1.5 0.5
650 : }
651 : Transform {
652 : children TWScrew {steel IS steel}
653 : rotation 1 0 0 1.57
654 : translation 0.11 -0.04 0.002
655 : scale 0.5 1.5 0.5
656 : }
657 : ]
658 : translation 0 0.125 -0.007
659 : }
660 : ]
661 : }
662 : LOD {
663 : range [1 5 20]
664 : level [
665 : USE Full
666 : Group {
667 : children [
668 : USE TMBottom
669 : USE TLMSide
670 : USE TRMSide
671 : Transform { # middle top
672 : children USE MBottom
673 : translation 0 0.178 -0.06
674 : scale 1 1 1.2
675 : }
676 : Transform { # front
677 : children Shape {
678 : geometry Box {
679 : size 0.248 0.108 0.004
680 : }
681 : appearance IS plastic
682 : }
683 : translation 0 0.125 -0.007
684 : }
685 : ]
686 : }
687 : Transform {
688 : children Shape {
689 : geometry Box {
690 : size 0.25 0.18 0.10
691 : }
692 : appearance IS plastic
693 : }
694 : translation 0 0.09 -0.05
695 : }
696 : Shape {}
697 : ]
698 : }
699 : ]
700 : }
701 : ]
702 : }
703 : }
704 :
705 : PROTO TWRearBox [ exposedField SFInt32 lod 1, exposedField SFNode plastic TWPlastic {},
706 : exposedField SFNode steel TWSteel {}]
707 : {
708 : Switch {
709 : whichChoice IS lod
710 : choice [
711 : DEF Full Group {
712 : children [
713 : DEF TLRSide Transform { # left rear side
714 : children DEF LRSide Shape {
715 : geometry Box {
716 : size 0.004 0.16 0.096
717 : }
718 : appearance IS plastic
719 : }
720 : translation -0.123 0.08 -0.148
721 : }
722 : DEF TRRSide Transform { # right rear side
723 : children USE LRSide
724 : translation 0.123 0.08 -0.148
725 : }
726 : DEF TRSide Transform { # rear side
727 : children Shape {
728 : geometry Box {
729 : size 0.25 0.18 0.004
730 : }
731 : appearance IS plastic
732 : }
733 : translation 0 0.09 -0.198
734 : }
735 : DEF TRBottom Transform { # rear bottom
736 : children Shape {
737 : geometry Box {
738 : size 0.242 0.004 0.096
739 : }
740 : appearance IS plastic
741 : }
742 : translation 0 0.002 -0.148
743 : }
744 : DEF TLTape Transform {
745 : children TWTape {lod IS lod, steel IS steel}# left tape box
746 : translation -0.10 0.1875 -0.11
747 : }
748 : DEF TRTape Transform {
749 : children TWTape {lod IS lod, steel IS steel}# right tape box
750 : translation 0.10 0.1875 -0.11
751 : }
752 : DEF TCylinder Transform {
753 : children TWRoller {steel IS steel} # cylinder
754 : translation 0 0.18 -0.17
755 : rotation 0 0 1 1.57
756 : }
757 : DEF TRScale Transform {
758 : children TWRearScale {steel IS steel} # rearest scale
759 : translation 0 0.21 -0.21
760 : }
761 : DEF TWindow Transform {
762 : children TWWindow {steel IS steel}
763 : translation 0 0.175 -0.15
764 : }
765 : DEF TReturn Transform {
766 : children TWReturn {lod IS lod, steel IS steel}
767 : translation -0.135 0.184 -0.172
768 : }
769 : ]
770 : }
771 : LOD {
772 : range [1 5 20]
773 : level [
774 : USE Full
775 : Group {
776 : children [
777 : USE TRSide
778 : USE TLRSide
779 : USE TRRSide
780 : USE TRBottom
781 : USE TLTape
782 : USE TRTape
783 : USE TCylinder
784 : USE TRScale
785 : USE TReturn
786 : ]
787 : }
788 : Group {
789 : children [
790 : Transform {
791 : children Shape {
792 : geometry Box {
793 : size 0.25 0.18 0.10
794 : }
795 : appearance IS plastic
796 : }
797 : translation 0 0.09 -0.15
798 : }
799 : USE TCylinder
800 : USE TRScale
801 : ]
802 : }
803 : Shape {}
804 : ]
805 : }
806 : ]
807 : }
808 : }
809 :
810 : PROTO TWKeyboard [ exposedField SFInt32 lod 1, exposedField SFNode steel TWSteel {}]
811 : {
812 : Switch {
813 : whichChoice IS lod
814 : choice [
815 : DEF Keys Group {
816 : children [
817 : Transform { # spacebar key
818 : children TWSpacebar {lod IS lod, steel IS steel}
819 : translation 0 0.02 0.135
820 : }
821 :
822 : Transform { ### first row - debugging
823 : children [
824 : Transform { # z
825 : children TWKey {lod IS lod, char ["z.png"], steel IS steel}
826 : translation -0.10 0.025 0.110
827 : }
828 : Transform { # x
829 : children TWKey {lod IS lod, char ["x.png"], steel IS steel}
830 : translation -0.08 0.025 0.110
831 : }
832 : Transform { # c
833 : children TWKey {lod IS lod, char ["c.png"], steel IS steel}
834 : translation -0.06 0.025 0.110
835 : }
836 : Transform { # v
837 : children TWKey {lod IS lod, char ["v.png"], steel IS steel}
838 : translation -0.04 0.025 0.110
839 : }
840 : Transform { # b
841 : children TWKey {lod IS lod, char ["b.png"], steel IS steel}
842 : translation -0.02 0.025 0.110
843 : }
844 : Transform { # n
845 : children TWKey {lod IS lod, char ["n.png"], steel IS steel}
846 : translation -0.00 0.025 0.110
847 : }
848 : Transform { # m
849 : children TWKey {lod IS lod, char ["m.png"], steel IS steel}
850 : translation 0.02 0.025 0.110
851 : }
852 : Transform { # ,
853 : children TWKey {lod IS lod, char ["period.png"], steel IS steel}
854 : translation 0.04 0.025 0.110
855 : }
856 : Transform { # .
857 : children TWKey {lod IS lod, char ["dot.png"], steel IS steel}
858 : translation 0.06 0.025 0.110
859 : }
860 : Transform { # /
861 : children TWKey {lod IS lod, char ["slash.png"], steel IS steel}
862 : translation 0.08 0.025 0.110
863 : }
864 : ]
865 : translation 0.01 0.005 0
866 : }
867 :
868 : Transform { ### second row - debugging
869 : children [
870 : Transform { # a
871 : children TWKey {lod IS lod, char ["a.png"], steel IS steel}
872 : translation -0.10 0.025 0.110
873 : }
874 : Transform { # s
875 : children TWKey {lod IS lod, char ["s.png"], steel IS steel}
876 : translation -0.08 0.025 0.110
877 : }
878 : Transform { # d
879 : children TWKey {lod IS lod, char ["d.png"], steel IS steel}
880 : translation -0.06 0.025 0.110
881 : }
882 : Transform { # f
883 : children TWKey {lod IS lod, char ["f.png"], steel IS steel}
884 : translation -0.04 0.025 0.110
885 : }
886 : Transform { # g
887 : children TWKey {lod IS lod, char ["g.png"], steel IS steel}
888 : translation -0.02 0.025 0.110
889 : }
890 : Transform { # h
891 : children TWKey {lod IS lod, char ["h.png"], steel IS steel}
892 : translation -0.00 0.025 0.110
893 : }
894 : Transform { # j
895 : children TWKey {lod IS lod, char ["j.png"], steel IS steel}
896 : translation 0.02 0.025 0.110
897 : }
898 : Transform { # k
899 : children TWKey {lod IS lod, char ["k.png"], steel IS steel}
900 : translation 0.04 0.025 0.110
901 : }
902 : Transform { # l
903 : children TWKey {lod IS lod, char ["l.png"], steel IS steel}
904 : translation 0.06 0.025 0.110
905 : }
906 : Transform { # ;
907 : children TWKey {lod IS lod, char ["semicolon.png"], steel IS steel}
908 : translation 0.08 0.025 0.110
909 : }
910 : ]
911 : translation 0.02 0.015 -0.025
912 : }
913 :
914 : Transform { ### third row - debugging
915 : children [
916 : Transform { # q
917 : children TWKey {lod IS lod, char ["q.png"], steel IS steel}
918 : translation -0.10 0.025 0.110
919 : }
920 : Transform { # w
921 : children TWKey {lod IS lod, char ["w.png"], steel IS steel}
922 : translation -0.08 0.025 0.110
923 : }
924 : Transform { # e
925 : children TWKey {lod IS lod, char ["e.png"], steel IS steel}
926 : translation -0.06 0.025 0.110
927 : }
928 : Transform { # r
929 : children TWKey {lod IS lod, char ["r.png"], steel IS steel}
930 : translation -0.04 0.025 0.110
931 : }
932 : Transform { # t
933 : children TWKey {lod IS lod, char ["t.png"], steel IS steel}
934 : translation -0.02 0.025 0.110
935 : }
936 : Transform { # y
937 : children TWKey {lod IS lod, char ["y.png"], steel IS steel}
938 : translation -0.00 0.025 0.110
939 : }
940 : Transform { # u
941 : children TWKey {lod IS lod, char ["u.png"], steel IS steel}
942 : translation 0.02 0.025 0.110
943 : }
944 : Transform { # i
945 : children TWKey {lod IS lod, char ["i.png"], steel IS steel}
946 : translation 0.04 0.025 0.110
947 : }
948 : Transform { # o
949 : children TWKey {lod IS lod, char ["o.png"], steel IS steel}
950 : translation 0.06 0.025 0.110
951 : }
952 : Transform { # p
953 : children TWKey {lod IS lod, char ["p.png"], steel IS steel}
954 : translation 0.08 0.025 0.110
955 : }
956 : Transform { # (
957 : children TWKey {lod IS lod, char ["parenthessis.png"], steel IS steel}
958 : translation 0.10 0.025 0.110
959 : }
960 : ]
961 : translation -0.003 0.025 -0.050
962 : }
963 :
964 : Transform { ### fourth row - debugging
965 : children [
966 : Transform { # 1
967 : children TWKey {lod IS lod, char ["1.png"], steel IS steel}
968 : translation -0.10 0.025 0.110
969 : }
970 : Transform { # 2
971 : children TWKey {lod IS lod, char ["2.png"], steel IS steel}
972 : translation -0.08 0.025 0.110
973 : }
974 : Transform { # 3
975 : children TWKey {lod IS lod, char ["3.png"], steel IS steel}
976 : translation -0.06 0.025 0.110
977 : }
978 : Transform { # 4
979 : children TWKey {lod IS lod, char ["4.png"], steel IS steel}
980 : translation -0.04 0.025 0.110
981 : }
982 : Transform { # 5
983 : children TWKey {lod IS lod, char ["5.png"], steel IS steel}
984 : translation -0.02 0.025 0.110
985 : }
986 : Transform { # 6
987 : children TWKey {lod IS lod, char ["6.png"], steel IS steel}
988 : translation -0.00 0.025 0.110
989 : }
990 : Transform { # 7
991 : children TWKey {lod IS lod, char ["7.png"], steel IS steel}
992 : translation 0.02 0.025 0.110
993 : }
994 : Transform { # 8
995 : children TWKey {lod IS lod, char ["8.png"], steel IS steel}
996 : translation 0.04 0.025 0.110
997 : }
998 : Transform { # 9
999 : children TWKey {lod IS lod, char ["9.png"], steel IS steel}
1000 : translation 0.06 0.025 0.110
1001 : }
1002 : Transform { # 0
1003 : children TWKey {lod IS lod, char ["0.png"], steel IS steel}
1004 : translation 0.08 0.025 0.110
1005 : }
1006 : ]
1007 : translation 0.005 0.035 -0.075
1008 : }
1009 : ]
1010 : }
1011 : LOD {
1012 : range [1 5 20]
1013 : level [
1014 : USE Keys # keys with letters
1015 : USE Keys # keys
1016 : Group {
1017 : children Shape { # image of keys
1018 : geometry IndexedFaceSet {
1019 : coord Coordinate {
1020 : point [-0.116 0.025 0.145, 0.116 0.025 0.145,
1021 : 0.1225 0.060 0.015, -0.1225 0.060 0.015]
1022 : }
1023 : coordIndex [0 1 2 3 -1]
1024 : texCoord TextureCoordinate {
1025 : point [0 0, 1 0, 1 1, 0 1]
1026 : }
1027 : texCoordIndex [0 1 2 3 -1]
1028 : }
1029 : appearance Appearance {
1030 : texture ImageTexture {
1031 : url ["keyboard.png"]
1032 : }
1033 : material Material {
1034 : }
1035 : }
1036 : }
1037 : }
1038 : Shape {} # nothing at all
1039 : ]
1040 : }
1041 : ]
1042 : }
1043 : }
1044 :
1045 : PROTO TW [ exposedField SFInt32 lod 1
1046 : exposedField SFNode plastic TWPlastic {}
1047 : exposedField SFNode steel TWSteel {}
1048 : ]
1049 : {
1050 : # lod: 0 - LOD off
1051 : # 1 - LOD on
1052 : Switch {
1053 : whichChoice IS lod
1054 : choice [
1055 : DEF Full Group {
1056 : children [
1057 : TWFrontHandle { lod IS lod, plastic IS plastic }
1058 : TWRearBox { lod IS lod, plastic IS plastic, steel IS steel }
1059 : TWMiddleBox { lod IS lod, plastic IS plastic, steel IS steel }
1060 : TWKeyboard { lod IS lod, steel IS steel }
1061 : ]
1062 : }
1063 : # LOD [1 5 12 20]
1064 : # d < 1 - full detail
1065 : # 1 < d < 5 - detail
1066 : # 5 < d < 12 - nicely shaped
1067 : # 12 < d < 20 - just a box
1068 : # d > 20 - nothing at all
1069 : LOD {
1070 : range [12 20]
1071 : level [
1072 : USE Full
1073 : Transform {
1074 : children Shape {
1075 : geometry Box {
1076 : size 0.25 0.20 0.20
1077 : }
1078 : appearance IS plastic
1079 : }
1080 : translation 0 0.10 -0.10
1081 : }
1082 : Shape {}
1083 : ]
1084 : }
1085 : ]
1086 : }
1087 : }