From 2fe1763b74b320894b7ffa9e10283eba52dc3565 Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 27 Jan 2008 14:05:42 +0000 Subject: [PATCH] getting ready to call materials git-svn-id: svn://anubis/misc/wfobj@21 bd8a9e45-a331-0410-811e-c64571078777 --- WFObj.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/WFObj.cc b/WFObj.cc index 744066b..d827759 100644 --- a/WFObj.cc +++ b/WFObj.cc @@ -110,6 +110,9 @@ GLuint WFObj::render() vector vertices[VERTEX_TYPES]; int numVertsLast = 0; bool inFace = false; + bool inMaterial = false; + string currentMaterialName; + WFMtl material; for (int i = 0; i < len; i++) { string type = m_data[i][0]; @@ -227,9 +230,24 @@ GLuint WFObj::render() glEnd(); 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") { + if (m_data[i].size() >= 2) + { + material.load(m_data[i][1]); + } } } if (inFace)