#WGPU Camera - Properties Seem Fine But Cant See Cubes

10 messages · Page 1 of 1 (latest)

lavish olive
#

Hi All,

I have started playing around with wgpu as a way to continue to learn rust and just for a bit of fun. I have mostly been following this tutorial (https://sotrh.github.io/learn-wgpu/#what-is-wgpu) however I have made a few adjustments (probably shouldnt have, but im committed now). I set it up to use winit version 0.30 and instead of cgmath I went with nalgerbra.

So I got the surface set up fine and could render a shape as shown in the tutorial, but then I jumped into adding a camera, this mostly went fine and I managed to get my version compiling however, I cannot see the cubes that I have set up. I have looked over the code and and print debug statements to check the camera and projection properties and they seem fine, so I am a bit stumped for what to look for next.

It is a tiny code base at the moment so an sort of quick glance would be appreciated! https://github.com/euandeas/voxels

#

going to try and sleep on it, so will get back to any replies in morning.

rough spear
lavish olive
dreamy zinc
#

could be field ordering issue, use c representation for your struct

#
#[repr(C)]
pub struct CameraUniform {
    view_position: [f32; 4],
    view_proj: [[f32; 4]; 4],
}
lavish olive
#

yeh already had that in place when testing above...

lavish olive
#

ah i somewhat have got it working, turns out i was my vertex code

lavish olive
#

only think now is the movement is completely wack so, my maths must be off somehwere