fix bashscript

This commit is contained in:
bolero-MURAKAMI 2013-09-20 16:38:27 +09:00
parent 3713351e3e
commit 3e33de25eb
3 changed files with 29 additions and 29 deletions

View file

@ -18,7 +18,7 @@ namespace darkcult {
//
SPROUT_STATIC_CONSTEXPR auto object = sprout::make_tuple(
objects::make_aa_plane(
sprout::darkroom::objects::aa_plane_direction::y,
objects::aa_plane_direction::y,
-2.0,
materials::make_plaid_material_image(
colors::rgb_f(1.0, 0.0, 0.0),

View file

@ -36,15 +36,15 @@ execute() {
fi
}
args=`getopt -o d:D:f -l stagedir:,gcc-version:,clang-version:,define:,force -- "$@"`
args=`getopt -o S:D:f -l stagedir:,gcc-version:,clang-version:,define:,force -- "$@"`
if [ "$?" -ne 0 ]; then
echo >&2 -e ": \e[31musage: $0 [-d|--stagedir=path] [--gcc-version=versions] [--clang-version=versions] [-D|--define=identifier]* [-f|-force]\e[m"
echo >&2 -e ": \e[31musage: $0 [-S|--stagedir=path] [--gcc-version=versions] [--clang-version=versions] [-D|--define=identifier]* [-f|-force]\e[m"
exit 1
fi
eval set -- ${args}
while [ -n "$1" ]; do
case $1 in
-d|--stagedir) stagedir=$2; shift 2;;
-S|--stagedir) stagedir=$2; shift 2;;
--gcc-version) gcc_version="$2"; shift 2;;
--clang-version) clang_version="$2"; shift 2;;
-D|--define) user_macros=(${user_macros[@]} "$2"); shift 2;;
@ -54,7 +54,7 @@ while [ -n "$1" ]; do
esac
done
echo ": settings"
echo ": stagedir = ${stagedir}"
echo ": stagedir = \"${stagedir}\""
echo ": gcc-version = (${gcc_version})"
echo ": clang-version = (${clang_version})"
echo ": user-macros = (${user_macros[*]})"
@ -62,7 +62,7 @@ echo ": force = ${force}"
if [ -d "${stagedir}" ]; then
if [ ${force} -eq 0 ]; then
echo >&2 -e ": \e[31mstagedir(${stagedir}) is already exist.\e[m"
echo >&2 -e ": \e[31mstagedir(${stagedir}) already exists.\e[m"
exit 1
else
rm -f -r ${stagedir}/*

View file

@ -17,16 +17,16 @@ tile_width=16
tile_height=16
force=0
args=`getopt -o s:d:w:h:W:H:f -l source:,stagedir:,width:,height:,tile-width:,tile-height:,force -- "$@"`
args=`getopt -o s:S:w:h:W:H:f -l source:,stagedir:,width:,height:,tile-width:,tile-height:,force -- "$@"`
if [ "$?" -ne 0 ]; then
echo >&2 -e ": \e[31musage: $0 -s|--source=file [-d|--stagedir=path] [-w|--width=value] [-h|--height=value] [-W|--tile-width=value] [-H|--tile-height=value] [-f|-force]\e[m"
echo >&2 -e ": \e[31musage: $0 [-s|--source=file] [-S|--stagedir=path] [-w|--width=value] [-h|--height=value] [-W|--tile-width=value] [-H|--tile-height=value] [-f|-force]\e[m"
exit 1
fi
eval set -- ${args}
while [ -n "$1" ]; do
case $1 in
-s|--source) src=$2; shift 2;;
-d|--stagedir) stagedir=$2; shift 2;;
-S|--stagedir) stagedir=$2; shift 2;;
-w|--width) width=$2; shift 2;;
-h|--height) height=$2; shift 2;;
-W|--tile-width) tile_width=$2; shift 2;;
@ -38,8 +38,8 @@ while [ -n "$1" ]; do
done
echo ": settings"
echo ": source = ${src}"
echo ": stagedir = ${stagedir}"
echo ": source = \"${src}\""
echo ": stagedir = \"${stagedir}\""
echo ": width = ${width}"
echo ": height = ${height}"
echo ": tile-width = ${tile_width}"
@ -47,13 +47,13 @@ echo ": tile-height = ${tile_height}"
echo ": force = ${force}"
if [ ! -f "${src}" -a ! -f "$(cd $(dirname $0); pwd)/${src}" ]; then
echo >&2 -e ": \e[31msource(${src}) is not exist.\e[m"
echo >&2 -e ": \e[31msource(${src}) not exists.\e[m"
exit 1
fi
if [ -d "${stagedir}" ]; then
if [ ${force} -eq 0 ]; then
echo >&2 -e ": \e[31mstagedir(${stagedir}) is already exist.\e[m"
echo >&2 -e ": \e[31mstagedir(${stagedir}) already exists.\e[m"
exit 1
else
rm -f -r ${stagedir}/*
@ -62,15 +62,16 @@ else
mkdir -p ${stagedir}
fi
echo ": rendering..."
start=$SECONDS
echo ": start."
start=${SECONDS}
for ((y=0; y<height; y+=tile_height)); do
y_start=$SECONDS
echo ": rendering(${y}/${height})..."
y_start=${SECONDS}
for ((x=0; x<width; x+=tile_width)); do
mkdir -p ${stagedir}/${y}/
binname=${stagedir}/${x}.${y}.out
binname=${stagedir}/${y}/${x}.out
g++ -o ${binname} -std=c++11 \
-DDARKROOM_SOURCE="\"${src}\"" \
-DDARKROOM_TOTAL_WIDTH=${width} \
@ -81,19 +82,18 @@ for ((y=0; y<height; y+=tile_height)); do
-DDARKROOM_OFFSET_Y=${y} \
$(cd $(dirname $0); pwd)/darkcult.cpp && ${binname} > ${stagedir}/${y}/${x}.ppm
# rm ${binname}
done;
pushd ${stagedir}/${y}/
done
pushd ${stagedir}/${y}/ > /dev/null
convert +append $(ls *.ppm | sort -n) ../${y}.ppm
popd
popd > /dev/null
let y_elapsed=$SECONDS-$y_start
echo ": elapsed(${y}) = ${y_elapsed}s"
done;
pushd ${stagedir}
let "y_elapsed=${SECONDS}-${y_start}"
echo ": elapsed = ${y_elapsed}s"
done
pushd ${stagedir} > /dev/null
convert -append $(ls *.ppm | sort -n) out.ppm
popd
let elapsed=$SECONDS-$start
echo ": elapsed = ${elapsed}s"
popd > /dev/null
let "elapsed=${SECONDS}-${start}"
echo ": elapsed(total) = ${elapsed}s"
echo ": finished."