.OBJLoader, странные номера индексов

В последнее время я возился с OpenGL и c ++ (с FreeGLUT и GLEW) и начал пытаться импортировать файлы .obj из 3DS Max 2014. Все хорошо, если я вручную печатаю вершины и индексы, но при попытке получить их из файл я получаю странные числа.
при получении индексов вместо 1 было 1000, а вместо 3 было 3965, а когда было 12, то было 1212 (есть единицы и тройки и т. д., но иногда они случайные)

Вот код, который я использую для импорта: http://pastebin.com/1ds6fgj9

или же

std::vector<std::string> Object::split(std::string str, char splitter){

char charText[1000];
int number = 0;
int numberOfWords = 0;
char current[10][100];

std::vector<std::string> tokens;

strcpy(charText, str.c_str());

int size = sizeof(charText) / sizeof(*charText);
//std::cout << size << " size\n";
for (int i = 0; i < splitter; i++){
if (charText[i] == splitter){
tokens.push_back(current[numberOfWords]);
numberOfWords++;
number = 0;
}
else{
current[numberOfWords][number] = charText[i];
number++;
}
}

return tokens;
}

Object::Object(std::string fileName, Vector3f pos, Vector3f rot, float Size, Vector3f color){
Position = pos;
Rotation = rot;
size = Size;colors = color;std::string data;
std::ifstream file(fileName);
std::string line;Vector3f _verts[1024];
int noVerts = 0;

unsigned int _inds[1024];
int noIndices = 0;

while (getline(file, line))  // same as: while (getline( myfile, line ).good())
{

char charText[1024];
strcpy(charText, line.c_str());if (charText[0] == 'v' && charText[1] != 'n' && charText[1] != 't'){

std::vector<std::string> splitLine = split(line, ' ');
_verts[noVerts] = Vector3f(atoi(splitLine[1].c_str()), atoi(splitLine[2].c_str()), atoi(splitLine[3].c_str()));

//std::cout << "Vertices Number:" << noVerts << " x:" << _verts[noVerts].getX() << " y:" << _verts[noVerts].getY() << " z:" << _verts[noVerts].getZ() << "\n";
noVerts++;
}

if (charText[0] == 'f'){
std::vector<std::string> splitLine = split(line, ' ');

for (int i = 0; i < 3; i++){

std::vector<std::string> ssl = split(splitLine[i+1], '/');

//std::cout << atoi(splitLine[i].c_str()) << "\n";

std::cout << i << ": " << atoi(ssl[0].c_str()) << " " << atoi(ssl[1].c_str()) << " " << atoi(ssl[2].c_str()) << "\n";

_inds[noIndices] = atoi(ssl[0].c_str());
noIndices++;
_inds[noIndices] = atoi(ssl[1].c_str());
noIndices++;
_inds[noIndices] = atoi(ssl[2].c_str());
noIndices++;

//std::cout << "number of indices:" << noIndices<< "\n";
}

}}

verts = _verts;
inds = _inds;

SizeV = sizeof(verts);
SizeI = sizeof(inds);noPoints = SizeI / sizeof(*inds);
length = SizeV / sizeof(*verts);Matrix4f posM, rotM, sizeM;
sizeM.InitScaleTransform(size, size, size);
rotM.InitRotateTransform(rot.getX(), rot.getY(), rot.getZ());
posM.InitTranslationTransform(pos.getX(), pos.getY(), pos.getZ());

M = posM * rotM * sizeM;

for (unsigned int i = 0; i < length; i++){
verts[i] = _verts[i];
}}

Я думаю, что это ошибка в моем коде при чтении файла, но если не просто попросить посмотреть мой другой код.

[РЕДАКТИРОВАТЬ]

Он делает это для всех файлов obj (не пытался экспортировать с помощью другой программы, и у файлов obj, которые я пробовал, очень мало лиц).

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …