added Ns material support
git-svn-id: svn://anubis/misc/wfobj@37 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
125b2e0863
commit
85c451e8c2
35
WFObj.cc
35
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<string, vector< vector<string> > >::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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user