Rework website with bulma instead of bootstrap #6
|
@ -1,11 +1,11 @@
|
||||||
#version 300 es
|
#version 300 es
|
||||||
//VERTEX SHADER
|
// VERTEX SHADER
|
||||||
//
|
//
|
||||||
// Takes vertices of a unit cube, scales them up along Y according to
|
// Takes vertices of a unit cube, scales them up along Y according to
|
||||||
// aHeight, and colors them with basic diffuse shading.
|
// aHeight, and colors them with basic diffuse shading.
|
||||||
|
|
||||||
#define CLEAR_COLOR vec4(0.0, 0.0, 0.0, 1.0)
|
#define CLEAR_COLOR vec4(0.0, 0.0, 0.0, 1.0)
|
||||||
#define BASE_COLOR vec4(1.0, 1.0, 1.0, 1.0)
|
#define BASE_COLOR vec3(0.6, 0.819607843137, 0.807843137255)
|
||||||
#define AMBIENT_LIGHT vec3(0.3, 0.3, 0.3)
|
#define AMBIENT_LIGHT vec3(0.3, 0.3, 0.3)
|
||||||
#define LIGHT_DIRECTION normalize(vec3(0.85, 0.8, 0.75))
|
#define LIGHT_DIRECTION normalize(vec3(0.85, 0.8, 0.75))
|
||||||
#define LIGHT_COLOR vec3(1.0, 1.0, 1.0)
|
#define LIGHT_COLOR vec3(1.0, 1.0, 1.0)
|
||||||
|
@ -44,6 +44,9 @@ void main() {
|
||||||
vec4 transformedNormal = uNormalMatrix * vec4(aVertexNormal, 1.0);
|
vec4 transformedNormal = uNormalMatrix * vec4(aVertexNormal, 1.0);
|
||||||
float directionalLight =
|
float directionalLight =
|
||||||
max(dot(transformedNormal.xyz, LIGHT_DIRECTION), 0.0);
|
max(dot(transformedNormal.xyz, LIGHT_DIRECTION), 0.0);
|
||||||
vColor = vec4(directionalLight * LIGHT_COLOR + AMBIENT_LIGHT, 1.0);
|
vec3 appliedColor =
|
||||||
|
BASE_COLOR * (directionalLight * LIGHT_COLOR + AMBIENT_LIGHT);
|
||||||
|
|
||||||
|
vColor = vec4(appliedColor.rgb, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue