tank.wrl

 tw.wrl  garaz2.wrl  cafe.wrl  tank.wrl  u2_l.wrl  u2.wrl  table.wrl 
Zpět Zpět
   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 : PROTO TankInside[]{
  17 :  Appearance {
  18 :   material Material {
  19 :    diffuseColor .3 .3 0
  20 :    ambientIntensity .6
  21 :    specularColor 1 1 1
  22 :    shininess .9
  23 :   }
  24 :  }
  25 : }
  26 : 
  27 : PROTO TankSurf[]{
  28 :  Appearance {
  29 :   material Material {
  30 :    diffuseColor .4 .8 .2
  31 :    ambientIntensity .6
  32 :    specularColor .1 .3 .1
  33 :   }
  34 :  }
  35 : }
  36 : 
  37 : PROTO TankPinkSurf[]{
  38 :  Appearance {
  39 :   material Material {
  40 :    diffuseColor .9 .5 .9
  41 :    ambientIntensity .6
  42 :    specularColor .3 .1 .3
  43 :   }
  44 :  }
  45 : }
  46 : 
  47 : PROTO TankTex [
  48 :  field MFString tex "tank2.png"
  49 : ]{
  50 :  Appearance {
  51 :   texture ImageTexture {
  52 :    url IS tex
  53 :   }
  54 :   material Material {
  55 :    ambientIntensity .4
  56 :    diffuseColor .4 .4 .4
  57 :   }
  58 :  }
  59 : }
  60 : 
  61 : 
  62 : PROTO TankWheelSurf [
  63 :  exposedField SFColor wheelColor 0 .4 0
  64 : ]{
  65 :  Appearance {
  66 :   material Material {
  67 :    diffuseColor IS wheelColor
  68 :    ambientIntensity .6
  69 :    specularColor 0 .3 0
  70 :   }
  71 :  }
  72 : }
  73 : 
  74 : PROTO TankWheel [
  75 :  exposedField SFVec3f pos 0 0 0
  76 :  exposedField SFColor wheelColor 0 .4 0
  77 :  exposedField SFColor wheelDarkColor 0 .2 0
  78 : ]{
  79 :  Transform {
  80 :   translation IS pos
  81 :   children Transform {
  82 :    rotation 0 0 1 1.57
  83 :    translation 0 -.9 -3
  84 :    children [
  85 :     Shape {
  86 :      appearance TankWheelSurf {wheelColor IS wheelColor }
  87 :      geometry Cylinder{
  88 :       height .2
  89 :       radius .4
  90 :      }
  91 :     }
  92 :     Shape {
  93 :      appearance TankWheelSurf {wheelColor IS wheelDarkColor }
  94 :      geometry Cylinder{
  95 :       height .25
  96 :       radius .32
  97 :      }
  98 :     }
  99 :    ]
 100 :   }
 101 :  }
 102 : }
 103 : 
 104 : PROTO TankWheelLod0 [
 105 :  exposedField SFVec3f pos 0 0 0
 106 :  exposedField SFColor wheelColor 0 .4 0
 107 :  exposedField SFColor wheelDarkColor 0 .2 0
 108 : ]{
 109 :  Transform {
 110 :   translation IS pos
 111 :   children Transform {
 112 :    rotation 0 0 1 1.57
 113 :    translation 0 -.9 -3
 114 :    children [
 115 :     Shape {
 116 :      appearance TankWheelSurf {wheelColor IS wheelColor }
 117 :      geometry Cylinder{
 118 :       height .23
 119 :       radius .4
 120 :       bottom FALSE
 121 :       top FALSE
 122 :      }
 123 :     }
 124 :     Shape {
 125 :      appearance TankWheelSurf {wheelColor IS wheelDarkColor }
 126 :      geometry Cylinder{
 127 :       height .23
 128 :       radius .4
 129 :       side FALSE
 130 :      }
 131 :     }
 132 :    ]
 133 :   }
 134 :  }
 135 : }
 136 : 
 137 : 
 138 : PROTO TankTrack[]{
 139 :  Shape {
 140 :   appearance Appearance {
 141 :    texture ImageTexture {
 142 :     url "trk.png"
 143 :    }
 144 :    textureTransform TextureTransform {
 145 :     scale 3 128
 146 :     translation -.05 0
 147 :    }
 148 :   }
 149 :   geometry Extrusion {
 150 :    creaseAngle 1.3
 151 :    beginCap FALSE
 152 :    endCap FALSE
 153 :    spine [
 154 :     0 -1.3 -3.1,
 155 :     0 -1.2 -3.3,
 156 :     0 -1.1 -3.4,
 157 :     0 -0.4 -3.85,
 158 :     0 -0.2 -3.9,
 159 :     0  0.0 -3.85
 160 :     0  0.1 -3.75
 161 :     0  0.2 -3.6,
 162 :     0  0.2  3.6,
 163 :     0  0.1  3.75
 164 :     0  0.0  3.85
 165 :     0 -0.2  3.9,
 166 :     0 -0.4  3.85,
 167 :     0 -1.1  3.4,
 168 :     0 -1.2  3.3,
 169 :     0 -1.3  3.1,
 170 :     0 -1.3 -3.1
 171 :    ]
 172 :    crossSection [.02 .16,.02 -.16,-.02 -.16,-.02 .16,.02 .16]
 173 :   }
 174 :  }
 175 : }
 176 : 
 177 : PROTO TankWheelSet [
 178 :  exposedField SFColor wheelColor 0 .4 0
 179 :  exposedField SFColor wheelDarkColor 0 .2 0
 180 : ]{
 181 :  Group {
 182 :   children [
 183 :    #upper row
 184 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor }
 185 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 1.5 }
 186 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 3   }
 187 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 4.5 }
 188 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 6   }
 189 :    #lower row
 190 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 -.5 }
 191 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 0.9  }
 192 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 2.3  }
 193 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 3.7  }
 194 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 5.1  }
 195 :    TankWheel { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 6.5  }
 196 :   ]
 197 :  }
 198 : }
 199 : 
 200 : PROTO TankWheelSetLod0 [
 201 :  exposedField SFColor wheelColor 0 .4 0
 202 :  exposedField SFColor wheelDarkColor 0 .2 0
 203 : ]{
 204 :  Group {
 205 :   children [
 206 :    #upper row
 207 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor }
 208 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 1.5 }
 209 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 3   }
 210 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 4.5 }
 211 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 0 6   }
 212 :    #lower row
 213 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 -.5 }
 214 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 0.9  }
 215 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 2.3  }
 216 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 3.7  }
 217 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 5.1  }
 218 :    TankWheelLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor  pos 0 .7 6.5  }
 219 :   ]
 220 :  }
 221 : }
 222 : 
 223 : 
 224 : PROTO TankTrackComponent [
 225 :  exposedField SFVec3f pos 0 0 0
 226 :  exposedField SFColor wheelColor 0 .4 0
 227 :  exposedField SFColor wheelDarkColor 0 .2 0
 228 : ]{
 229 :  Transform {
 230 :   translation IS pos
 231 :   children [
 232 :    TankWheelSet { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
 233 :    TankTrack {}
 234 :   ]
 235 :  }
 236 : }
 237 : 
 238 : PROTO TankTrackComponentLod0 [
 239 :  exposedField SFVec3f pos 0 0 0
 240 :  exposedField SFColor wheelColor 0 .4 0
 241 :  exposedField SFColor wheelDarkColor 0 .2 0
 242 : ]{
 243 :  Transform {
 244 :   translation IS pos
 245 :   children [
 246 :    TankWheelSetLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
 247 :    TankTrack {}
 248 :   ]
 249 :  }
 250 : }
 251 : 
 252 : PROTO TankLight [
 253 :  exposedField SFVec3f pos 0 0 0
 254 :  exposedField SFNode tex TankSurf {}
 255 : ]{
 256 :  Transform {
 257 :   translation IS pos
 258 :   rotation 1 0 0 -1.57
 259 :   children [
 260 :    SpotLight {
 261 :     beamWidth 1.570796
 262 :     intensity 1
 263 :     radius 10
 264 :     cutOffAngle 0.785398
 265 :     direction 0 1 0
 266 :    }
 267 :    Shape {
 268 :     appearance IS tex
 269 :     geometry Cylinder {
 270 :      bottom FALSE
 271 :      height .2
 272 :      radius .15
 273 :     }
 274 :    }
 275 :    Transform {
 276 :     translation 0 .35 0
 277 :     scale .35 .25 .35
 278 :     children Billboard {
 279 :      axisOfRotation 0 1 0
 280 :      children Shape {
 281 :       appearance Appearance {
 282 :        texture ImageTexture {
 283 :         url "lite2.png"
 284 :        }
 285 :       }
 286 :       geometry IndexedFaceSet {
 287 :        coord Coordinate {
 288 :         point [-1 -1 0,-1 1 0,1 1 0 1 -1 0]
 289 :        }
 290 :        coordIndex [3 2 1 0 -1]
 291 :       }
 292 :      }
 293 :     }
 294 :    }
 295 :    Shape {
 296 :     appearance Appearance {
 297 :      material Material {
 298 :       diffuseColor .9 .9 .9
 299 :       emissiveColor 1 1 1
 300 :      }
 301 :     }
 302 :     geometry Cylinder {
 303 :      bottom FALSE
 304 :      side FALSE
 305 :      height .205
 306 :      radius .12
 307 :     }
 308 :    }
 309 :   ]
 310 :  }
 311 : }
 312 : 
 313 : PROTO TankLightBack [
 314 :  exposedField SFVec3f pos 0 0 0
 315 :  exposedField SFNode tex TankSurf {}
 316 : ]{
 317 :  Transform {
 318 :   translation IS pos
 319 :   rotation 1 0 0 -1.57
 320 :   children [
 321 :    Shape {
 322 :     appearance IS tex
 323 :     geometry Cylinder {
 324 :      top FALSE
 325 :      height .2
 326 :      radius .09
 327 :     }
 328 :    }
 329 :    Shape {
 330 :     appearance Appearance {
 331 :      material Material {
 332 :       diffuseColor .9 0 0
 333 :       emissiveColor 1 0 0
 334 :      }
 335 :     }
 336 :     geometry Cylinder {
 337 :      top FALSE
 338 :      side FALSE
 339 :      height .205
 340 :      radius .06
 341 :     }
 342 :    }
 343 :   ]
 344 :  }
 345 : }
 346 : 
 347 : PROTO TankEntranceLod0 [
 348 :  exposedField SFVec3f pos 0 0 0
 349 :  exposedField SFNode tex TankSurf {}
 350 : ]{
 351 :  Transform {
 352 :   translation IS pos
 353 :   children [
 354 :    #cover
 355 :    Transform {
 356 :     translation 0 .04 0
 357 :     children [
 358 :      Shape {
 359 :       appearance IS tex
 360 :       geometry Cylinder {
 361 :        radius .45
 362 :        top TRUE
 363 :        bottom FALSE
 364 :        height .09
 365 :       }
 366 :      }
 367 :     ]
 368 :    }
 369 :    #rim
 370 :    Shape {
 371 :     appearance IS tex
 372 :     geometry Cylinder {
 373 :      radius .5
 374 :      top TRUE
 375 :      height .03
 376 :      bottom FALSE
 377 :     }
 378 :    }
 379 :   ]
 380 :  }
 381 : }
 382 : 
 383 : PROTO TankEntranceLod1 [
 384 :  exposedField SFVec3f pos 0 0 0
 385 :  exposedField SFNode tex TankSurf {}
 386 : ]{
 387 :  Transform {
 388 :   translation IS pos
 389 :   children Transform {
 390 :    translation 0 .025 0
 391 :    children Shape {
 392 :     appearance IS tex
 393 :     geometry Cylinder {
 394 :      radius .48
 395 :      top TRUE
 396 :      bottom FALSE
 397 :      height .12
 398 :     }
 399 :    }
 400 :   }
 401 :  }
 402 : }
 403 : 
 404 : PROTO TankEntrance [
 405 :  exposedField SFVec3f pos 0 0 0
 406 :  exposedField SFNode tex TankSurf {}
 407 : ]{
 408 :  Transform {
 409 :   translation IS pos
 410 :   children [
 411 :    #interior
 412 :    Shape {
 413 :     appearance TankInside {}
 414 :     geometry Cylinder {
 415 :      radius .4
 416 :      top TRUE
 417 :      height .05
 418 :      bottom FALSE
 419 :     }
 420 :    }
 421 :    TankEntranceLod0 { tex IS tex }
 422 :    #handle
 423 :    Transform {
 424 :     translation 0 .1 -.38
 425 :     children [
 426 :      Shape {
 427 :       appearance IS tex
 428 :       geometry Box {
 429 :        size .08 .03 .25
 430 :       }
 431 :      }
 432 :     ]
 433 :    }
 434 :    #"axis" of rotation
 435 :    Transform {
 436 :     translation 0 .05 .42
 437 :     rotation 0 0 1 1.57
 438 :     children [
 439 :      Shape {
 440 :       appearance IS tex
 441 :       geometry Cylinder {
 442 :        height .25
 443 :        radius .05
 444 :       }
 445 :      }
 446 :     ]
 447 :    }
 448 :   ]
 449 :  }
 450 : }
 451 : 
 452 : PROTO TankMG [
 453 :  exposedField SFVec3f pos 0 0 0
 454 :  exposedField SFNode tex TankSurf {}
 455 : ]{
 456 :  Transform {
 457 :   translation IS pos
 458 :   children [
 459 :    Transform {
 460 :     rotation 1 0 0 -1.57
 461 :     translation 0 0 -.25
 462 :     children [
 463 :      Shape {
 464 :       appearance IS tex
 465 :       geometry Cylinder {
 466 :        radius .03
 467 :        height .5
 468 :        bottom FALSE
 469 :       }
 470 :      }
 471 :      Shape {
 472 :       appearance BlackHole {}
 473 :       geometry Cylinder {
 474 :        radius .02
 475 :        height .502
 476 :        bottom FALSE
 477 :        side FALSE
 478 :       }
 479 :      }
 480 :     ]
 481 :    }
 482 :    Shape {
 483 :     appearance IS tex
 484 :     geometry Sphere {
 485 :      radius .2
 486 :     }
 487 :    }
 488 :   ]
 489 :  }
 490 : }
 491 : 
 492 : PROTO TankMGLod0 [
 493 :  exposedField SFVec3f pos 0 0 0
 494 :  exposedField SFNode tex TankSurf {}
 495 : ]{
 496 :  Transform {
 497 :   translation IS pos
 498 :   children Shape {
 499 :    appearance IS tex
 500 :    geometry Sphere {
 501 :     radius .2
 502 :    }
 503 :   }
 504 :  }
 505 : }
 506 : 
 507 : PROTO TankCannonHole[]{
 508 :  Transform {
 509 :   translation 0 -1.5 0
 510 :   children [
 511 :    Shape {
 512 :     appearance BlackHole {}
 513 :     geometry Cylinder {
 514 :      radius .10
 515 :      height .001
 516 :      top FALSE
 517 :      side FALSE
 518 :     }
 519 :    }
 520 :   ]
 521 :  }
 522 : }
 523 : 
 524 : PROTO TankCannon [
 525 :  exposedField SFVec3f pos 0 0 0
 526 :  exposedField SFNode tex TankSurf {}
 527 : ]{
 528 :  Transform {
 529 :   rotation 1 0 0 1.57
 530 :   translation IS pos
 531 :   children [
 532 :    TankCannonHole {}
 533 :    Transform {
 534 :     translation 0 -1.4 0
 535 :     children [
 536 :      Shape {
 537 :       appearance IS tex
 538 :       geometry Cylinder {
 539 :        radius .15
 540 :        height .2
 541 :       }
 542 :      }
 543 :     ]
 544 :    }
 545 :    Shape {
 546 :     appearance IS tex
 547 :     geometry Cylinder {
 548 :      radius .12
 549 :      height 3
 550 :      top FALSE
 551 :     }
 552 :    }
 553 :    Shape {
 554 :     appearance IS tex
 555 :     geometry Cylinder {
 556 :      radius .14
 557 :      height 1.1
 558 :     }
 559 :    }
 560 :   ]
 561 :  }
 562 : }
 563 : 
 564 : PROTO TankCannonLod0 [
 565 :  exposedField SFVec3f pos 0 0 0
 566 :  exposedField SFNode tex TankSurf {}
 567 : ]{
 568 :  Transform {
 569 :   rotation 1 0 0 1.57
 570 :   translation IS pos
 571 :   children [
 572 :    TankCannonHole {}
 573 :    Shape {
 574 :     appearance IS tex
 575 :     geometry Cylinder {
 576 :      radius .14
 577 :      height 3
 578 :      top FALSE
 579 :     }
 580 :    }
 581 :   ]
 582 :  }
 583 : }
 584 : 
 585 : PROTO TankWindow [
 586 :  exposedField SFVec3f pos 0 0 0
 587 :  exposedField SFNode tex TankSurf {}
 588 : ]{
 589 :  Transform {
 590 :   translation IS pos
 591 :   children [
 592 :    Shape {
 593 :     appearance IS tex
 594 :     geometry Box {
 595 :      size .6 .3 .3
 596 :     }
 597 :    }
 598 :    Shape {
 599 :     appearance BlackHole {}
 600 :     geometry Box {
 601 :      size .4 .1 .31
 602 :     }
 603 :    }
 604 :   ]
 605 :  }
 606 : }
 607 : 
 608 : PROTO TankWedge [
 609 :  exposedField SFNode tex TankSurf {}
 610 : ]{
 611 :  Shape {
 612 :   appearance IS tex
 613 :   geometry IndexedFaceSet {
 614 :    coord Coordinate {
 615 :     point [
 616 :      -1.2 -.65 -3.4,
 617 :      -1.2 -.65  3.4,
 618 :      -1.2  .65  4.1,
 619 :      -1.2  .65 -4.1,
 620 :      1.2 -.65 -3.4,
 621 :      1.2 -.65  3.4,
 622 :      1.2  .65  4.1
 623 :      1.2  .65 -4.1,
 624 :     ]
 625 :    }
 626 :    coordIndex [
 627 :     0 1 2 3 -1,
 628 :     4 5 1 0 -1,
 629 :     7 6 5 4 -1,
 630 :     6 7 3 2 -1,
 631 :     5 6 2 1 -1,
 632 :     0 3 7 4 -1
 633 :    ]
 634 :    texCoord TextureCoordinate {
 635 :     point [
 636 :      -1 -2,
 637 :      -1  2,
 638 :      1  1.7,
 639 :      1 -1.7,
 640 :     ]
 641 :    }
 642 :    texCoordIndex [
 643 :     0 1 2 3 -1,
 644 :     0 1 2 3 -1,
 645 :     0 1 2 3 -1,
 646 :     0 1 2 3 -1,
 647 :     1 2 3 0 -1,
 648 :     1 2 3 0 -1,
 649 :    ]
 650 :   }
 651 :  }
 652 : }
 653 : 
 654 : PROTO TankWedges [
 655 :  exposedField SFNode tex TankSurf {}
 656 : ]{
 657 :  Transform {
 658 :   translation 0 -.4 0
 659 :   children [
 660 :    TankWedge {tex IS tex }
 661 :    Transform {
 662 :     rotation 1 0 0 3.14
 663 :     scale 1.4 .5 1
 664 :     translation 0 .975 0
 665 :     children TankWedge {tex IS tex }
 666 :    }
 667 :   ]
 668 :  }
 669 : }
 670 : 
 671 : PROTO TankBackBox [
 672 :  exposedField SFVec3f pos 0 0 0
 673 :  exposedField SFNode tex TankSurf {}
 674 : ]{
 675 :  Transform {
 676 :   translation IS pos
 677 :   children DEF TankBackBox Shape {
 678 :    appearance IS tex
 679 :    geometry Box {
 680 :     size 1 .06 1
 681 :    }
 682 :   }
 683 :  }
 684 : }
 685 : 
 686 : PROTO TankGunRack [
 687 :  exposedField SFVec3f pos 0 0 0
 688 :  exposedField SFNode tex TankSurf {}
 689 : ]{
 690 :  Transform {
 691 :   translation IS pos
 692 :   rotation 0 0 1 1.57
 693 :   children [
 694 :    Shape {
 695 :     appearance IS tex
 696 :     geometry Cylinder {
 697 :      radius .4
 698 :      height .3
 699 :      bottom TRUE
 700 :      top TRUE
 701 :     }
 702 :    }
 703 :    Shape {
 704 :     appearance IS tex
 705 :     geometry Box {
 706 :      size .7 .5 .5
 707 :     }
 708 :    }
 709 :   ]
 710 :  }
 711 : }
 712 : 
 713 : PROTO TankGunRackLod0 [
 714 :  exposedField SFVec3f pos 0 0 0
 715 :  exposedField SFNode tex TankSurf {}
 716 : ]{
 717 :  Transform {
 718 :   translation IS pos
 719 :   rotation 0 0 1 1.57
 720 :   children [
 721 :    Shape {
 722 :     appearance IS tex
 723 :     geometry Cylinder {
 724 :      radius .4
 725 :      height .4
 726 :      bottom TRUE
 727 :      top TRUE
 728 :     }
 729 :    }
 730 :   ]
 731 :  }
 732 : }
 733 : 
 734 : 
 735 : PROTO TankHiBox [
 736 :  exposedField SFNode tex TankSurf {}
 737 : ]{
 738 :  Transform {
 739 :   translation 0 .6 .5
 740 :   children [
 741 :    Shape {
 742 :     appearance IS tex
 743 :     geometry Box {
 744 :      size 2.7 .65 6.7
 745 :     }
 746 :    }
 747 :   ]
 748 :  }
 749 : }
 750 : 
 751 : PROTO TankLowerBodyLod0 [
 752 :  exposedField SFNode tex TankSurf {}
 753 : ]{
 754 :  Group {
 755 :   children [
 756 :    TankHiBox {tex IS tex }
 757 :    TankWedges {tex IS tex }
 758 :   ]
 759 :  }
 760 : }
 761 : 
 762 : PROTO TankLowerBody [
 763 :  exposedField SFNode tex TankSurf {}
 764 : ]{
 765 :  Group {
 766 :   children [
 767 :    TankBackBox { pos  .7 .95 3.1 tex IS tex }
 768 :    TankBackBox { pos -.7 .95 3.1 tex IS tex }
 769 :    TankLowerBodyLod0 {tex IS tex }
 770 :   ]
 771 :  }
 772 : }
 773 : 
 774 : PROTO TurretBackWedge [
 775 :  exposedField SFNode tex TankSurf {}
 776 : ]{
 777 :  Transform {
 778 :   rotation 1 1 1 2.09
 779 :   translation 0 .69 1.75
 780 :   children [
 781 :    Shape {
 782 :     appearance IS tex
 783 :     geometry IndexedFaceSet {
 784 :      coord Coordinate {
 785 :       point [
 786 :        -.35 -1.75 -1.45,
 787 :        -.35 -1.75  1.45,
 788 :        -.35   .15   .8,
 789 :        -.35   .15  -.8,
 790 :         .35 -1.75 -1.45,
 791 :         .35 -1.75  1.45,
 792 :         .35   .15   .8
 793 :         .35   .15  -.8,
 794 :       ]
 795 :      }
 796 :      coordIndex [
 797 :       0 1 2 3 -1,
 798 :       4 5 1 0 -1,
 799 :       7 6 5 4 -1,
 800 :       6 7 3 2 -1,
 801 :       5 6 2 1 -1,
 802 :       0 3 7 4 -1
 803 :      ]
 804 :     }
 805 :    }
 806 :   ]
 807 :  }
 808 : }
 809 : 
 810 : PROTO TurretMiddle [
 811 :  exposedField SFNode tex TankSurf {}
 812 : ]{
 813 :  Transform { translation 0 .55 0
 814 :   children [
 815 :    Shape {
 816 :     appearance IS tex
 817 :     geometry Cylinder {
 818 :      radius 1.5
 819 :      height 1
 820 :     }
 821 :    }
 822 :   ]
 823 :  }
 824 : }
 825 : 
 826 : PROTO TurretMiddleLod0 [
 827 :  exposedField SFNode tex TankSurf {}
 828 : ]{
 829 :  Transform { translation 0 .5 0
 830 :   children [
 831 :    Shape {
 832 :     appearance IS tex
 833 :     geometry Cylinder {
 834 :      radius 1.5
 835 :      height 1.1
 836 :      bottom FALSE
 837 :     }
 838 :    }
 839 :   ]
 840 :  }
 841 : }
 842 : 
 843 : PROTO TurretBottom [
 844 :  exposedField SFNode tex TankSurf {}
 845 : ]{
 846 :  Shape {
 847 :   appearance IS tex
 848 :   geometry Cylinder {
 849 :    radius 1.4
 850 :    height .1
 851 :    top FALSE
 852 :    bottom FALSE
 853 :   }
 854 :  }
 855 : }
 856 : 
 857 : PROTO TurretTop [
 858 :  exposedField SFNode tex TankSurf {}
 859 : ]{
 860 :  Transform { translation 0 1.08 0
 861 :   children [
 862 :    Shape {
 863 :     appearance IS tex
 864 :     geometry Cone {
 865 :      bottomRadius 1.5
 866 :      height .1
 867 :      bottom FALSE
 868 :     }
 869 :    }
 870 :   ]
 871 :  }
 872 : }
 873 : 
 874 : PROTO TankTurretCore0 [
 875 :  exposedField SFNode tex TankSurf {}
 876 : ]{
 877 :  Group {
 878 :   children [
 879 :    TurretBackWedge { tex IS tex}
 880 :    TurretMiddle { tex IS tex}
 881 :    TurretBottom { tex IS tex}
 882 :    TurretTop { tex IS tex}
 883 :    TankCannon { pos 0 .5 -2.7 tex IS tex }
 884 :    TankGunRack { pos 0 .5 -1.3 tex IS tex }
 885 :   ]
 886 :  }
 887 : }
 888 : 
 889 : 
 890 : PROTO TankTurret [
 891 :  exposedField SFNode tex TankSurf {}
 892 : ]{
 893 :  Transform {
 894 :   translation 0 .94 1
 895 :   children [
 896 :    TankTurretCore0 { tex IS tex }
 897 :    TankEntrance { pos -.7 1.1 .45 tex IS tex }
 898 :    TankEntrance { pos  .7 1.1 .45 tex IS tex }
 899 :   ]
 900 :  }
 901 : }
 902 : 
 903 : PROTO TankTurretLod0 [
 904 :  exposedField SFNode tex TankSurf {}
 905 : ]{
 906 :  Transform {
 907 :   translation 0 .94 1
 908 :   children [
 909 :    TankTurretCore0 { tex IS tex }
 910 :    TankEntranceLod0 { pos -.7 1.1 .45 tex IS tex }
 911 :    TankEntranceLod0 { pos  .7 1.1 .45 tex IS tex }
 912 :   ]
 913 :  }
 914 : }
 915 : 
 916 : PROTO TankTurretCore1 [
 917 :  exposedField SFNode tex TankSurf {}
 918 : ]{
 919 :  Group {
 920 :   children [
 921 :    TurretBackWedge { tex IS tex}
 922 :    TurretMiddleLod0 { tex IS tex}
 923 :    TankCannonLod0 { pos 0 .5 -2.7 tex IS tex }
 924 :   ]
 925 :  }
 926 : }
 927 : 
 928 : 
 929 : PROTO TankTurretLod2 [
 930 :  exposedField SFNode tex TankSurf {}
 931 : ]{
 932 :  Transform {
 933 :   translation 0 .94 1
 934 :   children TankTurretCore1 { tex IS tex }
 935 :  }
 936 : }
 937 : 
 938 : PROTO TankTurretLod1 [
 939 :  exposedField SFNode tex TankSurf {}
 940 : ]{
 941 :  Transform {
 942 :   translation 0 .94 1
 943 :   children [
 944 :    TankTurretCore1 { tex IS tex }
 945 :    TankGunRackLod0 { pos 0 .5 -1.3 tex IS tex }
 946 :    TankEntranceLod1 { pos -.7 1.1 .45 tex IS tex }
 947 :    TankEntranceLod1 { pos  .7 1.1 .45 tex IS tex }
 948 :   ]
 949 :  }
 950 : }
 951 : 
 952 : PROTO TankFLights [
 953 :  exposedField SFNode tex TankSurf {}
 954 : ]{
 955 :  Group {
 956 :   children [
 957 :    TankLight { pos  1.3 .5 -3.9 tex IS tex }
 958 :    TankLight { pos -1.3 .5 -3.9 tex IS tex }
 959 :   ]
 960 :  }
 961 : }
 962 : 
 963 : PROTO TankLights [
 964 :  exposedField SFNode tex TankSurf {}
 965 : ]{
 966 :  Group {
 967 :   children [
 968 :    TankFLights { tex IS tex }
 969 :    TankLightBack { pos  1.3 .5 3.85 tex IS tex}
 970 :    TankLightBack { pos -1.3 .5 3.85 tex IS tex }
 971 :   ]
 972 :  }
 973 : }
 974 : 
 975 : PROTO TankLod0 [
 976 :  exposedField SFColor wheelColor 0 .4 0
 977 :  exposedField SFColor wheelDarkColor 0 .2 0
 978 :  exposedField SFNode tex TankSurf {}
 979 : ]{
 980 :  Group {
 981 :   children [
 982 :    TankLowerBody{ tex IS tex}
 983 :    TankTrackComponent {pos -1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
 984 :    TankTrackComponent {pos  1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
 985 :    TankEntrance { pos  .8 .95 -2.2 tex IS tex }
 986 :    TankEntrance { pos -.8 .95 -2.2 tex IS tex }
 987 :    TankTurret{ tex IS tex}
 988 :    TankMG { pos .7 .65 -3.68 tex IS tex }
 989 :    TankWindow { pos 0 .7 -3.6 tex IS tex }
 990 :    TankLights { tex IS tex }
 991 :   ]
 992 :  }
 993 : }
 994 : 
 995 : PROTO TankLod1 [
 996 :  exposedField SFColor wheelColor 0 .4 0
 997 :  exposedField SFColor wheelDarkColor 0 .2 0
 998 :  exposedField SFNode tex TankSurf {}
 999 : ]{
1000 :  Group {
1001 :   children [
1002 :    TankLowerBody{ tex IS tex}
1003 :    TankTrackComponent {pos -1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
1004 :    TankTrackComponent {pos  1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
1005 :    TankEntranceLod0 { pos  .8 .95 -2.2 tex IS tex }
1006 :    TankEntranceLod0 { pos -.8 .95 -2.2 tex IS tex }
1007 :    TankTurretLod0{ tex IS tex}
1008 :    TankMG { pos .7 .65 -3.68 tex IS tex }
1009 :    TankWindow { pos 0 .7 -3.6 tex IS tex }
1010 :    TankLights { tex IS tex }
1011 :   ]
1012 :  }
1013 : }
1014 : 
1015 : PROTO TankLod2 [
1016 :  exposedField SFColor wheelColor 0 .4 0
1017 :  exposedField SFColor wheelDarkColor 0 .2 0
1018 :  exposedField SFNode tex TankSurf {}
1019 : ]{
1020 :  Group {
1021 :   children [
1022 :    TankLowerBodyLod0{ tex IS tex}
1023 :    TankTrackComponent {pos -1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
1024 :    TankTrackComponent {pos  1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
1025 :    TankEntranceLod1 { pos  .8 .95 -2.2 tex IS tex}
1026 :    TankEntranceLod1 { pos -.8 .95 -2.2 tex IS tex}
1027 :    TankTurretLod1{ tex IS tex}
1028 :    TankMGLod0 { pos .7 .65 -3.68 tex IS tex }
1029 :    TankWindow { pos 0 .7 -3.6 tex IS tex }
1030 :    TankFLights { tex IS tex }
1031 :   ]
1032 :  }
1033 : }
1034 : 
1035 : PROTO TankLod3 [
1036 :  exposedField SFColor wheelColor 0 .4 0
1037 :  exposedField SFColor wheelDarkColor 0 .2 0
1038 :  exposedField SFNode tex TankSurf {}
1039 : ]{
1040 :  Group {
1041 :   children [
1042 :    TankLowerBodyLod0{ tex IS tex}
1043 :    TankTrackComponentLod0 {pos -1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
1044 :    TankTrackComponentLod0 {pos  1.4 0 0 wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor}
1045 :    TankTurretLod2{ tex IS tex}
1046 :   ]
1047 :  }
1048 : }
1049 : 
1050 : PROTO TankLod4 [
1051 :  exposedField SFNode tex TankSurf {}
1052 : ]{
1053 :  Group {
1054 :   children [
1055 :    Shape {
1056 :     appearance IS tex
1057 :     geometry Box {
1058 :      size 3.36 2.2 7.5
1059 :     }
1060 :    }
1061 :    Transform {
1062 :     translation 0 1.54 1
1063 :     children Shape {
1064 :      appearance IS tex
1065 :      geometry Box {
1066 :       size 3 1.1 3.4
1067 :      }
1068 :     }
1069 :    }
1070 :   ]
1071 :  }
1072 : }
1073 : 
1074 : 
1075 : PROTO Tank [
1076 :  exposedField SFVec3f pos 0 0 0              #pozice
1077 :  exposedField SFRotation rot 0 0 1 0         #rotace
1078 :  exposedField SFInt32 lod 1                  #zaputo/vypnuto lOD
1079 :  exposedField SFColor wheelColor 0 .4 0      #barva kolecek
1080 :  exposedField SFColor wheelDarkColor 0 .2 0  #barva vnitrku kolecek
1081 :  exposedField SFNode tex TankSurf {}         #barva ci textura tanku
1082 :  field MFFloat lodRanges [6 14 20 100 500] #vzdalenosti pro lod
1083 : ]{
1084 :  Transform {
1085 :   translation IS pos
1086 :   rotation IS rot
1087 :   children Switch {
1088 :    whichChoice IS lod
1089 :    choice [
1090 :     TankLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor tex IS tex}
1091 :     LOD {
1092 :      range IS lodRanges
1093 :      level [
1094 :       TankLod0 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor tex IS tex}
1095 :       TankLod1 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor tex IS tex }
1096 :       TankLod2 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor tex IS tex }
1097 :       TankLod3 { wheelColor IS wheelColor wheelDarkColor IS wheelDarkColor tex IS tex }
1098 :       TankLod4 { tex IS tex}
1099 :       Group{}
1100 :      ]
1101 :     }
1102 :    ]
1103 :   }
1104 :  }
1105 : }