Skip to content

Commit 828537e

Browse files
committed
discard Poi transparent fragment,#12
1 parent c56076d commit 828537e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/world/graphics/Poi.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,29 @@ void main(void) {
2222

2323
//http://stackoverflow.com/questions/3497068/textured-points-in-opengl-es-2-0
2424
//gl_FragColor = texture2D(uSampler, vec2(gl_PointCoord.x, 1.0 - gl_PointCoord.y));
25+
26+
//https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/discard.php
2527
const fs =
2628
`
2729
precision mediump float;
2830
uniform sampler2D uSampler;
2931
3032
void main()
3133
{
32-
gl_FragColor = texture2D(uSampler, vec2(gl_PointCoord.x, gl_PointCoord.y));
34+
vec4 color = texture2D(uSampler, vec2(gl_PointCoord.x, gl_PointCoord.y));
35+
if(color.a == 0.0){
36+
discard;
37+
}
38+
gl_FragColor = color;
3339
}
3440
`;
3541

3642
class Poi extends Graphic {
3743
private constructor(
38-
public geometry: Marker,
39-
public material: PoiMaterial,
40-
public uuid: string,
41-
public name: string,
44+
public geometry: Marker,
45+
public material: PoiMaterial,
46+
public uuid: string,
47+
public name: string,
4248
public address: string,
4349
public phone: string) {
4450
super(geometry, material);

0 commit comments

Comments
 (0)