Lesson 3: Quadric Animation

This lesson constructs a movie of an orbit around a sphere which has ocean temperature mapped on as a decal. PV‑WAVE applies a color lookup table after generating the movie.

If you wanted to add the boundaries of countries, you could do so by drawing them directly into the decal prior to calling SPHERE.

Note that the movie is saved to a file and is displayed using show_anim.pro in <RW_DIR>\wave\demo\render.

Program Listing

PRO gen_anim 
; Load the decal to apply. 
decal = BYTARR(720, 360) 
OPENR, 1, !Data_Dir + ’world_map.dat’ 
READU, 1, decal 
CLOSE, 1 
; Set shading to correspond directly to image values. 
dif = FLTARR(256) 
amb = FINDGEN(256)/255. 
T3D, /Reset, Rotate=[-90.0, 90.0, 0.0] 
c = SPHERE(Decal=decal, Kamb=amb, Kdiff=dif, Transform=!P.T) 
mve = BYTARR(256, 256, 72) 
; Create an animation by orbiting view around the sphere. 
FOR i=0, 71 DO BEGIN 
T3D, /Reset, Rotate=[-20.0, i*5.0, 0.0] 
mve(*,*,i)=RENDER(c, x=256, y=256, Transform=!P.T) 
ENDFOR 
OPENW, 1, !Data_Dir + ’world_anim.img’ 
WRITEU, 1, mve 
CLOSE, 1 
END