@@ -9,15 +9,15 @@ use crate::math::{
99} ;
1010use crate :: util:: { Dims , rect:: Rect } ;
1111
12- #[ cfg( feature = "fp" ) ]
13- use crate :: math:: {
14- Angle , Vec3 , orient_z, pt3, rotate_x, rotate_y, spherical, translate, turns,
15- } ;
16-
1712use super :: {
1813 Clip , Context , FragmentShader , NdcToScreen , RealToProj , Render , Target ,
1914 VertexShader , View , ViewToProj , World , WorldToView , clip:: ClipVec ,
2015} ;
16+ #[ cfg( feature = "fp" ) ]
17+ use crate :: math:: {
18+ Angle , Vec3 , orient_z, pt3, rotate_x, rotate_y, spherical, translate, turns,
19+ } ;
20+ use crate :: prelude:: Shader ;
2121
2222/// Trait for different modes of camera motion.
2323pub trait Transform {
@@ -198,6 +198,9 @@ impl<T> Camera<T> {
198198 }
199199}
200200
201+ // TODO Should probably pass view and projection matrices separately
202+ pub type CameraUni < ' a , B , Uni > = ( & ' a Mat4x4 < RealToProj < B > > , Uni ) ;
203+
201204impl < T : Transform > Camera < T > {
202205 /// Returns the composed camera and projection matrix.
203206 pub fn world_to_project ( & self ) -> Mat4x4 < RealToProj < World > > {
@@ -221,23 +224,18 @@ impl<T: Transform> Camera<T> {
221224 ) where
222225 Prim : Render < Var > + Clone ,
223226 [ <Prim >:: Clip ] : Clip < Item = Prim :: Clip > ,
224- Shd : for < ' a > VertexShader <
225- Vtx ,
226- ( & ' a Mat4x4 < RealToProj < B > > , Uni ) ,
227- Output = Vertex < ClipVec , Var > ,
228- > + FragmentShader < Var , Uni > ,
227+ Shd : for < ' a > Shader < Vtx , Var , CameraUni < ' a , B , Uni > > ,
229228 {
230- /*let tf = to_world.then(&self.world_to_project());
231-
229+ let to_proj = to_world. then ( & self . world_to_project ( ) ) ;
232230 super :: render (
233231 prims. as_ref ( ) ,
234232 verts. as_ref ( ) ,
235233 shader,
236- (&tf , uniform),
234+ ( & to_proj , uniform) ,
237235 self . viewport ,
238236 target,
239237 ctx,
240- );*/
238+ ) ;
241239 }
242240}
243241
0 commit comments