Skip to content

Instantly share code, notes, and snippets.

@wchargin
Last active August 29, 2015 14:03
Show Gist options
  • Save wchargin/4e6a8604ae553dadbab2 to your computer and use it in GitHub Desktop.
Save wchargin/4e6a8604ae553dadbab2 to your computer and use it in GitHub Desktop.
Format obj, tri, phi files, and push to an Android device
#!/bin/bash
# Set these up!
FORMATOBJ=
OBJ2TRI=
TRI2PHI=
PREFIX="/sdcard/car"
ADB="$(which adb)"
if [ -z "$1" ]; then
echo "usage: $(basename $0) infile.obj outfile [resolution]"
exit 1
fi
gridResolution=50
if [ -n "$2" ]; then
gridResolution="$2"
fi
$FORMATOBJ "$1.obj"
$OBJ2TRI "$1.obj" "$1.tri"
gzip "$1.tri"
$TRI2PHI "$1.tri.gz" -g "$gridResolution" "$gridResolution" "$gridResolution"
gzip "$1.phi"
if [ -f "$ADB" ]; then
adb push "$1.tri.gz" "$PREFIX/$1.tri.gz"
adb push "$1.phi.gz" "$PREFIX/$1.phi.gz"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment