Skip to content

Commit ef49777

Browse files
author
lasalvavida
committed
Update sample models to 2.0
1 parent 62e302c commit ef49777

File tree

381 files changed

+460906
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

381 files changed

+460906
-0
lines changed
Binary file not shown.

2.0/2CylinderEngine/glTF-Embedded/2CylinderEngine.gltf

+4,593
Large diffs are not rendered by default.

2.0/2CylinderEngine/glTF-MaterialsCommon/2CylinderEngine.gltf

+4,485
Large diffs are not rendered by default.
Binary file not shown.

2.0/2CylinderEngine/glTF-pbrSpecularGlossiness/2CylinderEngine.gltf

+4,599
Large diffs are not rendered by default.
Binary file not shown.

2.0/2CylinderEngine/glTF-techniqueWebGL/2CylinderEngine.gltf

+5,437
Large diffs are not rendered by default.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
precision highp float;
2+
uniform mat4 u_modelViewMatrix;
3+
uniform mat4 u_projectionMatrix;
4+
uniform mat3 u_normalMatrix;
5+
uniform mat4 u_light1Transform;
6+
uniform mat4 u_light2Transform;
7+
attribute vec3 a_position;
8+
varying vec3 v_position;
9+
attribute vec3 a_normal;
10+
varying vec3 v_normal;
11+
varying vec3 v_light1Direction;
12+
varying vec3 v_light2Direction;
13+
void main(void) {
14+
vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
15+
v_position = pos.xyz;
16+
gl_Position = u_projectionMatrix * pos;
17+
v_normal = u_normalMatrix * a_normal;
18+
v_light1Direction = mat3(u_light1Transform) * vec3(0., 0., 1.);
19+
v_light2Direction = mat3(u_light2Transform) * vec3(0., 0., 1.);
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
precision highp float;
2+
uniform vec4 u_ambient;
3+
uniform vec4 u_diffuse;
4+
uniform vec4 u_emission;
5+
uniform vec4 u_specular;
6+
uniform float u_shininess;
7+
uniform float u_transparency;
8+
uniform vec3 u_light0Color;
9+
uniform vec3 u_light1Color;
10+
uniform vec3 u_light2Color;
11+
varying vec3 v_position;
12+
varying vec3 v_normal;
13+
varying vec3 v_light1Direction;
14+
varying vec3 v_light2Direction;
15+
void main(void) {
16+
vec3 normal = normalize(v_normal);
17+
vec4 diffuse = u_diffuse;
18+
vec3 diffuseLight = vec3(0.0, 0.0, 0.0);
19+
vec3 specular = u_specular.rgb;
20+
vec3 specularLight = vec3(0.0, 0.0, 0.0);
21+
vec3 emission = u_emission.rgb;
22+
vec3 ambient = u_ambient.rgb;
23+
vec3 viewDir = -normalize(v_position);
24+
vec3 ambientLight = vec3(0.0, 0.0, 0.0);
25+
{
26+
ambientLight += u_light0Color;
27+
}
28+
{
29+
vec3 l = normalize(v_light1Direction);
30+
float attenuation = 1.0;
31+
diffuseLight += u_light1Color * max(dot(normal, l), 0.) * attenuation;
32+
vec3 reflectDir = reflect(-l, normal);
33+
float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;
34+
specularLight += u_light1Color * specularIntensity;
35+
}
36+
{
37+
vec3 l = normalize(v_light2Direction);
38+
float attenuation = 1.0;
39+
diffuseLight += u_light2Color * max(dot(normal, l), 0.) * attenuation;
40+
vec3 reflectDir = reflect(-l, normal);
41+
float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;
42+
specularLight += u_light2Color * specularIntensity;
43+
}
44+
vec3 color = vec3(0.0, 0.0, 0.0);
45+
color += diffuse.rgb * diffuseLight;
46+
color += specular * specularLight;
47+
color += emission;
48+
color += ambient * ambientLight;
49+
gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);
50+
}

0 commit comments

Comments
 (0)