mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-10 09:23:30 +00:00
fix bashscript
This commit is contained in:
parent
3713351e3e
commit
3e33de25eb
3 changed files with 29 additions and 29 deletions
|
@ -18,7 +18,7 @@ namespace darkcult {
|
||||||
//
|
//
|
||||||
SPROUT_STATIC_CONSTEXPR auto object = sprout::make_tuple(
|
SPROUT_STATIC_CONSTEXPR auto object = sprout::make_tuple(
|
||||||
objects::make_aa_plane(
|
objects::make_aa_plane(
|
||||||
sprout::darkroom::objects::aa_plane_direction::y,
|
objects::aa_plane_direction::y,
|
||||||
-2.0,
|
-2.0,
|
||||||
materials::make_plaid_material_image(
|
materials::make_plaid_material_image(
|
||||||
colors::rgb_f(1.0, 0.0, 0.0),
|
colors::rgb_f(1.0, 0.0, 0.0),
|
||||||
|
|
|
@ -20,7 +20,7 @@ version_specific_options=(
|
||||||
compile() {
|
compile() {
|
||||||
echo ": $1-$2 compile..."
|
echo ": $1-$2 compile..."
|
||||||
/usr/local/$1-$2/bin/${1/%cc}++ -Wall -pedantic -std=c++11 -o ${stagedir}/test_$1${2//.} $4 $3
|
/usr/local/$1-$2/bin/${1/%cc}++ -Wall -pedantic -std=c++11 -o ${stagedir}/test_$1${2//.} $4 $3
|
||||||
let "succ_$1${2//.} = $?"
|
let "succ_$1${2//.}=$?"
|
||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
execute() {
|
||||||
|
@ -36,15 +36,15 @@ execute() {
|
||||||
fi
|
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
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
eval set -- ${args}
|
eval set -- ${args}
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-d|--stagedir) stagedir=$2; shift 2;;
|
-S|--stagedir) stagedir=$2; shift 2;;
|
||||||
--gcc-version) gcc_version="$2"; shift 2;;
|
--gcc-version) gcc_version="$2"; shift 2;;
|
||||||
--clang-version) clang_version="$2"; shift 2;;
|
--clang-version) clang_version="$2"; shift 2;;
|
||||||
-D|--define) user_macros=(${user_macros[@]} "$2"); shift 2;;
|
-D|--define) user_macros=(${user_macros[@]} "$2"); shift 2;;
|
||||||
|
@ -54,7 +54,7 @@ while [ -n "$1" ]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo ": settings"
|
echo ": settings"
|
||||||
echo ": stagedir = ${stagedir}"
|
echo ": stagedir = \"${stagedir}\""
|
||||||
echo ": gcc-version = (${gcc_version})"
|
echo ": gcc-version = (${gcc_version})"
|
||||||
echo ": clang-version = (${clang_version})"
|
echo ": clang-version = (${clang_version})"
|
||||||
echo ": user-macros = (${user_macros[*]})"
|
echo ": user-macros = (${user_macros[*]})"
|
||||||
|
@ -62,7 +62,7 @@ echo ": force = ${force}"
|
||||||
|
|
||||||
if [ -d "${stagedir}" ]; then
|
if [ -d "${stagedir}" ]; then
|
||||||
if [ ${force} -eq 0 ]; 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
|
exit 1
|
||||||
else
|
else
|
||||||
rm -f -r ${stagedir}/*
|
rm -f -r ${stagedir}/*
|
||||||
|
|
|
@ -17,16 +17,16 @@ tile_width=16
|
||||||
tile_height=16
|
tile_height=16
|
||||||
force=0
|
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
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
eval set -- ${args}
|
eval set -- ${args}
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-s|--source) src=$2; shift 2;;
|
-s|--source) src=$2; shift 2;;
|
||||||
-d|--stagedir) stagedir=$2; shift 2;;
|
-S|--stagedir) stagedir=$2; shift 2;;
|
||||||
-w|--width) width=$2; shift 2;;
|
-w|--width) width=$2; shift 2;;
|
||||||
-h|--height) height=$2; shift 2;;
|
-h|--height) height=$2; shift 2;;
|
||||||
-W|--tile-width) tile_width=$2; shift 2;;
|
-W|--tile-width) tile_width=$2; shift 2;;
|
||||||
|
@ -38,8 +38,8 @@ while [ -n "$1" ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ": settings"
|
echo ": settings"
|
||||||
echo ": source = ${src}"
|
echo ": source = \"${src}\""
|
||||||
echo ": stagedir = ${stagedir}"
|
echo ": stagedir = \"${stagedir}\""
|
||||||
echo ": width = ${width}"
|
echo ": width = ${width}"
|
||||||
echo ": height = ${height}"
|
echo ": height = ${height}"
|
||||||
echo ": tile-width = ${tile_width}"
|
echo ": tile-width = ${tile_width}"
|
||||||
|
@ -47,13 +47,13 @@ echo ": tile-height = ${tile_height}"
|
||||||
echo ": force = ${force}"
|
echo ": force = ${force}"
|
||||||
|
|
||||||
if [ ! -f "${src}" -a ! -f "$(cd $(dirname $0); pwd)/${src}" ]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${stagedir}" ]; then
|
if [ -d "${stagedir}" ]; then
|
||||||
if [ ${force} -eq 0 ]; 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
|
exit 1
|
||||||
else
|
else
|
||||||
rm -f -r ${stagedir}/*
|
rm -f -r ${stagedir}/*
|
||||||
|
@ -62,15 +62,16 @@ else
|
||||||
mkdir -p ${stagedir}
|
mkdir -p ${stagedir}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ": rendering..."
|
echo ": start."
|
||||||
start=$SECONDS
|
start=${SECONDS}
|
||||||
|
|
||||||
for ((y=0; y<height; y+=tile_height)); do
|
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
|
for ((x=0; x<width; x+=tile_width)); do
|
||||||
mkdir -p ${stagedir}/${y}/
|
mkdir -p ${stagedir}/${y}/
|
||||||
binname=${stagedir}/${x}.${y}.out
|
binname=${stagedir}/${y}/${x}.out
|
||||||
g++ -o ${binname} -std=c++11 \
|
g++ -o ${binname} -std=c++11 \
|
||||||
-DDARKROOM_SOURCE="\"${src}\"" \
|
-DDARKROOM_SOURCE="\"${src}\"" \
|
||||||
-DDARKROOM_TOTAL_WIDTH=${width} \
|
-DDARKROOM_TOTAL_WIDTH=${width} \
|
||||||
|
@ -81,19 +82,18 @@ for ((y=0; y<height; y+=tile_height)); do
|
||||||
-DDARKROOM_OFFSET_Y=${y} \
|
-DDARKROOM_OFFSET_Y=${y} \
|
||||||
$(cd $(dirname $0); pwd)/darkcult.cpp && ${binname} > ${stagedir}/${y}/${x}.ppm
|
$(cd $(dirname $0); pwd)/darkcult.cpp && ${binname} > ${stagedir}/${y}/${x}.ppm
|
||||||
# rm ${binname}
|
# rm ${binname}
|
||||||
done;
|
done
|
||||||
pushd ${stagedir}/${y}/
|
pushd ${stagedir}/${y}/ > /dev/null
|
||||||
convert +append $(ls *.ppm | sort -n) ../${y}.ppm
|
convert +append $(ls *.ppm | sort -n) ../${y}.ppm
|
||||||
popd
|
popd > /dev/null
|
||||||
|
|
||||||
let y_elapsed=$SECONDS-$y_start
|
let "y_elapsed=${SECONDS}-${y_start}"
|
||||||
echo ": elapsed(${y}) = ${y_elapsed}s"
|
echo ": elapsed = ${y_elapsed}s"
|
||||||
done;
|
done
|
||||||
pushd ${stagedir}
|
pushd ${stagedir} > /dev/null
|
||||||
convert -append $(ls *.ppm | sort -n) out.ppm
|
convert -append $(ls *.ppm | sort -n) out.ppm
|
||||||
popd
|
popd > /dev/null
|
||||||
|
|
||||||
let elapsed=$SECONDS-$start
|
|
||||||
echo ": elapsed = ${elapsed}s"
|
|
||||||
|
|
||||||
|
let "elapsed=${SECONDS}-${start}"
|
||||||
|
echo ": elapsed(total) = ${elapsed}s"
|
||||||
echo ": finished."
|
echo ": finished."
|
||||||
|
|
Loading…
Add table
Reference in a new issue