hi there
I am trying to make an importer for .obj 3D model files.
It is for a 3D engine..
I have written something in PHP but i know very little about php.
here is the code i have used:
PHP Code:
 
<?php 
$fp 
fopen("model.obj""r" ); 

if(!
$fp

    echo 
"Couldn't open the data file. Try again later."
    exit; 

$counter 0
      while(!
feof($fp)) 
     { 
        
// get a line 
      
$line fgets($fp3000); 
      
// Split the input string into words as an array 
      
$arrWords explode' '$line );   
      
// Count the words in the string 
      
$numWords count$arrWords );  
              
// if first word is v - vertices 
          
if($arrWords[0] == "v"){ 
              
// write flash code to add a vertex 
              
echo "model.addPoint($arrWords[1] , 
                    
$arrWords[2] , $arrWords[3] ); "
          } 
          
// if first word is f - face 
          
if($arrWords[0] == "f"){ 
               
$counter++; 
              
// write flash code to render face 
              
echo "model.drawFace(\"face$counter\" ,   
                      [ 
$arrWords[1] , $arrWords[2]
                      
$arrWords[3] ] ,0xff0000 , $counter);" 
          } 
                
     } 
    
fclose($fp); 

?>
What it does is take the vertices and parse them into
my method like so:
.
PHP Code:
 
model
.addPoint(100,200,300); 
// and for the faces 
model.drawFace("faceName",pointListfillcolordepth); 
My question is - How can i have it so that any number of vertices
can be added to a face ?. at the moment it is hard coded at 3.

I have more details here.
http://www.video-animation.com/flash3d_002.shtml

tahnks
steve