<< Guile RMan #10 くりかえし処理その3 戻る はじめてのFujiyama Renderer その29 >>

Guile RMan #11 くりかえし処理その4

sin、cosを利用した。半径1の円周上に球体を12個、配置した。
色は乱数を発生させた。
sphere8.jpg
sphere8r.jpg

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "test8.rib")
(RiDisplay "sphere8.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 40.0))
(RiTranslate 0 0 4)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2
"uniform point from" (Point 3 3 -3)))

(define (test x)
(define N1 12)
(define PI 3.141592)
(set! *random-state* (random-state-from-platform))
(let ((n 0))
(while (< n x)
(RiTransformBegin)
(RiTranslate (sin (* 2 (/ PI N1) n)) (cos (* 2 (/ PI N1) n)) 0 )
(RiColor (Color (random 1.0) (random 1.0) (random 1.0)))
(RiSurface "plastic")
(RiSphere 0.25 -0.25 0.25 360)
(set! n (+ n 1))
(RiTransformEnd)
)))

(test 12)

(RiWorldEnd)
(RiEnd)
  • -
  • -

<< Guile RMan #10 くりかえし処理その3 戻る はじめてのFujiyama Renderer その29 >>