Route UI leaf render state through GL dispatch
This commit is contained in:
@@ -662,6 +662,10 @@ Known local toolchain state:
|
|||||||
retained `RTT` render-target pass entry
|
retained `RTT` render-target pass entry
|
||||||
and exit paths, tested depth renderbuffer allocation/delete and framebuffer
|
and exit paths, tested depth renderbuffer allocation/delete and framebuffer
|
||||||
depth attach/detach dispatch consumed by retained RTT and canvas object-drawing helpers,
|
depth attach/detach dispatch consumed by retained RTT and canvas object-drawing helpers,
|
||||||
|
shared legacy UI GL dispatch consumed by retained `NodeBorder`, `NodeImage`,
|
||||||
|
`NodeImageTexture`, `NodeColorWheel`, `NodeAnimationTimeline`, `NodeScroll`,
|
||||||
|
`NodeText`, `NodeTextInput`, and `NodeViewport` blend-state, fallback
|
||||||
|
texture unbind, viewport, color clear, and clear-color restore paths,
|
||||||
tested convert-command state dispatch consumed by
|
tested convert-command state dispatch consumed by
|
||||||
`App::cmd_convert`, tested render platform hint dispatch consumed by
|
`App::cmd_convert`, tested render platform hint dispatch consumed by
|
||||||
`WindowsPlatformServices` and the retained macOS legacy fallback, tested
|
`WindowsPlatformServices` and the retained macOS legacy fallback, tested
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
| DEBT-0033 | Open | Modernization | Tools menu planning and direct command execution dispatch now consume pure `pp_app_core` through `App::init_menu_tools`, `pano_cli plan-tools-menu`, `pano_cli plan-tools-panel`, and the `ToolsMenuServices` boundary, and direct command execution is centralized in `src/legacy_app_shell_services.*`; SonarPen availability/startup now routes through `PlatformServices`, but live adapters still construct legacy `NodePanelFloating` panels, mutate legacy panel nodes, clear `CanvasModeGrid`, reset `NodeCanvas` camera state, open legacy shortcuts UI, and rely on the legacy platform adapter for the retained iOS SonarPen bridge | Preserve current Tools menu behavior while UI shell actions move toward app/UI/platform services | `pp_app_core_tools_menu_tests`; `pp_platform_api_tests`; `pano_cli plan-tools-menu --command shortcuts`; `pano_cli plan-tools-panel --panel layers`; `pano_cli plan-tools-panel --panel animation --already-visible`; `ctest --preset desktop-fast --build-config Debug` | Tools panel creation, submenu routing, grid clear, camera reset, shortcuts dialog, and SonarPen dispatch are owned by injected app/UI/platform services with `App::init_menu_tools` acting only as a UI adapter and no legacy Tools adapter |
|
| DEBT-0033 | Open | Modernization | Tools menu planning and direct command execution dispatch now consume pure `pp_app_core` through `App::init_menu_tools`, `pano_cli plan-tools-menu`, `pano_cli plan-tools-panel`, and the `ToolsMenuServices` boundary, and direct command execution is centralized in `src/legacy_app_shell_services.*`; SonarPen availability/startup now routes through `PlatformServices`, but live adapters still construct legacy `NodePanelFloating` panels, mutate legacy panel nodes, clear `CanvasModeGrid`, reset `NodeCanvas` camera state, open legacy shortcuts UI, and rely on the legacy platform adapter for the retained iOS SonarPen bridge | Preserve current Tools menu behavior while UI shell actions move toward app/UI/platform services | `pp_app_core_tools_menu_tests`; `pp_platform_api_tests`; `pano_cli plan-tools-menu --command shortcuts`; `pano_cli plan-tools-panel --panel layers`; `pano_cli plan-tools-panel --panel animation --already-visible`; `ctest --preset desktop-fast --build-config Debug` | Tools panel creation, submenu routing, grid clear, camera reset, shortcuts dialog, and SonarPen dispatch are owned by injected app/UI/platform services with `App::init_menu_tools` acting only as a UI adapter and no legacy Tools adapter |
|
||||||
| DEBT-0034 | Open | Modernization | About menu command planning and execution dispatch now consume pure `pp_app_core` through `App::init_menu_about`, `pano_cli plan-about-menu`, and the `AboutMenuServices` boundary, and live execution is centralized in `src/legacy_app_shell_services.*`, but the bridge still opens legacy About/manual/what's-new dialogs, invokes the injected crash hook, and runs the legacy Canvas stroke performance test directly | Preserve About menu behavior while dialogs and diagnostics move toward app/UI/platform services | `pp_app_core_about_menu_tests`; `pano_cli plan-about-menu --command news --version-major 2 --version-minor 5 --version-fix 7`; `pano_cli plan-about-menu --command performance --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | About/manual/what's-new dialog dispatch, crash-test dispatch, and performance-test execution are owned by injected app/UI/platform services with `App::init_menu_about` acting only as a UI adapter and no legacy About adapter |
|
| DEBT-0034 | Open | Modernization | About menu command planning and execution dispatch now consume pure `pp_app_core` through `App::init_menu_about`, `pano_cli plan-about-menu`, and the `AboutMenuServices` boundary, and live execution is centralized in `src/legacy_app_shell_services.*`, but the bridge still opens legacy About/manual/what's-new dialogs, invokes the injected crash hook, and runs the legacy Canvas stroke performance test directly | Preserve About menu behavior while dialogs and diagnostics move toward app/UI/platform services | `pp_app_core_about_menu_tests`; `pano_cli plan-about-menu --command news --version-major 2 --version-minor 5 --version-fix 7`; `pano_cli plan-about-menu --command performance --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | About/manual/what's-new dialog dispatch, crash-test dispatch, and performance-test execution are owned by injected app/UI/platform services with `App::init_menu_about` acting only as a UI adapter and no legacy About adapter |
|
||||||
| DEBT-0035 | Open | Modernization | Main toolbar/status command planning and execution dispatch now consume pure `pp_app_core` through `App::init_toolbar_main`, `pano_cli plan-main-toolbar`, and the `MainToolbarServices` boundary, history/canvas commands now hand off through `HistoryUiServices` and `DocumentCanvasClearServices`, and live execution is centralized in `src/legacy_app_shell_services.*`, but the bridge still opens legacy open/save/settings/message-box dialogs and delegates to legacy history/canvas adapters | Preserve reachable toolbar/status behavior while app shell commands move toward app/document/UI services | `pp_app_core_main_toolbar_tests`; `pano_cli plan-main-toolbar --command undo --undo-count 2`; `pano_cli plan-main-toolbar --command clear-canvas --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | Open/save/settings/message-box routing, undo/redo/clear-history execution, and canvas-clear execution are owned by injected app/document/UI services with `App::init_toolbar_main` acting only as a UI adapter and no legacy toolbar adapter |
|
| DEBT-0035 | Open | Modernization | Main toolbar/status command planning and execution dispatch now consume pure `pp_app_core` through `App::init_toolbar_main`, `pano_cli plan-main-toolbar`, and the `MainToolbarServices` boundary, history/canvas commands now hand off through `HistoryUiServices` and `DocumentCanvasClearServices`, and live execution is centralized in `src/legacy_app_shell_services.*`, but the bridge still opens legacy open/save/settings/message-box dialogs and delegates to legacy history/canvas adapters | Preserve reachable toolbar/status behavior while app shell commands move toward app/document/UI services | `pp_app_core_main_toolbar_tests`; `pano_cli plan-main-toolbar --command undo --undo-count 2`; `pano_cli plan-main-toolbar --command clear-canvas --no-canvas`; `ctest --preset desktop-fast --build-config Debug` | Open/save/settings/message-box routing, undo/redo/clear-history execution, and canvas-clear execution are owned by injected app/document/UI services with `App::init_toolbar_main` acting only as a UI adapter and no legacy toolbar adapter |
|
||||||
| DEBT-0036 | Open | Modernization | `pp_renderer_api`, `pp_paint_renderer`, `pano_cli plan-paint-feedback`, and `pano_cli plan-stroke-composite` can choose backend-neutral complex paint feedback strategies for fixed-function blending, framebuffer-fetch-capable renderers, or ping-pong render targets. OpenGL extension detection now stores `pp::renderer::RenderDeviceFeatures` through `ShaderManager`, using `pp_renderer_gl::query_opengl_capability_detection`, `detect_opengl_feature_state`, and `render_device_features` as the backend conversion point; that feature snapshot now includes float32-linear filtering, so canvas stroke texture format selection, renderer diagnostics, grid lightmap render planning, and grid bake target selection no longer read `ShaderManager::ext_*` flags directly. `pp_paint_renderer::plan_canvas_blend_gate` owns the compatibility mapping from persisted layer/brush blend indices to the extracted stroke-composite planner, and live `Canvas::draw_merge` plus `NodeCanvas` panorama rendering both call it with the stored renderer-neutral feature set for their existing shader-blend gates and destination-copy versus framebuffer-fetch decisions. `pp_paint_renderer::plan_canvas_stroke_feedback` also owns the current destination-feedback decision, and live `Canvas::stroke_draw`, thumbnail layer blending, and `NodeStrokePreview` brush-preview rendering use it for framebuffer-fetch versus destination-copy decisions. The retained `copy_framebuffer_to_texture_2d` utility bridge now routes 2D framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch, retained `RTT::create`/`RTT::destroy` render-target texture parameter setup, optional depth renderbuffer allocation, framebuffer allocation/attachment/status checks, binding restore, and resource deletion now route through tested `pp_renderer_gl` dispatch, retained RTT clear, masked clear with color-write-mask restore, and texture bind/unbind now route through tested `pp_renderer_gl` dispatch, retained Canvas, NodeCanvas, and NodeStrokePreview texture-unit switches now route through tested active-texture dispatch, retained Canvas, NodeCanvas, NodeStrokePreview, and desktop HMD viewport/scissor/capability execution now route through tested `pp_renderer_gl` dispatch adapters, CanvasLayer cube/equirect generation plus frame clears now route blend state, active texture units, viewport execution, color clears, and cube-face framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch adapters, `NodePanelGrid` live heightmap draw and bake setup now route depth/blend state, depth clears, color-write-mask toggles, active texture selection, and bake viewport execution through tested `pp_renderer_gl` dispatch adapters, and retained CanvasMode overlay/mask/transform paths now route active texture, depth/blend state, and transform/cut viewport execution through tested `pp_renderer_gl` dispatch adapters while the retained canvas-tip pick readback remains direct legacy OpenGL, but actual live stroke rasterization, dual-brush compositing, pattern feedback math, thumbnail layer compositing, brush-preview compositing, and the retained `ShaderManager::ext_*` compatibility fields still use legacy OpenGL canvas/UI execution | Preserve current painting behavior while the renderer boundary matures for OpenGL parity and later Vulkan/Metal experiments | `pp_renderer_api_tests`; `pp_renderer_gl_capabilities_tests`; `pp_paint_renderer_compositor_tests`; `pano_cli plan-paint-feedback --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-paint-feedback --texture-copy`; `pano_cli plan-stroke-composite --stroke-blend 10 --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-stroke-composite --layer-blend 4 --dual-blend --texture-copy`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Live stroke/layer compositing chooses its feedback path through `pp_paint_renderer` and renderer services, with OpenGL golden parity and Vulkan/Metal lab tests covering framebuffer-fetch and ping-pong behavior |
|
| DEBT-0036 | Open | Modernization | `pp_renderer_api`, `pp_paint_renderer`, `pano_cli plan-paint-feedback`, and `pano_cli plan-stroke-composite` can choose backend-neutral complex paint feedback strategies for fixed-function blending, framebuffer-fetch-capable renderers, or ping-pong render targets. OpenGL extension detection now stores `pp::renderer::RenderDeviceFeatures` through `ShaderManager`, using `pp_renderer_gl::query_opengl_capability_detection`, `detect_opengl_feature_state`, and `render_device_features` as the backend conversion point; that feature snapshot now includes float32-linear filtering, so canvas stroke texture format selection, renderer diagnostics, grid lightmap render planning, and grid bake target selection no longer read `ShaderManager::ext_*` flags directly. `pp_paint_renderer::plan_canvas_blend_gate` owns the compatibility mapping from persisted layer/brush blend indices to the extracted stroke-composite planner, and live `Canvas::draw_merge` plus `NodeCanvas` panorama rendering both call it with the stored renderer-neutral feature set for their existing shader-blend gates and destination-copy versus framebuffer-fetch decisions. `pp_paint_renderer::plan_canvas_stroke_feedback` also owns the current destination-feedback decision, and live `Canvas::stroke_draw`, thumbnail layer blending, and `NodeStrokePreview` brush-preview rendering use it for framebuffer-fetch versus destination-copy decisions. The retained `copy_framebuffer_to_texture_2d` utility bridge now routes 2D framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch, retained `RTT::create`/`RTT::destroy` render-target texture parameter setup, optional depth renderbuffer allocation, framebuffer allocation/attachment/status checks, binding restore, and resource deletion now route through tested `pp_renderer_gl` dispatch, retained RTT clear, masked clear with color-write-mask restore, and texture bind/unbind now route through tested `pp_renderer_gl` dispatch, retained Canvas, NodeCanvas, and NodeStrokePreview texture-unit switches now route through tested active-texture dispatch, retained Canvas, NodeCanvas, NodeStrokePreview, and desktop HMD viewport/scissor/capability execution now route through tested `pp_renderer_gl` dispatch adapters, CanvasLayer cube/equirect generation plus frame clears now route blend state, active texture units, viewport execution, color clears, and cube-face framebuffer-to-texture copies through tested `pp_renderer_gl` dispatch adapters, `NodePanelGrid` live heightmap draw and bake setup now route depth/blend state, depth clears, color-write-mask toggles, active texture selection, and bake viewport execution through tested `pp_renderer_gl` dispatch adapters, retained CanvasMode overlay/mask/transform paths now route active texture, depth/blend state, and transform/cut viewport execution through tested `pp_renderer_gl` dispatch adapters while the retained canvas-tip pick readback remains direct legacy OpenGL, and retained simple UI draw paths now share `legacy_ui_gl_dispatch` for blend-state execution, fallback 2D texture unbinds, `NodeViewport` viewport query/restore, color-buffer clears, and clear-color restore, but actual live stroke rasterization, dual-brush compositing, pattern feedback math, thumbnail layer compositing, brush-preview compositing, and the retained `ShaderManager::ext_*` compatibility fields still use legacy OpenGL canvas/UI execution | Preserve current painting behavior while the renderer boundary matures for OpenGL parity and later Vulkan/Metal experiments | `pp_renderer_api_tests`; `pp_renderer_gl_capabilities_tests`; `pp_paint_renderer_compositor_tests`; `pano_cli plan-paint-feedback --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-paint-feedback --texture-copy`; `pano_cli plan-stroke-composite --stroke-blend 10 --framebuffer-fetch --explicit-transitions --render-only`; `pano_cli plan-stroke-composite --layer-blend 4 --dual-blend --texture-copy`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Live stroke/layer compositing chooses its feedback path through `pp_paint_renderer` and renderer services, with OpenGL golden parity and Vulkan/Metal lab tests covering framebuffer-fetch and ping-pong behavior |
|
||||||
| DEBT-0037 | Open | Modernization | Recording lifecycle/export planning and execution dispatch now consume pure `pp_app_core` through `App::rec_start`, `App::rec_stop`, `App::rec_clear`, `App::rec_export`, `pano_cli plan-recording-session`, and the `RecordingServices` boundary; live execution is centralized in `src/legacy_recording_services.*`, and retained `PBO` allocation/readback/map/unmap/delete operations now route through tested `pp_renderer_gl` dispatch, but the bridge still owns legacy recording thread startup/shutdown, platform recorded-file cleanup, progress UI, retained `App::rec_loop` readback call sites, and `MP4Encoder::write_mp4` execution | Preserve current timelapse/MP4 behavior while recording moves toward app/document/renderer/video services | `pp_app_core_document_recording_tests`; `pp_renderer_gl_capabilities_tests`; `pano_cli plan-recording-session --running --frame-count 12`; `pano_cli plan-recording-session --platform-clears-files`; `ctest --preset desktop-fast --build-config Debug` | Recording thread lifecycle, frame readback scheduling, platform cleanup, progress reporting, and MP4 writing are owned by injected app/renderer/video services with `App` methods acting only as adapters |
|
| DEBT-0037 | Open | Modernization | Recording lifecycle/export planning and execution dispatch now consume pure `pp_app_core` through `App::rec_start`, `App::rec_stop`, `App::rec_clear`, `App::rec_export`, `pano_cli plan-recording-session`, and the `RecordingServices` boundary; live execution is centralized in `src/legacy_recording_services.*`, and retained `PBO` allocation/readback/map/unmap/delete operations now route through tested `pp_renderer_gl` dispatch, but the bridge still owns legacy recording thread startup/shutdown, platform recorded-file cleanup, progress UI, retained `App::rec_loop` readback call sites, and `MP4Encoder::write_mp4` execution | Preserve current timelapse/MP4 behavior while recording moves toward app/document/renderer/video services | `pp_app_core_document_recording_tests`; `pp_renderer_gl_capabilities_tests`; `pano_cli plan-recording-session --running --frame-count 12`; `pano_cli plan-recording-session --platform-clears-files`; `ctest --preset desktop-fast --build-config Debug` | Recording thread lifecycle, frame readback scheduling, platform cleanup, progress reporting, and MP4 writing are owned by injected app/renderer/video services with `App` methods acting only as adapters |
|
||||||
| DEBT-0038 | Open | Modernization | Cloud upload/browse/bulk planning and execution dispatch now consume pure `pp_app_core` through `App::cloud_upload`, `App::cloud_upload_all`, `App::cloud_browse`, `pano_cli plan-cloud-upload`, `pano_cli plan-cloud-upload-all`, `pano_cli plan-cloud-browse`, and the `CloudServices` boundary; live execution is centralized in `src/legacy_cloud_services.*`, the app-owned `upload`/`download`/license curl helpers now ask `PlatformServices` for the Android TLS-verification bypass policy, and retained `Asset::open_url`, `LogRemote::net_init`, and `NodeDialogCloud::load_thumbs_thread` curl sites consume the `pp_platform_api` default TLS policy helper instead of spelling Android branches locally, but the bridge still uses legacy save-before-upload, app-owned curl helpers instead of an injected network service, progress/message UI, OpenGL context guarding, `NodeDialogCloud`, `Canvas` project open, layer refresh, and `ActionManager` reset | Preserve current cloud behavior while cloud/network/document import flows move toward app/document/platform services | `pp_app_core_document_cloud_tests`; `pp_platform_api_tests`; `pano_cli plan-cloud-upload --new-document --unsaved`; `pano_cli plan-cloud-browse --selected-file demo.ppi`; `pano_cli plan-cloud-upload-all --file-count 3`; `ctest --preset desktop-fast --build-config Debug` | Cloud upload/download, TLS policy, save-before-upload, progress reporting, cloud browse dialog, downloaded project opening, layer refresh, OpenGL context ownership, and action-history reset are owned by injected app/document/network/platform/renderer services with `App` methods acting only as adapters |
|
| DEBT-0038 | Open | Modernization | Cloud upload/browse/bulk planning and execution dispatch now consume pure `pp_app_core` through `App::cloud_upload`, `App::cloud_upload_all`, `App::cloud_browse`, `pano_cli plan-cloud-upload`, `pano_cli plan-cloud-upload-all`, `pano_cli plan-cloud-browse`, and the `CloudServices` boundary; live execution is centralized in `src/legacy_cloud_services.*`, the app-owned `upload`/`download`/license curl helpers now ask `PlatformServices` for the Android TLS-verification bypass policy, and retained `Asset::open_url`, `LogRemote::net_init`, and `NodeDialogCloud::load_thumbs_thread` curl sites consume the `pp_platform_api` default TLS policy helper instead of spelling Android branches locally, but the bridge still uses legacy save-before-upload, app-owned curl helpers instead of an injected network service, progress/message UI, OpenGL context guarding, `NodeDialogCloud`, `Canvas` project open, layer refresh, and `ActionManager` reset | Preserve current cloud behavior while cloud/network/document import flows move toward app/document/platform services | `pp_app_core_document_cloud_tests`; `pp_platform_api_tests`; `pano_cli plan-cloud-upload --new-document --unsaved`; `pano_cli plan-cloud-browse --selected-file demo.ppi`; `pano_cli plan-cloud-upload-all --file-count 3`; `ctest --preset desktop-fast --build-config Debug` | Cloud upload/download, TLS policy, save-before-upload, progress reporting, cloud browse dialog, downloaded project opening, layer refresh, OpenGL context ownership, and action-history reset are owned by injected app/document/network/platform/renderer services with `App` methods acting only as adapters |
|
||||||
| DEBT-0039 | Open | Modernization | Document-open planning and execution dispatch now consume pure `pp_app_core` through `App::open_document`, `pano_cli plan-open-route`, `DocumentOpenServices`, and `src/legacy_document_open_services.*`, but the bridge still opens ABR/PPBR import prompts before delegating import execution to `src/legacy_brush_package_import_services.*`, applies unsaved-project discard prompts, calls legacy project-open execution, refreshes layer UI, updates the app title, and clears legacy history directly | Preserve current file-open/import behavior while document loading and brush import move toward app/document/asset/UI services | `pp_app_core_document_route_tests`; `pp_app_core_document_session_tests`; `pano_cli plan-open-route --path D:/Paint/Scenes/demo.ppi --unsaved`; `pano_cli plan-open-route --path D:/Paint/Brushes/clouds.ABR --unsaved`; `ctest --preset desktop-fast --build-config Debug` | Brush import prompting, project-open execution, unsaved-project discard prompting, layer refresh, title updates, and history clearing are owned by injected app/document/asset/UI services with `App::open_document` acting only as an adapter |
|
| DEBT-0039 | Open | Modernization | Document-open planning and execution dispatch now consume pure `pp_app_core` through `App::open_document`, `pano_cli plan-open-route`, `DocumentOpenServices`, and `src/legacy_document_open_services.*`, but the bridge still opens ABR/PPBR import prompts before delegating import execution to `src/legacy_brush_package_import_services.*`, applies unsaved-project discard prompts, calls legacy project-open execution, refreshes layer UI, updates the app title, and clears legacy history directly | Preserve current file-open/import behavior while document loading and brush import move toward app/document/asset/UI services | `pp_app_core_document_route_tests`; `pp_app_core_document_session_tests`; `pano_cli plan-open-route --path D:/Paint/Scenes/demo.ppi --unsaved`; `pano_cli plan-open-route --path D:/Paint/Brushes/clouds.ABR --unsaved`; `ctest --preset desktop-fast --build-config Debug` | Brush import prompting, project-open execution, unsaved-project discard prompting, layer refresh, title updates, and history clearing are owned by injected app/document/asset/UI services with `App::open_document` acting only as an adapter |
|
||||||
|
|||||||
@@ -1081,18 +1081,19 @@ Canvas undo/redo dirty-region texture updates and readbacks now also delegate
|
|||||||
their 2D texture target, RGBA pixel format, and unsigned-byte component type
|
their 2D texture target, RGBA pixel format, and unsigned-byte component type
|
||||||
mapping to `pp_renderer_gl`.
|
mapping to `pp_renderer_gl`.
|
||||||
`NodeViewport` preview rendering now also delegates viewport query,
|
`NodeViewport` preview rendering now also delegates viewport query,
|
||||||
clear-color query, color-buffer clear mask, and blend-state tokens to
|
clear-color query, color-buffer clear mask, viewport execution, color clear,
|
||||||
`pp_renderer_gl`.
|
clear-color restore, and blend-state execution through the shared
|
||||||
|
`legacy_ui_gl_dispatch` adapter and `pp_renderer_gl` mappings.
|
||||||
`NodeImageTexture` preview drawing now delegates its fallback 2D texture bind
|
`NodeImageTexture` preview drawing now delegates its fallback 2D texture bind
|
||||||
target and blend-state tokens to `pp_renderer_gl`.
|
and blend-state execution through the shared UI GL adapter.
|
||||||
`NodeImage` drawing and remote-image texture creation now delegate mipmapped
|
`NodeImage` drawing and remote-image texture creation now delegate mipmapped
|
||||||
sampler filters, blend-state tokens, and RGBA8/RGBA texture format mapping to
|
sampler filters, blend-state execution, and RGBA8/RGBA texture format mapping
|
||||||
`pp_renderer_gl`.
|
to `pp_renderer_gl`.
|
||||||
`NodeColorWheel` triangle-buffer setup and draw-state handling now delegate
|
`NodeColorWheel` triangle-buffer setup and draw-state handling now delegate
|
||||||
array-buffer, static-upload, vertex-attribute, primitive-mode, and blend-state
|
array-buffer, static-upload, vertex-attribute, primitive-mode, and blend-state
|
||||||
tokens to `pp_renderer_gl`.
|
execution to `pp_renderer_gl`.
|
||||||
Simple UI text, text-input, border, scroll, and animation timeline draw paths
|
Simple UI text, text-input, border, scroll, and animation timeline draw paths
|
||||||
now also delegate blend-state tokens to `pp_renderer_gl`.
|
now also execute blend-state changes through the shared UI GL adapter.
|
||||||
Canvas layer cube/equirect generation, clear, restore, and snapshot paths now
|
Canvas layer cube/equirect generation, clear, restore, and snapshot paths now
|
||||||
also delegate cube/2D texture targets, active texture units, blend/clear state,
|
also delegate cube/2D texture targets, active texture units, blend/clear state,
|
||||||
viewport execution, target-aware framebuffer-to-texture copies, and RGBA8
|
viewport execution, target-aware framebuffer-to-texture copies, and RGBA8
|
||||||
@@ -2059,6 +2060,12 @@ Results:
|
|||||||
state, depth clears, color-write-mask toggles, active texture selection, and
|
state, depth clears, color-write-mask toggles, active texture selection, and
|
||||||
bake viewport execution through tested renderer GL backend dispatch
|
bake viewport execution through tested renderer GL backend dispatch
|
||||||
contracts.
|
contracts.
|
||||||
|
- Retained simple UI draw paths now share `legacy_ui_gl_dispatch` for
|
||||||
|
blend-state execution, fallback 2D texture unbinds, `NodeViewport` viewport
|
||||||
|
query/restore, color-buffer clear, and clear-color restore. This covers
|
||||||
|
`NodeBorder`, `NodeImage`, `NodeImageTexture`, `NodeColorWheel`,
|
||||||
|
`NodeAnimationTimeline`, `NodeScroll`, `NodeText`, `NodeTextInput`, and
|
||||||
|
`NodeViewport` without changing their legacy draw ordering.
|
||||||
- Canvas draw-merge shader-blend selection now consumes the extracted
|
- Canvas draw-merge shader-blend selection now consumes the extracted
|
||||||
`pp_paint_renderer` stroke composite planner for current layer and primary
|
`pp_paint_renderer` stroke composite planner for current layer and primary
|
||||||
brush blend modes, while preserving legacy OpenGL compositing execution under
|
brush blend modes, while preserving legacy OpenGL compositing execution under
|
||||||
|
|||||||
152
src/legacy_ui_gl_dispatch.h
Normal file
152
src/legacy_ui_gl_dispatch.h
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
|
|
||||||
|
namespace pp::legacy::ui_gl {
|
||||||
|
|
||||||
|
inline void enable_opengl_state(std::uint32_t state) noexcept
|
||||||
|
{
|
||||||
|
glEnable(static_cast<GLenum>(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void disable_opengl_state(std::uint32_t state) noexcept
|
||||||
|
{
|
||||||
|
glDisable(static_cast<GLenum>(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void clear_opengl_buffer(std::uint32_t mask) noexcept
|
||||||
|
{
|
||||||
|
glClear(static_cast<GLbitfield>(mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set_opengl_clear_color(float r, float g, float b, float a) noexcept
|
||||||
|
{
|
||||||
|
glClearColor(r, g, b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set_opengl_viewport(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height) noexcept
|
||||||
|
{
|
||||||
|
glViewport(static_cast<GLint>(x), static_cast<GLint>(y), static_cast<GLsizei>(width), static_cast<GLsizei>(height));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void bind_opengl_texture(std::uint32_t target, std::uint32_t texture) noexcept
|
||||||
|
{
|
||||||
|
glBindTexture(static_cast<GLenum>(target), static_cast<GLuint>(texture));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void get_opengl_integer(std::uint32_t name, std::int32_t* values) noexcept
|
||||||
|
{
|
||||||
|
GLint raw_values[4] {};
|
||||||
|
glGetIntegerv(static_cast<GLenum>(name), raw_values);
|
||||||
|
values[0] = static_cast<std::int32_t>(raw_values[0]);
|
||||||
|
values[1] = static_cast<std::int32_t>(raw_values[1]);
|
||||||
|
values[2] = static_cast<std::int32_t>(raw_values[2]);
|
||||||
|
values[3] = static_cast<std::int32_t>(raw_values[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void get_opengl_float(std::uint32_t name, float* values) noexcept
|
||||||
|
{
|
||||||
|
glGetFloatv(static_cast<GLenum>(name), values);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::array<std::int32_t, 4> query_viewport(const char* context)
|
||||||
|
{
|
||||||
|
std::array<std::int32_t, 4> viewport {};
|
||||||
|
get_opengl_integer(pp::renderer::gl::viewport_query(), viewport.data());
|
||||||
|
(void)context;
|
||||||
|
return viewport;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::array<float, 4> query_clear_color(const char* context)
|
||||||
|
{
|
||||||
|
std::array<float, 4> color {};
|
||||||
|
get_opengl_float(pp::renderer::gl::color_clear_value_query(), color.data());
|
||||||
|
(void)context;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set_capability(std::uint32_t state, bool enabled, const char* context)
|
||||||
|
{
|
||||||
|
const auto status = pp::renderer::gl::apply_opengl_capability(
|
||||||
|
state,
|
||||||
|
enabled,
|
||||||
|
pp::renderer::gl::OpenGlCapabilityDispatch {
|
||||||
|
.enable = enable_opengl_state,
|
||||||
|
.disable = disable_opengl_state,
|
||||||
|
});
|
||||||
|
if (!status.ok())
|
||||||
|
LOG("%s capability dispatch failed because: %s", context, status.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set_blend_enabled(bool enabled, const char* context)
|
||||||
|
{
|
||||||
|
set_capability(pp::renderer::gl::blend_state(), enabled, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void apply_viewport(
|
||||||
|
std::int32_t x,
|
||||||
|
std::int32_t y,
|
||||||
|
std::int32_t width,
|
||||||
|
std::int32_t height,
|
||||||
|
const char* context)
|
||||||
|
{
|
||||||
|
const auto status = pp::renderer::gl::apply_opengl_viewport(
|
||||||
|
pp::renderer::gl::OpenGlViewportRect {
|
||||||
|
.x = x,
|
||||||
|
.y = y,
|
||||||
|
.width = width,
|
||||||
|
.height = height,
|
||||||
|
},
|
||||||
|
pp::renderer::gl::OpenGlViewportDispatch {
|
||||||
|
.viewport = set_opengl_viewport,
|
||||||
|
});
|
||||||
|
if (!status.ok())
|
||||||
|
LOG("%s viewport dispatch failed because: %s", context, status.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void clear_color_buffer(std::array<float, 4> color, const char* context)
|
||||||
|
{
|
||||||
|
const auto status = pp::renderer::gl::clear_opengl_render_target(
|
||||||
|
pp::renderer::gl::OpenGlDefaultClear {
|
||||||
|
.color = color,
|
||||||
|
.mask = pp::renderer::gl::framebuffer_color_buffer_mask(),
|
||||||
|
},
|
||||||
|
pp::renderer::gl::OpenGlClearDispatch {
|
||||||
|
.clear_color = set_opengl_clear_color,
|
||||||
|
.clear = clear_opengl_buffer,
|
||||||
|
});
|
||||||
|
if (!status.ok())
|
||||||
|
LOG("%s clear dispatch failed because: %s", context, status.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void set_clear_color(std::array<float, 4> color, const char* context)
|
||||||
|
{
|
||||||
|
const auto status = pp::renderer::gl::clear_opengl_render_target(
|
||||||
|
pp::renderer::gl::OpenGlDefaultClear {
|
||||||
|
.color = color,
|
||||||
|
.mask = pp::renderer::gl::framebuffer_color_buffer_mask(),
|
||||||
|
},
|
||||||
|
pp::renderer::gl::OpenGlClearDispatch {
|
||||||
|
.clear_color = set_opengl_clear_color,
|
||||||
|
.clear = [](std::uint32_t) noexcept {},
|
||||||
|
});
|
||||||
|
if (!status.ok())
|
||||||
|
LOG("%s clear-color dispatch failed because: %s", context, status.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void unbind_texture_2d(const char* context)
|
||||||
|
{
|
||||||
|
const auto status = pp::renderer::gl::bind_opengl_texture_2d(
|
||||||
|
0U,
|
||||||
|
pp::renderer::gl::OpenGlTexture2DBindDispatch {
|
||||||
|
.bind_texture = bind_opengl_texture,
|
||||||
|
});
|
||||||
|
if (!status.ok())
|
||||||
|
LOG("%s texture bind dispatch failed because: %s", context, status.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace pp::legacy::ui_gl
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_border.h"
|
#include "node_border.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
|
||||||
Plane NodeBorder::m_plane;
|
Plane NodeBorder::m_plane;
|
||||||
@@ -63,22 +63,20 @@ void NodeBorder::draw()
|
|||||||
{
|
{
|
||||||
ShaderManager::use(kShader::Color);
|
ShaderManager::use(kShader::Color);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
||||||
const auto blend_state = pp::renderer::gl::blend_state();
|
|
||||||
|
|
||||||
if (m_color.a > 0.f)
|
if (m_color.a > 0.f)
|
||||||
{
|
{
|
||||||
m_color.a < 1.f ? glEnable(blend_state) : glDisable(blend_state);
|
pp::legacy::ui_gl::set_blend_enabled(m_color.a < 1.f, "NodeBorder");
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
glDisable(blend_state);
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeBorder");
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
ShaderManager::u_vec4(kShaderUniform::Col, m_border_color);
|
||||||
m_border_color.a < 1.f ? glEnable(blend_state) : glDisable(blend_state);
|
pp::legacy::ui_gl::set_blend_enabled(m_border_color.a < 1.f, "NodeBorder");
|
||||||
m_plane.draw_stroke();
|
m_plane.draw_stroke();
|
||||||
glDisable(blend_state);
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeBorder");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_colorwheel.h"
|
#include "node_colorwheel.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
@@ -90,7 +91,7 @@ void NodeColorWheel::loaded()
|
|||||||
|
|
||||||
void NodeColorWheel::draw()
|
void NodeColorWheel::draw()
|
||||||
{
|
{
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeColorWheel");
|
||||||
ShaderManager::use(kShader::ColorHue);
|
ShaderManager::use(kShader::ColorHue);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::eulerAngleZ(glm::radians(-90.f)));
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::eulerAngleZ(glm::radians(-90.f)));
|
||||||
ShaderManager::u_int(kShaderUniform::Direction, 0); // set horizontal
|
ShaderManager::u_int(kShaderUniform::Direction, 0); // set horizontal
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_image.h"
|
#include "node_image.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
@@ -102,7 +103,7 @@ void NodeImage::draw()
|
|||||||
auto& sampler = m_use_mipmaps ? m_sampler_mips : m_sampler;
|
auto& sampler = m_use_mipmaps ? m_sampler_mips : m_sampler;
|
||||||
sampler.bind(0);
|
sampler.bind(0);
|
||||||
|
|
||||||
glEnable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeImage");
|
||||||
if (m_use_atlas)
|
if (m_use_atlas)
|
||||||
{
|
{
|
||||||
ShaderManager::use(kShader::Atlas);
|
ShaderManager::use(kShader::Atlas);
|
||||||
@@ -117,7 +118,7 @@ void NodeImage::draw()
|
|||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::scale(glm::vec3(m_scale, 1.f)));
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp * glm::scale(glm::vec3(m_scale, 1.f)));
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
sampler.unbind();
|
sampler.unbind();
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImage");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NodeImage::set_image(const std::string& path)
|
bool NodeImage::set_image(const std::string& path)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_image_texture.h"
|
#include "node_image_texture.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "node_image.h"
|
#include "node_image.h"
|
||||||
|
|
||||||
@@ -19,14 +19,14 @@ void NodeImageTexture::clone_copy(Node* dest) const
|
|||||||
|
|
||||||
void NodeImageTexture::draw()
|
void NodeImageTexture::draw()
|
||||||
{
|
{
|
||||||
tex ? tex->bind() : glBindTexture(pp::renderer::gl::texture_2d_target(), 0);
|
tex ? tex->bind() : pp::legacy::ui_gl::unbind_texture_2d("NodeImageTexture");
|
||||||
auto& sampler = tex && tex->has_mips ? NodeImage::m_sampler_mips : NodeImage::m_sampler;
|
auto& sampler = tex && tex->has_mips ? NodeImage::m_sampler_mips : NodeImage::m_sampler;
|
||||||
sampler.bind(0);
|
sampler.bind(0);
|
||||||
glEnable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeImageTexture");
|
||||||
ShaderManager::use(kShader::Texture);
|
ShaderManager::use(kShader::Texture);
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_mvp);
|
||||||
NodeImage::m_plane.draw_fill();
|
NodeImage::m_plane.draw_fill();
|
||||||
sampler.unbind();
|
sampler.unbind();
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeImageTexture");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
#include "node_panel_animation.h"
|
#include "node_panel_animation.h"
|
||||||
#include "app_core/document_animation.h"
|
#include "app_core/document_animation.h"
|
||||||
#include "legacy_document_animation_services.h"
|
#include "legacy_document_animation_services.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_button.h"
|
#include "node_button.h"
|
||||||
#include "node_button_custom.h"
|
#include "node_button_custom.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
|
|
||||||
Node* NodePanelAnimation::clone_instantiate() const
|
Node* NodePanelAnimation::clone_instantiate() const
|
||||||
@@ -308,7 +308,7 @@ void NodeAnimationTimeline::draw()
|
|||||||
{
|
{
|
||||||
parent::draw();
|
parent::draw();
|
||||||
ShaderManager::use(kShader::Color);
|
ShaderManager::use(kShader::Color);
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeAnimationTimeline");
|
||||||
|
|
||||||
float step = 35.f;
|
float step = 35.f;
|
||||||
glm::vec2 cur_pos = {
|
glm::vec2 cur_pos = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_scroll.h"
|
#include "node_scroll.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ void NodeScroll::draw()
|
|||||||
|
|
||||||
if (rect.w > 0 && rect.z > 0)
|
if (rect.w > 0 && rect.z > 0)
|
||||||
{
|
{
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeScroll");
|
||||||
ShaderManager::use(kShader::Color);
|
ShaderManager::use(kShader::Color);
|
||||||
|
|
||||||
if (m_direction == kScrollDirection::Vertical)
|
if (m_direction == kScrollDirection::Vertical)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_text.h"
|
#include "node_text.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
|
||||||
Node* NodeText::clone_instantiate() const
|
Node* NodeText::clone_instantiate() const
|
||||||
@@ -174,9 +174,9 @@ void NodeText::draw()
|
|||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||||
glEnable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeText");
|
||||||
m_text_mesh.draw();
|
m_text_mesh.draw();
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeText");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeText::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
|
void NodeText::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_text_input.h"
|
#include "node_text_input.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "node_border.h"
|
#include "node_border.h"
|
||||||
|
|
||||||
Node* NodeTextInput::clone_instantiate() const
|
Node* NodeTextInput::clone_instantiate() const
|
||||||
@@ -220,13 +220,13 @@ void NodeTextInput::draw()
|
|||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
|
ShaderManager::u_mat4(kShaderUniform::MVP, m_proj * pos);
|
||||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||||
glEnable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeTextInput");
|
||||||
m_text_mesh.draw();
|
m_text_mesh.draw();
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeTextInput");
|
||||||
|
|
||||||
if (m_cursor_visible)
|
if (m_cursor_visible)
|
||||||
{
|
{
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeTextInput");
|
||||||
glm::mat4 cur_pos = glm::translate(glm::vec3(m_pos + m_off + xy(m_text_mesh.cur_box), 0));
|
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_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));
|
glm::mat4 cur_pivot = glm::translate(glm::vec3(0.5, 0.5, 0));
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "node_viewport.h"
|
#include "node_viewport.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
@@ -10,29 +13,31 @@ void NodeViewport::draw()
|
|||||||
glm::mat4 cam = glm::lookAt(glm::vec3(sinf(angle) * 10, 0, -10), glm::vec3(0, 0, 0), glm::vec3(0, -1, 0));
|
glm::mat4 cam = glm::lookAt(glm::vec3(sinf(angle) * 10, 0, -10), glm::vec3(0, 0, 0), glm::vec3(0, -1, 0));
|
||||||
glm::mat4 proj = glm::perspective<float>(glm::radians(45.f), m_clip.z / m_clip.w, .1f, 100);
|
glm::mat4 proj = glm::perspective<float>(glm::radians(45.f), m_clip.z / m_clip.w, .1f, 100);
|
||||||
|
|
||||||
GLint vp[4];
|
const auto vp = pp::legacy::ui_gl::query_viewport("NodeViewport");
|
||||||
GLfloat cc[4];
|
const auto cc = pp::legacy::ui_gl::query_clear_color("NodeViewport");
|
||||||
glGetIntegerv(pp::renderer::gl::viewport_query(), vp);
|
|
||||||
glGetFloatv(pp::renderer::gl::color_clear_value_query(), cc);
|
|
||||||
|
|
||||||
glClearColor(1, 0, 0, 1);
|
pp::legacy::ui_gl::clear_color_buffer({ 1.f, 0.f, 0.f, 1.f }, "NodeViewport");
|
||||||
glClear(pp::renderer::gl::framebuffer_color_buffer_mask());
|
|
||||||
auto box = m_clip * root()->m_zoom;
|
auto box = m_clip * root()->m_zoom;
|
||||||
glm::ivec4 c = (glm::ivec4)glm::vec4(box.x, (int)(vp[3] - box.y - box.w), box.z, box.w);
|
glm::ivec4 c = (glm::ivec4)glm::vec4(box.x, (int)(vp[3] - box.y - box.w), box.z, box.w);
|
||||||
glViewport(c.x + App::I->off_x, c.y + App::I->off_y, c.z, c.w);
|
pp::legacy::ui_gl::apply_viewport(
|
||||||
|
static_cast<std::int32_t>(c.x + App::I->off_x),
|
||||||
|
static_cast<std::int32_t>(c.y + App::I->off_y),
|
||||||
|
c.z,
|
||||||
|
c.w,
|
||||||
|
"NodeViewport");
|
||||||
TextureManager::get(m_tex_id).bind();
|
TextureManager::get(m_tex_id).bind();
|
||||||
m_sampler->bind(0);
|
m_sampler->bind(0);
|
||||||
glEnable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(true, "NodeViewport");
|
||||||
ShaderManager::use(kShader::Texture);
|
ShaderManager::use(kShader::Texture);
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, proj * cam);
|
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();
|
||||||
glDisable(pp::renderer::gl::blend_state());
|
pp::legacy::ui_gl::set_blend_enabled(false, "NodeViewport");
|
||||||
|
|
||||||
glViewport(vp[0], vp[1], vp[2], vp[3]);
|
pp::legacy::ui_gl::apply_viewport(vp[0], vp[1], vp[2], vp[3], "NodeViewport");
|
||||||
glClearColor(cc[0], cc[1], cc[2], cc[3]);
|
pp::legacy::ui_gl::set_clear_color(cc, "NodeViewport");
|
||||||
}
|
}
|
||||||
Node* NodeViewport::clone_instantiate() const
|
Node* NodeViewport::clone_instantiate() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user