feat: implement SkyTex and SkyLight
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -78,11 +78,11 @@ fn build_line_mesh(
|
||||
let mut peekable = line.points.iter().peekable();
|
||||
while let Some(curr) = peekable.next() {
|
||||
// Skip this point if it has the same position as the previous point
|
||||
if let Some(prev) = last {
|
||||
if Vec3::from(prev.point) == Vec3::from(curr.point) {
|
||||
last = Some(curr);
|
||||
continue;
|
||||
}
|
||||
if let Some(prev) = last
|
||||
&& Vec3::from(prev.point) == Vec3::from(curr.point)
|
||||
{
|
||||
last = Some(curr);
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut end = false;
|
||||
@@ -127,6 +127,9 @@ fn build_line_mesh(
|
||||
(Some(last), None) => last,
|
||||
(Some(last), Some(next)) => last.lerp(next, 0.5),
|
||||
};
|
||||
if !quat.is_finite() {
|
||||
panic!("non finite quat: next: {next:?}, last: {last:?}, curr: {curr:?},");
|
||||
}
|
||||
let normals = [
|
||||
Vec3::X,
|
||||
Vec3::new(1., 0., 1.).normalize(),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod lines;
|
||||
pub mod model;
|
||||
pub mod sky;
|
||||
pub mod text;
|
||||
|
||||
use self::{lines::Lines, model::Model, text::Text};
|
||||
@@ -13,6 +14,7 @@ use color_eyre::eyre::eyre;
|
||||
use model::ModelPart;
|
||||
use parking_lot::Mutex;
|
||||
use stardust_xr::values::ResourceID;
|
||||
use tracing::info;
|
||||
use std::{ffi::OsStr, path::PathBuf, sync::Arc};
|
||||
|
||||
static QUEUED_SKYLIGHT: Mutex<Option<Option<PathBuf>>> = Mutex::new(None);
|
||||
@@ -51,6 +53,7 @@ impl InterfaceAspect for Interface {
|
||||
calling_client: Arc<Client>,
|
||||
tex: Option<ResourceID>,
|
||||
) -> Result<()> {
|
||||
info!("setting sky tex");
|
||||
let resource_path = tex
|
||||
.map(|tex| {
|
||||
get_resource_file(&tex, &calling_client, &[OsStr::new("hdr")])
|
||||
@@ -66,6 +69,7 @@ impl InterfaceAspect for Interface {
|
||||
calling_client: Arc<Client>,
|
||||
light: Option<ResourceID>,
|
||||
) -> Result<()> {
|
||||
info!("setting sky light");
|
||||
let resource_path = light
|
||||
.map(|light| {
|
||||
get_resource_file(&light, &calling_client, &[OsStr::new("hdr")])
|
||||
|
||||
Reference in New Issue
Block a user