+ let text_rot = Matrix4::from_angle_x(cgmath::Deg(-90.0f32));
+ let text_pos = Matrix4::from_translation(Vector3 { x: 0.0, y: 0.501, z: 0.0f32}) * text_rot;
+ for x in 0..SEA_XSIZE {
+ for z in 0..SEA_ZSIZE {
+ let wave = ((x as f32 / SEA_XSIZE as f32 * PI * 5.0 + t * 2.0).sin() +
+ (z as f32 / SEA_ZSIZE as f32 * PI * 3.0 + t * 3.0).sin()) * 0.3;
+ let model = Matrix4::from_translation(
+ sea[x][z] + Vector3 {x: 0., y: wave, z: 0.});
+ let uniforms = uniform! {
+ model: array4x4(model),
+ perspview: perspview,
+ col: [0., (1. - wave).abs() * 0.5, wave.abs()],
+ };
+ shaded_cube.draw(&mut frame, &uniforms);
+ text.model = model * text_pos;
+ text.character = (x + z * SEA_XSIZE) as u8 as char;
+ text.draw(&mut frame, &perspview);
+ }
+ }
+