#!/bin/csh -f

# 0.05
# 0.5

if ("$?CTOL" == "0") then
  setenv CTOL 0.05
endif

if (! -e lod$CTOL) then
  mkdir lod$CTOL
endif

cat /dev/null > TESS$CTOL

if ("$argv" == "") then
  set argv="topo/*.csb"
endif

# -tristrip - only if want to keeps parts seperate
foreach a ($argv)
   echo opoptimize $a -ctol $CTOL -disableCustomSave -combine 0.1 -tristrip -batch lod$CTOL/$a:t
   opoptimize $a -ctol $CTOL -disableCustomSave -combine 0.1 -tristrip -batch lod$CTOL/$a:t >>& TESS$CTOL
end

set argv
