CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #2
    Join Date
    Nov 2001
    Posts
    251

    Re: Loading wavefront obj file into an indexed vertex array...

    struct face {
    union {
    struct {
    int x, y, z;
    int nx, ny, nz;
    int u, t, p;
    };
    int data[9];
    };
    };
    This isn't even a complete face since you only list one vertex.

    Try this:

    Code:
    struct face {
    
     int num_indices;
     int *vertex_indices;	// dynamically allocated (num_indices)
     int *uv_indices;	// dynamically allocated (num_indices)
     int *normal_indices;	// dynamically allocated (num_indices)
    }
    Or if you're using STL:

    Code:
    struct face {
     vector<int> vertex_indices;
     vector<int> uv_indices;
     vector<int> normal_indices;
    }
    Last edited by Syslock; January 30th, 2010 at 04:50 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured