Skip to content

Commit 5970bb1

Browse files
committed
wgsl
1 parent 687d7fc commit 5970bb1

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

modules/layers/src/scatterplot-layer/scatterplot-layer.wgsl.ts

+42-42
Original file line numberDiff line numberDiff line change
@@ -167,47 +167,47 @@ fn vertexMain(attributes: Attributes) -> Varyings {
167167
168168
@fragment
169169
fn fragmentMain(varyings: Varyings) -> @location(0) vec4<f32> {
170-
// var geometry: Geometry;
171-
// geometry.uv = unitPosition;
172-
173-
// let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels;
174-
// let inCircle = select(
175-
// smoothedge(distToCenter, varyings.outerRadiusPixels),
176-
// step(distToCenter, varyings.outerRadiusPixels),
177-
// scatterplot.antialiasing != 0
178-
// );
179-
180-
// if (inCircle == 0.0) {
181-
// discard;
182-
// }
183-
184-
// var fragColor: vec4<f32>;
185-
186-
// if (scatterplot.stroked != 0) {
187-
// let isLine = select(
188-
// smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
189-
// step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
190-
// scatterplot.antialiasing != 0
191-
// );
192-
193-
// if (scatterplot.filled != 0) {
194-
// fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine);
195-
// } else {
196-
// if (isLine == 0.0) {
197-
// discard;
198-
// }
199-
// fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine);
200-
// }
201-
// } else if (scatterplot.filled == 0) {
202-
// discard;
203-
// } else {
204-
// fragColor = varyings.vFillColor;
205-
// }
206-
207-
// fragColor.a *= inCircle;
208-
// // DECKGL_FILTER_COLOR(fragColor, geometry);
209-
210-
// return fragColor;
211-
return vec4<f32>(0, 0, 255, 1);
170+
var geometry: Geometry;
171+
geometry.uv = unitPosition;
172+
173+
let distToCenter = length(varyings.unitPosition) * varyings.outerRadiusPixels;
174+
let inCircle = select(
175+
smoothedge(distToCenter, varyings.outerRadiusPixels),
176+
step(distToCenter, varyings.outerRadiusPixels),
177+
scatterplot.antialiasing != 0
178+
);
179+
180+
if (inCircle == 0.0) {
181+
discard;
182+
}
183+
184+
var fragColor: vec4<f32>;
185+
186+
if (scatterplot.stroked != 0) {
187+
let isLine = select(
188+
smoothedge(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
189+
step(varyings.innerUnitRadius * varyings.outerRadiusPixels, distToCenter),
190+
scatterplot.antialiasing != 0
191+
);
192+
193+
if (scatterplot.filled != 0) {
194+
fragColor = mix(varyings.vFillColor, varyings.vLineColor, isLine);
195+
} else {
196+
if (isLine == 0.0) {
197+
discard;
198+
}
199+
fragColor = vec4<f32>(varyings.vLineColor.rgb, varyings.vLineColor.a * isLine);
200+
}
201+
} else if (scatterplot.filled == 0) {
202+
discard;
203+
} else {
204+
fragColor = varyings.vFillColor;
205+
}
206+
207+
fragColor.a *= inCircle;
208+
// DECKGL_FILTER_COLOR(fragColor, geometry);
209+
210+
return fragColor;
211+
// return vec4<f32>(0, 0, 255, 1);
212212
}
213213
`;

0 commit comments

Comments
 (0)