$value){ echo "vertex $value $y[$key] $z[$key] #$key\n"; }unset($value,$key); foreach($xn as $key => $value){ echo "normal $value $yn[$key] $zn[$key] #$key\n"; }unset($value,$key); foreach($xt as $key => $value){ echo "texcoord $value $yt[$key] #$key\n"; }unset($value,$key); /*foreach($zindex as $slice){ for($i=$slice;$i<=$slice+$divisions;$i++){ echo "\nmatref texture"; echo "\nface"; echo "\n\tvertices $i ".($i+1)." ".($i+$divisions+1)." ".($i+$divisions); echo "\nnormals $i ".($i+1)." ".($i+$divisions+1)." ".($i+$divisions); echo "\ntexcoords $i ".($i+1)." ".($i+$divisions+1)." ".($i+$divisions); echo "\nendface"; } } */ echo "\ndrawInfo\nangvel 30\nsphere 0 0 ".($radius)." ".($radius+$xshift)." \nextents ".(-$radius-$xshift)." ".(-$radius-$xshift)." 0 ".($radius+$xshift)." ".($radius+$xshift)." ".(2*$radius)."\n"; foreach($x as $key => $value){ echo "corner $key $key $key\n"; }unset($value,$key); echo "lod\nLengthPerPixel 0\nmatref texture\n"; foreach($zindex as $key=>$slice){ if($key == $slices/2){ }else{ echo "\n\tquads "; for($i=$slice;$i<$slice+$divisions;$i++){ echo "$i ".($i+1)." ".($i+$divisions+2)." ".($i+$divisions+1)." "; } } }unset($key,$slice); echo "\nend #matref\nmatref black\n"; foreach($zindex as $key=>$slice){ if($key == $slices/2){ }else{ echo "\n\tquads "; for($i=$slice;$i<$slice+$divisions;$i++){ echo($i+$divisions+1)." ".($i+$divisions+2)." ". ($i+1)." ".($i)." "; } } } echo "\nend\nend #lod\nend #drawinfo\nend #mesh"; echo "\nenddef\n"; echo "group sphere\n shift 0 0 10\nspin -45 0 0 1\nend\n"; ?>