| 104 | # ---------------------------------------------------------------------------- # |
| 105 | |
| 106 | class DepthState(_BaseModel): |
| 107 | |
| 108 | height: float = Field(default=0.20) |
| 109 | """Peak surface height, the parallax intensity""" |
| 110 | |
| 111 | steady: float = Field(default=0.15) |
| 112 | """Focal depth for offsets, the pivot point of the effect""" |
| 113 | |
| 114 | sticky: bool = Field(default=True) |
| 115 | """Make the background stay fixed in place on offsets""" |
| 116 | |
| 117 | focus: float = Field(default=0.00) |
| 118 | """Focal depth where perspective changes makes no effect""" |
| 119 | |
| 120 | zoom: float = Field(default=1.00) |
| 121 | """Camera zoom factor, 0.5 makes a quarter image visible""" |
| 122 | |
| 123 | isometric: float = Field(default=0.00) |
| 124 | """Isometric factor of projections, how much rays are parallel""" |
| 125 | |
| 126 | dolly: float = Field(default=0.00) |
| 127 | """Natural isometric changes, moves ray origins by this amount""" |
| 128 | |
| 129 | offset: tuple[float, float] = Field(default=(0.00, 0.00)) |
| 130 | """Camera position displacement that actually makes parallax""" |
| 131 | |
| 132 | center: tuple[float, float] = Field(default=(0.00, 0.00)) |
| 133 | """Camera is above this point, shifts the scene around""" |
| 134 | |
| 135 | origin: tuple[float, float] = Field(default=(0.00, 0.00)) |
| 136 | """Camera point where rays hits perpendicular to the surface""" |
| 137 | |
| 138 | def pipeline(self) -> Iterable[Uniform]: |
| 139 | yield Uniform("float", "iDepthHeight", self.height) |
| 140 | yield Uniform("float", "iDepthSteady", self.steady) |
| 141 | yield Uniform("bool", "iDepthSticky", self.sticky) |
| 142 | yield Uniform("float", "iDepthFocus", self.focus) |
| 143 | yield Uniform("float", "iDepthZoom", self.zoom) |
| 144 | yield Uniform("float", "iDepthIsometric", self.isometric) |
| 145 | yield Uniform("float", "iDepthDolly", self.dolly) |
| 146 | yield Uniform("vec2", "iDepthOffset", self.offset) |
| 147 | yield Uniform("vec2", "iDepthCenter", self.center) |
| 148 | yield Uniform("vec2", "iDepthOrigin", self.origin) |
| 149 | yield from self.vignette.pipeline() |
| 150 | yield from self.lens.pipeline() |
| 151 | yield from self.inpaint.pipeline() |
| 152 | yield from self.color.pipeline() |
| 153 | yield from self.blur.pipeline() |
| 154 | |
| 155 | vignette: VignetteState = Field(default_factory=VignetteState) |
| 156 | lens: LensState = Field(default_factory=LensState) |
| 157 | inpaint: InpaintState = Field(default_factory=InpaintState) |
| 158 | color: ColorState = Field(default_factory=ColorState) |
| 159 | blur: BlurState = Field(default_factory=BlurState) |