use cbindgen for FFI #3

Open
noteuclid wants to merge 5 commits from cbindgen into master
3 changed files with 5 additions and 5 deletions
Showing only changes of commit 1d433dc13b - Show all commits

View File

@ -9,11 +9,11 @@ pub(crate) fn rotation(yaw: f32, pitch: f32) -> Mat3 {
} }
pub(crate) fn view(yaw: f32, pitch: f32, distance: f32) -> Affine3A { pub(crate) fn view(yaw: f32, pitch: f32, distance: f32) -> Affine3A {
Affine3A::from_mat3_translation(rotation(yaw, pitch), vec3(0., 0., distance)) Affine3A::from_mat3_translation(rotation(-yaw, -pitch), vec3(0., 0., -distance))
} }
pub(crate) fn projection(fovy: f32, aspect: f32) -> Mat4 { pub(crate) fn projection(fovy: f32, aspect: f32) -> Mat4 {
Mat4::perspective_lh(fovy, aspect, 0.1, 10.0) Mat4::perspective_rh(fovy, aspect, 0.1, 10.0)
} }
#[cfg(test)] #[cfg(test)]

View File

@ -19,7 +19,7 @@ impl Default for RedrawArgs {
fn default() -> Self { fn default() -> Self {
Self { Self {
background: vec4(0.25, 0.49, 0.93, 1.00), background: vec4(0.25, 0.49, 0.93, 1.00),
cam_yaw: std::f32::consts::FRAC_PI_4, cam_yaw: 3. * std::f32::consts::FRAC_PI_4,
cam_pitch: std::f32::consts::FRAC_PI_6, cam_pitch: std::f32::consts::FRAC_PI_6,
cam_distance: 3., cam_distance: 3.,
cam_fovy: std::f32::consts::FRAC_PI_2, cam_fovy: std::f32::consts::FRAC_PI_2,
@ -56,7 +56,7 @@ fn cube(a: f32, b: f32) -> render::mesh::CpuMeshIndexed {
] { ] {
for m in [1., -1.] { for m in [1., -1.] {
let base = mesh.vertices.len() as u16; let base = mesh.vertices.len() as u16;
for offset in [m * v + u, -m * v + u, -m * v - u, m * v - u] { for offset in [m * v + u, m * v - u, -m * v - u, -m * v + u] {
let vertex = render::mesh::Vertex { let vertex = render::mesh::Vertex {
position: (m * w + offset), position: (m * w + offset),
color: gray + color_level * m * w, color: gray + color_level * m * w,

View File

@ -71,7 +71,7 @@
<double>5.000000000000000</double> <double>5.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>45.000000000000000</double> <double>135.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>