Move simple UI blend mapping to renderer gl
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "node_border.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "shader.h"
|
||||
|
||||
Plane NodeBorder::m_plane;
|
||||
@@ -62,21 +63,22 @@ void NodeBorder::draw()
|
||||
{
|
||||
ShaderManager::use(kShader::Color);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
||||
const auto blend_state = pp::renderer::gl::blend_state();
|
||||
|
||||
if (m_color.a > 0.f)
|
||||
{
|
||||
m_color.a < 1.f ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
|
||||
m_color.a < 1.f ? glEnable(blend_state) : glDisable(blend_state);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||
m_plane.draw_fill();
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(blend_state);
|
||||
}
|
||||
|
||||
if (m_thinkness > 0 && m_border_color.a > 0.f)
|
||||
{
|
||||
//glLineWidth(m_thinkness);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_border_color);
|
||||
m_border_color.a < 1.f ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
|
||||
m_border_color.a < 1.f ? glEnable(blend_state) : glDisable(blend_state);
|
||||
m_plane.draw_stroke();
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(blend_state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "node_panel_animation.h"
|
||||
#include "node_button.h"
|
||||
#include "node_button_custom.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "canvas.h"
|
||||
#include "app.h"
|
||||
|
||||
@@ -236,7 +237,7 @@ void NodeAnimationTimeline::draw()
|
||||
{
|
||||
parent::draw();
|
||||
ShaderManager::use(kShader::Color);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
|
||||
float step = 35.f;
|
||||
glm::vec2 cur_pos = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "node_scroll.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "event.h"
|
||||
#include "shader.h"
|
||||
|
||||
@@ -110,7 +111,7 @@ void NodeScroll::draw()
|
||||
|
||||
if (rect.w > 0 && rect.z > 0)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
ShaderManager::use(kShader::Color);
|
||||
|
||||
if (m_direction == kScrollDirection::Vertical)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "node_text.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "shader.h"
|
||||
|
||||
Node* NodeText::clone_instantiate() const
|
||||
@@ -173,9 +174,9 @@ void NodeText::draw()
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(pp::renderer::gl::blend_state());
|
||||
m_text_mesh.draw();
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
}
|
||||
|
||||
void NodeText::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "app.h"
|
||||
#include "log.h"
|
||||
#include "node_text_input.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
#include "node_border.h"
|
||||
|
||||
Node* NodeTextInput::clone_instantiate() const
|
||||
@@ -219,13 +220,13 @@ void NodeTextInput::draw()
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(pp::renderer::gl::blend_state());
|
||||
m_text_mesh.draw();
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
|
||||
if (m_cursor_visible)
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(pp::renderer::gl::blend_state());
|
||||
glm::mat4 cur_pos = glm::translate(glm::vec3(m_pos + m_off + xy(m_text_mesh.cur_box), 0));
|
||||
glm::mat4 cur_scale = glm::scale(glm::vec3(zw(m_text_mesh.cur_box), 1));
|
||||
glm::mat4 cur_pivot = glm::translate(glm::vec3(0.5, 0.5, 0));
|
||||
|
||||
Reference in New Issue
Block a user