Initial commit
This commit is contained in:
10
documents/Tesselation_Tutorial/shader/tess_frag.txt
Normal file
10
documents/Tesselation_Tutorial/shader/tess_frag.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 410 core
|
||||
|
||||
layout(location = 0, index = 0) out vec4 fragColor;
|
||||
|
||||
//in vec4 color_gs;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
fragColor = vec4(1.0,1.0,1.0,1.0);
|
||||
}
|
||||
19
documents/Tesselation_Tutorial/shader/tess_geo.txt
Normal file
19
documents/Tesselation_Tutorial/shader/tess_geo.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
#version 410 core
|
||||
|
||||
layout(triangles, invocations = 1) in;
|
||||
layout(line_strip, max_vertices = 4) out;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[1].gl_Position;
|
||||
EmitVertex();
|
||||
gl_Position = gl_in[2].gl_Position;
|
||||
EmitVertex();
|
||||
//gl_Position = gl_in[3].gl_Position;
|
||||
//EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
16
documents/Tesselation_Tutorial/shader/tess_quad_tcs.txt
Normal file
16
documents/Tesselation_Tutorial/shader/tess_quad_tcs.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
#version 410 core
|
||||
|
||||
layout(vertices = 4) out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TessLevelOuter[0] = 2.0;
|
||||
gl_TessLevelOuter[1] = 4.0;
|
||||
gl_TessLevelOuter[2] = 6.0;
|
||||
gl_TessLevelOuter[3] = 8.0;
|
||||
|
||||
gl_TessLevelInner[0] = 8.0;
|
||||
gl_TessLevelInner[1] = 8.0;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
}
|
||||
20
documents/Tesselation_Tutorial/shader/tess_quad_tes.txt
Normal file
20
documents/Tesselation_Tutorial/shader/tess_quad_tes.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 410 core
|
||||
|
||||
layout(quads, equal_spacing, ccw) in;
|
||||
|
||||
//quad interpol
|
||||
vec4 interpolate(in vec4 v0, in vec4 v1, in vec4 v2, in vec4 v3)
|
||||
{
|
||||
vec4 a = mix(v0, v1, gl_TessCoord.x);
|
||||
vec4 b = mix(v3, v2, gl_TessCoord.x);
|
||||
return mix(a, b, gl_TessCoord.y);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = interpolate(
|
||||
gl_in[0].gl_Position,
|
||||
gl_in[1].gl_Position,
|
||||
gl_in[2].gl_Position,
|
||||
gl_in[3].gl_Position);
|
||||
}
|
||||
14
documents/Tesselation_Tutorial/shader/tess_tri_tcs.txt
Normal file
14
documents/Tesselation_Tutorial/shader/tess_tri_tcs.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 410 core
|
||||
|
||||
layout(vertices = 3) out;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TessLevelOuter[0] = 2.0;
|
||||
gl_TessLevelOuter[1] = 4.0;
|
||||
gl_TessLevelOuter[2] = 6.0;
|
||||
|
||||
gl_TessLevelInner[0] = 8.0;
|
||||
|
||||
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
|
||||
}
|
||||
10
documents/Tesselation_Tutorial/shader/tess_tri_tes.txt
Normal file
10
documents/Tesselation_Tutorial/shader/tess_tri_tes.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 410 core
|
||||
|
||||
layout(triangles, equal_spacing, ccw) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position.xyzw = gl_in[0].gl_Position.xyzw * gl_TessCoord.x +
|
||||
gl_in[1].gl_Position.xyzw * gl_TessCoord.y +
|
||||
gl_in[2].gl_Position.xyzw * gl_TessCoord.z;
|
||||
}
|
||||
15
documents/Tesselation_Tutorial/shader/tess_vs.txt
Normal file
15
documents/Tesselation_Tutorial/shader/tess_vs.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 410 core
|
||||
|
||||
uniform mat4 projectionMatrix;
|
||||
uniform mat4 modelViewMatrix;
|
||||
|
||||
in vec4 gl_Vertex;
|
||||
in vec3 gl_Color;
|
||||
|
||||
out vec4 color_vs;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
color_vs.xyz = gl_Color.xyz;//mix( vec4(1,1,0,0),vec4(0,1,1,0), vertex.w);
|
||||
gl_Position = projectionMatrix*modelViewMatrix*vec4(gl_Vertex.xyz,1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user