Browse Source

Merge branch 'main' into fix/gfx-updates-3d-example

pull/19/head
Ian Chamberlain 1 year ago
parent
commit
f69f9e4e95
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 23
      citro3d/examples/triangle.rs

23
citro3d/examples/triangle.rs

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

Loading…
Cancel
Save