summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-01-07 15:33:42 +0100
committermetamuffin <metamuffin@disroot.org>2025-01-07 15:33:42 +0100
commit9af9fc6e9981fbb582fad9f69ad6bb0d96856b5e (patch)
tree7321528247a9f56776faff9de4c9c8fd97a1e531
parent4065dbe5b73839d4d3ed45a30bcc466ea414f3b5 (diff)
downloadweareserver-9af9fc6e9981fbb582fad9f69ad6bb0d96856b5e.tar
weareserver-9af9fc6e9981fbb582fad9f69ad6bb0d96856b5e.tar.bz2
weareserver-9af9fc6e9981fbb582fad9f69ad6bb0d96856b5e.tar.zst
remove pbr prefix
-rw-r--r--a.md38
-rw-r--r--client/src/scene_prepare.rs2
-rw-r--r--client/src/window.rs10
-rw-r--r--shared/src/resources.rs52
-rw-r--r--world/src/main.rs6
5 files changed, 58 insertions, 50 deletions
diff --git a/a.md b/a.md
index a2eb035..733d4e7 100644
--- a/a.md
+++ b/a.md
@@ -34,25 +34,25 @@ Attribute = 0x01 constant:f32 / 0x02 buffer:Res / 0x03 texture:Res<Texture>
NewAttribute = flag:u8 constant:f32 buffer:Res texture:Res<Texture>
```
-| Key | Value Type |
-| -------------------- | ------------- |
-| index | Resource |
-| g_metallic | f32 |
-| g_roughness | f32 |
-| g_albedo | Vec3A |
-| g_transmission | f32 |
-| va_position | [Resource; 3] |
-| va_normal | [Resource; 3] |
-| va_texcoord | [Resource; 2] |
-| va_pbr_roughness | Resource |
-| va_pbr_metallic | Resource |
-| va_pbr_albedo | [Resource; 3] |
-| va_pbr_transmission | Resource |
-| tex_normal | Resource |
-| tex_pbr_roughness | Resource |
-| tex_pbr_metallic | Resource |
-| tex_pbr_albedo | Resource |
-| tex_pbr_transmission | Resource |
+| Key | Value Type |
+| ---------------- | ------------- |
+| index | Resource |
+| g_metallic | f32 |
+| g_roughness | f32 |
+| g_albedo | Vec3A |
+| g_transmission | f32 |
+| va_position | [Resource; 3] |
+| va_normal | [Resource; 3] |
+| va_texcoord | [Resource; 2] |
+| va_roughness | Resource |
+| va_metallic | Resource |
+| va_albedo | [Resource; 3] |
+| va_transmission | Resource |
+| tex_normal | Resource |
+| tex_roughness | Resource |
+| tex_metallic | Resource |
+| tex_albedo | Resource |
+| tex_transmission | Resource |
### Texture
diff --git a/client/src/scene_prepare.rs b/client/src/scene_prepare.rs
index fcc7932..6d50035 100644
--- a/client/src/scene_prepare.rs
+++ b/client/src/scene_prepare.rs
@@ -222,7 +222,7 @@ impl ScenePreparer {
}
}
let mut texture = None;
- if let Some(albedores) = part.tex_pbr_albedo {
+ if let Some(albedores) = part.tex_albedo {
if let Some((_tex, bg)) = self.textures.try_get(albedores) {
texture = Some(bg)
}
diff --git a/client/src/window.rs b/client/src/window.rs
index ac90f71..8b3ee9e 100644
--- a/client/src/window.rs
+++ b/client/src/window.rs
@@ -7,7 +7,7 @@ use winit::{
event::{DeviceEvent, ElementState, WindowEvent},
event_loop::ActiveEventLoop,
keyboard::{KeyCode, PhysicalKey},
- window::{Window, WindowAttributes, WindowId},
+ window::{CursorGrabMode, Window, WindowAttributes, WindowId},
};
pub struct WindowState {
@@ -53,6 +53,14 @@ impl ApplicationHandler for WindowState {
if event.repeat {
return;
}
+ if event.state == ElementState::Pressed {
+ match event.physical_key {
+ PhysicalKey::Code(KeyCode::Escape) => {
+ win.set_cursor_grab(CursorGrabMode::Locked).unwrap();
+ }
+ _ => (),
+ }
+ }
sta.delta.move_dir += match event.physical_key {
PhysicalKey::Code(KeyCode::KeyW) => Vec3::X,
PhysicalKey::Code(KeyCode::KeyS) => Vec3::NEG_X,
diff --git a/shared/src/resources.rs b/shared/src/resources.rs
index 4c6321f..512e161 100644
--- a/shared/src/resources.rs
+++ b/shared/src/resources.rs
@@ -19,15 +19,15 @@ pub struct Part {
pub va_position: Option<[Resource; 3]>,
pub va_normal: Option<[Resource; 3]>,
pub va_texcoord: Option<[Resource; 2]>,
- pub va_pbr_roughness: Option<Resource>,
- pub va_pbr_metallic: Option<Resource>,
- pub va_pbr_albedo: Option<[Resource; 3]>,
- pub va_pbr_transmission: Option<Resource>,
+ pub va_roughness: Option<Resource>,
+ pub va_metallic: Option<Resource>,
+ pub va_albedo: Option<[Resource; 3]>,
+ pub va_transmission: Option<Resource>,
pub tex_normal: Option<Resource>,
- pub tex_pbr_roughness: Option<Resource>,
- pub tex_pbr_metallic: Option<Resource>,
- pub tex_pbr_albedo: Option<Resource>,
- pub tex_pbr_transmission: Option<Resource>,
+ pub tex_roughness: Option<Resource>,
+ pub tex_metallic: Option<Resource>,
+ pub tex_albedo: Option<Resource>,
+ pub tex_transmission: Option<Resource>,
}
#[derive(Debug, Default, Clone)]
@@ -98,15 +98,15 @@ impl ReadWrite for Part {
write_kv_opt(w, b"va_position", &self.va_position)?;
write_kv_opt(w, b"va_normal", &self.va_normal)?;
write_kv_opt(w, b"va_texcoord", &self.va_texcoord)?;
- write_kv_opt(w, b"va_pbr_roughness", &self.va_pbr_roughness)?;
- write_kv_opt(w, b"va_pbr_metallic", &self.va_pbr_metallic)?;
- write_kv_opt(w, b"va_pbr_albedo", &self.va_pbr_albedo)?;
- write_kv_opt(w, b"va_pbr_transmission", &self.va_pbr_transmission)?;
+ write_kv_opt(w, b"va_roughness", &self.va_roughness)?;
+ write_kv_opt(w, b"va_metallic", &self.va_metallic)?;
+ write_kv_opt(w, b"va_albedo", &self.va_albedo)?;
+ write_kv_opt(w, b"va_transmission", &self.va_transmission)?;
write_kv_opt(w, b"tex_normal", &self.tex_normal)?;
- write_kv_opt(w, b"tex_pbr_roughness", &self.tex_pbr_roughness)?;
- write_kv_opt(w, b"tex_pbr_metallic", &self.tex_pbr_metallic)?;
- write_kv_opt(w, b"tex_pbr_albedo", &self.tex_pbr_albedo)?;
- write_kv_opt(w, b"tex_pbr_transmission", &self.tex_pbr_transmission)?;
+ write_kv_opt(w, b"tex_roughness", &self.tex_roughness)?;
+ write_kv_opt(w, b"tex_metallic", &self.tex_metallic)?;
+ write_kv_opt(w, b"tex_albedo", &self.tex_albedo)?;
+ write_kv_opt(w, b"tex_transmission", &self.tex_transmission)?;
Ok(())
}
@@ -127,18 +127,18 @@ impl ReadWrite for Part {
b"va_position" => s.va_position = Some(<_ as ReadWrite>::read(&mut v)?),
b"va_normal" => s.va_normal = Some(<_ as ReadWrite>::read(&mut v)?),
b"va_texcoord" => s.va_texcoord = Some(<_ as ReadWrite>::read(&mut v)?),
- b"va_pbr_roughness" => s.va_pbr_roughness = Some(<_ as ReadWrite>::read(&mut v)?),
- b"va_pbr_metallic" => s.va_pbr_metallic = Some(<_ as ReadWrite>::read(&mut v)?),
- b"va_pbr_albedo" => s.va_pbr_albedo = Some(<_ as ReadWrite>::read(&mut v)?),
- b"va_pbr_transmission" => {
- s.va_pbr_transmission = Some(<_ as ReadWrite>::read(&mut v)?)
+ b"va_roughness" => s.va_roughness = Some(<_ as ReadWrite>::read(&mut v)?),
+ b"va_metallic" => s.va_metallic = Some(<_ as ReadWrite>::read(&mut v)?),
+ b"va_albedo" => s.va_albedo = Some(<_ as ReadWrite>::read(&mut v)?),
+ b"va_transmission" => {
+ s.va_transmission = Some(<_ as ReadWrite>::read(&mut v)?)
}
b"tex_normal" => s.tex_normal = Some(<_ as ReadWrite>::read(&mut v)?),
- b"tex_pbr_roughness" => s.tex_pbr_roughness = Some(<_ as ReadWrite>::read(&mut v)?),
- b"tex_pbr_metallic" => s.tex_pbr_metallic = Some(<_ as ReadWrite>::read(&mut v)?),
- b"tex_pbr_albedo" => s.tex_pbr_albedo = Some(<_ as ReadWrite>::read(&mut v)?),
- b"tex_pbr_transmission" => {
- s.tex_pbr_transmission = Some(<_ as ReadWrite>::read(&mut v)?)
+ b"tex_roughness" => s.tex_roughness = Some(<_ as ReadWrite>::read(&mut v)?),
+ b"tex_metallic" => s.tex_metallic = Some(<_ as ReadWrite>::read(&mut v)?),
+ b"tex_albedo" => s.tex_albedo = Some(<_ as ReadWrite>::read(&mut v)?),
+ b"tex_transmission" => {
+ s.tex_transmission = Some(<_ as ReadWrite>::read(&mut v)?)
}
x => warn!("unknown part key: {:?}", String::from_utf8_lossy(x)),
}
diff --git a/world/src/main.rs b/world/src/main.rs
index 7bcd021..b68b287 100644
--- a/world/src/main.rs
+++ b/world/src/main.rs
@@ -74,14 +74,14 @@ fn main() -> Result<()> {
.array_chunks::<3>()
.collect::<Vec<_>>();
- let mut tex_pbr_albedo = None;
+ let mut tex_albedo = None;
if let Some(tex) = p.material().pbr_metallic_roughness().base_color_texture() {
let s = tex.texture().source().source();
if let gltf::image::Source::View { view, mime_type } = s {
info!("albedo texture is of type {mime_type:?}");
let buf = &buffers[view.buffer().index()].0
[view.offset()..view.offset() + view.length()];
- tex_pbr_albedo = Some(store.set(buf)?);
+ tex_albedo = Some(store.set(buf)?);
}
}
@@ -101,7 +101,7 @@ fn main() -> Result<()> {
store.set(&AttributeArray(uv_x).write_alloc())?,
store.set(&AttributeArray(uv_y).write_alloc())?,
]),
- tex_pbr_albedo,
+ tex_albedo,
index: Some(store.set(&IndexArray(index).write_alloc())?),
..Part::default()
}