Hiho,
Das ist mein erster Beitrag hier daher erstmal hallo allerseits

Ich beschäftige mich erst seit 2 Tagen mit Irrlicht und komme derzeit nicht weiter.
Um mehr über Irrlicht zu lernen dachte ich mir ich schreibe mir einen kleinen Model viewer für das gute alte FF7.
Nun bin ich soweit das ich die Texturen importieren kann und auch ein mesh aus den game dateien erstellen kann und auch anzeigen.
Das problem an der sache ist wie bekomme ich nun die texturen auf das mesh und an die richtige position >_< z.B. bei einem kopf die augen.
Hier mal der code wie ich das mesh erzeuge
Code:
SMesh *newmesh = new SMesh();
SMeshBuffer *meshbuffer = new SMeshBuffer();
p_tmp *cords = new p_tmp[100];
int cid = 0;
int i = 0;
for (int x = 0; x < p_fileHeader.NumGroups;x++)
{
for (int y = 0; y < groups[x].NumPolygons;y++)
{
rgb_quad pcolor;
pcolor.blue = polygon_colors[y].blue;
pcolor.green = polygon_colors[y].green;
pcolor.red = polygon_colors[y].red;
pcolor.alpha = polygon_colors[y].alpha;
p_vertex v1, v2, v3, n1, n2, n3;
v1.x = vertices[groups[x].VerticesStartIndex + polygons[y].vi_1].x;
v1.y = vertices[groups[x].VerticesStartIndex + polygons[y].vi_1].y;
v1.z = vertices[groups[x].VerticesStartIndex + polygons[y].vi_1].z;
v2.x = vertices[groups[x].VerticesStartIndex + polygons[y].vi_2].x;
v2.y = vertices[groups[x].VerticesStartIndex + polygons[y].vi_2].y;
v2.z = vertices[groups[x].VerticesStartIndex + polygons[y].vi_2].z;
v3.x = vertices[groups[x].VerticesStartIndex + polygons[y].vi_3].x;
v3.y = vertices[groups[x].VerticesStartIndex + polygons[y].vi_3].y;
v3.z = vertices[groups[x].VerticesStartIndex + polygons[y].vi_3].z;
n1.x = normal_i_table[polygons[y].ni_1].x;
n1.y = normal_i_table[polygons[y].ni_1].y;
n1.z = normal_i_table[polygons[y].ni_1].z;
n2.x = normal_i_table[polygons[y].ni_2].x;
n2.y = normal_i_table[polygons[y].ni_2].y;
n2.z = normal_i_table[polygons[y].ni_2].z;
n3.x = normal_i_table[polygons[y].ni_3].x;
n3.y = normal_i_table[polygons[y].ni_3].y;
n3.z = normal_i_table[polygons[y].ni_3].z;
meshbuffer->Vertices.push_back(S3DVertex(v1.x, v1.y, v1.z, n1.x, n1.y, n1.z, SColor(pcolor.alpha,pcolor.red,pcolor.green,pcolor.blue),0,0) );
meshbuffer->Vertices.push_back(S3DVertex(v2.x, v2.y, v2.z, n2.x, n2.y, n2.z, SColor(pcolor.alpha,pcolor.red,pcolor.green,pcolor.blue),0,0) );
meshbuffer->Vertices.push_back(S3DVertex(v3.x, v3.y, v3.z, n3.x, n3.y, n3.z, SColor(pcolor.alpha,pcolor.red,pcolor.green,pcolor.blue),0,0) );
meshbuffer->recalculateBoundingBox();
if (groups[x].TextureNumber == 1)
{
cords[cid].tex_id = groups[x].TextureNumber;
cords[cid].x = texcoords[groups[x].TexCoordStartIndex].v1;
cords[cid].y = texcoords[groups[x].TexCoordStartIndex].v2;
cid++;
}
meshbuffer->Indices.push_back(i++);
meshbuffer->Indices.push_back(i++);
meshbuffer->Indices.push_back(i++);
}
}
ISceneManager* smgr = irr_device->getSceneManager();
newmesh->addMeshBuffer(meshbuffer);
smgr->getMeshManipulator()->flipSurfaces(newmesh);
ISceneNode *node = smgr->addMeshSceneNode(newmesh);
node->setMaterialTexture(0, (ITexture*) tex_arr[0]);
node->setMaterialFlag(EMF_LIGHTING, false);
Das funktioniert soweit echt super insovern ich die 2 Material befehle weglasse wird es genau so wie es sein soll angezeigt mit ihnen wird es schwarz.
Für die einzelnen texturen habe ich auch noch deren XY coordinaten nur wie soll ich die festlegen
Jemand ne Idee? Ich steh aufm schlauch such mich schon seit stunden durchs netz aber komme nicht wirklich ans ziehl
