$y){ $object[$count]=$hxcoord[$key]." $y 0"; $count++; $object[$count]=$hxcoord[$key]." $y $height"; $count++; }unset($y); if( in_array($material, $usedmat)){ $materialcount++; $objectname=$material.$materialcount; //arbitrary number, it doesn't really matter }else{ $usedmat[]=$material; echo "material\n\tname $material\n\tnolighting\n\tnolighting\n\talphathresh 0.74\n\tnoradar\n\tnoshadow\n\tnoculling\n\tnosorting\n\tnotexalpha\n\ttexture $webmaterial\nend\n"; } echo "\ndefine $objectname\n"; echo "mesh\n"; foreach($object as $key => $hvert){ echo "\tvertex $hvert\t#$key\n"; }unset($key); echo "\n\tnormal 0 0 0\n\ttexcoord .5 0\n\ttexcoord .5 1\n\n\ttexcoord 0 0\n\ttexcoord 1 0\n\ttexcoord 1 1\n\ttexcoord 0 1\n\n"; if($trunk){ echo "\n\tvertex 0 ".-(.25*$radius)." 0\n\tvertex ".(.25*$radius)." 0 0\n\tvertex 0 ".(.25*$radius)." 0\n\tvertex ".-(.25*$radius)." 0 0\n"; for($i=((360/$angle)*2)+2;$i < ((360/$angle)*2+5);$i++){ echo "face\n\tvertices $i ".($i+1)." 1\nendface\n"; } echo "face\n\tvertices ".((360/$angle)*2+5)." ".((360/$angle)*2+2)." 1\nendface\n"; } /* bottom face of trunk echo "face\n\tvertices "; for($i=2;$i < ((360/$angle)*2); $i+=2){ echo"$i "; } echo "\nendface\n"; */ echo "drawInfo\n"; echo"\tdlist\n"; echo "\t#angvel 120\t# uncomment this line to cause the object to spin at 120 degrees/second\n"; echo "\textents -$radius -$radius 0 $radius $radius $height\n"; echo "\tsphere 0 0 ".(.5*$height)." $radius\n"; echo "\tcorner 0 0 0\n\tcorner 1 0 1\n"; for($i=2;$i= 2){ echo "\tlod\n"; echo "\tlengthPerPixel .2\n"; echo "\t\tmatref $material\n"; echo "\t\t\tquadstrip "; for($i=2;$i < ((360/$angle)*4); $i+=12){ echo "1 0 ".($i+1)." ".($i)." ".($i+3)." ".($i+2)." "; } echo "1 0"; echo "\n\t\tend\t# matref\n"; echo "\tend\t# lod\n\n"; }else{ echo "\tlod\n"; echo "\tlengthPerPixel .2\n"; echo "\t\tmatref $material\n"; echo "\t\t\tquadstrip "; for($i=2;$i < ((360/$angle)*4); $i+=8){ echo "1 0 ".($i+1)." ".($i)." ".($i+3)." ".($i+2)." "; } echo "1 0"; echo "\n\t\tend\t# matref\n"; echo "\tend\t# lod\n\n"; } echo "\tend\t# drawInfo\n"; echo "end #mesh\nenddef\n"; //echo "group $objectname\nend\n"; ?>