feat(shaders_lab): per-node preview thumbnails + double-rclick delete node
- DagStep: preview_open flag (default false). - dag_compile: emit `uniform int u_preview_target` and a series of early-return branches at the start of fragColor selection. -1 (default) falls through to the real Output-driven fragColor. - dag_node_previews (new fn): per-node FBO keyed by editor_uid, lazy created. Renders each node with preview_open=true to its FBO by setting u_preview_target = step index. Texture exposed via dag_preview_texture(uid) for ImGui::Image. - dag_node_editor: small toggle button "[+] preview"/"[-] preview" in each non-Output node; when open, ImGui::Image(96x64, V-flipped). - dag_node_editor: double right-click on hovered node deletes it (Output is protected). - main.cpp: dag_previews_render after Canvas DAG; dag_previews_destroy on shutdown. Single GL program drives both the canvas and all thumbnails — moving sliders never recompiles, only the topology change does. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "gfx/dag_panel.h"
|
||||
#include "gfx/dag_node_editor.h"
|
||||
#include "gfx/dag_palette.h"
|
||||
#include "gfx/dag_node_previews.h"
|
||||
#include "core/fps_overlay.h"
|
||||
#include "seed_shaders.h"
|
||||
|
||||
@@ -187,6 +188,11 @@ static void render() {
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
// Render per-node previews (only nodes with preview_open=true)
|
||||
if (g_canvas_dag.program) {
|
||||
fn::gfx::dag_previews_render(g_pipeline, g_canvas_dag.program);
|
||||
}
|
||||
|
||||
// --- Controls window (Code uniforms) ---
|
||||
if (ImGui::Begin("Controls")) {
|
||||
if (g_descs.empty()) {
|
||||
@@ -232,5 +238,6 @@ int main() {
|
||||
fn::gfx::canvas_destroy(g_canvas_code);
|
||||
fn::gfx::canvas_destroy(g_canvas_dag);
|
||||
fn::gfx::dag_node_editor_destroy();
|
||||
fn::gfx::dag_previews_destroy();
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user