diff options
author | HampusM <hampus@hampusmat.com> | 2024-05-07 22:00:43 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-05-07 22:16:02 +0200 |
commit | b0a3506054a1afd7c6c5554d653753fab6411203 (patch) | |
tree | e2883d1354cde4613995c373882bcbf9c07bfe43 /engine | |
parent | 4d9ce83a8823e457f28f7d8d1377eca2db667d4c (diff) |
refactor(engine): remove unused vertex color attribute
Diffstat (limited to 'engine')
-rw-r--r-- | engine/src/file_format/wavefront/obj.rs | 2 | ||||
-rw-r--r-- | engine/src/vertex.rs | 21 | ||||
-rw-r--r-- | engine/vertex.glsl | 7 |
3 files changed, 3 insertions, 27 deletions
diff --git a/engine/src/file_format/wavefront/obj.rs b/engine/src/file_format/wavefront/obj.rs index 7e1629a..29fc985 100644 --- a/engine/src/file_format/wavefront/obj.rs +++ b/engine/src/file_format/wavefront/obj.rs @@ -4,7 +4,6 @@ use std::path::PathBuf; -use crate::color::Color; use crate::file_format::wavefront::common::{ keyword, parse_statement_line, @@ -239,7 +238,6 @@ impl FaceVertex Ok(VertexBuilder::new() .pos(vertex_pos) - .color(Color::WHITE_F32) .texture_coords(texture_pos) .normal(vertex_normal) .build() diff --git a/engine/src/vertex.rs b/engine/src/vertex.rs index 37a6c51..456a2a3 100644 --- a/engine/src/vertex.rs +++ b/engine/src/vertex.rs @@ -1,6 +1,5 @@ use std::mem::size_of; -use crate::color::Color; use crate::vector::{Vec2, Vec3}; #[derive(Debug, Clone, Default)] @@ -8,7 +7,6 @@ use crate::vector::{Vec2, Vec3}; pub struct Vertex { pos: Vec3<f32>, - color: Color<f32>, texture_coords: Vec2<f32>, normal: Vec3<f32>, } @@ -17,7 +15,6 @@ pub struct Vertex pub struct Builder { pos: Option<Vec3<f32>>, - color: Option<Color<f32>>, texture_coords: Vec2<f32>, normal: Option<Vec3<f32>>, } @@ -39,14 +36,6 @@ impl Builder } #[must_use] - pub fn color(mut self, color: Color<f32>) -> Self - { - self.color = Some(color); - - self - } - - #[must_use] pub fn texture_coords(mut self, texture_coords: Vec2<f32>) -> Self { self.texture_coords = texture_coords; @@ -66,12 +55,10 @@ impl Builder pub fn build(self) -> Option<Vertex> { let pos = self.pos?; - let color = self.color.unwrap_or_default(); let normal = self.normal.unwrap_or_default(); Some(Vertex { pos, - color, texture_coords: self.texture_coords, normal, }) @@ -93,17 +80,11 @@ impl Vertex Attribute { index: 1, component_type: AttributeComponentType::Float, - component_cnt: AttributeComponentCnt::Three, - component_size: size_of::<f32>() as u32, - }, - Attribute { - index: 2, - component_type: AttributeComponentType::Float, component_cnt: AttributeComponentCnt::Two, component_size: size_of::<f32>() as u32, }, Attribute { - index: 3, + index: 2, component_type: AttributeComponentType::Float, component_cnt: AttributeComponentCnt::Three, component_size: size_of::<f32>() as u32, diff --git a/engine/vertex.glsl b/engine/vertex.glsl index 3279036..ac24ef2 100644 --- a/engine/vertex.glsl +++ b/engine/vertex.glsl @@ -1,10 +1,8 @@ #version 330 core layout (location = 0) in vec3 pos; -layout (location = 1) in vec3 color; -layout (location = 2) in vec2 texture_coords; -layout (location = 3) in vec3 normal; +layout (location = 1) in vec2 texture_coords; +layout (location = 2) in vec3 normal; -out vec3 in_frag_color; out vec3 in_frag_pos; out vec2 in_texture_coords; out vec3 in_normal; @@ -17,7 +15,6 @@ void main() { gl_Position = projection * view * model * vec4(pos, 1.0); - in_frag_color = color; in_frag_pos = vec3(model * vec4(pos, 1.0)); in_texture_coords = texture_coords; |