Route import and node texture setup through helpers
This commit is contained in:
@@ -18,6 +18,14 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
|
|
||||||
## Recent Reductions
|
## Recent Reductions
|
||||||
|
|
||||||
|
- 2026-06-13: DEBT-0036 was narrowed again. `NodeViewport` retained preview
|
||||||
|
draw and `NodePanelGrid` sun-overlay `Texture` shader setup now route
|
||||||
|
through `legacy_canvas_draw_merge_services.h`; the node paths still own
|
||||||
|
texture/sampler binding, viewport/state setup, and draw execution.
|
||||||
|
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::import_layer` retained
|
||||||
|
object-draw `Texture` shader setup now routes through
|
||||||
|
`legacy_canvas_draw_merge_services.h`; import_layer still owns texture upload,
|
||||||
|
sampler/texture binding, draw callbacks, and object geometry.
|
||||||
- 2026-06-13: DEBT-0036 was narrowed again. `NodeImage` and
|
- 2026-06-13: DEBT-0036 was narrowed again. `NodeImage` and
|
||||||
`NodeImageTexture` retained plain image `Texture` shader setup now routes
|
`NodeImageTexture` retained plain image `Texture` shader setup now routes
|
||||||
through `legacy_canvas_draw_merge_services.h`; the nodes still own
|
through `legacy_canvas_draw_merge_services.h`; the nodes still own
|
||||||
|
|||||||
@@ -3021,6 +3021,10 @@ Results:
|
|||||||
stroke composite shader setup helper, while render-task ordering, framebuffer
|
stroke composite shader setup helper, while render-task ordering, framebuffer
|
||||||
copy bounds, sampler/texture binding, and draw execution remain in retained
|
copy bounds, sampler/texture binding, and draw execution remain in retained
|
||||||
canvas-mode code.
|
canvas-mode code.
|
||||||
|
- `Canvas::import_layer` retained object drawing now shares the draw-merge
|
||||||
|
texture shader setup helper for flat and spherical imports, while texture
|
||||||
|
upload, sampler/texture binding, draw callbacks, and object geometry remain in
|
||||||
|
retained Canvas code.
|
||||||
- `Canvas::thumbnail_generate` checkerboard redraw and final texture blending
|
- `Canvas::thumbnail_generate` checkerboard redraw and final texture blending
|
||||||
now share the retained draw-merge shader setup helpers, while destination
|
now share the retained draw-merge shader setup helpers, while destination
|
||||||
copies, sampler/texture binding, readback, and draw execution remain in
|
copies, sampler/texture binding, readback, and draw execution remain in
|
||||||
@@ -3040,6 +3044,10 @@ Results:
|
|||||||
retained draw-merge texture shader setup helper for `Texture`, `Tex`, and
|
retained draw-merge texture shader setup helper for `Texture`, `Tex`, and
|
||||||
`MVP` setup. Texture/sampler binding, atlas setup, blend state, and draw
|
`MVP` setup. Texture/sampler binding, atlas setup, blend state, and draw
|
||||||
execution remain in the node paths.
|
execution remain in the node paths.
|
||||||
|
- `NodeViewport` preview drawing and `NodePanelGrid` sun-overlay drawing now
|
||||||
|
share the retained draw-merge texture shader setup helper for `Texture`,
|
||||||
|
`Tex`, and `MVP` setup. Texture/sampler binding, viewport/state setup, and
|
||||||
|
draw execution remain in the node paths.
|
||||||
- `Canvas::stroke_draw_mix` now shares the retained stroke composite shader
|
- `Canvas::stroke_draw_mix` now shares the retained stroke composite shader
|
||||||
helper for mixer-pass `CompDraw` setup, while preserving its caller-specific
|
helper for mixer-pass `CompDraw` setup, while preserving its caller-specific
|
||||||
texture slot uniforms. Mixer framebuffer/scissor state, sampler and texture
|
texture slot uniforms. Mixer framebuffer/scissor state, sampler and texture
|
||||||
|
|||||||
@@ -2049,9 +2049,11 @@ void Canvas::import_equirectangular_thread(std::string file_path, std::shared_pt
|
|||||||
m_sampler.bind(0);
|
m_sampler.bind(0);
|
||||||
set_active_texture_unit(0);
|
set_active_texture_unit(0);
|
||||||
tex.bind();
|
tex.bind();
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
pp::panopainter::LegacyCanvasDrawMergeTextureUniforms {
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::scale(glm::vec3(-1, -1, 1)));
|
.mvp = glm::scale(glm::vec3(-1, -1, 1)),
|
||||||
|
.texture_slot = 0,
|
||||||
|
});
|
||||||
plane.draw_fill();
|
plane.draw_fill();
|
||||||
tex.unbind();
|
tex.unbind();
|
||||||
m_sampler.unbind();
|
m_sampler.unbind();
|
||||||
@@ -2069,10 +2071,12 @@ void Canvas::import_equirectangular_thread(std::string file_path, std::shared_pt
|
|||||||
m_sampler.bind(0);
|
m_sampler.bind(0);
|
||||||
set_active_texture_unit(0);
|
set_active_texture_unit(0);
|
||||||
tex.bind();
|
tex.bind();
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader(
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
pp::panopainter::LegacyCanvasDrawMergeTextureUniforms {
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * camera *
|
.mvp = proj * camera *
|
||||||
glm::eulerAngleY(glm::radians(180.f)) * glm::scale(glm::vec3(1, -1, 1)));
|
glm::eulerAngleY(glm::radians(180.f)) * glm::scale(glm::vec3(1, -1, 1)),
|
||||||
|
.texture_slot = 0,
|
||||||
|
});
|
||||||
sphere.draw_fill();
|
sphere.draw_fill();
|
||||||
tex.unbind();
|
tex.unbind();
|
||||||
m_sampler.unbind();
|
m_sampler.unbind();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "app_core/grid_ui.h"
|
#include "app_core/grid_ui.h"
|
||||||
|
#include "legacy_canvas_draw_merge_services.h"
|
||||||
#include "legacy_grid_ui_services.h"
|
#include "legacy_grid_ui_services.h"
|
||||||
#include "legacy_ui_overlay_services.h"
|
#include "legacy_ui_overlay_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -343,11 +344,11 @@ void NodePanelGrid::draw_heightmap(const glm::mat4& proj, const glm::mat4& camer
|
|||||||
auto aspect_ratio = static_cast<float>(viewport.height) / static_cast<float>(viewport.width);
|
auto aspect_ratio = static_cast<float>(viewport.height) / static_cast<float>(viewport.width);
|
||||||
apply_grid_capability(pp::renderer::gl::blend_state(), true);
|
apply_grid_capability(pp::renderer::gl::blend_state(), true);
|
||||||
apply_grid_capability(pp::renderer::gl::depth_test_state(), false);
|
apply_grid_capability(pp::renderer::gl::depth_test_state(), false);
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
.mvp = glm::ortho(-1.f, 1.f, -1.f, 1.f) *
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-1.f, 1.f, -1.f, 1.f) *
|
//glm::scale(glm::vec3(100)) *
|
||||||
//glm::scale(glm::vec3(100)) *
|
glm::translate(glm::vec3(p2d, 0)) * glm::scale(glm::vec3(.1f * aspect_ratio, .1f, 1.f)),
|
||||||
glm::translate(glm::vec3(p2d, 0)) * glm::scale(glm::vec3(.1f * aspect_ratio, .1f, 1.f)));
|
.texture_slot = 0});
|
||||||
set_grid_active_texture_unit(0U);
|
set_grid_active_texture_unit(0U);
|
||||||
m_sampler_linear.bind(0);
|
m_sampler_linear.bind(0);
|
||||||
constexpr auto sun_tex = const_hash("data/sun.png");
|
constexpr auto sun_tex = const_hash("data/sun.png");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "legacy_canvas_draw_merge_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_viewport.h"
|
#include "node_viewport.h"
|
||||||
@@ -28,9 +29,7 @@ void NodeViewport::draw()
|
|||||||
TextureManager::get(m_tex_id).bind();
|
TextureManager::get(m_tex_id).bind();
|
||||||
m_sampler->bind(0);
|
m_sampler->bind(0);
|
||||||
pp::legacy::ui_gl::set_blend_enabled(true, "NodeViewport");
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeViewport");
|
||||||
ShaderManager::use(kShader::Texture);
|
pp::panopainter::setup_legacy_canvas_draw_merge_texture_shader({.mvp = proj * cam, .texture_slot = 0});
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * cam);
|
|
||||||
m_faces->draw_fill();
|
m_faces->draw_fill();
|
||||||
m_sampler->unbind();
|
m_sampler->unbind();
|
||||||
TextureManager::get(m_tex_id).unbind();
|
TextureManager::get(m_tex_id).unbind();
|
||||||
|
|||||||
Reference in New Issue
Block a user