From 18a47eebb5cd9a0a4847f48255a982b3c422e573 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 8 Jan 2025 02:12:15 +0100 Subject: add skybox option --- world/src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'world/src/main.rs') diff --git a/world/src/main.rs b/world/src/main.rs index c10f0b0..c8ef8c6 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -36,7 +36,7 @@ use weareshared::{ Vec3A, helper::ReadWrite, packets::{Data, Object, Packet, Resource}, - resources::{Image, LightPart, Prefab}, + resources::{EnvironmentPart, Image, LightPart, Prefab}, store::ResourceStore, vec3a, }; @@ -64,6 +64,9 @@ struct Args { /// Register to the prefab index #[arg(short, long)] name: Option, + /// Add skybox + #[arg(short, long)] + skybox: Option, } fn main() -> Result<()> { @@ -111,6 +114,14 @@ fn main() -> Result<()> { radius: Some(0.2), })?, )); + if let Some(skybox) = args.skybox { + let mut buf = Vec::new(); + File::open(skybox)?.read_to_end(&mut buf)?; + prefab.environment = Some(store.set(&EnvironmentPart { + skybox: Some(store.set(&Image(buf))?), + ..Default::default() + })?); + } let pres = store.set(&prefab)?; -- cgit v1.2.3-70-g09d2