1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

fix uv scaling

This commit is contained in:
Robin Appelman 2023-12-12 21:39:55 +01:00
commit 6b4f553221

View file

@ -131,14 +131,18 @@ impl<'a> Handle<'a, TextureInfo> {
(self.texture_scale[0] * pos.x (self.texture_scale[0] * pos.x
+ self.texture_scale[1] * pos.y + self.texture_scale[1] * pos.y
+ self.texture_scale[2] * pos.z) + self.texture_scale[2] * pos.z)
/ self.texture_data().height as f32 / self.texture_data().width as f32
} }
pub fn v(&self, pos: Vector) -> f32 { pub fn v(&self, pos: Vector) -> f32 {
(self.texture_transform[0] * pos.x (self.texture_transform[0] * pos.x
+ self.texture_transform[1] * pos.y + self.texture_transform[1] * pos.y
+ self.texture_transform[2] * pos.z) + self.texture_transform[2] * pos.z)
/ self.texture_data().width as f32 / self.texture_data().height as f32
}
pub fn uv(&self, pos: Vector) -> [f32; 2] {
[self.u(pos), self.v(pos)]
} }
} }