/
PointCircle.txt
59 lines (50 loc) · 1.22 KB
/
PointCircle.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<shader>{
"name":"PointCircle",
"ubo":[ "UBOTransform" ],
"options": { "modelMatrix":true },
"uniforms":[
{ "name":"u_color", "type":"vec4" },
{ "name":"u_psize", "type":"float" },
{ "name":"u_rangeA", "type":"float" },
{ "name":"u_rangeB", "type":"float" }
]
}<\shader>
<materials>[
{ "name":"PointCircle",
"options" : { "blend":true, "depthTest":true },
"uniforms":[
{ "name":"u_color", "value": "00ff00ff", "type":"rgba" },
{ "name":"u_psize", "value": 20 },
{ "name":"u_rangeA", "value": 0.0 },
{ "name":"u_rangeB", "value": 0.5 }
]
}
]<\materials>
<vertex>
#version 300 es
layout(location=0) in vec3 a_position;
uniform UBOTransform{
mat4 projViewMatrix;
vec3 cameraPos;
float globalTime;
vec2 screenSize;
};
uniform mat4 u_modelMatrix;
uniform float u_psize;
void main(void){
gl_PointSize = u_psize;
gl_Position = projViewMatrix * u_modelMatrix * vec4(a_position, 1.0);
}
<\vertex>
<fragment>
#version 300 es
precision mediump float;
uniform vec4 u_color;
uniform float u_rangeA;
uniform float u_rangeB;
out vec4 oFragColor;
void main(void){
oFragColor = u_color;
oFragColor.a *= 1.0 - smoothstep(u_rangeA, u_rangeB, length( gl_PointCoord - 0.5 ));
}
<\fragment>