# Last edited on 2011-05-07 08:19:20 by stolfi SHELL := /bin/bash ####################################################################### # Makefile to render a movie. # Caller must define # ${OUT_DIR} = output directory. # ${NAME} = name of image to render minus "${OUT_DIR}/" and ".png". # ${WIDTH} = width of image(s). # ${HEIGHT} = height of image(s). # ${NRAYS} = subsampling order (1,2,...). # ${NFRAMES} = number of frames to render (required render-movie or render-strip). # Optionally also: # ${SHOW} = "YES" to display the movie after rendering. ifneq "/${OUT_DIR}" "/" ifneq "/${NAME}" "/" ifneq "/${WIDTH}" "/" ifneq "/${HEIGHT}" "/" ifneq "/${NRAYS}" "/" ifneq "/${NFRAMES}" "/" .PHONY:: render-movie clean-movie CLOCK_FORMAT := "%8.6f" VIEW_MOVIE := iceweasel CLOCKS := ${shell compute-movie-clocks.sh 0.0 1.0 ${NFRAMES} ${CLOCK_FORMAT}} FRAME_PNGS := ${addprefix ${OUT_DIR}/${NAME}-,${addsuffix .png,${CLOCKS}}} ${OUT_DIR}: mkdir -p ${OUT_DIR} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # "make render-movie" creates a movie with ${NFRAMES} frames. MOVIE_NAME := ${NAME}-mov MOVIE_GIF := ${OUT_DIR}/${MOVIE_NAME}.gif DELAY := ${shell echo '360.0/${NFRAMES}' | bc -lq} render-movie: ${OUT_DIR} clean-movie ${MOVIE_GIF} ${MOVIE_GIF}: for clock in ${CLOCKS} ; do \ ${MAKE} -f POVRAY-FRAME.make \ NAME=${NAME} CLOCK=$$clock \ WIDTH=${WIDTH} HEIGHT=${HEIGHT} NRAYS=${NRAYS} \ SHOWOPT='-D' \ render-frame ; \ done ./animate-movie-frames.sh \ -delay ${DELAY} \ ${MOVIE_GIF} \ ${FRAME_PNGS} @-if [[ -s ${MOVIE_GIF} ]] ; then \ if [[ "/${SHOW}" == "/YES" ]]; then ${VIEW_MOVIE} ${MOVIE_GIF} ; fi \ fi clean-movie: -/bin/rm -f ${OUT_DIR}/${NAME}.log ${OUT_DIR}/${NAME}-*.log -/bin/rm -f ${FRAME_PNGS} -/bin/rm -f ${MOVIE_GIF} # End ${OUT_DIR}, ${NAME}, ${WIDTH}, ${HEIGHT}, ${NRAYS}, ${NFRAMES} section ###################################################################### endif endif endif endif endif endif