Billboard

From MHCGraphics

Jump to: navigation, search
In addition to the Mead model file below, you will need to add the full-sized version of the image at the right to your Images folder.
; Mead example file -- a billboard with a spotlight
;
; Jim Teresco
; Computer Science 110
; Mount Holyoke College
; March 2, 2008
;
; $Id: Billboard.scm 522 2008-03-03 03:40:53Z terescoj $
;
(require (lib "Defs.ss" "Mead"))

; some constants that will make it easier to switch to 
; different sized pictures
(define picWidth 1024)
(define picHeight 768)
(define frameSize 10)

; create a billboard to advertise our favorite MHC building
(object billboardPic Mesh
        (addUVPoly ; this is a special type of polygon
         '((-1 -1 0) (-1 1 0) (1 1 0) (1 -1 0))
         '((0 0) (0 1) (1 1) (1 0)))
        )

(object clappPicture Material
        (surfaceImage "clapplab.png"))

(object billboard Group
        ; mesh with the picture pasted on
        (add billboardPic clappPicture
             (scale (/ picWidth 2) (/ picHeight 2) 1))
        ; top border
        (add cube
             (scale (* .01 picWidth)
                    (* .01 frameSize)
                    (* .01 frameSize))
             (translate 0 (/ picHeight 2) 0)
             )
        ; bottom border
        (add cube
             (scale (* .01 picWidth)
                    (* .01 frameSize)
                    (* .01 frameSize))
             (translate 0 (- (/ picHeight 2)) 0)
             )
        ; left border
        (add cube
             (scale (* .01 frameSize)
                    (* .01 picHeight)
                    (* .01 frameSize))
             (translate (- (/ picWidth 2)) 0 0)
             )
        ; right border
        (add cube
             (scale (* .01 frameSize)
                    (* .01 picHeight)
                    (* .01 frameSize))
             (translate (/ picWidth 2) 0 0)
             )
        )

; a spotlight to shine on the billboard
(object spot Spotlight
        (color white)
        (intensity 0.6)
        (pos '(200 200 -400))
        (radius 5)
        )

(tell scene
      (add spot)
      (add billboard whitePlaster
           (scale .33 .33 1))
      )

(tell camera
      (shoot))
Personal tools