# creates an 'envmap' pict from six pictures
# For more information, see
# 'The RenderMan Interface, v 3.1', p. 91

R=32
G=32
B=32
TMP1=/tmp/jn1.pict
TMP2=/tmp/jn2.pict
TMP3=/tmp/jn3.pict

BACK_COLOR="$R $G $B"

set -k

joinp -o $TMP1 -r p -b "$BACK_COLOR" $1.nx $1.pz
joinp -o $TMP2 -u p -b "$BACK_COLOR" $TMP1 $1.py
joinp -o $TMP1 -r p -b "$BACK_COLOR" $TMP2 $1.px
joinp -o $TMP2 -r p -b "$BACK_COLOR" $TMP1 $1.nz

mkpict $TMP3 `lsp $1.ny | awk '{print $4" "$3" "$2}'` $R $G $B
joinp -o $TMP1 -r p -b "$BACK_COLOR" $TMP3 $1.ny
joinp -o $1.pict -d p -b "$BACK_COLOR" $TMP2 $TMP1

rm $TMP2 $TMP1 $TMP3
