Skip to content

Commit

Permalink
wgsl
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Feb 17, 2025
1 parent 687d7fc commit 5970bb1
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions modules/layers/src/scatterplot-layer/scatterplot-layer.wgsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,47 +167,47 @@ fn vertexMain(attributes: Attributes) -> Varyings {
@fragment
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
// var geometry: Geometry;
// geometry.uv = unitPosition;
// let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels;
// let inCircle = select(
// smoothedge(distToCenter, varyings.outerRadiusPixels),
// step(distToCenter, varyings.outerRadiusPixels),
// scatterplot.antialiasing != 0
// );
// if (inCircle == 0.0) {
// discard;
// }
// var fragColor: vec4<f32>;
// if (scatterplot.stroked != 0) {
// let isLine = select(
// smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
// step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
// scatterplot.antialiasing != 0
// );
// if (scatterplot.filled != 0) {
// fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine);
// } else {
// if (isLine == 0.0) {
// discard;
// }
// fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine);
// }
// } else if (scatterplot.filled == 0) {
// discard;
// } else {
// fragColor = varyings.vFillColor;
// }
// fragColor.a *= inCircle;
// // DECKGL_FILTER_COLOR(fragColor, geometry);
// return fragColor;
return vec4<f32>(0, 0, 255, 1);
var geometry: Geometry;
geometry.uv = unitPosition;
let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels;
let inCircle = select(
smoothedge(distToCenter, varyings.outerRadiusPixels),
step(distToCenter, varyings.outerRadiusPixels),
scatterplot.antialiasing != 0
);
if (inCircle == 0.0) {
discard;
}
var fragColor: vec4<f32>;
if (scatterplot.stroked != 0) {
let isLine = select(
smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
scatterplot.antialiasing != 0
);
if (scatterplot.filled != 0) {
fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine);
} else {
if (isLine == 0.0) {
discard;
}
fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine);
}
} else if (scatterplot.filled == 0) {
discard;
} else {
fragColor = varyings.vFillColor;
}
fragColor.a *= inCircle;
// DECKGL_FILTER_COLOR(fragColor, geometry);
return fragColor;
// return vec4<f32>(0, 0, 255, 1);
}
`;

0 comments on commit 5970bb1

Please sign in to comment.