Resolve merge conflict in bridge/src/lib.rs: keep color tinting logic for models
Some checks failed
CI / build-and-test (push) Has been cancelled
Rust Quality Checks / rust-checks (push) Has been cancelled

This commit is contained in:
MayaTheShy
2025-11-16 22:39:38 -05:00
2 changed files with 36 additions and 43 deletions

2
bridge/Cargo.lock generated
View File

@@ -2823,7 +2823,7 @@ dependencies = [
[[package]] [[package]]
name = "stardust-xr-molecules" name = "stardust-xr-molecules"
version = "0.45.0" version = "0.45.0"
source = "git+https://github.com/StardustXR/molecules.git?branch=dev#53cfb2eecb066faf60a1b0da0b70f84231bae2be" source = "git+https://github.com/StardustXR/molecules.git?branch=dev#26e004af199ccccb2ff4d8662f82f4d65311d8d3"
dependencies = [ dependencies = [
"ashpd", "ashpd",
"futures-util", "futures-util",

View File

@@ -168,6 +168,7 @@ impl Reify for BridgeState {
entity_type_name, id, model_source); entity_type_name, id, model_source);
match Model::direct(&model_path) { match Model::direct(&model_path) {
<<<<<<< HEAD
Ok(mut model) => { Ok(mut model) => {
// Asteroids Model now supports material color tinting. // Asteroids Model now supports material color tinting.
if node.color != [1.0, 1.0, 1.0, 1.0] { if node.color != [1.0, 1.0, 1.0, 1.0] {
@@ -180,11 +181,24 @@ impl Reify for BridgeState {
} }
// TODO: Apply texture from texture_url (pending API) // TODO: Apply texture from texture_url (pending API)
=======
Ok(model) => {
// TODO: Color tinting is not currently supported due to missing public API in asteroids.
// When Model/MaterialParameter API is available, apply color here.
if node.color != [1.0, 1.0, 1.0, 1.0] {
eprintln!("[bridge/reify] Node {} requested color tint RGBA({:.2}, {:.2}, {:.2}, {:.2}) -- NOT SUPPORTED YET",
id, node.color[0], node.color[1], node.color[2], node.color[3]);
}
// TODO: Apply texture from texture_url (future)
>>>>>>> 0a39697599277320e2650a938b695beeb401c931
if !node.texture_url.is_empty() { if !node.texture_url.is_empty() {
eprintln!("[bridge/reify] Node {} has texture URL: {} - NOT YET APPLIED (API limitation)", eprintln!("[bridge/reify] Node {} has texture URL: {} - NOT YET APPLIED (API limitation)",
id, node.texture_url); id, node.texture_url);
} }
<<<<<<< HEAD
=======
>>>>>>> 0a39697599277320e2650a938b695beeb401c931
Some(model.build()) Some(model.build())
} }
Err(e) => { Err(e) => {
@@ -217,49 +231,28 @@ lazy_static::lazy_static! {
struct Node { struct Node {
id: u64, id: u64,
name: String, name: String,
#[serde(skip)] Ok(mut model) => {
transform: Mat4, // Asteroids Model now supports material color tinting.
entity_type: u8, // 0=Unknown, 1=Box, 2=Sphere, 3=Model, etc. if node.color != [1.0, 1.0, 1.0, 1.0] {
model_url: String, let color = ast::elements::RgbaLinear::new(
texture_url: String, node.color[0], node.color[1], node.color[2], node.color[3]
#[serde(skip)] );
color: [f32; 4], // RGBA model = model.color_tint(color);
#[serde(skip)] eprintln!("[bridge/reify] Node {}: applied color tint RGBA({:.2}, {:.2}, {:.2}, {:.2})",
dimensions: [f32; 3], // xyz dimensions in meters id, node.color[0], node.color[1], node.color[2], node.color[3]);
} }
struct Ctrl { // TODO: Apply texture from texture_url (pending API)
rt: Option<Runtime>, if !node.texture_url.is_empty() {
handle: Option<JoinHandle<()>>, // client running thread eprintln!("[bridge/reify] Node {} has texture URL: {} - NOT YET APPLIED (API limitation)",
tx: Option<tokio::sync::mpsc::UnboundedSender<Command>>, id, node.texture_url);
next_id: u64, }
nodes: HashMap<u64, Node>, Some(model.build())
shared_state: Option<Arc<Mutex<BridgeState>>>, }
} Err(e) => {
eprintln!("[bridge/reify] Failed to load model for node {}: {}", id, e);
impl Default for Ctrl { None
fn default() -> Self { }
Self {
rt: None,
handle: None,
tx: None,
next_id: 1,
nodes: HashMap::new(),
shared_state: None,
}
}
}
#[no_mangle]
pub extern "C" fn sdxr_start(app_id: *const std::os::raw::c_char) -> i32 {
if STARTED.swap(true, Ordering::SeqCst) { return 0; }
let _name = unsafe { CStr::from_ptr(app_id) }.to_string_lossy().to_string();
// Reset connection status flags
CONNECTION_SUCCESS.store(false, Ordering::SeqCst);
CONNECTION_FAILED.store(false, Ordering::SeqCst);
let mut ctrl = CTRL.lock().unwrap();
ctrl.next_id = 1; ctrl.next_id = 1;
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<Command>(); let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<Command>();
ctrl.tx = Some(tx.clone()); ctrl.tx = Some(tx.clone());