Fixed blending (for now)

This commit is contained in:
2023-06-26 18:36:58 -07:00
parent 2eb6c6a91f
commit ee7963fb1a
6 changed files with 17 additions and 83 deletions

View File

@ -32,7 +32,7 @@ void RenderManager::init() {
// Prepare the initial values
glEnable(GL_TEXTURE_2D);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);
}

View File

@ -7,7 +7,7 @@
#include "display/shader/Shader.hpp"
#include "display/shader/buffers/RenderPipelineShaderBuffer.hpp"
#define UI_SHADER_PROGRAM_PRIORITY 100
#define UI_SHADER_PROGRAM_PRIORITY 1000
namespace Dawn {
struct UICanvasShaderParameterBufferData {

View File

@ -36,9 +36,17 @@ std::vector<struct ShaderPassItem> SimpleTexturedMaterial::getRenderPasses(IRend
onlyPass.matrixValues[shader->paramModel] = this->transform->getWorldTransform();
onlyPass.parameterBuffers[shader->bufferRenderPipeline] = &context.renderPipeline->shaderBuffer;
onlyPass.renderFlags = (
RENDER_MANAGER_RENDER_FLAG_BLEND
);
if(this->opaque) {
onlyPass.renderFlags = (
RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST
);
} else {
onlyPass.priority = 100;
onlyPass.renderFlags = (
RENDER_MANAGER_RENDER_FLAG_BLEND
);
}
if(this->texture != nullptr) {
onlyPass.boolValues[shader->paramHasTexture] = true;

View File

@ -17,6 +17,8 @@ namespace Dawn {
Texture *texture = nullptr;
// @optional
struct Color color = COLOR_WHITE;
// @optional
bool_t opaque = true;
/**
* SimpleTexturedShader scene item component interface.