[Fluxus] lighting of build-polygons

Kassen signal.automatique at gmail.com
Thu Aug 13 16:41:08 PDT 2009


Dear list,


Below I'm pasting some code that attempts to build a more advanced "house"
with a sloped instead of a pointy roof using "build-polygons". Geometrically
this seems fine, if a bit on the verbose side for now, but it looks wrong;
the lighting is very different between the standard cube and my own roof.
The manual notes that indexed polygons will have uniform lighting but
doesn't seem to mention how we would cure that. It's not so clear to me how
I'd go about generating shapes that *aren't* indexed either. So; what is the
fundamental difference here between my "roof" and the standard cube with
regard to lighting? How would I get rid of that difference?

Yours,
Kas.

(clear-colour (vector 0 0 1))
(clear)


(with-primitive (build-plane)
(scale 8)
(colour (vector 0 1 0)))

(with-state
(translate (vector 0 0 .5))
(build-cube))



(with-state
    (translate (vector 0 0 1))
    (with-primitive (build-polygons 8 'quad-list)
        (pdata-set! "p" 0 (vector   0  .5 .5))
        (pdata-set! "p" 1 (vector -.5  .5  0))
        (pdata-set! "p" 2 (vector -.5 -.5  0))
        (pdata-set! "p" 3 (vector   0 -.5 .5))

        (pdata-set! "p" 4 (vector   0  .5  .5))
        (pdata-set! "p" 5 (vector   0  -.5 .5))
        (pdata-set! "p" 6 (vector  .5 -.5  0))
        (pdata-set! "p" 7 (vector  .5  .5  0))


        (pdata-set! "c" 0 (vector   1  0   0))
        (pdata-set! "c" 1 (vector   1  0   0))
        (pdata-set! "c" 2 (vector   1  0   0))
        (pdata-set! "c" 3 (vector   1  0   0))
        (pdata-set! "c" 4 (vector   1  0   0))
        (pdata-set! "c" 5 (vector   1  0   0))
        (pdata-set! "c" 6 (vector   1  0   0))
        (pdata-set! "c" 7 (vector   1  0   0))
    (hint-vertcols)

    )

    (with-primitive (build-polygons 3 'triangel-list)
        (pdata-set! "p" 0 (vector   0 -.5  .5))
        (pdata-set! "p" 1 (vector -.5 -.5 0))
        (pdata-set! "p" 2 (vector   .5  -.5  0))

        (pdata-set! "c" 0 (vector 1 1 1))
        (pdata-set! "c" 1 (vector 1 1 1))
        (pdata-set! "c" 2 (vector 1 1 1))
    (hint-vertcols)
    )

    (with-primitive (build-polygons 3 'triangel-list)
        (pdata-set! "p" 0 (vector   0 .5  .5))
        (pdata-set! "p" 1 (vector   .5  .5  0))
        (pdata-set! "p" 2 (vector -.5 .5 0))

        (pdata-set! "c" 0 (vector 1 1 1))
        (pdata-set! "c" 1 (vector 1 1 1))
        (pdata-set! "c" 2 (vector 1 1 1))
    (hint-vertcols)
    )

)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20090814/c9c1b48c/attachment-0002.htm>


More information about the Fluxus mailing list