From 85c451e8c2a9b1a1b31c18d28a09abbe0015acba Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 15 Feb 2008 01:30:06 +0000 Subject: [PATCH] added Ns material support git-svn-id: svn://anubis/misc/wfobj@37 bd8a9e45-a331-0410-811e-c64571078777 --- WFObj.cc | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/WFObj.cc b/WFObj.cc index 3777c09..c2a5ff5 100644 --- a/WFObj.cc +++ b/WFObj.cc @@ -14,7 +14,7 @@ using namespace std; #define WHITESPACE " \n\r\t\v" -#define DEBUGGL +//#define DEBUGGL /****** static functions ******/ @@ -376,24 +376,6 @@ bool WFMtl::load(const string & filename, WFObj::loadTextureFunc_t loadTexture) processInputLine(input); } - /* DEBUG */ - map > >::iterator it = m_data.begin(); - while (it != m_data.end()) - { - cout << "Material '" << it->first << "':" << endl; - for (int i = 0; i < it->second.size(); i++) - { - cout << " "; - for (int j = 0; j < it->second[i].size(); j++) - { - cout << '\'' << it->second[i][j] << "' "; - } - cout << endl; - } - it++; - } - /* END DEBUG */ - ifs.close(); m_loadTexture = loadTexture; m_fileName = filename; @@ -490,6 +472,21 @@ void WFMtl::renderBegin(const string & mtlname) didSomething = true; } } + else if (type == "Ns") /* set shininess */ + { + if (stmts[i].size() == 2) + { + pushAttributes(); + GLfloat shininess = 0.0f; + sscanf(stmts[i][1].c_str(), "%f", &shininess); +#ifdef DEBUGGL + cout << " glMaterialf(GL_FRONT, GL_SHININESS, " + << shininess << ")" << endl; +#endif + glMaterialf(GL_FRONT, GL_SHININESS, shininess); + didSomething = true; + } + } else if (type == "map_Kd") /* load a diffuse texture */ { /* TODO: figure out how i want to load the texture */