Original Post
I don''t get errors when I compile this...but it doesn''t work the way I want(in fact it doesn''t work at all...). Here''s the general file format any help is greatly appreciated. It is a wavefront obj exported from milkshape... there are so many different types of this format, I wanted to load this myself.
////////////////////////
words that are unimportant
v float1 float2 float3
vt float1 float2
vn float1 float2 float3
f float1/float2/float3 float1/float2/float3 float1/float2/float3
////////////////////////
#include <iostream.h>
#include <fstream>
#include <string.h>
#include <vector>
using namespace std;
#define FILENAME "bessie.obj"
struct data
{
float x, y, z;
};
int main()
{
ifstream infile;
infile.open(FILENAME, ios::in);
char *character = "";
char *temp = "";
vector data(0);
for (int i=0; !infile.eof(); i++)
{
infile.get(character,255,'' '');
if (strcmp(character,"v") == 0)
{ // load in whatever "v" is
data.resize(i+1);
infile >> data.x >> data[i].y >> data[i].z;
} else if (strcmp(character,"vt") == 0)
{ // load in whatever "vt" is
data.resize(i+1);
infile >> data[i].x >> data[i].y;
} else if (strcmp(character,"vn") == 0)
{ // load in whatever "vn" is
data.resize(i+1);
infile >> data[i].x >> data[i].y >> data[i].z;
} else if (strcmp(character,"f") == 0)
{ // load in whatever "f" is
data.resize(i+3);
for (int a=1; a<=3; a++)
{
infile.get(temp,''/'');
data[a+i].x = atof(temp);
infile.get(temp,''/'');
data[a+i].y = atof(temp);
infile.get(temp,'' '' ''\n'');
data[a+i].z = atof(temp);
}
}
}
infile.close();
for (int j=0; j
-~-The Cow of Darkness-~-