pub use mat3::Mat3;
pub use mat4::Mat4;
pub use next_after_f32::next_after_f32;
-pub use point2::Point2;
-pub use point3::Point3;
+pub use point2::{point2, Point2};
+pub use point3::{point3, Point3};
pub use quat::Quat;
pub use sin_cos_pi::sin_cos_pi_f32;
pub use tan_pi::tan_pi_f32;
-pub use vec2::Vec2;
-pub use vec3::Vec3;
-pub use vec4::Vec4;
+pub use vec2::{vec2, Vec2};
+pub use vec3::{vec3, Vec3};
+pub use vec4::{vec4, Vec4};
/// Unit type for an angle expressed in radians.
#[derive(Clone, Copy, PartialEq, PartialOrd, Debug, Default)]
TypedBind, Viewport,
};
use narcissus_maths::{
- sin_cos_pi_f32, Affine3, Deg, HalfTurn, Mat3, Mat4, Point3, Vec2, Vec3, Vec4,
+ sin_cos_pi_f32, vec2, vec3, vec4, Affine3, Deg, HalfTurn, Mat3, Mat4, Point3, Vec2, Vec3,
};
const MAX_SHARKS: usize = 262_144;
impl obj::Visitor for ObjVisitor {
fn visit_position(&mut self, x: f32, y: f32, z: f32, _w: f32) {
- self.positions.push(Vec3::new(x, y, z))
+ self.positions.push(vec3(x, y, z))
}
fn visit_texcoord(&mut self, u: f32, v: f32, _w: f32) {
- self.texcoords.push(Vec2::new(u, v));
+ self.texcoords.push(vec2(u, v));
}
fn visit_normal(&mut self, x: f32, y: f32, z: f32) {
- self.normals.push(Vec3::new(x, y, z))
+ self.normals.push(vec3(x, y, z))
}
fn visit_face(&mut self, indices: &[(i32, i32, i32)]) {
let texcoord = visitor.texcoords[texcoord_index as usize - 1];
(
Vertex {
- position: Vec4::new(position.x, position.y, position.z, 0.0).into(),
- normal: Vec4::new(normal.x, normal.y, normal.z, 0.0).into(),
- texcoord: Vec4::new(texcoord.x, texcoord.y, 0.0, 0.0).into(),
+ position: vec4(position.x, position.y, position.z, 0.0).into(),
+ normal: vec4(normal.x, normal.y, normal.z, 0.0).into(),
+ texcoord: vec4(texcoord.x, texcoord.y, 0.0, 0.0).into(),
},
index as u16,
)
let z = z as f32 * shark_distance - NUM_SHARKS as f32 / 2.0 * shark_distance;
shark_transforms.push(Affine3 {
matrix: Mat3::from_axis_rotation(Vec3::Y, HalfTurn::new(rng.next_f32())),
- translate: Vec3::new(x, 0.0, z),
+ translate: vec3(x, 0.0, z),
})
}
}