getting ready to call materials

git-svn-id: svn://anubis/misc/wfobj@21 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2008-01-27 14:05:42 +00:00
parent 5b34c54c96
commit 2fe1763b74

View File

@ -110,6 +110,9 @@ GLuint WFObj::render()
vector<Vertex> vertices[VERTEX_TYPES]; vector<Vertex> vertices[VERTEX_TYPES];
int numVertsLast = 0; int numVertsLast = 0;
bool inFace = false; bool inFace = false;
bool inMaterial = false;
string currentMaterialName;
WFMtl material;
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
{ {
string type = m_data[i][0]; string type = m_data[i][0];
@ -227,9 +230,24 @@ GLuint WFObj::render()
glEnd(); glEnd();
inFace = false; inFace = false;
} }
if (inMaterial)
{
material.renderEnd(currentMaterialName);
inMaterial = false;
}
if (m_data[i].size() >= 2)
{
currentMaterialName = m_data[i][1];
material.renderBegin(currentMaterialName);
inMaterial = true;
}
} }
else if (type == "mtllib") else if (type == "mtllib")
{ {
if (m_data[i].size() >= 2)
{
material.load(m_data[i][1]);
}
} }
} }
if (inFace) if (inFace)