tw.wrl

 garaz2.wrl  u5.wrl  fence.wrl  tree.wrl  table.wrl  tw.wrl  stavba.wrl  tank.wrl  sibenice.wrl  hud.wrl  cafe.wrl 
Zpět Zpět
   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 MFString char [""],
  36 : 		     exposedField SFNode steel TWSteel {}]
  37 : {
  38 : 	LOD	{
  39 : 		range [1 20]
  40 : 		level [
  41 : 			Group {			# full detail
  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 : 					DEF	Letter Shape {
  72 : 						geometry IndexedFaceSet	{
  73 : 							coord Coordinate {
  74 : 								point [-0.01 0.0011 0.01, 0.01 0.0011 0.01, 0.01 0.0011 -0.01, -0.01 0.0011 -0.01]
  75 : 							}
  76 : 							coordIndex [0 1 2 3 -1]
  77 : 							texCoord TextureCoordinate {
  78 : 								point [0.05 0, 1 0, 1 1, 0.05 1]
  79 : 							}
  80 : 						}
  81 : 						appearance Appearance {
  82 : 							texture	ImageTexture {
  83 : 								url	IS char
  84 : 								repeatS	FALSE
  85 : 								repeatT	FALSE
  86 : 							}
  87 : 						
  88 : 						}
  89 : 					}
  90 : 					Shape {
  91 : 						geometry Extrusion {
  92 : 							beginCap FALSE
  93 : 							endCap FALSE
  94 : 							creaseAngle	1.0
  95 : 							scale 0.001 0.0015
  96 : 							spine [0 0 0, 0 -0.01 0, 0 0 -0.18]
  97 : 							crossSection [0.7 0.7, 1.0 0, 0.7 -0.7, 0 -1.0,
  98 : 										 -0.7 -0.7, -1.0 0, -0.7 0.7, 0 1.0
  99 : 										 0.7 0.7]
 100 : 						}
 101 : 						appearance IS steel
 102 : 					}
 103 : 				]
 104 : 			}
 105 : 			Group {			# from distance
 106 : 				children [
 107 : 					USE	Inner
 108 : 					USE	Outer
 109 : 					Transform {
 110 : 						children Shape {
 111 : 							geometry Box {
 112 : 								size 0.002 0.003 0.18
 113 : 							}
 114 : 							appearance IS steel
 115 : 						}
 116 : 						translation	-0.001 -0.005 -0.09
 117 : 					}
 118 : 				]
 119 : 			}
 120 : 			Shape {}		# far away
 121 : 		]
 122 : 	}
 123 : }
 124 : 
 125 : PROTO TWScrew [exposedField SFNode steel TWSteel {}]
 126 : {
 127 : 	Group {
 128 : 		children [
 129 : 			Shape {
 130 : 				geometry Cylinder {
 131 : 					bottom FALSE
 132 : 					height 0.001
 133 : 					radius 0.005
 134 : 				}
 135 : 				appearance IS steel
 136 : 			}
 137 : 			Shape {
 138 : 				geometry IndexedFaceSet {
 139 : 					coord Coordinate {
 140 : 						point [
 141 : 							-0.005 0.00051  0.0005,
 142 : 							-0.005 0.00051 -0.0005,
 143 : 							 0.005 0.00051  0.0005,
 144 : 							 0.005 0.00051 -0.0005
 145 : 						]
 146 : 					}
 147 : 					coordIndex [0 2 3 1 -1]
 148 : 				}
 149 : 				appearance Appearance {						# cut simulation
 150 : 					material Material {
 151 : 						diffuseColor 0 0 0
 152 : 						specularColor .29 .298 .29
 153 : 						ambientIntensity 0
 154 : 						shininess .063
 155 : 						transparency .224					# <<-
 156 : 					}
 157 : 				}
 158 : 			}
 159 : 		]
 160 : 	}
 161 : }
 162 : 
 163 : PROTO TWSpacebar [exposedField SFNode steel TWSteel {}]
 164 : {
 165 : 	LOD	{
 166 : 		range [1 20]
 167 : 		level [
 168 : 			Group {				# full detail
 169 : 				children [
 170 : 					DEF CBox Shape {
 171 : 						geometry Box {
 172 : 		   					size 0.18 0.008 0.01
 173 : 						}
 174 : 						appearance TWPlastic {}
 175 : 					}
 176 : 					DEF LeftPart Shape {
 177 : 						geometry Extrusion {
 178 : 							beginCap TRUE
 179 : 							endCap TRUE
 180 : 							solid TRUE
 181 : 							creaseAngle	0.3
 182 : 							spine [-0.09 -0.004 -0.005, -0.09 -0.004 0.005]
 183 : 							scale 0.01 0.01
 184 : 							crossSection [-1 0, 0 0, 0 -0.8, -0.1 -0.7, -0.2 -0.6,
 185 : 										  -0.3 -0.53, -0.4 -0.47, -0.5 -0.41,
 186 : 										  -0.6 -0.36, -0.7 -0.32, -0.8 -0.28,
 187 : 										  -0.9 -0.26, -1 -0.20, -1 0]
 188 : 						}
 189 : 						appearance TWPlastic {}
 190 : 					}
 191 : 					Transform {
 192 : 						children USE LeftPart
 193 : 						rotation 0 1 0 3.14
 194 : 						translation	0 0 0
 195 : 					}
 196 : 					DEF LeftStick Shape {
 197 : 						geometry Extrusion {
 198 : 							beginCap FALSE
 199 : 							endCap FALSE
 200 : 							creaseAngle	1.0
 201 : 							scale 0.001 0.0015
 202 : 							spine [-0.07 0 0, -0.07 -0.01 0, -0.07 0 -0.22]
 203 : 							crossSection [0.7 0.7, 1.0 0, 0.7 -0.7, 0 -1.0,
 204 : 										 -0.7 -0.7, -1.0 0, -0.7 0.7, 0 1.0
 205 : 										 0.7 0.7]
 206 : 						}
 207 : 						appearance IS steel
 208 : 					}
 209 : 					Transform {
 210 : 						children USE LeftStick
 211 : 						translation	0.14 0 0
 212 : 					}
 213 : 
 214 : 				]
 215 : 			}
 216 : 			Group {				# from distance
 217 : 				children [
 218 : 					USE	CBox
 219 : 					Transform {
 220 : 						children DEF LeftSimple Shape {
 221 : 							geometry Box {
 222 : 								size 0.002 0.003 0.20
 223 : 							}
 224 : 							appearance IS steel
 225 : 						}
 226 : 						translation	-0.071 -0.005 -0.10
 227 : 					}
 228 : 					Transform {
 229 : 						children USE LeftSimple
 230 :                         translation	0.071 -0.005 -0.10
 231 : 					}
 232 : 				]
 233 : 			}
 234 : 			Shape {}			# far away
 235 : 		]
 236 : 	}
 237 : }
 238 : 
 239 : PROTO TWTopBox [exposedField SFNode plastic TWPlastic {}]
 240 : {
 241 : 	LOD	{
 242 : 		range [1 5 20]
 243 : 		level [
 244 : 			Transform {			# full detail
 245 : 				scale 0.012 0.009 0.011
 246 : 				children [
 247 : 					Shape {
 248 : 						geometry Extrusion {
 249 : 							spine [ 0.97 0 0.26,  0.87 0 0.50, 0.70 0 0.70,  0.50 0 0.87,
 250 : 					        		0.26 0 0.97,  0.00 0 1.00, -0.26 0 0.97, -0.50 0 0.87,
 251 : 								   -0.70 0 0.70, -0.87 0 0.50, -0.97 0 0.26]
 252 : 							creaseAngle	1.5
 253 : 							scale 1 0.5
 254 : 							solid TRUE
 255 : 							ccw	FALSE
 256 : 							crossSection [0 0, 0 -6, 3.6 -6, 3.8 -6.2, 4 -7.8, 4.2 -8, 8.5 -8,
 257 : 			            				  9.5 -5, 10 -2, 10.3 -2, 10.5 0, 0 0]
 258 : 						}
 259 : 						appearance IS plastic
 260 : 					}
 261 : 				]
 262 : 			}
 263 : 			Transform {			# detail
 264 : 				scale 0.012 0.009 0.011
 265 : 				children [
 266 : 					Shape {
 267 : 						geometry Extrusion {
 268 : 							spine [ 0.97 0 0.26,  0.87 0 0.50, 0.50 0 0.87,	0.00 0 1.00,
 269 : 							       -0.50 0 0.87, -0.87 0 0.50, -0.97 0 0.26]
 270 : 							creaseAngle	1.5
 271 : 							scale 1 0.5
 272 : 							solid TRUE
 273 : 							ccw	FALSE
 274 : 							crossSection [0 0, 0 -6, 4 -6, 4 -8, 8.5 -8, 10 -2, 10.5 0, 0 0]
 275 : 						}
 276 : 						appearance IS plastic
 277 : 					}
 278 : 				]
 279 : 			}
 280 :   			Transform {			# from distance
 281 : 				scale 0.012 0.009 0.011
 282 : 				children [
 283 : 					Shape {
 284 : 						geometry Extrusion {
 285 : 							spine [ 0.97 0 0.26,  0.70 0 0.70, -0.70 0 0.70, -0.97 0 0.26]
 286 : 							creaseAngle	1.5
 287 : 							scale 1 0.5
 288 : 							solid TRUE
 289 : 							ccw	FALSE
 290 : 							crossSection [0 0, 0 -6, 4 -6, 4 -8, 8.5 -8, 10 -2, 10.5 0, 0 0]
 291 : 						}
 292 : 						appearance IS plastic
 293 : 					}
 294 : 				]
 295 : 			}
 296 : 			Shape {}			# far away
 297 : 		]
 298 : 	}
 299 : }
 300 : 
 301 : PROTO TWTape [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 : 			LOD	{
 313 : 				range [1]
 314 : 				level [
 315 : 					Transform {			# tiny topie
 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 : 					Shape {}			# no tiny topie
 327 : 				]
 328 : 			}
 329 : 		]
 330 : 	}
 331 : }
 332 : 
 333 : PROTO TWRoller [exposedField SFNode steel TWSteel {}]
 334 : {
 335 : 	Group {
 336 : 		children [
 337 : 			Shape {						# cylinder
 338 : 				geometry Cylinder {
 339 : 					height 0.249
 340 : 					radius 0.015
 341 : 				}
 342 : 				appearance Appearance {
 343 : 					material Material {
 344 : 						diffuseColor 0 0 0
 345 : 						specularColor .631 .69 1
 346 : 						ambientIntensity 0
 347 : 					}
 348 : 				}
 349 : 			}
 350 : 			LOD	{
 351 : 				range [5]
 352 : 				level [
 353 : 					Group {
 354 : 						children [
 355 : 							Transform {
 356 : 								children DEF LeftStick Shape {	# left steel stick to cap
 357 : 									geometry Cylinder {
 358 : 										top	FALSE
 359 : 										bottom FALSE
 360 : 										height 0.02
 361 : 										radius 0.004
 362 : 									}
 363 : 									appearance IS steel
 364 : 								}
 365 : 								translation	0 0.135 0
 366 : 							}	
 367 : 							Transform {							# right ...
 368 : 								children USE LeftStick
 369 : 								translation	0 -0.135 0
 370 : 							}
 371 : 						]
 372 : 					}
 373 : 					Shape {}
 374 : 				]
 375 : 			}
 376 : 			Transform {
 377 : 				children DEF LeftCap Shape {	# left handle of cylinder
 378 : 					geometry Cylinder {
 379 : 						height 0.008
 380 : 						radius 0.017
 381 : 					}
 382 : 					appearance TWPlastic {}
 383 : 				}
 384 : 				translation	0 0.15 0 
 385 : 			}
 386 : 			Transform {							# right ...
 387 : 				children USE LeftCap
 388 : 				translation	0 -0.15 0
 389 : 			}
 390 : 		]
 391 : 	}
 392 : }
 393 : 
 394 : PROTO TWReturn [exposedField SFNode steel TWSteel {}]
 395 : {
 396 : 	LOD	{
 397 : 		range [1 5]
 398 : 		level [
 399 : 			DEF Full Group {
 400 : 				children Shape {
 401 : 					geometry Extrusion {
 402 : 						creaseAngle	2
 403 : 						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,
 404 : 			    			0.0001 0.018 0.082, 0.0003 0.023 0.089, 0.00031 0.025 0.09,  0.00035 0.03 0.092,
 405 : 							0.001 0.045 0.094, 0 0.060 0.0942, -0.004 0.065 0.0942, -0.012 0.066 0.0942]
 406 : 						scale 0.002 0.006
 407 : 						crossSection [1 1, 1 -1, -1 -1, -1 1, 1 1]
 408 : 					}
 409 : 					appearance IS steel
 410 : 				}
 411 : 			}
 412 : 			Shape {
 413 : 				geometry Extrusion {
 414 : 					creaseAngle	2
 415 : 					spine [0 0 0, 0 0.02 0.04, 0 0.016 0.075, 0.0003 0.023 0.089,
 416 : 						0.001 0.045 0.094, -0.012 0.066 0.0942]
 417 : 					scale 0.002 0.006
 418 : 					crossSection [1 1, 1 -1, -1 -1, -1 1, 1 1]
 419 : 				}
 420 : 				appearance IS steel
 421 : 			}
 422 : 			Shape {}
 423 : 		]
 424 : 	}
 425 : }
 426 : 
 427 : PROTO TWRearScale [exposedField SFNode steel TWSteel {}]
 428 : {
 429 : 	Group {
 430 : 		children [
 431 : 			Shape {
 432 : 				geometry Box {
 433 : 					size 0.25 0.01 0.002
 434 : 				}
 435 : 				appearance TWPlastic {}
 436 : 			}
 437 : 			Transform {
 438 : 				children DEF LeftStuff Shape {
 439 : 					geometry Extrusion {
 440 : 						solid TRUE
 441 : 						creaseAngle	1
 442 : 						spine [0 -0.033 0.043, 0 -0.001 0.007, 0 0 0, 0 0.001 -0.007]
 443 : 						scale 0.005 0.002
 444 : 						crossSection [-1 0, -1 1, 1 1, 1 -1, -1 0, -1 0]
 445 : 					}
 446 : 					appearance IS steel
 447 : 				}
 448 : 				translation	-0.127 0 0
 449 : 			}
 450 : 			Transform {
 451 : 				children USE LeftStuff
 452 : 				translation	0.127 0 0
 453 : 			}
 454 : 		]
 455 : 	}
 456 : }
 457 : 
 458 : PROTO TWWindow [exposedField SFNode steel TWSteel {}]
 459 : {
 460 : 	Group {
 461 : 		children [
 462 : 			Transform {
 463 : 				children Shape {
 464 : 					geometry Extrusion {
 465 : 						beginCap FALSE
 466 : 						endCap FALSE
 467 : 						creaseAngle	0.3
 468 : 						scale 0.001 0.001
 469 : 						spine [-0.005 0 0, 0.005 0 0, 0.005 0.01 0, -0.005 0.01 0, -0.005 0 0]
 470 : 						crossSection [1 1, 1 -1, -1 -1, -1 1, 1 1]
 471 : 					}
 472 : 					appearance IS steel
 473 : 				}
 474 : 				translation	0 0 0.001
 475 : 			}
 476 : 			Transform {
 477 : 				children DEF LeftStick Shape {
 478 : 					geometry Box {
 479 : 						size 0.119 0.008 0.001
 480 : 					}
 481 : 					appearance IS steel
 482 : 				}
 483 : 				translation	-0.065 0.004 0.0005
 484 : 			}
 485 : 			Transform {
 486 : 				children USE LeftStick
 487 : 				translation	0.065 0.004 0.0005
 488 : 			}
 489 : 		]
 490 : 	}
 491 : }
 492 : 
 493 : PROTO TWFrontHandle [exposedField SFNode plastic TWPlastic {}]
 494 : {
 495 : 	LOD	{
 496 : 		range [1]
 497 : 		level [
 498 : 			Group {				# full detail
 499 : 				children Shape {
 500 : 					geometry Extrusion {
 501 : 						beginCap FALSE
 502 : 						endCap FALSE
 503 : 						solid TRUE
 504 : 						ccw	FALSE
 505 : 						creaseAngle	0.3
 506 : 						spine [-0.1225 0 0.00, -0.1225 0 0.07, -0.1225 0 0.140,
 507 : 					    	-0.1170 0 0.147,
 508 : 							-0.1125 0 0.15, -0.080 0 0.15, -0.056 0 0.15, -0.025 0 0.15
 509 : 						    0 0 0.15,
 510 : 						    0.025 0 0.15, 0.056 0 0.15, 0.080 0 0.15, 0.1125 0 0.15,
 511 : 						    0.1170 0 0.147,
 512 : 						    0.1225 0 0.140, 0.1225 0 0.07, 0.1225 0 0.00]
 513 : 						crossSection [-0.0025 0, 0.0025 0, 0.0025 0.01, -0.0025 0.01, -0.0025 0]
 514 : 					}
 515 : 					appearance IS plastic
 516 : 				}
 517 : 			}
 518 : 			Group {				# detail
 519 : 				children Shape {
 520 : 					geometry Extrusion {
 521 : 						beginCap FALSE
 522 : 						endCap FALSE
 523 : 						solid TRUE
 524 : 						ccw	FALSE
 525 : 						creaseAngle	0.3
 526 : 						spine [-0.1225 0 0.00, -0.1225 0 0.150, 0.1225 0 0.150,  0.1225 0 0.00]
 527 : 						crossSection [-0.0025 0, 0.0025 0, 0.0025 0.01, -0.0025 0.01, -0.0025 0]
 528 : 					}
 529 : 					appearance IS plastic
 530 : 				}
 531 : 			}
 532 : 		]
 533 : 	}
 534 : }
 535 : 
 536 : PROTO TWMiddleBox [exposedField SFNode plastic TWPlastic {}
 537 : 				   exposedField SFNode steel TWSteel {}]
 538 : {
 539 : 	Group {
 540 : 		children [
 541 : 			Transform {
 542 : 				children TWTopBox { plastic IS plastic }
 543 : 				translation	0 0.18 -0.11
 544 : 			}
 545 : 			LOD	{
 546 : 				range [1 5 20]
 547 : 				level [
 548 : 					Group {
 549 : 						children [
 550 : 							DEF TMBottom Transform {			# middle bottom
 551 : 								children DEF MBottom Shape {
 552 : 									geometry Box {
 553 : 										size 0.248 0.004 0.10
 554 : 									}
 555 : 									appearance IS plastic
 556 : 								}
 557 : 								translation	0 0.002 -0.05
 558 : 							}
 559 : 							DEF TLMSide Transform {				# left middle side
 560 : 								children DEF LMSide Shape {
 561 : 									geometry Box {
 562 : 										size 0.004 0.18 0.10
 563 : 									}
 564 : 									appearance IS plastic
 565 : 								}
 566 : 								translation	-0.123 0.09 -0.05
 567 : 							}
 568 : 							DEF TRMSide Transform {				# right middle side
 569 : 								children USE LMSide 
 570 : 								translation	0.123 0.09 -0.05
 571 : 							}
 572 : 							Transform {							# middle top
 573 : 								children [
 574 : 									USE MBottom
 575 : 									Transform {
 576 : 										children TWScrew {steel IS steel}
 577 : 										translation	-0.115 0.002 0.04
 578 : 									}
 579 : 									Transform {
 580 : 										children TWScrew {steel IS steel}
 581 : 										translation	0.115 0.002 0.04
 582 : 									}
 583 : 								]
 584 : 								translation	0 0.178 -0.06
 585 : 								scale 1 1 1.2
 586 : 							}
 587 : 							Transform {							# front
 588 : 								children [
 589 : 									Shape {
 590 : 										geometry Box {
 591 : 											size 0.248 0.108 0.004
 592 : 										}
 593 : 										appearance IS plastic
 594 : 									}
 595 : 									Transform {
 596 : 										children TWScrew {steel IS steel}
 597 : 										rotation 1 0 0 1.57
 598 : 										translation -0.11 0.04 0.002
 599 : 										scale 0.5 1.5 0.5
 600 : 									}
 601 : 									Transform {
 602 : 										children TWScrew {steel IS steel}
 603 : 										rotation 1 0 0 1.57
 604 : 										translation -0.11 -0.04 0.002
 605 : 										scale 0.5 1.5 0.5
 606 : 									}
 607 : 									Transform {
 608 : 										children TWScrew {steel IS steel}
 609 : 										rotation 1 0 0 1.57
 610 : 										translation 0.11 0.04 0.002
 611 : 										scale 0.5 1.5 0.5
 612 : 									}
 613 : 									Transform {
 614 : 										children TWScrew {steel IS steel}
 615 : 										rotation 1 0 0 1.57
 616 : 										translation 0.11 -0.04 0.002
 617 : 										scale 0.5 1.5 0.5
 618 : 									}
 619 : 								]
 620 : 								translation	0 0.125 -0.007
 621 : 							}
 622 : 						]
 623 : 					}
 624 : 					Group {
 625 : 						children [
 626 : 							USE TMBottom
 627 : 							USE	TLMSide
 628 : 							USE	TRMSide
 629 : 							Transform {							# middle top
 630 : 								children USE MBottom
 631 : 								translation	0 0.178 -0.06
 632 : 								scale 1 1 1.2
 633 : 							}
 634 : 							Transform {							# front
 635 : 								children Shape {
 636 : 									geometry Box {
 637 : 										size 0.248 0.108 0.004
 638 : 									}
 639 : 									appearance IS plastic
 640 : 								}
 641 : 								translation	0 0.125 -0.007
 642 : 							}
 643 : 						]
 644 : 					}
 645 : 					Transform {
 646 : 						children Shape {
 647 : 							geometry Box {
 648 : 								size 0.25 0.18 0.10
 649 : 							}
 650 : 							appearance IS plastic
 651 : 						}
 652 : 						translation	0 0.09 -0.05
 653 : 					}
 654 : 					Shape {}
 655 : 				]
 656 : 			}
 657 : 		]
 658 : 	}
 659 : }
 660 : 
 661 : PROTO TWRearBoxMoveable [exposedField SFNode plastic TWPlastic {},
 662 : 						 exposedField SFNode steel TWSteel {},
 663 : 						 eventIn SFBool SpaceTouched,
 664 : 						 eventIn SFBool active]
 665 : {
 666 : 	DEF	Cyl Transform {
 667 : 		children [
 668 : 			LOD	{
 669 : 				range [1 5]
 670 : 				level [
 671 : 					Group {
 672 : 						children [
 673 : 							DEF TCylinder Transform {
 674 : 								children TWRoller {steel IS steel}			# cylinder
 675 : 								translation	0 0.18 -0.17
 676 : 								rotation 0 0 1 1.57
 677 : 							}
 678 : 							DEF TRScale Transform {
 679 : 								children TWRearScale {steel IS steel}		# rearest scale
 680 : 								translation	0 0.21 -0.21
 681 : 							}
 682 : 							DEF TReturn Transform {
 683 : 								children [
 684 : 									Transform {
 685 : 										children [
 686 : 										    TWReturn {steel IS steel}
 687 : 											DEF	SR CylinderSensor {
 688 : 												enabled	IS active
 689 : 												maxAngle 0.5
 690 : 												minAngle 0
 691 : 												diskAngle 0.262
 692 : 												autoOffset FALSE
 693 : 											}
 694 : 										]
 695 : 										rotation 1 0 0 -0.15
 696 : 									}
 697 : 								]
 698 : 								translation	-0.135 0.184 -0.172
 699 : 							}
 700 : 						]
 701 : 					}
 702 : 					Group {
 703 : 						children [
 704 : 							USE	TCylinder
 705 : 							USE	TRScale
 706 : 							USE	TReturn
 707 : 						]
 708 : 					}
 709 : 					Group {
 710 : 						children [
 711 : 							USE	TCylinder
 712 : 							USE	TRScale
 713 : 						]
 714 : 					}
 715 : 				]
 716 : 			}
 717 :             DEF SP PlaneSensor {
 718 : 				enabled	IS active
 719 : 				minPosition	-0.15 0
 720 : 				maxPosition 0.15 0
 721 : 				
 722 : 			}
 723 : 			DEF	OBack OrientationInterpolator {
 724 : 				key	[0, 1]
 725 : 				keyValue [0 1 0 0.5, 0 1 0 0]
 726 : 			}
 727 : 			DEF	TBack TimeSensor {
 728 : 				cycleInterval 0.05
 729 : 				loop FALSE
 730 : 				enabled	FALSE
 731 : 			}
 732 : 			DEF ScrCyl Script {
 733 : 				field SFNode manip USE SP
 734 : 				field SFNode rotmanip USE SR
 735 : 				field SFNode valec USE Cyl
 736 : 				field SFNode cas USE TBack
 737 : 				field SFVec3f vec 0 0 0
 738 : 				field SFRotation rotvec 0 1 0 0
 739 : 				field SFBool wasback FALSE
 740 : 				eventIn	SFBool back
 741 : 				eventIn	SFBool space IS	SpaceTouched
 742 : 				eventIn	SFRotation rot
 743 : 				url	"javascript:
 744 : 				function rot(val)
 745 : 				{
 746 : 					if (val.angle >= 0.5)
 747 : 					{
 748 : 						vec = valec.translation;
 749 : 						vec[0] = vec[0] + 0.002;
 750 : 						if (vec[0] >= 0.15)
 751 : 							vec[0] = 0.15;
 752 : 						manip.offset = vec;
 753 : 						valec.translation = vec;
 754 : 					}
 755 : 
 756 : 				}
 757 : 				function back(val, time)
 758 : 				{
 759 : 					if (!val) {
 760 : 						if (!wasback) {
 761 : 							wasback = true;
 762 : 							cas.startTime = time;
 763 : 							cas.enabled = true;
 764 : 							rotmanip.offset = rotvec;
 765 : 						}
 766 : 					} else {
 767 : 						wasback = false;
 768 : 					}
 769 : 				}
 770 : 				function space(val)
 771 : 				{
 772 : 					if (val) {
 773 : 						vec = valec.translation;
 774 : 						vec[0] = vec[0] - 0.01;
 775 : 						if (vec[0] <= -0.15)
 776 : 							vec[0] = -0.15;
 777 : 						manip.offset = vec;
 778 : 						valec.translation = vec;
 779 : 					}
 780 : 				}
 781 : 				"
 782 : 			}
 783 : 		]
 784 : 	}
 785 : 
 786 : 	ROUTE SP.translation_changed TO	Cyl.translation
 787 : 	ROUTE SR.rotation_changed TO TReturn.rotation
 788 : 	ROUTE SR.rotation_changed TO ScrCyl.rot
 789 : 	ROUTE SR.isActive TO ScrCyl.back
 790 : 	ROUTE TBack.fraction_changed TO	OBack.set_fraction
 791 : 	ROUTE OBack.value_changed TO TReturn.rotation
 792 : }
 793 : 
 794 : PROTO TWRearBox [exposedField SFNode plastic TWPlastic {},
 795 : 				 exposedField SFNode steel TWSteel {},
 796 : 				 eventIn SFBool SpaceTouched,
 797 : 				 eventIn SFBool active] 
 798 : {
 799 : 	LOD	{
 800 : 		range [1 5 20]
 801 : 		level [
 802 : 			DEF	Full Group {
 803 : 				children [
 804 :  					DEF TLRSide Transform {							# left rear side
 805 : 						children DEF LRSide Shape {
 806 : 							geometry Box {
 807 : 								size 0.004 0.16 0.096
 808 : 							}
 809 : 							appearance IS plastic
 810 : 						}
 811 : 						translation	-0.123 0.08 -0.148
 812 : 					}
 813 : 					DEF TRRSide Transform {							# right rear side
 814 : 						children USE LRSide
 815 : 						translation	0.123 0.08 -0.148
 816 : 					}
 817 : 					DEF TRSide Transform {							# rear side
 818 : 						children Shape {
 819 : 							geometry Box {
 820 : 								size 0.25 0.18 0.004
 821 : 							}
 822 : 							appearance IS plastic
 823 : 						}
 824 : 						translation	0 0.09 -0.198
 825 : 					}
 826 : 					DEF TRBottom Transform {						# rear bottom
 827 : 						children Shape {
 828 : 							geometry Box {
 829 : 								size 0.242 0.004 0.096
 830 : 							}
 831 : 							appearance IS plastic
 832 : 						}
 833 : 						translation	0 0.002 -0.148
 834 : 					}
 835 : 					DEF TLTape Transform {
 836 : 						children TWTape {steel IS steel}			# left tape box
 837 : 						translation	-0.10 0.1875 -0.11
 838 : 					}
 839 : 					DEF TRTape Transform {
 840 : 						children TWTape {steel IS steel}			# right tape box
 841 : 						translation	0.10 0.1875 -0.11
 842 : 					}
 843 : 					DEF TWindow Transform {
 844 : 						children TWWindow {steel IS steel}
 845 : 						translation	0 0.175 -0.15
 846 : 					}
 847 : 					DEF RMove TWRearBoxMoveable {plastic IS plastic, steel IS steel, SpaceTouched IS SpaceTouched, active IS active}
 848 : 				]
 849 : 			}
 850 : 			Group {
 851 : 				children [
 852 : 					USE	TRSide
 853 : 					USE	TLRSide
 854 : 					USE	TRRSide
 855 : 					USE	TRBottom
 856 : 					USE	TLTape
 857 : 					USE	TRTape
 858 : 					USE RMove
 859 : 				]
 860 : 			}
 861 : 			Group {
 862 : 				children [
 863 : 					Transform {
 864 : 						children Shape {
 865 : 							geometry Box {
 866 : 								size 0.25 0.18 0.10
 867 : 							}
 868 :                             appearance IS plastic
 869 : 						}
 870 : 						translation	0 0.09 -0.15
 871 : 					}
 872 : 					USE	RMove
 873 : 				]
 874 : 			}
 875 : 			Shape {}
 876 : 		]
 877 : 	}
 878 : }
 879 : 
 880 : PROTO TWKeyboard [exposedField SFNode steel TWSteel {}, eventOut SFBool SpaceTouched, eventIn SFBool active]
 881 : {
 882 : 	LOD	{
 883 : 		range [1 5 20]
 884 : 		level [
 885 : 			DEF Keys Group {		# keys with letters
 886 : 				children [
 887 : 					DEF Space Transform {		# spacebar key
 888 : 						children [
 889 : 							TWSpacebar	{steel IS steel}
 890 : 							DEF	TouchSpace TouchSensor {
 891 : 								enabled	IS active
 892 : 							}
 893 : 						]
 894 : 						translation	0 0.02 0.135
 895 : 					}
 896 : 					DEF	TimeSpace TimeSensor {
 897 : 						cycleInterval 0.5
 898 : 					}
 899 : 					DEF AniSpace PositionInterpolator {
 900 : 						key	[0, 0.3, 1]
 901 : 						keyValue [0 0.02 0.135, 0 0.01 0.135, 0 0.02 0.135]
 902 : 					}
 903 : 					Sound {
 904 :     					 source DEF SoundSpace AudioClip { url "key_wav/char_e.wav"}
 905 :     				}
 906 : 
 907 : 					Transform {		### first row - debugging
 908 : 						children [
 909 : 							Transform {							# z
 910 : 								children TWKey {char ["key_img/z.png"], steel IS steel}
 911 : 								translation	-0.10 0.025 0.110
 912 : 							}
 913 : 							Transform {							# x
 914 : 								children TWKey {char ["key_img/x.png"], steel IS steel}
 915 : 								translation	-0.08 0.025 0.110
 916 : 							}
 917 : 							Transform {							# c
 918 : 								children TWKey {char ["key_img/c.png"], steel IS steel}
 919 : 								translation	-0.06 0.025 0.110
 920 : 							}
 921 : 							Transform {							# v
 922 : 								children TWKey {char ["key_img/v.png"], steel IS steel}
 923 : 								translation	-0.04 0.025 0.110
 924 : 							}
 925 : 							Transform {							# b
 926 : 								children TWKey {char ["key_img/b.png"], steel IS steel}
 927 : 								translation	-0.02 0.025 0.110
 928 : 							}
 929 : 							Transform {							# n
 930 : 								children TWKey {char ["key_img/n.png"], steel IS steel}
 931 : 								translation	-0.00 0.025 0.110
 932 : 							}
 933 : 							Transform {							# m
 934 : 								children TWKey {char ["key_img/m.png"], steel IS steel}
 935 : 								translation	0.02 0.025 0.110
 936 : 							}
 937 : 							Transform {							# ,
 938 : 								children TWKey {char ["key_img/qmark_comma.png"], steel IS steel}
 939 : 								translation	0.04 0.025 0.110
 940 : 							}
 941 : 							Transform {							# .
 942 : 								children TWKey {char ["key_img/slash_period.png"], steel IS steel}
 943 : 								translation	0.06 0.025 0.110
 944 : 							}
 945 : 							Transform {							# /
 946 : 								children TWKey {char ["key_img/colon_hyphen.png"], steel IS steel}
 947 : 								translation	0.08 0.025 0.110
 948 : 							}
 949 : 						]
 950 : 						translation 0.01 0.005 0
 951 : 					}
 952 : 
 953 : 					Transform {		### second row - debugging
 954 : 						children [
 955 : 							Transform {							# a
 956 : 								children TWKey {char ["key_img/a.png"], steel IS steel}
 957 : 								translation	-0.10 0.025 0.110
 958 : 							}
 959 : 							Transform {							# s
 960 : 								children TWKey {char ["key_img/s.png"], steel IS steel}
 961 : 								translation	-0.08 0.025 0.110
 962 : 							}
 963 : 							Transform {							# d
 964 : 								children TWKey {char ["key_img/d.png"], steel IS steel}
 965 : 								translation	-0.06 0.025 0.110
 966 : 							}
 967 : 							Transform {							# f
 968 : 								children TWKey {char ["key_img/f.png"], steel IS steel}
 969 : 								translation	-0.04 0.025 0.110
 970 : 							}
 971 : 							Transform {							# g
 972 : 								children TWKey {char ["key_img/g.png"], steel IS steel}
 973 : 								translation	-0.02 0.025 0.110
 974 : 							}
 975 : 							Transform {							# h
 976 : 								children TWKey {char ["key_img/h.png"], steel IS steel}
 977 : 								translation	-0.00 0.025 0.110
 978 : 							}
 979 : 							Transform {							# j
 980 : 								children TWKey {char ["key_img/j.png"], steel IS steel}
 981 : 								translation	0.02 0.025 0.110
 982 : 							}
 983 : 							Transform {							# k
 984 : 								children TWKey {char ["key_img/k.png"], steel IS steel}
 985 : 								translation	0.04 0.025 0.110
 986 : 							}
 987 : 							Transform {							# l
 988 : 								children TWKey {char ["key_img/l.png"], steel IS steel}
 989 : 								translation	0.06 0.025 0.110
 990 : 							}
 991 : 							Transform {							# ;
 992 : 								children TWKey {char ["key_img/percent_o.png"], steel IS steel}
 993 : 								translation	0.08 0.025 0.110
 994 : 							}
 995 : 							Transform {							# ;
 996 : 								children TWKey {char ["key_img/ampersand_a.png"], steel IS steel}
 997 : 								translation	0.10 0.025 0.110
 998 : 							}
 999 : 						]
1000 : 						translation 0.00 0.015 -0.025
1001 : 					}
1002 : 
1003 : 					Transform {		### third row - debugging
1004 : 						children [
1005 : 							Transform {							# q
1006 : 								children TWKey {char ["key_img/q.png"], steel IS steel}
1007 : 								translation	-0.10 0.025 0.110
1008 : 							}
1009 : 							Transform {							# w
1010 : 								children TWKey {char ["key_img/w.png"], steel IS steel}
1011 : 								translation	-0.08 0.025 0.110
1012 : 							}
1013 : 							Transform {							# e
1014 : 								children TWKey {char ["key_img/e.png"], steel IS steel}
1015 : 								translation	-0.06 0.025 0.110
1016 : 							}
1017 : 							Transform {							# r
1018 : 								children TWKey {char ["key_img/r.png"], steel IS steel}
1019 : 								translation	-0.04 0.025 0.110
1020 : 							}
1021 : 							Transform {							# t
1022 : 								children TWKey {char ["key_img/t.png"], steel IS steel}
1023 : 								translation	-0.02 0.025 0.110
1024 : 							}
1025 : 							Transform {							# y
1026 : 								children TWKey {char ["key_img/y.png"], steel IS steel}
1027 : 								translation	-0.00 0.025 0.110
1028 : 							}
1029 : 							Transform {							# u
1030 : 								children TWKey {char ["key_img/u.png"], steel IS steel}
1031 : 								translation	0.02 0.025 0.110
1032 : 							}
1033 : 							Transform {							# i
1034 : 								children TWKey {char ["key_img/i.png"], steel IS steel}
1035 : 								translation	0.04 0.025 0.110
1036 : 							}
1037 : 							Transform {							# o
1038 : 								children TWKey {char ["key_img/o.png"], steel IS steel}
1039 : 								translation	0.06 0.025 0.110
1040 : 							}
1041 : 							Transform {							# p
1042 : 								children TWKey {char ["key_img/p.png"], steel IS steel}
1043 : 								translation	0.08 0.025 0.110
1044 : 							}
1045 : 							Transform {							# (
1046 : 								children TWKey {char ["key_img/paragraph_u.png"], steel IS steel}
1047 : 								translation	0.10 0.025 0.110
1048 : 							}
1049 : 						]
1050 : 						translation -0.003 0.025 -0.050
1051 : 					}
1052 : 
1053 : 					Transform {		### fourth row - debugging
1054 : 						children [
1055 : 							Transform {							# 1
1056 : 								children TWKey {char ["key_img/2.png"], steel IS steel}
1057 : 								translation	-0.10 0.025 0.110
1058 : 							}
1059 : 							Transform {							# 2
1060 : 								children TWKey {char ["key_img/3.png"], steel IS steel}
1061 : 								translation	-0.08 0.025 0.110
1062 : 							}
1063 : 							Transform {							# 3
1064 : 								children TWKey {char ["key_img/4.png"], steel IS steel}
1065 : 								translation	-0.06 0.025 0.110
1066 : 							}
1067 : 							Transform {							# 4
1068 : 								children TWKey {char ["key_img/5.png"], steel IS steel}
1069 : 								translation	-0.04 0.025 0.110
1070 : 							}
1071 : 							Transform {							# 5
1072 : 								children TWKey {char ["key_img/6.png"], steel IS steel}
1073 : 								translation	-0.02 0.025 0.110
1074 : 							}
1075 : 							Transform {							# 6
1076 : 								children TWKey {char ["key_img/7.png"], steel IS steel}
1077 : 								translation	-0.00 0.025 0.110
1078 : 							}
1079 : 							Transform {							# 7
1080 : 								children TWKey {char ["key_img/8.png"], steel IS steel}
1081 : 								translation	0.02 0.025 0.110
1082 : 							}
1083 : 							Transform {							# 8
1084 : 								children TWKey {char ["key_img/9.png"], steel IS steel}
1085 : 								translation	0.04 0.025 0.110
1086 : 							}
1087 : 							Transform {							# 9
1088 : 								children TWKey {char ["key_img/u_i.png"], steel IS steel}
1089 : 								translation	0.06 0.025 0.110
1090 : 							}
1091 : 							Transform {							# 0
1092 : 								children TWKey {char ["key_img/u_Kc.png"], steel IS steel}
1093 : 								translation	0.08 0.025 0.110
1094 : 							}
1095 : 							Transform {							# 0
1096 : 								children TWKey {char ["key_img/exclamation_underscore.png"], steel IS steel}
1097 : 								translation	0.10 0.025 0.110
1098 : 							}
1099 : 						]
1100 : 						translation 0.005 0.035 -0.075
1101 : 					}
1102 : 				]
1103 : 			}
1104 : 			USE Keys					# keys
1105 : 			Group {
1106 : 				children Shape {		# image of keyboard
1107 : 					geometry IndexedFaceSet	{
1108 : 						coord Coordinate {
1109 : 							point [-0.116 0.025 0.145,  0.116 0.025 0.145,
1110 : 								0.1225 0.060 0.015, -0.1225 0.060 0.015]
1111 : 						}
1112 : 						coordIndex [0 1 2 3 -1]
1113 : 						texCoord TextureCoordinate {
1114 : 							point [0 0, 1 0, 1 1, 0 1]
1115 : 						}
1116 : 						texCoordIndex [0 1 2 3 -1]
1117 : 					}
1118 : 					appearance Appearance {
1119 : 						texture	ImageTexture {
1120 : 							url	["keyboard.png"]
1121 : 						}
1122 : 						material Material {
1123 : 						}
1124 : 					}
1125 : 				}
1126 : 			}
1127 : 			Shape {}					# nothing at all
1128 : 		]
1129 : 	}
1130 : 
1131 : 	DEF	ScrSpace Script	{
1132 : 		eventIn	SFFloat	set_fraction
1133 : 		eventOut SFBool	space IS SpaceTouched
1134 : 		field SFBool msgsent FALSE
1135 : 		url	"javascript:
1136 : 			function set_fraction(value)
1137 : 			{
1138 : 				if (value < 0.5) {
1139 : 					msgsent = false;
1140 : 				}
1141 : 				if (value >= 0.5 && !msgsent)
1142 : 				{
1143 : 					msgsent = true;
1144 : 					space = true;
1145 : 				}
1146 : 			}
1147 : 		"
1148 : 	}
1149 : 
1150 : 	ROUTE TouchSpace.touchTime TO TimeSpace.startTime
1151 : 	ROUTE TimeSpace.fraction_changed TO	AniSpace.set_fraction
1152 : 	ROUTE TimeSpace.fraction_changed TO	ScrSpace.set_fraction
1153 : 	ROUTE AniSpace.value_changed TO	Space.translation
1154 : 	ROUTE TouchSpace.touchTime TO SoundSpace.startTime
1155 : }
1156 : 
1157 : PROTO TW [exposedField SFNode plastic TWPlastic {}
1158 :           exposedField SFNode steel TWSteel {}
1159 : 	      exposedField SFColor light 0 0 1
1160 :           eventIn SFBool lightOn 
1161 : 		  eventIn SFFloat rotSpeed
1162 : 		  field SFTime startTime 0
1163 : 		  exposedField SFTime stopTime 0
1164 : 		  eventIn SFBool lightOn
1165 : 		  exposedField SFTime startRotation -1
1166 : 		  exposedField SFTime stopRotation 0
1167 : 		  eventIn SFFloat rotSpeed
1168 : 		  eventOut SFString	get_name
1169 : 		  field SFString name "Psaci stroj"
1170 :  eventOut SFBool nearby
1171 : 		  
1172 : 	  ]
1173 : {
1174 : 	Group {
1175 : 		children [
1176 : 			# LOD [1 5 12 20]
1177 : 			# d < 1			- full detail
1178 : 			# 1 < d < 5		- detail
1179 : 			# 5 < d < 12	- nicely shaped
1180 : 			# 12 < d < 20	- just a box
1181 : 			# d > 20		- nothing at all
1182 : 			DEF TWT Transform {
1183 : 				children [
1184 : 					LOD	{
1185 : 						range [12 20]
1186 : 						level [
1187 : 							Group {
1188 : 								children [
1189 : 									TWFrontHandle { plastic IS plastic }
1190 : 									DEF RBox TWRearBox     { plastic IS plastic, steel IS steel }
1191 : 									TWMiddleBox   { plastic IS plastic, steel IS steel }
1192 : 									DEF Keyb TWKeyboard    { steel IS steel }
1193 : 								]
1194 : 							}
1195 : 							Transform {
1196 : 								children Shape {
1197 : 									geometry Box {
1198 : 										size 0.25 0.20 0.20
1199 : 									}
1200 : 									appearance IS plastic
1201 : 								}
1202 : 								translation	0 0.10 -0.10
1203 : 							}
1204 : 							Shape {}
1205 : 						]
1206 : 					}
1207 : 					DEF	Btn Transform {
1208 : 						children [
1209 : 							Transform {
1210 : 								children Shape {
1211 : 									geometry Cylinder {
1212 : 										bottom FALSE
1213 : 										top	FALSE
1214 : 										height 0.10
1215 : 										radius 0.008
1216 : 									}
1217 : 									appearance IS plastic
1218 : 								}
1219 : 								rotation 0 0 1 1.57
1220 : 								translation	-0.05 0.05 0
1221 : 							}
1222 : 							Transform {
1223 : 								children Shape {
1224 : 									geometry Cylinder {
1225 : 										bottom FALSE
1226 : 										top	FALSE
1227 : 										height 0.20
1228 : 										radius 0.008
1229 : 									}
1230 : 									appearance IS plastic
1231 : 								}
1232 : 								translation	0 0.15 0
1233 : 							}
1234 : 							DEF BtnHandle Transform {
1235 : 								children Shape {
1236 : 									geometry Sphere	{
1237 : 										radius 0.025
1238 : 									}
1239 : 									appearance Appearance {
1240 : 										material DEF BtnMat Material {
1241 : 											diffuseColor 1 .85 0
1242 : 											specularColor .87 .25 .25
1243 : 											ambientIntensity .157
1244 : 											shininess 1
1245 : 										}
1246 : 									}
1247 : 								}
1248 : 								translation	0 0.23 0
1249 : 								scale 1 1 1
1250 : 							}			  
1251 : 							DEF BtnTouch TouchSensor {}
1252 : 						]
1253 : 						translation	0.18 0.05 0
1254 : 						rotation 1 0 0 -1.2
1255 : 						center 0 0.05 0
1256 : 						scale 0.5 0.5 0.5
1257 : 					}
1258 : 				]
1259 : 			}
1260 : 			DEF BtnCol ColorInterpolator {
1261 : 				key	[0,0.5,1.0]
1262 : 				keyValue [0.1 0.8 0.2, 0 0.2 0.8, 0.1 0.8 0.2]
1263 : 			}
1264 : 			DEF	BtnSize PositionInterpolator {
1265 : 				key	[0, 0.05, 0.45, 0.5, 0.55, 0.95, 1.0]
1266 : 				keyValue [1 1 1, 1.1 1.1 1.1, 1.45 1.45 1.45, 1.5 1.5 1.5,
1267 : 				          1.45 1.45 1.45, 1.1 1.1 1.1, 1 1 1]
1268 : 			}
1269 : 			DEF	BtnTime TimeSensor {
1270 : 				cycleInterval 2
1271 : 				enabled	TRUE
1272 : 				loop TRUE
1273 : 			}
1274 : 			DEF BtnScr Script {
1275 : 				field SFNode btnOn USE Btn
1276 : 				eventIn	SFTime touch
1277 : 				eventOut SFBool	active
1278 : 				field SFBool on TRUE
1279 : 				url	"javascript:
1280 : 				function initialize()
1281 : 				{
1282 : 				    active = on;
1283 : 				}
1284 : 				function touch(x)
1285 : 				{
1286 : 				    if (on) {
1287 : 	                                btnOn.rotation = new SFRotation(1, 0, 0, 0);
1288 : 				    } else {
1289 : 		                        btnOn.rotation = new SFRotation(1, 0, 0, -1.2);
1290 : 				    }	
1291 : 				    on = !on;
1292 : 				    active = on;
1293 : 				}
1294 : 
1295 : 				"
1296 : 			}
1297 : 			DEF PS ProximitySensor	{
1298 : 				center 0 0 0
1299 : 				size 4 4 4
1300 : 				enabled	TRUE
1301 : 			}
1302 : 			DEF SLProx SpotLight {
1303 : 				ambientIntensity 1
1304 : 				beamWidth 1.570796
1305 : 				color IS light
1306 : 				cutOffAngle	0.55
1307 : 				direction 0 -1 0
1308 : 				intensity 1
1309 : 				location 0 0.5 -0.1
1310 : 				on FALSE
1311 : 				radius 1
1312 : 			}
1313 : 			DEF SLHUD SpotLight {
1314 : 				ambientIntensity 1
1315 : 				beamWidth 1.570796
1316 : 				color IS light
1317 : 				cutOffAngle	0.55
1318 : 				direction 0 -1 0
1319 : 				intensity 1
1320 : 				location 0 0.5 -0.1
1321 : 				on IS lightOn
1322 : 				radius 1
1323 : 			}
1324 : 			DEF ORot OrientationInterpolator {
1325 : 				key	[0, 0.5, 1.0]
1326 : 				keyValue [0 1 0 0, 0 1 0 3.14, 0 1 0 6.28]
1327 : 			}
1328 : 			DEF	TRot TimeSensor	{
1329 : 				cycleInterval 10
1330 : 				loop TRUE
1331 : 			}
1332 : 		  # rotation
1333 :           DEF DUMMY TimeSensor {
1334 :            startTime IS startRotation
1335 :            stopTime IS stopRotation
1336 :           }
1337 :           DEF ROTATOR Script {
1338 :            field SFBool rotEnable FALSE
1339 :            field SFFloat rotFracx 0
1340 :            eventOut SFFloat rotFrac
1341 :            field SFFloat rotSpd 0.05
1342 :            eventIn SFTime rotStart
1343 :            eventIn SFTime rotStop
1344 :            eventIn SFFloat rotSpeed IS rotSpeed
1345 :            field SFFloat rotFracLast 0
1346 :            field SFBool t1 FALSE
1347 :            eventIn SFFloat tick
1348 :            url "javascript:
1349 :             function rotStart(qx) {
1350 :              rotEnable=true;
1351 :             }
1352 :             function rotStop (qx) {
1353 :              rotEnable=false;
1354 :             }
1355 :             function rotSpeed(qx) {
1356 :              rotSpd=qx;
1357 :             }
1358 :             function tick(qx) {
1359 :              if (rotEnable) {
1360 :               var diff=qx-rotFracLast;
1361 :               if (diff<0) diff+=1;
1362 :               rotFracx+=diff*rotSpd;
1363 :               while (rotFracx>1) rotFracx-=1;
1364 :               rotFrac=rotFracx;
1365 :              }
1366 :              rotFracLast=qx;
1367 :             }
1368 :            "
1369 :           }         
1370 : 
1371 :      DEF NameScr Script {
1372 :       eventOut SFString get_name IS	get_name
1373 :       eventIn SFBool SendName
1374 :       eventOut SFBool nearby IS nearby
1375 :       field	SFString name IS name
1376 :       url "javascript:
1377 :       function SendName(x) {
1378 :        if (x){
1379 : 	get_name = name;
1380 :        }
1381 :        nearby=x;
1382 :       }
1383 :       "
1384 :      }
1385 : 
1386 : 		]
1387 : 	}								 
1388 : 	ROUTE BtnScr.active	TO Keyb.active
1389 : 	ROUTE BtnScr.active	TO RBox.active
1390 : 	ROUTE BtnScr.active	TO PS.enabled
1391 : 	ROUTE BtnTime.fraction_changed TO BtnSize.set_fraction
1392 : 	ROUTE BtnSize.value_changed TO BtnHandle.scale
1393 : 	ROUTE BtnTouch.touchTime TO BtnScr.touch
1394 : 
1395 : 	ROUTE TRot.fraction_changed	TO ROTATOR.tick
1396 : 	ROUTE ROTATOR.rotFrac TO ORot.set_fraction
1397 : 	ROUTE ORot.value_changed TO	TWT.rotation
1398 :     ROUTE DUMMY.startTime TO ROTATOR.rotStart
1399 :     ROUTE DUMMY.stopTime TO ROTATOR.rotStop
1400 : 
1401 : 	ROUTE PS.isActive TO SLProx.on
1402 : 	ROUTE PS.isActive TO NameScr.SendName
1403 : 	ROUTE Keyb.SpaceTouched	TO RBox.SpaceTouched
1404 : 	ROUTE BtnTime.fraction_changed TO BtnCol.set_fraction
1405 : 	ROUTE BtnCol.value_changed TO BtnMat.emissiveColor
1406 : }