@@ -17,8 +17,8 @@ use learn::{
17
17
null_str, Buffer , BufferType , Shader , ShaderProgram , ShaderType , VertexArray ,
18
18
} ;
19
19
use learn_opengl as learn;
20
- use learn_opengl:: math:: * ;
21
20
use ogl33:: * ;
21
+ use ultraviolet:: * ;
22
22
23
23
type Vertex = [ f32 ; 3 + 2 ] ;
24
24
/// Draw this with glDrawArrays(GL_TRIANGLES, 0, 36)
@@ -262,7 +262,7 @@ fn main() {
262
262
glGetUniformLocation ( shader_program. 0 , name)
263
263
} ;
264
264
265
- let projection = perspective_view (
265
+ let projection = ultraviolet :: projection :: lh_yup :: perspective_gl (
266
266
45.0_f32 . to_radians ( ) ,
267
267
( WINDOW_WIDTH as f32 ) / ( WINDOW_HEIGHT as f32 ) ,
268
268
0.1 ,
@@ -296,9 +296,11 @@ fn main() {
296
296
297
297
// update the "world state".
298
298
let time = sdl. get_ticks ( ) as f32 / 10_000.0_f32 ;
299
- let view =
300
- Mat4 :: euler_angles ( 0.0 , view_pitch. to_radians ( ) , view_yaw. to_radians ( ) )
301
- * Mat4 :: translate ( vec3 ( 0.0 , 0.0 , -3.0 ) ) ;
299
+ let view = Mat4 :: from_euler_angles (
300
+ 0.0 ,
301
+ view_pitch. to_radians ( ) ,
302
+ view_yaw. to_radians ( ) ,
303
+ ) * Mat4 :: from_translation ( Vec3 :: new ( 0.0 , 0.0 , -3.0 ) ) ;
302
304
303
305
// and then draw!
304
306
unsafe {
@@ -307,10 +309,10 @@ fn main() {
307
309
glUniformMatrix4fv ( view_loc, 1 , GL_FALSE , view. as_ptr ( ) ) ;
308
310
309
311
for ( i, position) in CUBE_POSITIONS . iter ( ) . copied ( ) . enumerate ( ) {
310
- let model = Mat4 :: translate ( position)
311
- * Mat4 :: rotate_x ( 3.0 )
312
- * Mat4 :: rotate_y ( ( 1.0 + i as f32 ) * 0.8 )
313
- * Mat4 :: rotate_z ( time * ( 1.0 + i as f32 ) ) ;
312
+ let model = Mat4 :: from_translation ( position)
313
+ * Mat4 :: from_rotation_x ( 3.0 )
314
+ * Mat4 :: from_rotation_y ( ( 1.0 + i as f32 ) * 0.8 )
315
+ * Mat4 :: from_rotation_z ( time * ( 1.0 + i as f32 ) ) ;
314
316
315
317
glUniformMatrix4fv ( model_loc, 1 , GL_FALSE , model. as_ptr ( ) ) ;
316
318
0 commit comments