File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -206,9 +206,18 @@ impl<T> Camera<T> {
206206}
207207
208208impl < T : Transform > Camera < T > {
209+ /// Returns the camera matrix.
210+ pub fn world_to_view ( & self ) -> Mat4 < World , View > {
211+ self . transform . world_to_view ( )
212+ }
213+ /// Returns the inverse camera matrix.
214+ pub fn view_to_world ( & self ) -> Mat4 < View , World > {
215+ self . world_to_view ( ) . inverse ( )
216+ }
217+
209218 /// Returns the composed camera and projection matrix.
210219 pub fn world_to_project ( & self ) -> ProjMat3 < World > {
211- self . transform . world_to_view ( ) . then ( & self . project )
220+ self . world_to_view ( ) . then ( & self . project )
212221 }
213222
214223 /// Renders the given geometry from the viewpoint of this camera.
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ fn main() {
6464 let modelview = rotate_x ( theta * 0.2 )
6565 . then ( & rotate_z ( theta * 0.14 ) )
6666 . to ( )
67- . then ( & cam. transform . world_to_view ( ) ) ;
67+ . then ( & cam. world_to_view ( ) ) ;
6868
6969 render (
7070 & tris,
You can’t perform that action at this time.
0 commit comments