Skip to content

Commit

Permalink
working version
Browse files Browse the repository at this point in the history
  • Loading branch information
sajattack committed Sep 9, 2020
1 parent 67c641f commit 7323be8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/lit-crab/src/crab.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use psp::Align16;

#[repr(C, align(4))]
struct NPVertex {
pub struct NPVertex {
nx: f32,
ny: f32,
nz: f32,
Expand Down
7 changes: 4 additions & 3 deletions examples/lit-crab/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ use crab::CRAB_VERTICES;

psp::module!("lights", 1, 1);

static mut LIST: Align16<[u32; 0x40000]> = Align16([0; 0x40000]);
const LIGHT_DISTANCE: f32 = 5.0;

static mut LIST: Align16<[u32; 0x40000]> = Align16([0; 0x40000]);

static COLORS: [u32; 4] = [0xffff0000, 0xff00ff00, 0xff0000ff, 0xffff00ff];

Expand Down Expand Up @@ -87,7 +88,7 @@ fn psp_main() {
let pos = ScePspFVector3 {
x: cosf32(i as f32 * (PI / 2.0) + val as f32 * (PI / 180.0)) * LIGHT_DISTANCE,
y: 0.0,
z: sinf32(i as f32 * (PI / 2.0) + val as f32 * (PI / 180.0)) * LIGHT_DISTANCE,
z: (sinf32(i as f32 * (PI / 2.0) + val as f32 * (PI / 180.0)) * LIGHT_DISTANCE) - 8.0,
};
sys::sceGuLight(
i,
Expand All @@ -111,7 +112,7 @@ fn psp_main() {
let pos = ScePspFVector3 {
x: 0.0,
y: 0.0,
z: -3.5,
z: -9.0,
};
sys::sceGumLoadIdentity();
sys::sceGumTranslate(&pos);
Expand Down

0 comments on commit 7323be8

Please sign in to comment.