Advertisement

I still cant load a lousy .raw model ><

Started by March 11, 2002 08:11 PM
0 comments, last by SonShadowCat 22 years, 11 months ago
its been almost 2 months and i still cant load a model from a .raw file here is the code i use to load the model
  
struct Vert  // The struct that holds the coords for each vertex

{
  float x;
  float y;
  float z;
};

struct Tri  // The struct that makes a triangle

{
  Vert Vertices[3];
  Tri *Next;
};

Tri *Triangle;

bool LoadRawModel(char* Filename, Tri *First)
{
  ifstream Model(Filename, ios::nocreate);  // Attemplt to load the raw file

  if (!Model)  // Check to see if the file was loaded

  {
    return false;  // If not return false

  }

  int FirstPass=1;
  Tri *Point;
  bool done=false;

  while (done==false)
  {
    if (FirstPass==1)
    {
      First=new Tri;
      for (int i=0; i<3; i++)
      {
        Model >> First->Vertices[i].x >> First->Vertices[i].y >> First->Vertices[i].z;
      }

      First->Next=new Tri;
      Point=First->Next;
      FirstPass=0;
    }
    else
    {
      for (int i=0; i<3; i++)
      {
        Model >> Point->Vertices[i].x >> Point->Vertices[i].y >> Point->Vertices[i].z;
      }
        Point->Next=new Tri;
        Point=Point->Next;
    }
    if (Model.eof())
    {
      done=true;
    }
  }
}

void RenderModel(Tri *First)
{
  Tri* Point;
  Point=First;
  glBegin(GL_TRIANGLES);
  while (Point!=NULL)
  {
    glColor3f( 1.0f, 0.0f, 0.0f);
    glVertex3f( Point->Vertices[1].x, Point->Vertices[1].y, Point->Vertices[1].z);
    glVertex3f( Point->Vertices[2].x, Point->Vertices[2].y, Point->Vertices[2].z);
    glVertex3f( Point->Vertices[3].x, Point->Vertices[3].y, Point->Vertices[3].z);
    Point=Point->Next;
  }
  glEnd();
}
  
if i still cant load a file im just gonna move to allegro and forget about OGL >< --------------------------------- "Those who serve no purpose, have no purpose."- SSC the Super Saiyan Cat Sex leads to hate, Hate leads to anger, Anger leads to children! Oh the possibilities!! Edited By - SonShadowCat on Your Girlfriends Birthday
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
Never heard of .raw models, but heard of .raw images. Link to format of .raw models please?

" Do we need us? "


Ionware Productions - Games and Game Tools Development

This topic is closed to new replies.

Advertisement