|
|
@ -3,9 +3,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
#![feature(allocator_api)] |
|
|
|
#![feature(allocator_api)] |
|
|
|
|
|
|
|
|
|
|
|
use citro3d::attrib::{self}; |
|
|
|
use citro3d::attrib; |
|
|
|
use citro3d::buffer::{self}; |
|
|
|
use citro3d::buffer; |
|
|
|
use citro3d::render::{ClearFlags, Target}; |
|
|
|
use citro3d::render::{self, ClearFlags}; |
|
|
|
use citro3d::{include_aligned_bytes, shader}; |
|
|
|
use citro3d::{include_aligned_bytes, shader}; |
|
|
|
use citro3d_sys::C3D_Mtx; |
|
|
|
use citro3d_sys::C3D_Mtx; |
|
|
|
use ctru::prelude::*; |
|
|
|
use ctru::prelude::*; |
|
|
@ -70,17 +70,17 @@ fn main() { |
|
|
|
let (mut top_left, mut top_right) = top_screen.split_mut(); |
|
|
|
let (mut top_left, mut top_right) = top_screen.split_mut(); |
|
|
|
|
|
|
|
|
|
|
|
let RawFrameBuffer { width, height, .. } = top_left.raw_framebuffer(); |
|
|
|
let RawFrameBuffer { width, height, .. } = top_left.raw_framebuffer(); |
|
|
|
let mut top_left_target = citro3d::render::Target::new(width, height, top_left, None) |
|
|
|
let mut top_left_target = |
|
|
|
.expect("failed to create render target"); |
|
|
|
render::Target::new(width, height, top_left, None).expect("failed to create render target"); |
|
|
|
|
|
|
|
|
|
|
|
let RawFrameBuffer { width, height, .. } = top_right.raw_framebuffer(); |
|
|
|
let RawFrameBuffer { width, height, .. } = top_right.raw_framebuffer(); |
|
|
|
let mut top_right_target = citro3d::render::Target::new(width, height, top_right, None) |
|
|
|
let mut top_right_target = render::Target::new(width, height, top_right, None) |
|
|
|
.expect("failed to create render target"); |
|
|
|
.expect("failed to create render target"); |
|
|
|
|
|
|
|
|
|
|
|
let mut bottom_screen = gfx.bottom_screen.borrow_mut(); |
|
|
|
let mut bottom_screen = gfx.bottom_screen.borrow_mut(); |
|
|
|
let RawFrameBuffer { width, height, .. } = bottom_screen.raw_framebuffer(); |
|
|
|
let RawFrameBuffer { width, height, .. } = bottom_screen.raw_framebuffer(); |
|
|
|
|
|
|
|
|
|
|
|
let mut bottom_target = citro3d::render::Target::new(width, height, bottom_screen, None) |
|
|
|
let mut bottom_target = render::Target::new(width, height, bottom_screen, None) |
|
|
|
.expect("failed to create bottom screen render target"); |
|
|
|
.expect("failed to create bottom screen render target"); |
|
|
|
|
|
|
|
|
|
|
|
let shader = shader::Library::from_bytes(SHADER_BYTES).unwrap(); |
|
|
|
let shader = shader::Library::from_bytes(SHADER_BYTES).unwrap(); |
|
|
@ -103,7 +103,7 @@ fn main() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
instance.render_frame_with(|instance| { |
|
|
|
instance.render_frame_with(|instance| { |
|
|
|
let mut render_to = |target: &mut Target, projection| { |
|
|
|
let mut render_to = |target: &mut render::Target, projection| { |
|
|
|
instance |
|
|
|
instance |
|
|
|
.select_render_target(target) |
|
|
|
.select_render_target(target) |
|
|
|
.expect("failed to set render target"); |
|
|
|
.expect("failed to set render target"); |
|
|
@ -247,11 +247,10 @@ fn scene_init(program: &mut shader::Program) -> i8 { |
|
|
|
|
|
|
|
|
|
|
|
// Get the location of the uniforms
|
|
|
|
// Get the location of the uniforms
|
|
|
|
let projection_name = CStr::from_bytes_with_nul(b"projection\0").unwrap(); |
|
|
|
let projection_name = CStr::from_bytes_with_nul(b"projection\0").unwrap(); |
|
|
|
let projection_uniform_idx = ctru_sys::shaderInstanceGetUniformLocation( |
|
|
|
|
|
|
|
|
|
|
|
ctru_sys::shaderInstanceGetUniformLocation( |
|
|
|
(*program.as_raw()).vertexShader, |
|
|
|
(*program.as_raw()).vertexShader, |
|
|
|
projection_name.as_ptr(), |
|
|
|
projection_name.as_ptr(), |
|
|
|
); |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
projection_uniform_idx |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|