animation wip-2

This commit is contained in:
Marcus 2024-01-06 15:37:22 +01:00
parent 6641771171
commit 06ff88d9c2

View file

@ -15,6 +15,7 @@ IMGFILE="$2"
PPMFILE="$FNAME.ppm" PPMFILE="$FNAME.ppm"
HEXPPM="images/$FNAME.hexppm" HEXPPM="images/$FNAME.hexppm"
PIXLIST="/tmp/$FNAME.pixlist" PIXLIST="/tmp/$FNAME.pixlist"
ANIFILE="/tmp/$FNAME"
SHUFMODE="$3" SHUFMODE="$3"
FLOOTSRUNNING=0 FLOOTSRUNNING=0
@ -50,7 +51,7 @@ test -z "$BOUNCESTEP" && BOUNCESTEP=2
# to not draw too fast, there is a sleep in frametick which waits for # to not draw too fast, there is a sleep in frametick which waits for
# FRAMETICKTIME seconds. Values are float, down to lowest value 0.001 # FRAMETICKTIME seconds. Values are float, down to lowest value 0.001
# Only one of ANIMATION or LARGE can be true, not both. # Only one of ANIMATION or LARGE can be true, not both.
FRAMETICK_SHM="/dev/shm/frametick" FRAMETOPICK_SHM="/dev/shm/pxlflt-frametopick"
## END ANIMATION ## END ANIMATION
@ -61,6 +62,13 @@ declare -a PIXMAP
declare -a LOL declare -a LOL
declare -a LOLPID declare -a LOLPID
## TODOS
#
# - Put OFFSET into /dev/shm/ so each worker do not have to count OFFSET
# for itself and we prevent worker from drifting apart when drawing.
# - get dimensions of pic with "identify" (imagemagick part)
# - get dimensions of the pixelflut board
# colors for colored output 8) # colors for colored output 8)
RED="\e[31m" RED="\e[31m"
@ -302,10 +310,18 @@ xymode() {
frametick() { frametick() {
test -z "$FRAMETICKTIME" && FRAMETICKTIME=0.1 test -z "$FRAMETICKTIME" && FRAMETICKTIME=0.1
LOLFIELDS=12
i=0
while true while true
do do
echo lol echo "$i" #> $FRAMETOPICK_SHM
exit 1 if [ "$i" -ge $LOLFIELDS ]
then
i=0
else
i=$(($i+1))
fi
sleep $FRAMETICKTIME
done done
} }
@ -322,6 +338,16 @@ flootworker()
do do
echo "${LOL[$i]}" echo "${LOL[$i]}"
done done
elif [ $ANIMATION ]
then
xymode
echo "$OFFSET"
i=0
while [ $i -le $1 ]
do
echo "${LOL[$i]}"
i=$(($i+1))
done
else else
xymode xymode
echo "$OFFSET echo "$OFFSET
@ -365,6 +391,11 @@ loadLOL() {
i=$(($i+1)) i=$(($i+1))
done done
elif [ $ANIMATION ]
then
# ani
echo ani ani
exit 1
else else
for i in $(seq 1 $FLOOTFORKS) for i in $(seq 1 $FLOOTFORKS)
do do
@ -428,9 +459,20 @@ floot() {
;; ;;
*) *)
# generate a tmp file, as i have trouble atm to figure out if [ $ANIMATION ]
# why free space get lost when i generate the pixlist directly then
# in ram checkfile $IMGFILE
message "ANIMATION mode, checking if ${YELLOW}${IMGFILE}${ENDCOLOR} is an GIF"
if [ "$(file $IMGFILE |awk '{print $2}')" == "GIF" ]
then
LOLFIELDS="$(identify $IMGFILE | echo $(( $(wc -l) - 1 )) )"
message "splitting ${YELLOW}${IMGFILE}${ENDCOLOR} up into ${YELLOW}${LOLFIELDS}${ENDCOLOR} frame images"
convert -coalesce $IMGFILE ${ANIFILE}.png || error
else
message error "Other filetypes then ${YELLOW}GIF${ENDCOLOR} are not supported at the moment for ${YELLOW}ANIMATION${ENDCOLOR}"
exit 1
fi
else
if [ $USECACHE ] if [ $USECACHE ]
then then
checkfile $PIXLIST checkfile $PIXLIST
@ -442,7 +484,7 @@ floot() {
LOL_org="$(convertimg)" LOL_org="$(convertimg)"
#convertimg > $PIXLIST #convertimg > $PIXLIST
fi fi
fi
message "prepare worker ${YELLOW}$i${ENDCOLOR} .." message "prepare worker ${YELLOW}$i${ENDCOLOR} .."
#set -x #set -x
loadLOL loadLOL
@ -533,11 +575,14 @@ case $1 in
;; ;;
esac esac
if ! command -v convert > /dev/null for imgmgckCMD in convert identify
do
if ! command -v $imgmgckCMD > /dev/null
then then
message error "${YELLOW}convert${ENDCOLOR} not found" message error "imagemagick ${YELLOW}${imgmgckCMD}${ENDCOLOR} not found"
exit 1 exit 1
fi fi
done
if [ $LARGE ] && [ $ANIMATION ] if [ $LARGE ] && [ $ANIMATION ]
then then