shader refactoring and float pos for lights

This commit is contained in:
zomseffen 2025-01-20 10:18:28 +01:00
parent 86135cb2ce
commit 9b618b0e3f
3 changed files with 92 additions and 70 deletions
src/scene

View file

@ -15,9 +15,9 @@ impl PointLight {
}
pub fn insert_into_memory(&self, mut v: Vec<u32>) -> Vec<u32> {
v[self.memory_start] = self.pos.x as u32;
v[self.memory_start + 1] = self.pos.y as u32;
v[self.memory_start + 2] = self.pos.z as u32;
v[self.memory_start] = u32::from_ne_bytes(self.pos.x.to_ne_bytes());
v[self.memory_start + 1] = u32::from_ne_bytes(self.pos.y.to_ne_bytes());
v[self.memory_start + 2] = u32::from_ne_bytes(self.pos.z.to_ne_bytes());
v[self.memory_start + 3] = (self.color.x * 255.0) as u32;
v[self.memory_start + 4] = (self.color.y * 255.0) as u32;