tessellationgit status
This commit is contained in:
@ -1,12 +1,23 @@
|
||||
#version 330
|
||||
#version 400
|
||||
|
||||
//color from earlier stages
|
||||
smooth in vec4 fg_SmoothColor;
|
||||
smooth in vec3 teNormal;
|
||||
in vec4 teColor;
|
||||
|
||||
out vec4 fg_FragColor;
|
||||
out vec4 fgColor;
|
||||
|
||||
uniform mat4 ViewMatrix;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//copy-shader
|
||||
fg_FragColor = fg_SmoothColor;
|
||||
//heliospheric lighting
|
||||
vec4 light = vec4(1.0,1.0,1.0,1.0);
|
||||
vec4 dark = vec4(0.0,0.0,0.0,1.0);
|
||||
//direction to sun from origin
|
||||
vec3 lightDir = normalize(ViewMatrix * vec4(5.0,5.0,1.0,0.0)).xyz;
|
||||
|
||||
float costheta = dot(teNormal, lightDir);
|
||||
float a = costheta * 0.5 + 0.5;
|
||||
|
||||
|
||||
fgColor = teColor * mix(dark, light, a);
|
||||
}
|
@ -1,32 +1,18 @@
|
||||
#version 330
|
||||
|
||||
//constant projection matrix
|
||||
uniform mat4 fg_ProjectionMatrix;
|
||||
uniform mat4 fg_ViewMatrix;
|
||||
uniform mat3 fg_NormalMatrix;
|
||||
#version 400
|
||||
|
||||
//vertex-data
|
||||
in vec4 fg_Color;
|
||||
in vec3 fg_VertexIn;
|
||||
in vec3 fg_NormalIn;
|
||||
in vec4 Color;
|
||||
in vec3 Position;
|
||||
in vec3 Normal;
|
||||
|
||||
//output-data for later stages
|
||||
smooth out vec4 fg_SmoothColor;
|
||||
out vec4 vColor;
|
||||
out vec3 vPosition;
|
||||
out vec3 vNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 fg_Normal = fg_NormalMatrix * fg_NormalIn; //vec3(0,1,0);
|
||||
//transform vec3 into vec4, setting w to 1
|
||||
vec4 fg_Vertex = vec4(fg_VertexIn, 1.0);
|
||||
vec4 light = vec4(1.0,1.0,1.0,1.0);
|
||||
vec4 dark = vec4(0.0,0.0,0.0,1.0);
|
||||
//direction to sun from origin
|
||||
vec3 lightDir = normalize(fg_ViewMatrix * vec4(5.0,5.0,1.0,0.0)).xyz;
|
||||
|
||||
|
||||
float costheta = dot(normalize(fg_Normal), lightDir);
|
||||
float a = costheta * 0.5 + 0.5;
|
||||
|
||||
fg_SmoothColor = fg_Color * mix(dark, light, a);// + 0.001* fg_Normal.xyzx;
|
||||
gl_Position = fg_ProjectionMatrix * fg_ViewMatrix * fg_Vertex;
|
||||
vPosition = Position;
|
||||
vNormal = Normal;
|
||||
vColor = Color;
|
||||
}
|
Reference in New Issue
Block a user