/
PostBasic.txt
56 lines (45 loc) · 1.17 KB
/
PostBasic.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
<shader>{
"name" : "PostBasic",
"ubo" : [ "UBOTransform" ],
"options" : { "modelMatrix":false },
"uniforms" : [
{ "name":"u_colorTex", "type":"sampler2D" },
{ "name":"u_depthTex", "type":"sampler2D" }
]
}<\shader>
<materials>[
{ "name":"PostBasic", "options": { "depthTest":false } }
]<\materials>
<vertex>
#version 300 es
layout(location=0) in vec3 a_position;
layout(location=2) in vec2 a_uv;
out highp vec2 v_uv;
uniform UBOTransform{
mat4 projViewMatrix;
vec3 cameraPos;
float globalTime;
vec2 screenSize;
};
void main(void){
v_uv = a_uv;
gl_Position = vec4(a_position.xyz,1.0);
}
<\vertex>
<fragment>
#version 300 es
precision mediump float;
in highp vec2 v_uv;
uniform sampler2D u_colorTex;
uniform sampler2D u_depthTex;
out vec4 oFragColor;
void main(void){
//Full Screen rendering, Can use texelFetch and current X,Y position
//ivec2 fCoord = ivec2(gl_FragCoord.xy); //Get the Int of the current Screen pixel X,Y
//vec4 color = texelFetch(u_colorTex, fCoord , 0);
//How to Render Depth Buffer
//vec4 c = texture(u_colorTex, v_uv);
//oFragColor = vec4(c.r,c.r,c.r,1.0);
oFragColor = texture(u_colorTex, v_uv);
}
<\fragment>