forked from genewildish/Mainline
feat: Complete pipeline hot-rebuild implementation with acceptance tests
- Implements pipeline hot-rebuild with state preservation (issue #43) - Adds auto-injection of MVP stages for missing capabilities - Adds radial camera mode for polar coordinate scanning - Adds afterimage and motionblur effects using framebuffer history - Adds comprehensive acceptance tests for camera modes and pipeline rebuild - Updates presets.toml with new effect configurations Related to: #35 (Pipeline Mutation API epic) Closes: #43, #44, #45
This commit is contained in:
60
engine/data_sources/checkerboard.py
Normal file
60
engine/data_sources/checkerboard.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""Checkerboard data source for visual pattern generation."""
|
||||
|
||||
from engine.data_sources.sources import DataSource, SourceItem
|
||||
|
||||
|
||||
class CheckerboardDataSource(DataSource):
|
||||
"""Data source that generates a checkerboard pattern.
|
||||
|
||||
Creates a grid of alternating characters, useful for testing motion effects
|
||||
and camera movement. The pattern is static; movement comes from camera panning.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
width: int = 200,
|
||||
height: int = 200,
|
||||
square_size: int = 10,
|
||||
char_a: str = "#",
|
||||
char_b: str = " ",
|
||||
):
|
||||
"""Initialize checkerboard data source.
|
||||
|
||||
Args:
|
||||
width: Total pattern width in characters
|
||||
height: Total pattern height in lines
|
||||
square_size: Size of each checker square in characters
|
||||
char_a: Character for "filled" squares (default: '#')
|
||||
char_b: Character for "empty" squares (default: ' ')
|
||||
"""
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.square_size = square_size
|
||||
self.char_a = char_a
|
||||
self.char_b = char_b
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "checkerboard"
|
||||
|
||||
@property
|
||||
def is_dynamic(self) -> bool:
|
||||
return False
|
||||
|
||||
def fetch(self) -> list[SourceItem]:
|
||||
"""Generate the checkerboard pattern as a single SourceItem."""
|
||||
lines = []
|
||||
for y in range(self.height):
|
||||
line_chars = []
|
||||
for x in range(self.width):
|
||||
# Determine which square this position belongs to
|
||||
square_x = x // self.square_size
|
||||
square_y = y // self.square_size
|
||||
# Alternate pattern based on parity of square coordinates
|
||||
if (square_x + square_y) % 2 == 0:
|
||||
line_chars.append(self.char_a)
|
||||
else:
|
||||
line_chars.append(self.char_b)
|
||||
lines.append("".join(line_chars))
|
||||
content = "\n".join(lines)
|
||||
return [SourceItem(content=content, source="checkerboard", timestamp="0")]
|
||||
Reference in New Issue
Block a user