forked from KhronosGroup/glTF-Sample-Models
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lasalvavida
committed
May 11, 2017
1 parent
62e302c
commit ef49777
Showing
381 changed files
with
460,906 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
4,593 changes: 4,593 additions & 0 deletions
4,593
2.0/2CylinderEngine/glTF-Embedded/2CylinderEngine.gltf
Large diffs are not rendered by default.
Oops, something went wrong.
4,485 changes: 4,485 additions & 0 deletions
4,485
2.0/2CylinderEngine/glTF-MaterialsCommon/2CylinderEngine.gltf
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
4,599 changes: 4,599 additions & 0 deletions
4,599
2.0/2CylinderEngine/glTF-pbrSpecularGlossiness/2CylinderEngine.gltf
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
5,437 changes: 5,437 additions & 0 deletions
5,437
2.0/2CylinderEngine/glTF-techniqueWebGL/2CylinderEngine.gltf
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
2.0/2CylinderEngine/glTF-techniqueWebGL/2CylinderEngine0.vert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
precision highp float; | ||
uniform mat4 u_modelViewMatrix; | ||
uniform mat4 u_projectionMatrix; | ||
uniform mat3 u_normalMatrix; | ||
uniform mat4 u_light1Transform; | ||
uniform mat4 u_light2Transform; | ||
attribute vec3 a_position; | ||
varying vec3 v_position; | ||
attribute vec3 a_normal; | ||
varying vec3 v_normal; | ||
varying vec3 v_light1Direction; | ||
varying vec3 v_light2Direction; | ||
void main(void) { | ||
vec4 pos = u_modelViewMatrix * vec4(a_position,1.0); | ||
v_position = pos.xyz; | ||
gl_Position = u_projectionMatrix * pos; | ||
v_normal = u_normalMatrix * a_normal; | ||
v_light1Direction = mat3(u_light1Transform) * vec3(0., 0., 1.); | ||
v_light2Direction = mat3(u_light2Transform) * vec3(0., 0., 1.); | ||
} |
50 changes: 50 additions & 0 deletions
50
2.0/2CylinderEngine/glTF-techniqueWebGL/2CylinderEngine1.frag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
precision highp float; | ||
uniform vec4 u_ambient; | ||
uniform vec4 u_diffuse; | ||
uniform vec4 u_emission; | ||
uniform vec4 u_specular; | ||
uniform float u_shininess; | ||
uniform float u_transparency; | ||
uniform vec3 u_light0Color; | ||
uniform vec3 u_light1Color; | ||
uniform vec3 u_light2Color; | ||
varying vec3 v_position; | ||
varying vec3 v_normal; | ||
varying vec3 v_light1Direction; | ||
varying vec3 v_light2Direction; | ||
void main(void) { | ||
vec3 normal = normalize(v_normal); | ||
vec4 diffuse = u_diffuse; | ||
vec3 diffuseLight = vec3(0.0, 0.0, 0.0); | ||
vec3 specular = u_specular.rgb; | ||
vec3 specularLight = vec3(0.0, 0.0, 0.0); | ||
vec3 emission = u_emission.rgb; | ||
vec3 ambient = u_ambient.rgb; | ||
vec3 viewDir = -normalize(v_position); | ||
vec3 ambientLight = vec3(0.0, 0.0, 0.0); | ||
{ | ||
ambientLight += u_light0Color; | ||
} | ||
{ | ||
vec3 l = normalize(v_light1Direction); | ||
float attenuation = 1.0; | ||
diffuseLight += u_light1Color * max(dot(normal, l), 0.) * attenuation; | ||
vec3 reflectDir = reflect(-l, normal); | ||
float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation; | ||
specularLight += u_light1Color * specularIntensity; | ||
} | ||
{ | ||
vec3 l = normalize(v_light2Direction); | ||
float attenuation = 1.0; | ||
diffuseLight += u_light2Color * max(dot(normal, l), 0.) * attenuation; | ||
vec3 reflectDir = reflect(-l, normal); | ||
float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation; | ||
specularLight += u_light2Color * specularIntensity; | ||
} | ||
vec3 color = vec3(0.0, 0.0, 0.0); | ||
color += diffuse.rgb * diffuseLight; | ||
color += specular * specularLight; | ||
color += emission; | ||
color += ambient * ambientLight; | ||
gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency); | ||
} |
Oops, something went wrong.