Skip to content

Commit 908ccc1

Browse files
committed
Change wasm frontend to use [u8; 4] pixel format
* Similar to SDL2 frontend * Removes the unsafe block casting [u32] to [u8] * Fixes component order from BGRA to RGBA, oops.
1 parent 9337dd1 commit 908ccc1

File tree

8 files changed

+16
-431
lines changed

8 files changed

+16
-431
lines changed

demos/wasm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ package = "retrofire-core"
2323
version = "0.4.0"
2424
path = "../../core"
2525
features = ["mm"]
26+
default-features = false
2627

2728
[dependencies.re-front]
2829
package = "retrofire-front"

demos/wasm/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</head>
88
<body>
99
<script type="module">
10-
import init from './pkg/wasm.js';
10+
import init from './pkg/retrofire_wasm_demo.js';
1111
async function run() { await init(); }
1212
run();
1313
</script>

demos/wasm/src/triangle.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use re::prelude::*;
66

77
use re::render::{ModelToView, render, shader::Shader};
88
use re::util::Dims;
9-
109
use re_front::{dims::SVGA_800_600, wasm::Window};
1110

1211
// Entry point from JS
@@ -20,9 +19,9 @@ pub fn start() {
2019
win.ctx.color_clear = Some(rgba(0, 0, 0, 0x80));
2120

2221
let vs = [
23-
vertex(pt3(-2.0, 1.0, 0.0), rgba(1.0, 0.2, 0.1, 0.9)),
24-
vertex(pt3(2.0, 2.0, 0.0), rgba(0.2, 0.9, 0.1, 0.8)),
22+
vertex(pt3(-2.0, 1.0, 0.0), rgba(0.9, 0.2, 0.1, 0.9)),
2523
vertex(pt3(0.0, -2.0, 0.0), rgba(0.3, 0.4, 1.0, 1.0)),
24+
vertex(pt3(2.0, 2.0, 0.0), rgba(0.2, 0.9, 0.1, 0.8)),
2625
];
2726

2827
let proj = perspective(1.0, 4.0 / 3.0, 0.1..1000.0);

docs/wasm/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</head>
88
<body>
99
<script type="module">
10-
import init from './pkg/wasm.js';
10+
import init from './pkg/retrofire_wasm_demo.js';
1111
async function run() { await init(); }
1212
run();
1313
</script>

0 commit comments

Comments
 (0)