Trouble adding normals to mesh from .obj file

I’m attempting to write a small class to parse .obj files, but I’m not adding the normals correctly, and can’t figure out why. At first, I thought I was exporting them wrong from Blender, but the same thing happened when I downloaded a random 3d object from the web. The normals are just all over the place.

When I write the normals to the console, they’re in the exact order as they appear in the .obj file. The vertices and vertex indicies and working perfect.

Here’s something a little complex, along with a basic cube rendering:

waveFrontLoader.h

#ifndef _WAVEFRONTLOADER
#define _WAVEFRONTLOADER

#include "ofMain.h"

class waveFrontLoader {

public:

ofMesh mesh;

waveFrontLoader();
~waveFrontLoader();

void loadFile(char *fileName);
ofMesh generateMesh();

private:

typedef struct
{
    ofIndexType v1,v2,v3;
    ofIndexType vn1,vn2,vn3;
}
Index;

std::vector<ofVec3f> vertices;
std::vector<ofVec3f> normals;
std::vector<Index> indices;

void parseLine(char *line);
void parseVertex(char *line);
void parseNormal(char *line);
void parseFace(char *line);

};

#endif

waveFrontLoader.cpp

 #include "waveFrontLoader.h"

waveFrontLoader::waveFrontLoader()
{

}

void waveFrontLoader::loadFile(char *fileName)
{
ifstream file;
char line[255];

//open file in openframeworks data folder
file.open(ofToDataPath(fileName).c_str());

if (file.is_open())
{
    while (file.getline(line,255))
    {
        parseLine(line);
    }
}
}

void waveFrontLoader::parseLine(char *line)
{
//If empty, don't do anything with it
if(!strlen(line))
{
    return;
}

//get line type identifier from char string
char *lineType = strtok(strdup(line), " ");

//parse line depending on type

if (!strcmp(lineType, "v")) // Vertices
{
    parseVertex(line);
}
else if (!strcmp(lineType, "vn")) // Normals
{
    parseNormal(line);
}
else if (!strcmp(lineType, "f")) // Indices
{
    parseFace(line);
}
}

void waveFrontLoader::parseVertex(char *line)
{
float x;
float y;
float z;

vertices.push_back(ofVec3f(x,y,z));

//get coordinates from vertex line and assign
sscanf(line, "v %f %f %f", &vertices.back().x, &vertices.back().y, &vertices.back().z);
}

void waveFrontLoader::parseNormal(char *line)
{
float x;
float y;
float z;

normals.push_back(ofVec3f(x,y,z));

//get coordinates from normals line and assign
sscanf(line, "vn %f %f %f", &normals.back().x, &normals.back().y, &normals.back().z);
}

void waveFrontLoader::parseFace(char *line)
{
int fill = 0;

indices.push_back(Index());

//get vertex and normal indices
sscanf(line, "f %d//%d %d//%d %d//%d",
       &indices.back().v1,
       &indices.back().vn1,
       &indices.back().v2,
       &indices.back().vn2,
       &indices.back().v3,
       &indices.back().vn3);

    //if texture coords exist
    /*sscanf(line, "f %d/%d/%d %d/%d/%d %d/%d/%d", &indices.back().v1,
                                                 &fill,
                                                 &indices.back().vn1,
                                                 &indices.back().v2,
                                                 &fill,
                                                 &indices.back().vn2,
                                                 &indices.back().v3,
                                                 &fill,
                                                 &indices.back().vn3);*/
}

ofMesh waveFrontLoader::generateMesh()
{
//add vertices to mesh
for (std::vector<ofVec3f>::iterator i = vertices.begin(); i != vertices.end(); ++i)
{
    mesh.addVertex(*i);
}

//add indices to mesh
for (std::vector<Index>::iterator i = indices.begin(); i != indices.end(); ++i)
{
    // -1 to count from 0
    mesh.addIndex((i->v1) - 1);
    mesh.addIndex((i->v2) - 1);
    mesh.addIndex((i->v3) - 1);
}

    //add normals to mesh
for (std::vector<Index>::iterator i = indices.begin(); i != indices.end(); ++i)
{
    // -1 to count from 0
    mesh.addNormal(normals[(i->vn1) - 1]);
    //mesh.addNormal(normals[(i->vn2) - 1]);
   // mesh.addNormal(normals[(i->vn3) - 1]);

    cout << normals[(i->vn1) - 1] << "\n";
}

return mesh;
}

waveFrontLoader::~waveFrontLoader()
{
//
}