Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelselleck committed Oct 29, 2024
1 parent de487d0 commit 6192b7f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
3 changes: 2 additions & 1 deletion pax-chassis-web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ include = ["/src", "/interface/public"]
crate-type = ["cdylib", "rlib"]

[features]
default = ["console_error_panic_hook", "gpu"]
default = ["console_error_panic_hook"]
designtime = ["dep:pax-designtime", "pax-runtime/designtime"]
gpu = []

[dependencies]
piet = "0.7.0"
piet-web = "0.7.0"
pax-pixels = {path = "../pax-pixels", version = "0.38.3"}
pax-runtime = { path = "../pax-runtime", version="0.38.3" }
pax-message = {path = "../pax-message", version="0.38.3"}
pax-runtime-api = { path = "../pax-runtime-api", version="0.38.3" }
Expand Down
2 changes: 1 addition & 1 deletion pax-designer/src/project_mode_toggle/mod.pax
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Group x=50% y=50% width={100% - 20px} height={100% - 20px}>
if self.edit_mode {
<Text text="Play" id=text fill=WHITE />
<Path id=play_symbol class=play_triangle _raycastable=false/>
<Path class=play_triangle _raycastable=false/>
}
if self.running_mode {
<Text text="Stop" id=text fill=WHITE />
Expand Down
4 changes: 2 additions & 2 deletions pax-pixels/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pax-pixels"
version = "0.10.7"
version = "0.38.3"
edition = "2021"
authors = ["Samuel Selleck <sellecksamuel@gmail.com>"]
license = "MIT OR Apache-2.0"
Expand All @@ -12,7 +12,7 @@ description = "WGPU rendering library for the pax framework"
crate-type = ["cdylib", "rlib"]

[dependencies]
pax-runtime-api = {path = "../pax-runtime-api", version="0.38.1"}
pax-runtime-api = {path = "../pax-runtime-api", version="0.38.3"}
log = "0.4.20"
bytemuck = { version = "1.14", features = ["derive"] }
anyhow = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion pax-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pax-designtime = {version="0.38.3", path = "../pax-designtime", optional = true}
pax-runtime-api = {version="0.38.3", path = "../pax-runtime-api"}
piet = "0.7.0"
piet-common = "0.7.0"
pax-pixels = {path = "../pax-pixels"}
pax-pixels = {path = "../pax-pixels", version = "0.38.3"}
serde = {version="1.0.196", features=["derive"]}
wasm-bindgen = {version = "0.2.93", features=["serde-serialize"]}
wasm-bindgen-futures = "0.4.42"
Expand Down
34 changes: 20 additions & 14 deletions pax-runtime/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
};
use_RefCell!();
use std::collections::HashMap;
use std::ops::Range;
use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, Ordering};

Expand Down Expand Up @@ -289,18 +290,7 @@ impl PaxEngine {
}

pub fn render(&mut self, rcs: &mut dyn RenderContext) {
static LAST_LAYER_COUNT: AtomicUsize = AtomicUsize::new(0); // last-patch layer_count
let curr_layer_count = self.runtime_context.layer_count.get();
let old_layer_count = LAST_LAYER_COUNT.load(Ordering::Relaxed);
if old_layer_count != curr_layer_count {
rcs.resize_layers_to(
curr_layer_count,
Rc::clone(&self.runtime_context.dirty_canvases),
);
self.runtime_context
.resize_canvas_layers_to(curr_layer_count);
LAST_LAYER_COUNT.store(curr_layer_count, Ordering::Relaxed)
}
let new_range = self.update_layer_count(rcs);

for i in 0..rcs.layers() {
if self
Expand All @@ -325,8 +315,8 @@ impl PaxEngine {
}
self.runtime_context.clear_all_dirty_canvases();

//dirtify the canvases that where created this frame (why is this needed?)
for i in old_layer_count..curr_layer_count {
//dirtify the canvases that where created this frame
for i in new_range {
self.runtime_context.set_canvas_dirty(i);
}
}
Expand All @@ -345,6 +335,22 @@ impl PaxEngine {
});
}

pub fn update_layer_count(&self, rcs: &mut dyn RenderContext) -> Range<usize> {
static LAST_LAYER_COUNT: AtomicUsize = AtomicUsize::new(0); // last-patch layer_count
let curr_layer_count = self.runtime_context.layer_count.get();
let old_layer_count = LAST_LAYER_COUNT.load(Ordering::Relaxed);
if old_layer_count != curr_layer_count {
rcs.resize_layers_to(
curr_layer_count,
Rc::clone(&self.runtime_context.dirty_canvases),
);
self.runtime_context
.resize_canvas_layers_to(curr_layer_count);
LAST_LAYER_COUNT.store(curr_layer_count, Ordering::Relaxed)
}
old_layer_count..curr_layer_count
}

pub fn global_dispatch_focus(&self, args: Focus) -> bool {
let mut prevent_default = false;
self.root_expanded_node
Expand Down
9 changes: 0 additions & 9 deletions pax-runtime/src/engine/occlusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ fn update_node_occlusion_recursive(
.map(|v| v.to_u32()),
};

let cp = borrow!(node.common_properties);
let cp = borrow!(cp);
if cp
.id
.read(|i| i.as_ref().is_some_and(|i| i == "play_symbol"))
{
log::debug!("new occl: {:#?}", new_occlusion);
}

if (layer == Layer::Native || borrow!(node.instance_node).clips_content(&node))
&& node.occlusion.get() != new_occlusion
{
Expand Down

0 comments on commit 6192b7f

Please sign in to comment.