|
|
@ -44,6 +44,9 @@ const VERTICES: &[Vertex] = &[ |
|
|
|
}, |
|
|
|
}, |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static SHADER_BYTES: &[u8] = |
|
|
|
|
|
|
|
include_bytes!(concat!(env!("OUT_DIR"), "/examples/assets/vshader.shbin")); |
|
|
|
|
|
|
|
|
|
|
|
fn main() { |
|
|
|
fn main() { |
|
|
|
ctru::init(); |
|
|
|
ctru::init(); |
|
|
|
|
|
|
|
|
|
|
@ -78,14 +81,7 @@ fn main() { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unsafe { |
|
|
|
instance.render_frame_with(|instance| { |
|
|
|
citro3d_sys::C3D_FrameBegin( |
|
|
|
|
|
|
|
citro3d_sys::C3D_FRAME_SYNCDRAW |
|
|
|
|
|
|
|
.try_into() |
|
|
|
|
|
|
|
.expect("const is valid u8"), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let clear_color: u32 = 0x7F_7F_7F_FF; |
|
|
|
let clear_color: u32 = 0x7F_7F_7F_FF; |
|
|
|
render_target.clear(ClearFlags::ALL, clear_color, 0); |
|
|
|
render_target.clear(ClearFlags::ALL, clear_color, 0); |
|
|
|
|
|
|
|
|
|
|
@ -94,22 +90,16 @@ fn main() { |
|
|
|
.expect("failed to set render target"); |
|
|
|
.expect("failed to set render target"); |
|
|
|
|
|
|
|
|
|
|
|
scene_render(uloc_projection.into(), &projection); |
|
|
|
scene_render(uloc_projection.into(), &projection); |
|
|
|
|
|
|
|
}); |
|
|
|
unsafe { |
|
|
|
|
|
|
|
citro3d_sys::C3D_FrameEnd(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
scene_exit(vbo_data, program, vshader_dvlb); |
|
|
|
scene_exit(vbo_data, program, vshader_dvlb); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static SHBIN_BYTES: &[u8] = |
|
|
|
|
|
|
|
include_bytes!(concat!(env!("OUT_DIR"), "/examples/assets/vshader.shbin")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn scene_init() -> (shaderProgram_s, i8, C3D_Mtx, *mut libc::c_void, *mut DVLB_s) { |
|
|
|
fn scene_init() -> (shaderProgram_s, i8, C3D_Mtx, *mut libc::c_void, *mut DVLB_s) { |
|
|
|
// Load the vertex shader, create a shader program and bind it
|
|
|
|
// Load the vertex shader, create a shader program and bind it
|
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
let mut shader_bytes = SHBIN_BYTES.to_owned(); |
|
|
|
let mut shader_bytes = SHADER_BYTES.to_owned(); |
|
|
|
|
|
|
|
|
|
|
|
// Assume the data is aligned properly...
|
|
|
|
// Assume the data is aligned properly...
|
|
|
|
let vshader_dvlb = citro3d_sys::DVLB_ParseFile( |
|
|
|
let vshader_dvlb = citro3d_sys::DVLB_ParseFile( |
|
|
|