Hi Gabor

Thanks for that, but there's still an oddity - there are 3 extra rows?
This script gives an error because of that - (pdata-size) for the nurbs primitive gives 4288, and (quotient 4288 64) is 67. So, the corrected version is below, but this isn't exactly what I'd want - I want to be able to set the number of rows beforehand. Hmm...

Cheers
Evan



(clear)

(define dims 64)

(define shape
   (with-state
       (build-nurbs-sphere dims dims)))

(with-primitive shape
   (pdata-copy "p" "p0")
   (pdata-copy "n" "n0"))

(define vals (build-list (with-primitive shape (pdata-size)) (lambda (n) (rndf))))

(define (bump p)
       (with-primitive p
               (pdata-index-map!
                   (lambda (i p p0 n0)
                       (let* ([row (quotient i dims)]
                              [rv (list-ref vals row)])
                       (vadd p0 (vmul n0 rv))))
                   "p" "p0" "n0"))
           (recalc-normals 0))

(every-frame (bump shape))



Reply via email to