diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:21 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:21 +0100 |
commit | 26c325640df7ab8b9ea4a6c3fd5166f7df7f80ff (patch) | |
tree | de100d1c3a1db6a00f9ba70a182cc1507162a696 /stockton-render/src/draw/context.rs | |
parent | 58ae76634da13423894a958e3a71cf8f001054e4 (diff) |
fix(draw): re-order vertex attributes to align properly
Diffstat (limited to 'stockton-render/src/draw/context.rs')
-rw-r--r-- | stockton-render/src/draw/context.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/stockton-render/src/draw/context.rs b/stockton-render/src/draw/context.rs index 789b4ce..db543a4 100644 --- a/stockton-render/src/draw/context.rs +++ b/stockton-render/src/draw/context.rs @@ -73,7 +73,7 @@ const FRAGMENT_SOURCE: &str = include_str!("./data/stockton.frag"); /// Represents a point of a triangle, including UV and texture information. #[derive(Debug, Clone, Copy)] -pub struct UVPoint (pub Vector3, pub Vector2, pub i32); +pub struct UVPoint (pub Vector3, pub i32, pub Vector2); /// Contains all the hal related stuff. /// In the end, this takes some 3D points and puts it on the screen. @@ -540,8 +540,8 @@ impl<'a> RenderingContext<'a> { let attributes: Vec<AttributeDesc> = pipeline_vb_attributes!(0, size_of::<f32>() * 3; Rgb32Sfloat, - size_of::<f32>() * 2; Rg32Sfloat, - size_of::<u32>(); R32Sint + size_of::<u32>(); R32Sint, + size_of::<f32>() * 2; Rg32Sfloat ); // Rasterizer @@ -788,7 +788,7 @@ impl<'a> RenderingContext<'a> { let vert = &file.resolve_meshvert(idx2 as u32, base); let uv = Vector2::new(vert.tex.u[0], vert.tex.v[0]); - let uvp = UVPoint (vert.position, uv, 0); + let uvp = UVPoint (vert.position, face.texture_idx.try_into().unwrap(), uv); self.vert_buffer[curr_vert_idx] = uvp; curr_vert_idx += 1; |