Добавить ресурсы маджонга

This commit is contained in:
2019-09-05 12:02:21 +03:00
parent 42d6571bcd
commit 835cf7a88f
12 changed files with 324 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#ifdef GL_ES
precision highp float;
#endif
varying vec3 position;
varying vec3 normal;
const vec3 lightPosition = vec3(10, 20, 10);
varying vec2 texCoord;
uniform sampler2D image;
float lambertianReflectanceStrength(vec3 position, vec3 lightPosition)
{
vec3 lightDirection = normalize(lightPosition - position);
// Light flux direction.
float strength = dot(normal, lightDirection);
float diffuse = max(strength, 0.2);
return diffuse;
}
void main()
{
vec3 texColor = texture2D(image, texCoord).rgb;
vec3 finalColor = texColor * lambertianReflectanceStrength(position, lightPosition);
gl_FragColor = vec4(finalColor, 1.0);
}

View File

@@ -0,0 +1,16 @@
varying vec3 position;
varying vec3 normal;
varying vec2 texCoord;
void main()
{
// Translate vertex coordinates from model/object space to screen one.
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// Pass vertex coordinates and normal into camera/eye space.
position = vec3(gl_ModelViewMatrix * gl_Vertex);
normal = vec3(gl_ModelViewMatrix * vec4(gl_Normal, 0.0));
// Pass texture coordinate.
texCoord = gl_MultiTexCoord0.xy;
}