We could use a debug block in NME to show the current state of the graph from any point within the graph. This would be a block that can take any vector (float, vec2, vec3, vec4) and will use the preview window to render what the values would be at that point. Here are the requirements:
There can be many debug blocks wired into a graph for testing, but they are all null-op unless one is selected. When a debug is selected the preview window is taken over and displays the output up to that debug block.
There is no real need to pass through the debug block. In NGE, we place a debug block on a wire because the block after can affect the data reported by the debug block such as the case of placing a debug before a setXXX block. The data will be driven by what the following block asks for. In the case of NME, the graph is a waterfall, so nothing after a block will affect the render at the point of that block, so we can just make the debug block input only, which will help with removing them later as no wires will need to be reconnected when deleting the block.
When a debug block is selected, the preview window shows the data at that point as the FragmentOut would do, but also allows the user to hover the preview and get a value from the pixel hovered. This would need to be the full float data (likely from a secondary texture rendered from raw float data) displayed to the preview window either as an overlay on the frame or in the footer bar of the window. We could also render it in the properties panel, but if the preview window is popped out, it may be more convenient to render it on the window.
If no debug block is selected, there is no need to render the second texture or to allow hover on the preview window to save on perf. If this means there is a slight lag to render the secondary texture when a debug node is selected, that is likely an acceptable tradeoff.
If rendering a vec2 (x, y), assume vec4 (x, y, 0.0, 1.0) in the render, but only display the vec2 on hover.
If rendering a float x in debug, assume vec4 (x, x, x, 1.0) on render, but only display float x on hover.
Camera manipulation of preview when in debug mode needs to stay the same, so the user can zoom, pan, and rotate camera and we continue to show debug values on hovered pixel. If this is too much computation, we can disable the hover debug value while a mouse button is down when manipulating the camera.
We only show a debug value when hovering the mesh. If the cursor is hovering the clear color, we don't display a value.
We could use a debug block in NME to show the current state of the graph from any point within the graph. This would be a block that can take any vector (float, vec2, vec3, vec4) and will use the preview window to render what the values would be at that point. Here are the requirements: