Route remaining UI shader setup through helpers
This commit is contained in:
@@ -18,6 +18,11 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
|
|
||||||
## Recent Reductions
|
## Recent Reductions
|
||||||
|
|
||||||
|
- 2026-06-13: DEBT-0036 was narrowed again. Remaining simple color, hue,
|
||||||
|
color-quad, grid heightmap, and pen/line preview shader setup in UI nodes
|
||||||
|
and canvas modes now routes through retained helper surfaces; those paths
|
||||||
|
still own geometry, texture/sampler binding, blend/depth state, readback,
|
||||||
|
and draw execution.
|
||||||
- 2026-06-13: DEBT-0036 was narrowed again. Scrollbar, text-input, and VR
|
- 2026-06-13: DEBT-0036 was narrowed again. Scrollbar, text-input, and VR
|
||||||
frame/cursor/controller shader setup now routes through retained UI/preview
|
frame/cursor/controller shader setup now routes through retained UI/preview
|
||||||
helpers; those paths still own geometry, blend/depth state, sampler/texture
|
helpers; those paths still own geometry, blend/depth state, sampler/texture
|
||||||
|
|||||||
@@ -3068,6 +3068,10 @@ Results:
|
|||||||
- Scrollbar, text-input, and VR frame/cursor/controller shader setup now share
|
- Scrollbar, text-input, and VR frame/cursor/controller shader setup now share
|
||||||
retained UI/preview helpers, while geometry, blend/depth state,
|
retained UI/preview helpers, while geometry, blend/depth state,
|
||||||
sampler/texture binding, and draw execution remain retained.
|
sampler/texture binding, and draw execution remain retained.
|
||||||
|
- Remaining simple color, hue, color-quad, grid heightmap, and pen/line
|
||||||
|
preview shader setup in UI nodes and canvas modes now shares retained helper
|
||||||
|
surfaces, while geometry, texture/sampler binding, blend/depth state,
|
||||||
|
readback, and draw execution remain retained.
|
||||||
- `NodeCanvas` density-resolve drawing and desktop VR UI drawing now share the
|
- `NodeCanvas` density-resolve drawing and desktop VR UI drawing now share the
|
||||||
retained draw-merge texture shader setup helper, while render target,
|
retained draw-merge texture shader setup helper, while render target,
|
||||||
sampler/texture binding, viewport/state restoration, and draw execution
|
sampler/texture binding, viewport/state restoration, and draw execution
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "node_canvas.h"
|
#include "node_canvas.h"
|
||||||
#include "legacy_canvas_draw_merge_services.h"
|
#include "legacy_canvas_draw_merge_services.h"
|
||||||
#include "legacy_canvas_stroke_composite_services.h"
|
#include "legacy_canvas_stroke_composite_services.h"
|
||||||
|
#include "legacy_canvas_stroke_preview_services.h"
|
||||||
#include "legacy_ui_overlay_services.h"
|
#include "legacy_ui_overlay_services.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
@@ -298,9 +299,6 @@ void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const
|
|||||||
auto pos = m_resizing ? m_size_pos_start : m_cur_pos;
|
auto pos = m_resizing ? m_size_pos_start : m_cur_pos;
|
||||||
//if (App::I->keys[(int)kKey::KeyAlt] && !m_resizing)
|
//if (App::I->keys[(int)kKey::KeyAlt] && !m_resizing)
|
||||||
// pos.x = pos.x - brush->m_tip_size * .5f;
|
// pos.x = pos.x - brush->m_tip_size * .5f;
|
||||||
ShaderManager::use(kShader::StrokePreview);
|
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
|
||||||
ShaderManager::u_float(kShaderUniform::Alpha, brush->m_tip_flow * brush->m_tip_opacity);
|
|
||||||
float tip_scale_fix = 1.f / glm::tan(glm::radians(Canvas::I->m_cam_fov * 0.5f));
|
float tip_scale_fix = 1.f / glm::tan(glm::radians(Canvas::I->m_cam_fov * 0.5f));
|
||||||
float tip_angle = brush->m_tip_angle * (float)(M_PI * 2.0);
|
float tip_angle = brush->m_tip_angle * (float)(M_PI * 2.0);
|
||||||
glm::vec2 tip_scale = App::I->zoom * brush->m_tip_scale *
|
glm::vec2 tip_scale = App::I->zoom * brush->m_tip_scale *
|
||||||
@@ -334,15 +332,17 @@ void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const
|
|||||||
static_cast<std::int32_t>(((App::I->height - pos.y - 1) / App::I->height) * fb_height),
|
static_cast<std::int32_t>(((App::I->height - pos.y - 1) / App::I->height) * fb_height),
|
||||||
pixel);
|
pixel);
|
||||||
bool outline = glm::min(tip_scale.x, tip_scale.y) < 20 || m_resizing ? false : m_draw_outline;
|
bool outline = glm::min(tip_scale.x, tip_scale.y) < 20 || m_resizing ? false : m_draw_outline;
|
||||||
ShaderManager::u_int(kShaderUniform::DrawOutline, outline);
|
pp::panopainter::setup_legacy_vr_stroke_preview_shader({
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, outline ? glm::vec4(1.f - glm::vec3(pixel) / 255.f, 1.f) : tip_color);
|
.texture_slot = 0,
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP,
|
.alpha = brush->m_tip_flow * brush->m_tip_opacity,
|
||||||
glm::scale(glm::vec3(1, -1, 1)) *
|
.draw_outline = outline,
|
||||||
|
.color = outline ? glm::vec4(1.f - glm::vec3(pixel) / 255.f, 1.f) : tip_color,
|
||||||
|
.mvp = glm::scale(glm::vec3(1, -1, 1)) *
|
||||||
ortho *
|
ortho *
|
||||||
glm::translate(glm::vec3(pos + tip_offset, 0)) *
|
glm::translate(glm::vec3(pos + tip_offset, 0)) *
|
||||||
glm::eulerAngleZ(tip_angle) *
|
glm::eulerAngleZ(tip_angle) *
|
||||||
glm::scale(glm::vec3(tip_scale, 1))
|
glm::scale(glm::vec3(tip_scale, 1)),
|
||||||
);
|
});
|
||||||
const bool blend = query_canvas_mode_capability(pp::renderer::gl::blend_state());
|
const bool blend = query_canvas_mode_capability(pp::renderer::gl::blend_state());
|
||||||
apply_canvas_mode_capability(pp::renderer::gl::blend_state(), true);
|
apply_canvas_mode_capability(pp::renderer::gl::blend_state(), true);
|
||||||
set_canvas_mode_active_texture_unit(0);
|
set_canvas_mode_active_texture_unit(0);
|
||||||
@@ -411,9 +411,10 @@ void CanvasModeLine::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, cons
|
|||||||
{
|
{
|
||||||
if (m_dragging)
|
if (m_dragging)
|
||||||
{
|
{
|
||||||
ShaderManager::use(kShader::Color);
|
pp::panopainter::setup_legacy_vr_color_shader({
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, ortho);
|
.color = Canvas::I->m_current_brush->m_tip_color,
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, Canvas::I->m_current_brush->m_tip_color);
|
.mvp = ortho,
|
||||||
|
});
|
||||||
static glm::vec4 AB[2];
|
static glm::vec4 AB[2];
|
||||||
AB[0] = { m_drag_start, 0, 1 };
|
AB[0] = { m_drag_start, 0, 1 };
|
||||||
AB[1] = { m_drag_pos, 0, 1 };
|
AB[1] = { m_drag_pos, 0, 1 };
|
||||||
@@ -425,9 +426,6 @@ void CanvasModeLine::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, cons
|
|||||||
else if (m_draw_tip)
|
else if (m_draw_tip)
|
||||||
{
|
{
|
||||||
const auto& brush = Canvas::I->m_current_brush;
|
const auto& brush = Canvas::I->m_current_brush;
|
||||||
ShaderManager::use(kShader::StrokePreview);
|
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
|
||||||
ShaderManager::u_float(kShaderUniform::Alpha, brush->m_tip_flow * brush->m_tip_opacity);
|
|
||||||
float tip_scale_fix = 1.f / glm::tan(glm::radians(Canvas::I->m_cam_fov * 0.5f));
|
float tip_scale_fix = 1.f / glm::tan(glm::radians(Canvas::I->m_cam_fov * 0.5f));
|
||||||
float tip_angle = brush->m_tip_angle * (float)(M_PI * 2.0);
|
float tip_angle = brush->m_tip_angle * (float)(M_PI * 2.0);
|
||||||
glm::vec2 tip_scale = App::I->zoom * brush->m_tip_scale *
|
glm::vec2 tip_scale = App::I->zoom * brush->m_tip_scale *
|
||||||
@@ -436,15 +434,17 @@ void CanvasModeLine::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, cons
|
|||||||
glm::vec2((brush->m_tip_aspect <= 0.5 ? brush->m_tip_aspect * 2.f : 1.f),
|
glm::vec2((brush->m_tip_aspect <= 0.5 ? brush->m_tip_aspect * 2.f : 1.f),
|
||||||
(brush->m_tip_aspect > 0.5 ? 1.f - (brush->m_tip_aspect - .5f) * 2.f : 1.f));
|
(brush->m_tip_aspect > 0.5 ? 1.f - (brush->m_tip_aspect - .5f) * 2.f : 1.f));
|
||||||
auto tip_color = glm::vec4(glm::vec3(brush->m_tip_color), 1.f);
|
auto tip_color = glm::vec4(glm::vec3(brush->m_tip_color), 1.f);
|
||||||
ShaderManager::u_int(kShaderUniform::DrawOutline, false);
|
pp::panopainter::setup_legacy_vr_stroke_preview_shader({
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, tip_color);
|
.texture_slot = 0,
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP,
|
.alpha = brush->m_tip_flow * brush->m_tip_opacity,
|
||||||
glm::scale(glm::vec3(1, -1, 1)) *
|
.draw_outline = false,
|
||||||
|
.color = tip_color,
|
||||||
|
.mvp = glm::scale(glm::vec3(1, -1, 1)) *
|
||||||
ortho *
|
ortho *
|
||||||
glm::translate(glm::vec3(m_cur_pos, 0)) *
|
glm::translate(glm::vec3(m_cur_pos, 0)) *
|
||||||
glm::eulerAngleZ(tip_angle) *
|
glm::eulerAngleZ(tip_angle) *
|
||||||
glm::scale(glm::vec3(tip_scale, 1))
|
glm::scale(glm::vec3(tip_scale, 1)),
|
||||||
);
|
});
|
||||||
const bool blend = query_canvas_mode_capability(pp::renderer::gl::blend_state());
|
const bool blend = query_canvas_mode_capability(pp::renderer::gl::blend_state());
|
||||||
apply_canvas_mode_capability(pp::renderer::gl::blend_state(), true);
|
apply_canvas_mode_capability(pp::renderer::gl::blend_state(), true);
|
||||||
set_canvas_mode_active_texture_unit(0);
|
set_canvas_mode_active_texture_unit(0);
|
||||||
|
|||||||
@@ -39,6 +39,46 @@ inline void configure_legacy_ui_color_shader(
|
|||||||
ShaderManager::u_vec4(kShaderUniform::Col, color);
|
ShaderManager::u_vec4(kShaderUniform::Col, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void configure_legacy_grid_lambert_shader(
|
||||||
|
const glm::mat4& mvp,
|
||||||
|
const glm::vec3& light_dir,
|
||||||
|
float ambient) noexcept
|
||||||
|
{
|
||||||
|
ShaderManager::use(kShader::Lambert);
|
||||||
|
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
||||||
|
ShaderManager::u_vec3(kShaderUniform::LightDir, light_dir);
|
||||||
|
ShaderManager::u_float(kShaderUniform::Ambient, ambient);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void configure_legacy_grid_lambert_lightmap_shader(
|
||||||
|
const glm::mat4& mvp,
|
||||||
|
const glm::vec3& light_dir,
|
||||||
|
float ambient,
|
||||||
|
int texture_slot) noexcept
|
||||||
|
{
|
||||||
|
ShaderManager::use(kShader::LambertLightmap);
|
||||||
|
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
||||||
|
ShaderManager::u_vec3(kShaderUniform::LightDir, light_dir);
|
||||||
|
ShaderManager::u_float(kShaderUniform::Ambient, ambient);
|
||||||
|
ShaderManager::u_int(kShaderUniform::Tex, texture_slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void configure_legacy_grid_bake_uv_shader(
|
||||||
|
const glm::mat4& mvp) noexcept
|
||||||
|
{
|
||||||
|
ShaderManager::use(kShader::BakeUV);
|
||||||
|
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void configure_legacy_ui_color_quad_shader(
|
||||||
|
const glm::mat4& mvp,
|
||||||
|
const glm::vec4& color) noexcept
|
||||||
|
{
|
||||||
|
ShaderManager::use(kShader::ColorQuad);
|
||||||
|
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
||||||
|
ShaderManager::u_vec4(kShaderUniform::Col, color);
|
||||||
|
}
|
||||||
|
|
||||||
inline void configure_legacy_ui_font_shader(
|
inline void configure_legacy_ui_font_shader(
|
||||||
const glm::mat4& mvp,
|
const glm::mat4& mvp,
|
||||||
const glm::vec4& color) noexcept
|
const glm::vec4& color) noexcept
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include "legacy_ui_overlay_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_border.h"
|
#include "node_border.h"
|
||||||
@@ -61,12 +62,10 @@ void NodeBorder::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* a
|
|||||||
}
|
}
|
||||||
void NodeBorder::draw()
|
void NodeBorder::draw()
|
||||||
{
|
{
|
||||||
ShaderManager::use(kShader::Color);
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
|
||||||
if (m_color.a > 0.f)
|
if (m_color.a > 0.f)
|
||||||
{
|
{
|
||||||
pp::legacy::ui_gl::set_blend_enabled(m_color.a < 1.f, "NodeBorder");
|
pp::legacy::ui_gl::set_blend_enabled(m_color.a < 1.f, "NodeBorder");
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
pp::panopainter::configure_legacy_ui_color_shader(m_mvp, m_color);
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
pp::legacy::ui_gl::set_blend_enabled(false, "NodeBorder");
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeBorder");
|
||||||
}
|
}
|
||||||
@@ -74,8 +73,8 @@ void NodeBorder::draw()
|
|||||||
if (m_thinkness > 0 && m_border_color.a > 0.f)
|
if (m_thinkness > 0 && m_border_color.a > 0.f)
|
||||||
{
|
{
|
||||||
//glLineWidth(m_thinkness);
|
//glLineWidth(m_thinkness);
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, m_border_color);
|
|
||||||
pp::legacy::ui_gl::set_blend_enabled(m_border_color.a < 1.f, "NodeBorder");
|
pp::legacy::ui_gl::set_blend_enabled(m_border_color.a < 1.f, "NodeBorder");
|
||||||
|
pp::panopainter::configure_legacy_ui_color_shader(m_mvp, m_border_color);
|
||||||
m_plane.draw_stroke();
|
m_plane.draw_stroke();
|
||||||
pp::legacy::ui_gl::set_blend_enabled(false, "NodeBorder");
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeBorder");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ void NodeColorQuad::draw()
|
|||||||
auto pos = glm::clamp(m_value * sz, { 0, 0 }, sz);
|
auto pos = glm::clamp(m_value * sz, { 0, 0 }, sz);
|
||||||
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||||
|
|
||||||
ShaderManager::use(kShader::ColorQuad);
|
pp::panopainter::configure_legacy_ui_color_quad_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
m_mvp,
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, glm::vec4(convert_rgb2hsv(glm::vec3(m_color)), 1));
|
glm::vec4(convert_rgb2hsv(glm::vec3(m_color)), 1));
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,26 +100,24 @@ void NodeColorWheel::loaded()
|
|||||||
void NodeColorWheel::draw()
|
void NodeColorWheel::draw()
|
||||||
{
|
{
|
||||||
pp::legacy::ui_gl::set_blend_enabled(false, "NodeColorWheel");
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeColorWheel");
|
||||||
ShaderManager::use(kShader::ColorHue);
|
pp::panopainter::configure_legacy_slider_hue_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::eulerAngleZ(glm::radians(-90.f)));
|
m_mvp * glm::eulerAngleZ(glm::radians(-90.f)),
|
||||||
ShaderManager::u_int(kShaderUniform::Direction, 0); // set horizontal
|
0); // set horizontal
|
||||||
m_circle.draw_fill();
|
m_circle.draw_fill();
|
||||||
|
|
||||||
ShaderManager::use(kShader::Color);
|
pp::panopainter::configure_legacy_ui_color_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::eulerAngleZ(glm::radians(-360.f * m_hsv.x)) * glm::translate(glm::vec3(.45f,0.f,0.f)));
|
m_mvp * glm::eulerAngleZ(glm::radians(-360.f * m_hsv.x)) * glm::translate(glm::vec3(.45f,0.f,0.f)),
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, {convert_hsv2rgb({glm::fract(m_hsv.x + 0.5f), 1.f, 1.f}), 1.f});
|
{convert_hsv2rgb({glm::fract(m_hsv.x + 0.5f), 1.f, 1.f}), 1.f});
|
||||||
m_cur_hue.draw_stroke();
|
m_cur_hue.draw_stroke();
|
||||||
|
|
||||||
ShaderManager::use(kShader::ColorQuad);
|
pp::panopainter::configure_legacy_ui_color_quad_shader(m_mvp, glm::vec4(m_hsv, 0.f));
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, glm::vec4(m_hsv, 0.f));
|
|
||||||
m_quad.draw_fill();
|
m_quad.draw_fill();
|
||||||
|
|
||||||
float quad_scale = glm::sin(glm::radians(45.f)) * 0.8f;
|
float quad_scale = glm::sin(glm::radians(45.f)) * 0.8f;
|
||||||
glm::vec3 pos = glm::vec3(glm::vec2(m_hsv.y, 1.f - m_hsv.z) - 0.5f, 0);
|
glm::vec3 pos = glm::vec3(glm::vec2(m_hsv.y, 1.f - m_hsv.z) - 0.5f, 0);
|
||||||
ShaderManager::use(kShader::Color);
|
pp::panopainter::configure_legacy_ui_color_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::translate(pos * quad_scale));
|
m_mvp * glm::translate(pos * quad_scale),
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, {convert_hsv2rgb({glm::fract(m_hsv.x + 0.5f), 1.f, 1.f}), 1.f});
|
{convert_hsv2rgb({glm::fract(m_hsv.x + 0.5f), 1.f, 1.f}), 1.f});
|
||||||
m_cur_quad.draw_fill();
|
m_cur_quad.draw_fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,6 @@ void NodeAnimationLayer::draw()
|
|||||||
void NodeAnimationTimeline::draw()
|
void NodeAnimationTimeline::draw()
|
||||||
{
|
{
|
||||||
parent::draw();
|
parent::draw();
|
||||||
ShaderManager::use(kShader::Color);
|
|
||||||
pp::legacy::ui_gl::set_blend_enabled(false, "NodeAnimationTimeline");
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeAnimationTimeline");
|
||||||
|
|
||||||
float step = 35.f;
|
float step = 35.f;
|
||||||
@@ -358,20 +357,18 @@ void NodeAnimationTimeline::draw()
|
|||||||
m_pos.y + m_size.y * 0.5f
|
m_pos.y + m_size.y * 0.5f
|
||||||
};
|
};
|
||||||
|
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, glm::vec4(glm::vec3(m_cursor_color) * 0.5f, 1.f));
|
pp::panopainter::configure_legacy_ui_color_shader(
|
||||||
|
m_proj
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj
|
|
||||||
* glm::translate(glm::vec3(cur_pos, 0))
|
* glm::translate(glm::vec3(cur_pos, 0))
|
||||||
* glm::scale(glm::vec3(step * m_onion_size * 2.f, m_size.y * 0.5f, 1))
|
* glm::scale(glm::vec3(step * m_onion_size * 2.f, m_size.y * 0.5f, 1)),
|
||||||
);
|
glm::vec4(glm::vec3(m_cursor_color) * 0.5f, 1.f));
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
|
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, m_cursor_color);
|
pp::panopainter::configure_legacy_ui_color_shader(
|
||||||
|
m_proj
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj
|
|
||||||
* glm::translate(glm::vec3(cur_pos, 0))
|
* glm::translate(glm::vec3(cur_pos, 0))
|
||||||
* glm::scale(glm::vec3(step * 0.25f, m_size.y * 0.75f, 1))
|
* glm::scale(glm::vec3(step * 0.25f, m_size.y * 0.75f, 1)),
|
||||||
);
|
m_cursor_color);
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -273,29 +273,28 @@ void NodePanelGrid::draw_heightmap(const glm::mat4& proj, const glm::mat4& camer
|
|||||||
if (m_shade_mode == ShadeMode::Solid)
|
if (m_shade_mode == ShadeMode::Solid)
|
||||||
{
|
{
|
||||||
apply_grid_capability(pp::renderer::gl::blend_state(), false);
|
apply_grid_capability(pp::renderer::gl::blend_state(), false);
|
||||||
ShaderManager::use(kShader::Lambert);
|
pp::panopainter::configure_legacy_grid_lambert_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
mvp,
|
||||||
ShaderManager::u_vec3(kShaderUniform::LightDir, light_dir);
|
light_dir,
|
||||||
ShaderManager::u_float(kShaderUniform::Ambient, get_ambient());
|
get_ambient());
|
||||||
m_hm_plane.draw_fill();
|
m_hm_plane.draw_fill();
|
||||||
}
|
}
|
||||||
else if (m_shade_mode == ShadeMode::Flat)
|
else if (m_shade_mode == ShadeMode::Flat)
|
||||||
{
|
{
|
||||||
ShaderManager::use(kShader::Color);
|
pp::panopainter::configure_legacy_ui_color_shader(
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, glm::vec4(
|
mvp,
|
||||||
|
glm::vec4(
|
||||||
glm::vec3(1.f - m_groud_value->get_value()),
|
glm::vec3(1.f - m_groud_value->get_value()),
|
||||||
m_groud_opacity->get_value()
|
m_groud_opacity->get_value()));
|
||||||
));
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
|
||||||
m_hm_plane.draw_fill();
|
m_hm_plane.draw_fill();
|
||||||
}
|
}
|
||||||
else if(m_shade_mode == ShadeMode::Textured)
|
else if(m_shade_mode == ShadeMode::Textured)
|
||||||
{
|
{
|
||||||
ShaderManager::use(kShader::LambertLightmap);
|
pp::panopainter::configure_legacy_grid_lambert_lightmap_shader(
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
mvp,
|
||||||
ShaderManager::u_vec3(kShaderUniform::LightDir, light_dir);
|
light_dir,
|
||||||
ShaderManager::u_float(kShaderUniform::Ambient, get_ambient());
|
get_ambient(),
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
0);
|
||||||
m_sampler_mipmap.bind(0);
|
m_sampler_mipmap.bind(0);
|
||||||
set_grid_active_texture_unit(0U);
|
set_grid_active_texture_unit(0U);
|
||||||
m_texture.bind();
|
m_texture.bind();
|
||||||
@@ -309,13 +308,12 @@ void NodePanelGrid::draw_heightmap(const glm::mat4& proj, const glm::mat4& camer
|
|||||||
if (wire_alpha > 0.f)
|
if (wire_alpha > 0.f)
|
||||||
{
|
{
|
||||||
apply_grid_capability(pp::renderer::gl::blend_state(), true);
|
apply_grid_capability(pp::renderer::gl::blend_state(), true);
|
||||||
ShaderManager::use(kShader::Color);
|
pp::panopainter::configure_legacy_ui_color_shader(
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, glm::vec4(
|
mvp,
|
||||||
|
glm::vec4(
|
||||||
glm::vec3(m_groud_value->get_value()),
|
glm::vec3(m_groud_value->get_value()),
|
||||||
m_groud_opacity->get_value() *
|
m_groud_opacity->get_value() *
|
||||||
wire_alpha
|
wire_alpha));
|
||||||
));
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, mvp);
|
|
||||||
if (m_hm_image.m_data && m_shade_mode == ShadeMode::Transparent)
|
if (m_hm_image.m_data && m_shade_mode == ShadeMode::Transparent)
|
||||||
{
|
{
|
||||||
apply_grid_color_mask(
|
apply_grid_color_mask(
|
||||||
@@ -401,8 +399,7 @@ void NodePanelGrid::bake_uvs()
|
|||||||
apply_grid_capability(pp::renderer::gl::blend_state(), false);
|
apply_grid_capability(pp::renderer::gl::blend_state(), false);
|
||||||
apply_grid_capability(pp::renderer::gl::depth_test_state(), false);
|
apply_grid_capability(pp::renderer::gl::depth_test_state(), false);
|
||||||
apply_grid_viewport(0, 0, fb.getWidth(), fb.getHeight());
|
apply_grid_viewport(0, 0, fb.getWidth(), fb.getHeight());
|
||||||
ShaderManager::use(kShader::BakeUV);
|
pp::panopainter::configure_legacy_grid_bake_uv_shader(glm::mat4(1));
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::mat4(1));
|
|
||||||
|
|
||||||
// bake normal
|
// bake normal
|
||||||
ShaderManager::u_int(kShaderUniform::Mode, 0);
|
ShaderManager::u_int(kShaderUniform::Mode, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user