mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-07 11:31:39 +12:00
[GL renderer] Add constant blend colour
This commit is contained in:
parent
025231b037
commit
5a8416f87e
1 changed files with 6 additions and 12 deletions
|
@ -231,13 +231,6 @@ void Renderer::setupBlending() {
|
||||||
GL_SRC_ALPHA_SATURATE, GL_ONE
|
GL_SRC_ALPHA_SATURATE, GL_ONE
|
||||||
};
|
};
|
||||||
|
|
||||||
// Temporarily here until we add constant color/alpha
|
|
||||||
const auto panicIfUnimplementedFunc = [](const u32 func) {
|
|
||||||
auto x = blendingFuncs[func];
|
|
||||||
if (x == GL_CONSTANT_COLOR || x == GL_ONE_MINUS_CONSTANT_COLOR || x == GL_ALPHA || x == GL_ONE_MINUS_CONSTANT_ALPHA) [[unlikely]]
|
|
||||||
Helpers::panic("Unimplemented blending function!");
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!blendingEnabled) {
|
if (!blendingEnabled) {
|
||||||
OpenGL::disableBlend();
|
OpenGL::disableBlend();
|
||||||
} else {
|
} else {
|
||||||
|
@ -254,11 +247,12 @@ void Renderer::setupBlending() {
|
||||||
const u32 alphaSourceFunc = (blendControl >> 24) & 0xf;
|
const u32 alphaSourceFunc = (blendControl >> 24) & 0xf;
|
||||||
const u32 alphaDestFunc = (blendControl >> 28) & 0xf;
|
const u32 alphaDestFunc = (blendControl >> 28) & 0xf;
|
||||||
|
|
||||||
// Panic if one of the blending funcs is unimplemented
|
const u32 constantColor = regs[PICAInternalRegs::BlendColour];
|
||||||
panicIfUnimplementedFunc(rgbSourceFunc);
|
const u32 r = constantColor & 0xff;
|
||||||
panicIfUnimplementedFunc(rgbDestFunc);
|
const u32 g = (constantColor >> 8) & 0xff;
|
||||||
panicIfUnimplementedFunc(alphaSourceFunc);
|
const u32 b = (constantColor >> 16) & 0xff;
|
||||||
panicIfUnimplementedFunc(alphaDestFunc);
|
const u32 a = (constantColor >> 24) & 0xff;
|
||||||
|
OpenGL::setBlendColor(float(r) / 255.f, float(g) / 255.f, float(b) / 255.f, float(a) / 255.f);
|
||||||
|
|
||||||
// Translate equations and funcs to their GL equivalents and set them
|
// Translate equations and funcs to their GL equivalents and set them
|
||||||
glBlendEquationSeparate(blendingEquations[rgbEquation], blendingEquations[alphaEquation]);
|
glBlendEquationSeparate(blendingEquations[rgbEquation], blendingEquations[alphaEquation]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue