home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / graphics / ftpovst / temp / pencil.inc next >
Text File  |  1994-02-12  |  7KB  |  221 lines

  1.  
  2. #declare PencilPaint =
  3. texture {
  4.    color red 1.0 green 0.6666 blue 0.33333
  5. }
  6.  
  7. declare Pencil = composite {
  8.  
  9.    /*----------------------------- parte metalica ----------------------*/
  10.    /*                             (that metal part)                     */
  11. /*
  12.    composite {
  13.       object {
  14.          union {
  15.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 2.0 > }
  16.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 1.0 > }
  17.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > }
  18.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 -1.0 > }
  19.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 -2.0 > }
  20.          }
  21.          translate < 0.0 0.0 38.5 >
  22.          texture {
  23.             color Gold
  24.             reflection 0.3
  25.          }
  26.       }
  27.  
  28.       object {
  29.          union {
  30.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 2.0 > }
  31.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 1.0 > }
  32.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > }
  33.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 -1.0 > }
  34.             quadric { Ellipsoid scale < 4.0 4.0 1.5 > translate <0.0 0.0 -2.0 > }
  35.          }
  36.          translate < 0.0 0.0 30.5 >
  37.          texture {
  38.             color Gold
  39.             reflection 0.3
  40.          }
  41.       }
  42.  
  43.       object {
  44.          intersection { Disk_Z }
  45.          scale < 3.5 3.5 3.0 >
  46.          translate < 0.0 0.0 34.0 >
  47.          texture {
  48.             color Brown
  49.             reflection 0.25
  50.          }
  51.       }
  52.  
  53.       bounded_by {
  54.          sphere { <0.0 0.0 34.0> 9.0 }
  55.       }
  56.    }
  57. */
  58.    /*---------------------------------- borrador ----------------------------*/
  59.    /*                (the rubber eraser, from eraser-root plants)            */
  60. /*
  61.    composite {
  62.       object {
  63.          intersection { Disk_Z }
  64.          scale < 3.5 3.5 3.0 >
  65.          translate < 0.0 0.0 41.0 >
  66.          texture {
  67.             color Pink
  68.          }
  69.       }
  70.       object { sphere { < 0.0 0.0 44.0 > 3.5 }
  71.          texture {
  72.             color Pink
  73.          }
  74.       }
  75.    }
  76. */
  77.    /*---------------------------------- cuerpo de madera ---------------------*/
  78.    /*                                 (body of pencilwood)                    */
  79.    object {
  80.       difference {
  81.          intersection {
  82.             plane { < 0.0 1.0 0.0 > 3.031
  83.                texture { PencilPaint }
  84.                texture {
  85.                   image_map { <-1.0 0.0 1.0> gif "pencil2.gif" // 320x200
  86.                      alpha 0 1.0      /* colour 0 is the "key" or transparent colour */
  87.                      once
  88.                   }
  89.                   scale <15.0 1.0 15.0>
  90.                   translate <-12.2 0.0 12.0 >
  91.                }
  92.  
  93.                /* Now for the complicated image mapping:
  94.   Currently, the pencil is standing up in the z axis:
  95.                    z
  96.  
  97.              eraser  ^ *vp
  98.                      | |   
  99.                      | |
  100.                      | |----/ y
  101.                      |     /
  102.                      |    /
  103.                      |   /
  104.                      |  /
  105.                      | /
  106.              point   |/
  107.                      -------------->
  108.                                    x
  109.  
  110.   We want the image to be mapped as follows (viewed from the +ve y axis):
  111.  
  112.           Right
  113.           ---- z=28.0
  114.           |  |
  115.           |..|
  116.           |..|
  117.           |..|
  118.           |ee|
  119.           |ce|
  120.       Top |ar| Bottom
  121.           |rf|
  122.           |t |
  123.           | s|
  124.           |b'|
  125.           |Kt|
  126.           |di|
  127.           ---- z=12.7
  128.           Left
  129.  
  130.           ^  ^
  131.           |  |
  132.     x=1.75   x=-1.75
  133.  
  134.  The image map above gives (viewed from the y axis):
  135.  
  136.                    ^ z
  137.           1,1 Right|
  138.              ------|
  139.              |     |
  140.              |     |
  141.          Top |     |Bottom
  142.              |     |
  143.              |     |
  144.          <----------
  145.           x   Left     
  146.  
  147.   Which is at least in the right orientation.
  148.  
  149.   Now, we must scale the image so the letters are the right size. */
  150.  
  151.                //         scale <15.0 1.0 15.0>  /* Never use 0 for any scale value */
  152.  
  153.                /* Now, we align the top left of the picture to the proper point on the
  154.   pencil.  This is a bit tricky because the top left of the picture is now
  155.   at x=15 z=0.  We have to move it to about x=-12, z=12 because the letters
  156.   don't start at the very top of the image. */
  157.  
  158.                //         translate <-12.20 0 12>
  159.  
  160.                /* As you may have guessed, this still took a lot of trial and error to get it
  161.   right, but some analysis of the picture before hand saved a lot of time. */
  162.                //      }
  163.             }
  164.             plane { < 0.0 1.0 0.0 > 3.031
  165.                rotate < 0.0 0.0 60.0 >
  166.                texture { PencilPaint }
  167.             }
  168.             plane { < 0.0 1.0 0.0 > 3.031
  169.                rotate < 0.0 0.0 120.0 >
  170.                texture { PencilPaint }
  171.             }
  172.             plane { < 0.0 1.0 0.0 > 3.031
  173.                rotate < 0.0 0.0 180.0 >
  174.                texture { PencilPaint }
  175.             }
  176.             plane { < 0.0 1.0 0.0 > 3.031
  177.                rotate < 0.0 0.0 240.0 >
  178.                texture { PencilPaint }
  179.             }
  180.             plane { < 0.0 1.0 0.0 > 3.031
  181.                rotate < 0.0 0.0 300.0 >
  182.                texture { PencilPaint }
  183.             }
  184.             plane { < 0.0 0.0 1.0 > 100.0 } //40
  185.             plane { < 0.0 0.0 1.0 > 3.629 inverse }
  186.          }
  187.          quadric { QCone_Z inverse scale < 0.275558 0.275558 1.0 > }
  188.       }
  189.       texture {
  190.          Pencil_Wood
  191.          turbulence 0.1
  192.          scale <1.5 1.5 1.5>
  193.          rotate <0.0 90.0 0.0>
  194.          translate <30.0 0.0 0.0>
  195.       }
  196.    }
  197.  
  198.    /*---------------------------- punta de grafito ------------------------------*/
  199.    /*                            (point of graphite)                             */
  200.  
  201.    object {
  202.       intersection {
  203.          quadric { QCone_Z scale < 0.275558 0.275558 1.0 > }
  204.          plane { < 0.0 0.0 1.0 > 3.629 }
  205.          plane { < 0.0 0.0 1.0 > 0.001 inverse }
  206.       }
  207.       texture {
  208.          color Black
  209.          reflection 0.25
  210.          phong 1.0
  211.          phong_size 20
  212.       }
  213.    }
  214.  
  215. bounded_by {
  216.     object { Disk_Z scale < 4.0 4.0 128.0 > translate < 0.0 0.0 15.0 > }
  217. }
  218. scale < 0.8 0.8 1.0 >
  219. rotate < -90.0 0.0 0.0 >
  220. }
  221.