Skip to content

Commit d9c2341

Browse files
committed
custom blend funcs
1 parent 06e6446 commit d9c2341

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Qor/Pipeline.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,12 @@ void Pipeline :: render(
353353
// set up multi-pass state
354354
if(not has_lights){
355355
if(m_bBlend) {
356-
glEnable(GL_BLEND);
357-
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
356+
if(m_BlendFunc)
357+
m_BlendFunc();
358+
else{
359+
glEnable(GL_BLEND);
360+
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
361+
}
358362
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
359363
}else{
360364
//glDisable(GL_BLEND);

Qor/Pipeline.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ class Pipeline:
145145
auto l = this->lock();
146146
m_bBlend = b;
147147
}
148+
void blend(std::function<void()> func) {
149+
auto l = this->lock();
150+
m_bBlend = true;
151+
m_BlendFunc = func;
152+
}
148153

149154
void backfaces(bool b);
150155

@@ -220,6 +225,8 @@ class Pipeline:
220225

221226
const static std::vector<std::string> s_TextureUniformNames;
222227
const static std::vector<std::string> s_AttributeNames;
228+
229+
std::function<void()> m_BlendFunc;
223230
};
224231

225232
#endif

0 commit comments

Comments
 (0)