|
@@ -44,7 +44,7 @@ void ObjFile::readModel(Model3DData* zTarget)
|
|
|
Text* line = file.leseZeile();
|
|
|
while (line)
|
|
|
{
|
|
|
- if (line->positionVon("o "))
|
|
|
+ if (line->positionVon("o ") == 0)
|
|
|
{
|
|
|
line->release();
|
|
|
break;;
|
|
@@ -80,7 +80,7 @@ void ObjFile::readModel(Model3DData* zTarget)
|
|
|
if (line->positionVon("f ") == 0)
|
|
|
{
|
|
|
// only triangulated meshes ares supported
|
|
|
- Text* p1 = line->getTeilText(3, line->positionVon(" ", 1));
|
|
|
+ Text* p1 = line->getTeilText(2, line->positionVon(" ", 1));
|
|
|
Text* p2 = line->getTeilText(line->positionVon(" ", 1) + 1, line->positionVon(" ", 2));
|
|
|
Text* p3 = line->getTeilText(line->positionVon(" ", 2) + 1);
|
|
|
indices.add(parseIndex(p1));
|
|
@@ -102,7 +102,7 @@ void ObjFile::readModel(Model3DData* zTarget)
|
|
|
current.normal = normals.get(index.z - 1);
|
|
|
current.knochenId = 0;
|
|
|
int ind = 0;
|
|
|
- for (Vertex3D& other : modelData)
|
|
|
+ for (const Vertex3D& other : modelData)
|
|
|
{
|
|
|
if (other.pos == current.pos && other.tPos == current.tPos && other.normal == current.normal)
|
|
|
break;
|
|
@@ -114,7 +114,7 @@ void ObjFile::readModel(Model3DData* zTarget)
|
|
|
}
|
|
|
Vertex3D* vertexData = new Vertex3D[modelData.getEintragAnzahl()];
|
|
|
int ind = 0;
|
|
|
- for (Vertex3D& vertex : modelData)
|
|
|
+ for (const Vertex3D& vertex : modelData)
|
|
|
vertexData[ind++] = vertex;
|
|
|
zTarget->setVertecies(vertexData, modelData.getEintragAnzahl());
|
|
|
Polygon3D* polygon = new Polygon3D();
|
|
@@ -129,7 +129,7 @@ bool ObjFile::loadModel(const char* name, Model3DData* zTarget)
|
|
|
Text* line = file.leseZeile();
|
|
|
while (line)
|
|
|
{
|
|
|
- if (line->positionVon("o ") == 0 && line->positionVon(name) == 2 && line->getLength() == textLength(name) + 2)
|
|
|
+ if (line->positionVon("o ") == 0 && line->positionVon(name) == 2 && line->getLength() == textLength(name) + 3)
|
|
|
{
|
|
|
readModel(zTarget);
|
|
|
line->release();
|