Added lens shift functionality to PerspectiveCamera#23
Conversation
|
Hey! I apprear to have had somehow a bad github notification setup on Satin ! Apologies for only seeing this now, this is super interesting - ill review tomorrow - much appreciated and apologies! |
vade
left a comment
There was a problem hiding this comment.
Sorry! I didnt realize i had to click "submit review" all this time, ive had a comment that you couldnt see!
| } | ||
| } | ||
|
|
||
| @Published public var enableFrustumShift: Bool = false { |
There was a problem hiding this comment.
Quick in situ review - Satin is migrating away from observable objects in the frmework, and we want to at a minimum replace Observable subclasses with @observable for more optimal updates in swiftui - and minimally leverage combine (see some open issues on the repo), and Camera, Object no longer implement any observability :)
|
No worries, just addressed by removing some @published ! |
Implements lens shift support for
PerspectiveCamera.Changes to
PerspectiveCameraNew properties:
lensShiftX: Horizontal lens shift parameter (normalised units)lensShiftY: Vertical lens shift parameter (normalised units)enableFrustumShift: Toggle to enable/disable frustum shift calculationCore functionality:
frustumShiftPerspectiveMatrixf()inSatinCoreto compute off-axis projection matricesHelper methods:
setLensShift(_:_:): Convenience method to set both shift values and auto-enableresetLensShift(): Resets shift values and disables frustum shiftSerialisation:
Codablesupport for the new properties with backward compatibility(Ideally I want to have an equivalent implementation to what
THREE.jsoffers with PerpsectiveCamera.setViewOffset. But for now, lets start at minimum...)