Files
sideline/engine/pipeline_viz.py
David Gwilliam a1dcceac47 feat(demo): add pipeline visualization demo mode
- Add --pipeline-demo flag for ASCII pipeline animation
- Create engine/pipeline_viz.py with animated pipeline graphics
- Shows data flow, camera modes, FPS counter
- Run with: python mainline.py --pipeline-demo --display pygame
2026-03-16 02:04:53 -07:00

124 lines
3.8 KiB
Python

"""
Pipeline visualization - ASCII text graphics showing the render pipeline.
"""
def generate_pipeline_visualization(width: int = 80, height: int = 24) -> list[str]:
"""Generate ASCII visualization of the pipeline.
Args:
width: Width of the visualization in characters
height: Height in lines
Returns:
List of formatted strings representing the pipeline
"""
lines = []
for y in range(height):
line = ""
if y == 1:
line = "" + "" * (width - 2) + ""
elif y == 2:
line = "" + " RENDER PIPELINE ".center(width - 2) + ""
elif y == 3:
line = "" + "" * (width - 2) + ""
elif y == 5:
line = "║ SOURCES ══════════════> FETCH ═════════> SCROLL ═══> EFFECTS ═> DISPLAY"
elif y == 6:
line = "║ │ │ │ │"
elif y == 7:
line = "║ RSS Poetry Camera Terminal"
elif y == 8:
line = "║ Ntfy Cache Noise WebSocket"
elif y == 9:
line = "║ Mic Fade Pygame"
elif y == 10:
line = "║ Glitch Sixel"
elif y == 11:
line = "║ Firehose Kitty"
elif y == 12:
line = "║ Hud"
elif y == 14:
line = "" + "" * (width - 2) + ""
elif y == 15:
line = "║ CAMERA MODES "
remaining = width - len(line) - 1
line += (
"" * (remaining // 2 - 7)
+ " VERTICAL "
+ "" * (remaining // 2 - 6)
+ ""
)
elif y == 16:
line = (
""
+ "".center(8)
+ " "
+ "".center(8)
+ " "
+ "".center(8)
+ " "
+ "".center(8)
+ " " * 20
+ ""
)
elif y == 17:
line = (
"║ scroll up scroll left diagonal bobbing "
+ " " * 16
+ ""
)
elif y == 19:
line = "" + "" * (width - 2) + ""
elif y == 20:
fps = "60"
line = (
f"║ FPS: {fps} │ Frame: 16.7ms │ Effects: 5 active │ Camera: VERTICAL "
+ " " * (width - len(line) - 2)
+ ""
)
elif y == 21:
line = "" + "" * (width - 2) + ""
else:
line = " " * width
lines.append(line)
return lines
def generate_animated_pipeline(width: int = 80, frame: int = 0) -> list[str]:
"""Generate animated ASCII visualization.
Args:
width: Width of the visualization
frame: Animation frame number
Returns:
List of formatted strings
"""
lines = generate_pipeline_visualization(width, 20)
anim_chars = ["", "", "", " ", "", "", ""]
char = anim_chars[frame % len(anim_chars)]
for i, line in enumerate(lines):
if "Effects" in line:
lines[i] = line.replace("" * 5, char * 5)
if "FPS:" in line:
lines[i] = (
f"║ FPS: {60 - frame % 10} │ Frame: {16 + frame % 5:.1f}ms │ Effects: {5 - (frame % 3)} active │ Camera: {['VERTICAL', 'HORIZONTAL', 'OMNI', 'FLOATING'][frame % 4]} "
+ " " * (80 - len(lines[i]) - 2)
+ ""
)
return lines