added enableBlending flag to WFObj rendering
git-svn-id: svn://anubis/misc/wfobj@242 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
11033c5876
commit
9920ba04b8
25
WFObj.cc
25
WFObj.cc
@ -195,7 +195,7 @@ void WFObj::processInputLine(const std::string & input)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLuint WFObj::render(bool doTextureInfo)
|
GLuint WFObj::render(bool doTextureInfo, bool enableBlending)
|
||||||
{
|
{
|
||||||
checkGLError();
|
checkGLError();
|
||||||
GLuint list = glGenLists(1);
|
GLuint list = glGenLists(1);
|
||||||
@ -331,13 +331,15 @@ GLuint WFObj::render(bool doTextureInfo)
|
|||||||
}
|
}
|
||||||
if (inMaterial)
|
if (inMaterial)
|
||||||
{
|
{
|
||||||
material.renderEnd(currentMaterialName, doTextureInfo);
|
material.renderEnd(currentMaterialName, doTextureInfo,
|
||||||
|
enableBlending);
|
||||||
inMaterial = false;
|
inMaterial = false;
|
||||||
}
|
}
|
||||||
if (m_data[i].size() >= 2)
|
if (m_data[i].size() >= 2)
|
||||||
{
|
{
|
||||||
currentMaterialName = m_data[i][1];
|
currentMaterialName = m_data[i][1];
|
||||||
material.renderBegin(currentMaterialName, doTextureInfo);
|
material.renderBegin(currentMaterialName, doTextureInfo,
|
||||||
|
enableBlending);
|
||||||
inMaterial = true;
|
inMaterial = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,7 +364,7 @@ GLuint WFObj::render(bool doTextureInfo)
|
|||||||
}
|
}
|
||||||
if (inMaterial)
|
if (inMaterial)
|
||||||
{
|
{
|
||||||
material.renderEnd(currentMaterialName, doTextureInfo);
|
material.renderEnd(currentMaterialName, doTextureInfo, enableBlending);
|
||||||
inMaterial = false;
|
inMaterial = false;
|
||||||
}
|
}
|
||||||
glEndList();
|
glEndList();
|
||||||
@ -493,7 +495,8 @@ void WFObj::WFMtl::processInputLine(const std::string & input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WFObj::WFMtl::renderBegin(const string & mtlname, bool doTextureInfo)
|
void WFObj::WFMtl::renderBegin(const string & mtlname, bool doTextureInfo,
|
||||||
|
bool enableBlending)
|
||||||
{
|
{
|
||||||
map< string, vector< vector<string> > >::iterator it = m_data.find(mtlname);
|
map< string, vector< vector<string> > >::iterator it = m_data.find(mtlname);
|
||||||
if (it == m_data.end())
|
if (it == m_data.end())
|
||||||
@ -610,6 +613,11 @@ void WFObj::WFMtl::renderBegin(const string & mtlname, bool doTextureInfo)
|
|||||||
pushAttributes();
|
pushAttributes();
|
||||||
if (doTextureInfo)
|
if (doTextureInfo)
|
||||||
{
|
{
|
||||||
|
if (enableBlending)
|
||||||
|
{
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
if (foundTexture)
|
if (foundTexture)
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGL
|
#ifdef DEBUGGL
|
||||||
@ -635,15 +643,16 @@ void WFObj::WFMtl::pushAttributes()
|
|||||||
return;
|
return;
|
||||||
m_attributesPushed = true;
|
m_attributesPushed = true;
|
||||||
#ifdef DEBUGGL
|
#ifdef DEBUGGL
|
||||||
cout << " glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT)"
|
cout << " glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT)"
|
||||||
<< endl;
|
<< endl;
|
||||||
#endif
|
#endif
|
||||||
checkGLError();
|
checkGLError();
|
||||||
glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT);
|
glPushAttrib(GL_LIGHTING_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
checkGLError();
|
checkGLError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WFObj::WFMtl::renderEnd(const string & mtlname, bool doTextureInfo)
|
void WFObj::WFMtl::renderEnd(const string & mtlname, bool doTextureInfo,
|
||||||
|
bool enableBlending)
|
||||||
{
|
{
|
||||||
map< string, vector< vector<string> > >::iterator it = m_data.find(mtlname);
|
map< string, vector< vector<string> > >::iterator it = m_data.find(mtlname);
|
||||||
if (it == m_data.end())
|
if (it == m_data.end())
|
||||||
|
9
WFObj.h
9
WFObj.h
@ -24,9 +24,11 @@ public:
|
|||||||
WFMtl(WFObj * obj) { m_obj = obj; }
|
WFMtl(WFObj * obj) { m_obj = obj; }
|
||||||
bool load(const FileLoader::Path & path);
|
bool load(const FileLoader::Path & path);
|
||||||
void renderBegin(const std::string & mtlname,
|
void renderBegin(const std::string & mtlname,
|
||||||
bool doTextureInfo = true);
|
bool doTextureInfo = true,
|
||||||
|
bool enableBlending = false);
|
||||||
void renderEnd(const std::string & mtlname,
|
void renderEnd(const std::string & mtlname,
|
||||||
bool doTextureInfo = true);
|
bool doTextureInfo = true,
|
||||||
|
bool enableBlending = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* methods */
|
/* methods */
|
||||||
@ -51,7 +53,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool load(const FileLoader::Path & path);
|
bool load(const FileLoader::Path & path);
|
||||||
GLuint render(bool doTextureInfo = true);
|
GLuint render(bool doTextureInfo = true,
|
||||||
|
bool enableBlending = false);
|
||||||
const float * const getAABB() { return m_aabb; }
|
const float * const getAABB() { return m_aabb; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user