forked from Qfusion/glsl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefaultCelshade.vert.glsl
45 lines (35 loc) · 1.05 KB
/
defaultCelshade.vert.glsl
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
#include "include/common.glsl"
#include "include/uniforms.glsl"
#include "include/attributes.glsl"
#include "include/rgbgen.glsl"
#include_if(APPLY_FOG) "include/fog.glsl"
qf_varying vec2 v_TexCoord;
qf_varying vec3 v_TexCoordCube;
#if defined(APPLY_FOG) && !defined(APPLY_FOG_COLOR)
qf_varying vec2 v_FogCoord;
#endif
uniform mat3 u_ReflectionTexMatrix;
void main(void)
{
vec4 Position = a_Position;
vec3 Normal = a_Normal.xyz;
vec2 TexCoord = a_TexCoord;
myhalf4 inColor = myhalf4(a_Color);
QF_TransformVerts(Position, Normal, TexCoord);
myhalf4 outColor = VertexRGBGen(Position, Normal, inColor);
#ifdef APPLY_FOG
#ifdef APPLY_FOG_COLOR
FogGenColor(Position, outColor, u_BlendMix);
#else
FogGenCoord(Position, v_FogCoord);
#endif
#endif
qf_FrontColor = vec4(outColor);
#if defined(APPLY_TC_MOD)
v_TexCoord = TextureMatrix2x3Mul(u_TextureMatrix, TexCoord);
#else
v_TexCoord = TexCoord;
#endif
v_TexCoordCube = u_ReflectionTexMatrix * reflect(normalize(Position.xyz - u_EntityDist), Normal.xyz);
gl_Position = u_ModelViewProjectionMatrix * Position;
}