# Last edited on 2011-05-11 02:42:33 by stolfi SHELL := /bin/bash ####################################################################### # Makefile to render a static scene. # 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,...). # # Optionally also: # ${SHOW} = "YES" to display the image after rendering. ifneq "/${OUT_DIR}" "/" ifneq "/${NAME}" "/" ifneq "/${WIDTH}" "/" ifneq "/${HEIGHT}" "/" ifneq "/${NRAYS}" "/" .PHONY:: render-static clean-static CLOCK_FORMAT := "%8.6f" VIEW_STATIC := display -title "%f" ${OUT_DIR}: mkdir -p ${OUT_DIR} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # "make render-static" creates a still frame with ${CLOCK} == 0.5 # STATIC_NAME := ${NAME} STATIC_PNG := ${OUT_DIR}/${STATIC_NAME}.png CLOCK := ${shell printf ${CLOCK_FORMAT} "0.5"} STATIC_FRAME_PNG := ${OUT_DIR}/${STATIC_NAME}-${CLOCK}.png REFERENCE_NAME := ${subst fig_,ref_,${NAME}} REFERENCE_PNG := reference/out/${REFERENCE_NAME}.png SCALED_REF_PNG := /tmp/${shell echo $$$$}-ref.png BLENDED_NAME := ${subst fig_,ovr_,${NAME}} BLENDED_PNG := ${OUT_DIR}/${BLENDED_NAME}.png render-static: ${OUT_DIR} clean-static ${STATIC_PNG} ${STATIC_PNG}: ${MAKE} -f POVRAY-FRAME.make \ NAME=${NAME} CLOCK=${CLOCK} \ WIDTH=${WIDTH} HEIGHT=${HEIGHT} NRAYS=${NRAYS} \ SHOWOPT='+D' \ render-frame if [[ -s ${STATIC_FRAME_PNG} ]]; then \ mv -v ${STATIC_FRAME_PNG} ${STATIC_PNG} && \ if [[ "/${SHOW}" == "/YES" ]]; then \ if [[ -s ${REFERENCE_PNG} ]]; then \ convert ${REFERENCE_PNG} -resize '${WIDTH}x${HEIGHT}' ${SCALED_REF_PNG} ; \ convert ${SCALED_REF_PNG} ${STATIC_PNG} \ -compose Blend -define 'compose:args=50,50' \ -composite ${BLENDED_PNG} ; \ ${VIEW_STATIC} ${BLENDED_PNG} ${STATIC_PNG} ${SCALED_REF_PNG} ; \ else \ ${VIEW_STATIC} ${STATIC_PNG} ; \ fi ; \ fi ;\ fi clean-static: -/bin/rm -f ${OUT_DIR}/${NAME}.log ${OUT_DIR}/${NAME}-*.log -/bin/rm -f ${STATIC_FRAME_PNG} ${STATIC_PNG} # End ${OUT_DIR}, ${NAME}, ${WIDTH}, ${HEIGHT}, ${NRAYS} section ###################################################################### endif endif endif endif endif