Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues #570, #575 #576

Merged
merged 7 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Set up Rust toolchain
id: setup-rust
run: |
rustup toolchain install 1.72 -c clippy -t ${{ matrix.target }}
rustup toolchain install 1.76 -c clippy -t ${{ matrix.target }}

- name: Install cargo-nextest and cargo-llvm-cov
uses: taiki-e/install-action@v2
Expand All @@ -56,21 +56,21 @@ jobs:

- name: build
run: |
cargo +1.72 build --target ${{ matrix.target }} --profile ci
cargo +1.76 build --target ${{ matrix.target }} --profile ci
if: matrix.target != 'wasm32-unknown-unknown'

- name: clippy (rend3-gltf featureless)
run: |
cargo +1.72 clippy --target ${{ matrix.target }} --profile ci -p rend3-gltf --no-default-features
cargo +1.76 clippy --target ${{ matrix.target }} --profile ci -p rend3-gltf --no-default-features

- name: clippy
run: |
cargo +1.72 clippy --target ${{ matrix.target }} --profile ci
cargo +1.76 clippy --target ${{ matrix.target }} --profile ci
if: matrix.target != 'wasm32-unknown-unknown'

- name: doc
run: |
cargo +1.72 doc --target ${{ matrix.target }} --profile ci --no-deps
cargo +1.76 doc --target ${{ matrix.target }} --profile ci --no-deps
if: matrix.target != 'wasm32-unknown-unknown'

- name: download test resources
Expand All @@ -80,7 +80,7 @@ jobs:

- name: test
run: |
cargo +1.72 nextest run --target ${{ matrix.target }} --cargo-profile ci --no-fail-fast
cargo +1.76 nextest run --target ${{ matrix.target }} --cargo-profile ci --no-fail-fast
if: matrix.target != 'wasm32-unknown-unknown'

- uses: actions/upload-artifact@v4
Expand All @@ -101,11 +101,11 @@ jobs:
- name: Set up Rust toolchain
id: setup-rust
run: |
rustup toolchain install 1.72 -c rustfmt
rustup toolchain install 1.76 -c rustfmt

- name: format
run: |
cargo +1.72 fmt --check
cargo +1.76 fmt --check

cargo-deny:
runs-on: ubuntu-latest
Expand Down
1 change: 0 additions & 1 deletion rend3-framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pollster = "0.3"
console_error_panic_hook = "0.1"
console_log = "1"
js-sys = "0.3"
reqwest = "0.11"
once_cell = "1.8"
wasm-bindgen = "0.2.87"
wasm-bindgen-futures = "0.4"
Expand Down
13 changes: 0 additions & 13 deletions rend3-framework/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ pub enum AssetError {
#[source]
error: std::io::Error,
},
#[error("Could not read {path} from the network")]
#[cfg(target_arch = "wasm32")]
NetworkError {
path: SsoString,
#[source]
error: reqwest::Error,
},
#[error("Reading {path} from the network returned non-success status code {status}")]
#[cfg(target_arch = "wasm32")]
NetworkStatusError {
path: SsoString,
status: reqwest::StatusCode,
},
}

pub enum AssetPath<'a> {
Expand Down
22 changes: 19 additions & 3 deletions rend3-framework/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ pub trait App<T: 'static = ()> {
console_log::init().unwrap();

#[cfg(all(not(target_arch = "wasm32"), not(target_os = "android")))]
env_logger::builder()
if let Err(e) = env_logger::builder()
.filter_module("rend3", log::LevelFilter::Info)
.parse_default_env()
.init();
.try_init()
{
eprintln!("Error registering logger from Rend3 framework: {:?}", e);
// probably ran two runs in sequence and initialized twice
};
}

fn register_panic_hook(&mut self) {
Expand Down Expand Up @@ -134,15 +138,27 @@ pub trait App<T: 'static = ()> {
1.0
}

/// Set up the rendering environment. Called once at startup.
fn setup(&mut self, context: SetupContext<'_, T>) {
let _ = context;
}

/// Handle a non-redraw event.
fn handle_event(&mut self, context: EventContext<'_, T>, event: Event<T>) {
let _ = (context, event);
}

/// Handle a redraw event.
fn handle_redraw(&mut self, context: RedrawContext<'_, T>);

/// Called after each redraw for post-processing, if needed.
/// By default, this queues another redraw.
/// That behavior is not appropriate on some platforms.
/// Ref: Issue 570.
/// This gives the application the option of overriding that behavior.
fn handle_redraw_done(&mut self, window: &Window) {
window.request_redraw(); // just queue a redraw.
}
}

pub fn lock<T>(lock: &parking_lot::Mutex<T>) -> parking_lot::MutexGuard<'_, T> {
Expand Down Expand Up @@ -369,7 +385,7 @@ pub async fn async_start<A: App<T> + 'static, T: 'static>(mut app: A, window_bui

surface_texture.present();

window.request_redraw();
app.handle_redraw_done(&window); // standard action is to redraw, but that can be overridden.
} else {
app.handle_event(
EventContext {
Expand Down
Loading