-
Notifications
You must be signed in to change notification settings - Fork 0
/
mesh.vert
49 lines (41 loc) · 1.08 KB
/
mesh.vert
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
#version 450 core
layout( location = 0 ) in vec3 vPosition;
layout(location=1) in vec4 aColor;
layout(location=2) in vec2 aTexCoord;
layout(location=3) in vec3 nor;
layout(location=4) in float element_id;
layout(location=5) in float face_index_marked;
out vec4 outColor;
out vec2 texcoord;
out float e_id;
out float f_i_marked1;
out float f_i_marked2;
out vec3 norf;
out vec3 dirf;
uniform mat4 Proj;
//camera_matrix_inverse
uniform mat4 Camera_Matrix;
uniform mat4 Object_Matrix;
//gl_Pointsize
void set_color()
{
//outColor=aColor;
norf=(Camera_Matrix*vec4(normalize(nor),0.0)).xyz;
dirf=normalize(vec3(0,0,1));
float st=step(length(nor),0);
//vec3 temp_nor=normalize(norf);
//temp_nor=(Camera_Matrix*vec4(temp_nor,0.0)).xyz;
//vec3 dir=normalize(vec3(0,0,1));
outColor=st*aColor+(1-st)*max(-dot(norf,dirf),0)*aColor;
}
void main()
{
gl_PointSize=10.0f;
texcoord=aTexCoord;
set_color();
//outColor=aColor;
gl_Position =Proj*Camera_Matrix*Object_Matrix*vec4(vPosition,1);
e_id=element_id;
f_i_marked1=face_index_marked;
f_i_marked2=face_index_marked*face_index_marked;
}