Skip to content

Commit b6d4c56

Browse files
committed
Group color with position because it can change a lot
1 parent 0120c42 commit b6d4c56

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/webgpu/shaders/color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ struct ModelUniforms {
1818
uModelViewMatrix: mat4x4<f32>,
1919
uNormalMatrix: mat3x3<f32>,
2020
// @p5 endif
21+
uMaterialColor: vec4<f32>,
2122
}
2223
2324
// Group 3: Material Properties
2425
struct MaterialUniforms {
25-
uMaterialColor: vec4<f32>,
2626
uUseVertexColor: u32,
2727
}
2828
`;
@@ -64,7 +64,7 @@ fn main(input: VertexInput) -> VertexOutput {
6464
input.aPosition,
6565
input.aNormal,
6666
input.aTexCoord,
67-
select(material.uMaterialColor, input.aVertexColor, useVertexColor)
67+
select(model.uMaterialColor, input.aVertexColor, useVertexColor)
6868
);
6969
7070
// @p5 ifdef Vertex getObjectInputs

src/webgpu/shaders/line.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ struct ModelUniforms {
1515
// @p5 ifndef StrokeVertex getWorldInputs
1616
uModelViewMatrix: mat4x4<f32>,
1717
// @p5 endif
18+
uMaterialColor: vec4<f32>,
1819
}
1920
2021
// Group 3: Stroke Properties
2122
struct StrokeUniforms {
22-
uMaterialColor: vec4<f32>,
2323
uStrokeWeight: f32,
2424
uUseLineColor: f32,
2525
uSimpleLines: f32,
@@ -104,7 +104,7 @@ fn main(input: StrokeVertexInput) -> StrokeVertexOutput {
104104
if (stroke.uUseLineColor != 0.) {
105105
lineColor = input.aVertexColor;
106106
} else {
107-
lineColor = stroke.uMaterialColor;
107+
lineColor = model.uMaterialColor;
108108
}
109109
var inputs = StrokeVertex(
110110
input.aPosition.xyz,

src/webgpu/shaders/material.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ struct ModelUniforms {
1616
uModelViewMatrix: mat4x4<f32>,
1717
uNormalMatrix: mat3x3<f32>,
1818
// @p5 endif
19+
uMaterialColor: vec4<f32>,
1920
}
2021
2122
// Group 3: Material Properties
2223
struct MaterialUniforms {
23-
uMaterialColor: vec4<f32>,
2424
uUseVertexColor: u32,
2525
uHasSetAmbient: u32,
2626
uAmbientColor: vec3<f32>,
@@ -98,7 +98,7 @@ fn main(input: VertexInput) -> VertexOutput {
9898
input.aPosition,
9999
input.aNormal,
100100
input.aTexCoord,
101-
select(material.uMaterialColor, input.aVertexColor, useVertexColor)
101+
select(model.uMaterialColor, input.aVertexColor, useVertexColor)
102102
);
103103
104104
// @p5 ifdef Vertex getObjectInputs

0 commit comments

Comments
 (0)