aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:21 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:21 +0100
commit26c325640df7ab8b9ea4a6c3fd5166f7df7f80ff (patch)
treede100d1c3a1db6a00f9ba70a182cc1507162a696
parent58ae76634da13423894a958e3a71cf8f001054e4 (diff)
fix(draw): re-order vertex attributes to align properly
-rw-r--r--stockton-render/src/draw/context.rs8
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;