Skip to content

Commit

Permalink
Flip Y dimension in RGB shader
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Feb 16, 2022
1 parent 83bc21d commit 06eab05
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/lib/src/vis/rgb/RgbMesh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ function RgbMesh(props: Props) {
varying vec2 coords;
void main() {
float red = texture(data, vec3(0., coords)).r;
float green = texture(data, vec3(0.5, coords)).r;
float blue = texture(data, vec3(1., coords)).r;
float yFlipped = 1. - coords.y;
float red = texture(data, vec3(0., coords.x, yFlipped)).r;
float green = texture(data, vec3(0.5, coords.x, yFlipped)).r;
float blue = texture(data, vec3(1., coords.x, yFlipped)).r;
if (bgr) {
gl_FragColor = vec4(blue, green, red, 1.);
Expand All @@ -39,7 +41,7 @@ function RgbMesh(props: Props) {
};

return (
<VisMesh scale={[1, -1, 1]}>
<VisMesh>
<shaderMaterial args={[shader]} />
</VisMesh>
);
Expand Down

0 comments on commit 06eab05

Please sign in to comment.