diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-04-11 14:58:17 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-04-23 11:14:30 +0000 |
commit | 0542f1614aa6d50c4c9809fb0ce5f1adb5666d67 (patch) | |
tree | 77a1ed41c16262f5cc7aa9ddb2d66d3f9b61a719 /src/render/shaders | |
parent | 8677f62fa690efa29fbb6f870af1ea2b4e7111cf (diff) |
Move defaults and geometries out of Qt3DRender and into Qt3DExtras
QBoundingVolumeDebug has been disabled for now. Will be re-enabled later on.
Change-Id: Id6b0abab2ec2aa697330bd20d782f9d104d25d50
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/shaders')
35 files changed, 0 insertions, 1285 deletions
diff --git a/src/render/shaders/es2/diffusemap.frag b/src/render/shaders/es2/diffusemap.frag deleted file mode 100644 index 7d06d8e2c..000000000 --- a/src/render/shaders/es2/diffusemap.frag +++ /dev/null @@ -1,25 +0,0 @@ -#define FP highp - -uniform FP vec3 ka; // Ambient reflectivity -uniform FP vec3 ks; // Specular reflectivity -uniform FP float shininess; // Specular shininess factor - -uniform FP vec3 eyePosition; - -uniform sampler2D diffuseTexture; - -varying FP vec3 worldPosition; -varying FP vec3 worldNormal; -varying FP vec2 texCoord; - -#pragma include light.inc.frag - -void main() -{ - FP vec3 diffuseTextureColor = texture2D( diffuseTexture, texCoord ).rgb; - - FP vec3 diffuseColor, specularColor; - adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor); - - gl_FragColor = vec4( diffuseTextureColor * ( ka + diffuseColor ) + ks * specularColor, 1.0 ); -} diff --git a/src/render/shaders/es2/diffusemap.vert b/src/render/shaders/es2/diffusemap.vert deleted file mode 100644 index 13798279e..000000000 --- a/src/render/shaders/es2/diffusemap.vert +++ /dev/null @@ -1,22 +0,0 @@ -attribute vec3 vertexPosition; -attribute vec3 vertexNormal; -attribute vec2 vertexTexCoord; - -varying vec3 worldPosition; -varying vec3 worldNormal; -varying vec2 texCoord; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -uniform float texCoordScale; - -void main() -{ - texCoord = vertexTexCoord * texCoordScale; - worldNormal = normalize( modelNormalMatrix * vertexNormal ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/es2/diffusespecularmap.frag b/src/render/shaders/es2/diffusespecularmap.frag deleted file mode 100644 index 4d776772c..000000000 --- a/src/render/shaders/es2/diffusespecularmap.frag +++ /dev/null @@ -1,27 +0,0 @@ -#define FP highp - -// TODO: Replace with a struct -uniform FP vec3 ka; // Ambient reflectivity -uniform FP float shininess; // Specular shininess factor - -uniform FP vec3 eyePosition; - -uniform sampler2D diffuseTexture; -uniform sampler2D specularTexture; - -varying FP vec3 worldPosition; -varying FP vec3 worldNormal; -varying FP vec2 texCoord; - -#pragma include light.inc.frag - -void main() -{ - FP vec3 diffuseTextureColor = texture2D( diffuseTexture, texCoord ).rgb; - FP vec3 specularTextureColor = texture2D( specularTexture, texCoord ).rgb; - - FP vec3 diffuseColor, specularColor; - adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor); - - gl_FragColor = vec4( diffuseTextureColor * ( ka + diffuseColor ) + specularTextureColor * specularColor, 1.0 ); -} diff --git a/src/render/shaders/es2/gooch.frag b/src/render/shaders/es2/gooch.frag deleted file mode 100644 index 622aaf0b4..000000000 --- a/src/render/shaders/es2/gooch.frag +++ /dev/null @@ -1,56 +0,0 @@ -#define FP highp - -// TODO: Replace with a struct -uniform FP vec3 kd; // Diffuse reflectivity -uniform FP vec3 ks; // Specular reflectivity -uniform FP vec3 kblue; // Cool color -uniform FP vec3 kyellow; // Warm color -uniform FP float alpha; // Fraction of diffuse added to kblue -uniform FP float beta; // Fraction of diffuse added to kyellow -uniform FP float shininess; // Specular shininess factor - -uniform FP vec3 eyePosition; - -varying FP vec3 worldPosition; -varying FP vec3 worldNormal; - -#pragma include light.inc.frag - -FP vec3 goochModel( const in FP vec3 pos, const in FP vec3 n ) -{ - // Based upon the original Gooch lighting model paper at: - // http://www.cs.northwestern.edu/~ago820/SIG98/abstract.html - - // Calculate kcool and kwarm from equation (3) - FP vec3 kcool = clamp(kblue + alpha * kd, 0.0, 1.0); - FP vec3 kwarm = clamp(kyellow + beta * kd, 0.0, 1.0); - - // Calculate the vector from the light to the fragment - FP vec3 s = normalize( vec3( lights[0].position ) - pos ); - - // Calculate the cos theta factor mapped onto the range [0,1] - FP float sDotNFactor = ( 1.0 + dot( s, n ) ) / 2.0; - - // Calculate the tone by blending the kcool and kwarm contributions - // as per equation (2) - FP vec3 intensity = mix( kcool, kwarm, sDotNFactor ); - - // Calculate the vector from the fragment to the eye position - FP vec3 v = normalize( eyePosition - pos ); - - // Reflect the light beam using the normal at this fragment - FP vec3 r = reflect( -s, n ); - - // Calculate the specular component - FP float specular = 0.0; - if ( dot( s, n ) > 0.0 ) - specular = pow( max( dot( r, v ), 0.0 ), shininess ); - - // Sum the blended tone and specular highlight - return intensity + ks * specular; -} - -void main() -{ - gl_FragColor = vec4( goochModel( worldPosition, normalize( worldNormal ) ), 1.0 ); -} diff --git a/src/render/shaders/es2/gooch.vert b/src/render/shaders/es2/gooch.vert deleted file mode 100644 index dd162a66b..000000000 --- a/src/render/shaders/es2/gooch.vert +++ /dev/null @@ -1,17 +0,0 @@ -attribute vec3 vertexPosition; -attribute vec3 vertexNormal; - -varying vec3 worldPosition; -varying vec3 worldNormal; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -void main() -{ - worldNormal = normalize( modelNormalMatrix * vertexNormal ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/es2/light.inc.frag b/src/render/shaders/es2/light.inc.frag deleted file mode 100644 index cdec536cf..000000000 --- a/src/render/shaders/es2/light.inc.frag +++ /dev/null @@ -1,131 +0,0 @@ -const int MAX_LIGHTS = 8; -const int TYPE_POINT = 0; -const int TYPE_DIRECTIONAL = 1; -const int TYPE_SPOT = 2; -struct Light { - int type; - FP vec3 position; - FP vec3 color; - FP float intensity; - FP vec3 direction; - FP vec3 attenuation; - FP float cutOffAngle; -}; -uniform Light lights[MAX_LIGHTS]; -uniform int lightCount; - -void adsModelNormalMapped(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess, - const in FP mat3 tangentMatrix, - out FP vec3 diffuseColor, out FP vec3 specularColor) -{ - diffuseColor = vec3(0.0); - specularColor = vec3(0.0); - - FP vec3 n = normalize( vnormal ); - - int i; - FP vec3 s; - for (i = 0; i < lightCount; ++i) { - FP float att = 1.0; - if ( lights[i].type != TYPE_DIRECTIONAL ) { - s = tangentMatrix * ( lights[i].position - vpos ); - if (length( lights[i].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[i].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( tangentMatrix * -lights[i].direction ); - } - - FP float diffuse = max( dot( s, n ), 0.0 ); - - FP float specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - FP vec3 r = reflect( -s, n ); - FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) ); - FP float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[i].intensity * diffuse * lights[i].color; - specularColor += att * lights[i].intensity * specular * lights[i].color; - } -} - -void adsModel(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess, - out FP vec3 diffuseColor, out FP vec3 specularColor) -{ - diffuseColor = vec3(0.0); - specularColor = vec3(0.0); - - FP vec3 n = normalize( vnormal ); - - int i; - FP vec3 s; - for (i = 0; i < lightCount; ++i) { - FP float att = 1.0; - if ( lights[i].type != TYPE_DIRECTIONAL ) { - s = lights[i].position - vpos; - if (length( lights[i].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[i].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[i].direction ); - } - - FP float diffuse = max( dot( s, n ), 0.0 ); - - FP float specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - FP vec3 r = reflect( -s, n ); - FP vec3 v = normalize( eye - vpos ); - FP float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[i].intensity * diffuse * lights[i].color; - specularColor += att * lights[i].intensity * specular * lights[i].color; - } -} - -void adModel(const in FP vec3 vpos, const in FP vec3 vnormal, out FP vec3 diffuseColor) -{ - diffuseColor = vec3(0.0); - - FP vec3 n = normalize( vnormal ); - - int i; - FP vec3 s; - for (i = 0; i < lightCount; ++i) { - FP float att = 1.0; - if ( lights[i].type != TYPE_DIRECTIONAL ) { - s = lights[i].position - vpos; - if (length( lights[i].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[i].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[i].direction ); - } - - FP float diffuse = max( dot( s, n ), 0.0 ); - - diffuseColor += att * lights[i].intensity * diffuse * lights[i].color; - } -} diff --git a/src/render/shaders/es2/light.inc.frag100 b/src/render/shaders/es2/light.inc.frag100 deleted file mode 100644 index b4988ad82..000000000 --- a/src/render/shaders/es2/light.inc.frag100 +++ /dev/null @@ -1,218 +0,0 @@ -const int MAX_LIGHTS = 2; // RPi: cannot use more than two as we run out of uniforms -const int TYPE_POINT = 0; -const int TYPE_DIRECTIONAL = 1; -const int TYPE_SPOT = 2; -struct Light { - int type; - FP vec3 position; - FP vec3 color; - FP float intensity; - FP vec3 direction; - FP vec3 attenuation; - FP float cutOffAngle; -}; -uniform Light lights[MAX_LIGHTS]; -uniform int lightCount; - -void adsModelNormalMapped(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess, - const in FP mat3 tangentMatrix, - out FP vec3 diffuseColor, out FP vec3 specularColor) -{ - diffuseColor = vec3(0.0); - specularColor = vec3(0.0); - - FP vec3 n = normalize( vnormal ); - - // 0 - if (lightCount < 1) - return; - FP vec3 s; - FP float att = 1.0; - if ( lights[0].type != TYPE_DIRECTIONAL ) { - s = tangentMatrix * ( lights[0].position - vpos ); - if (length( lights[0].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[0].attenuation.x + lights[0].attenuation.y * dist + lights[0].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[0].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[0].direction))) ) > lights[0].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( tangentMatrix * -lights[0].direction ); - } - - FP float diffuse = max( dot( s, n ), 0.0 ); - - FP float specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - FP vec3 r = reflect( -s, n ); - FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) ); - FP float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[0].intensity * diffuse * lights[0].color; - specularColor += att * specular; - - // 1 - if (lightCount < 2) - return; - att = 1.0; - if ( lights[1].type != TYPE_DIRECTIONAL ) { - s = tangentMatrix * ( lights[1].position - vpos ); - if (length( lights[1].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[1].attenuation.x + lights[1].attenuation.y * dist + lights[1].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[1].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[1].direction))) ) > lights[1].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( tangentMatrix * -lights[1].direction ); - } - - diffuse = max( dot( s, n ), 0.0 ); - - specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - FP vec3 r = reflect( -s, n ); - FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) ); - FP float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[1].intensity * diffuse * lights[1].color; - specularColor += att * specular; -} - -void adsModel(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess, - out FP vec3 diffuseColor, out FP vec3 specularColor) -{ - diffuseColor = vec3(0.0); - specularColor = vec3(0.0); - - FP vec3 n = normalize( vnormal ); - - // 0 - if (lightCount < 1) - return; - FP vec3 s; - FP float att = 1.0; - if ( lights[0].type != TYPE_DIRECTIONAL ) { - s = lights[0].position - vpos; - if (length( lights[0].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[0].attenuation.x + lights[0].attenuation.y * dist + lights[0].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[0].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[0].direction))) ) > lights[0].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[0].direction ); - } - - FP float diffuse = max( dot( s, n ), 0.0 ); - - FP float specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - FP vec3 r = reflect( -s, n ); - FP vec3 v = normalize( eye - vpos ); - FP float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[0].intensity * diffuse * lights[0].color; - specularColor += att * specular; - - // 1 - if (lightCount < 2) - return; - att = 1.0; - if ( lights[1].type != TYPE_DIRECTIONAL ) { - s = lights[1].position - vpos; - if (length( lights[1].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[1].attenuation.x + lights[1].attenuation.y * dist + lights[1].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[1].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[1].direction))) ) > lights[1].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[1].direction ); - } - - diffuse = max( dot( s, n ), 0.0 ); - - specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - FP vec3 r = reflect( -s, n ); - FP vec3 v = normalize( eye - vpos ); - FP float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[1].intensity * diffuse * lights[1].color; - specularColor += att * specular; -} - -void adModel(const in FP vec3 vpos, const in FP vec3 vnormal, out FP vec3 diffuseColor) -{ - diffuseColor = vec3(0.0); - - FP vec3 n = normalize( vnormal ); - - // 0 - if (lightCount < 1) - return; - FP vec3 s; - FP float att = 1.0; - if ( lights[0].type != TYPE_DIRECTIONAL ) { - s = lights[0].position - vpos; - if (length( lights[0].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[0].attenuation.x + lights[0].attenuation.y * dist + lights[0].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[0].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[0].direction))) ) > lights[0].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[0].direction ); - } - - FP float diffuse = max( dot( s, n ), 0.0 ); - - diffuseColor += att * lights[0].intensity * diffuse * lights[0].color; - - // 1 - if (lightCount < 2) - return; - att = 1.0; - if ( lights[1].type != TYPE_DIRECTIONAL ) { - s = lights[1].position - vpos; - if (length( lights[1].attenuation ) != 0.0) { - FP float dist = length(s); - att = 1.0 / (lights[1].attenuation.x + lights[1].attenuation.y * dist + lights[1].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[1].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[1].direction))) ) > lights[1].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[1].direction ); - } - - diffuse = max( dot( s, n ), 0.0 ); - - diffuseColor += att * lights[1].intensity * diffuse * lights[1].color; -} diff --git a/src/render/shaders/es2/normaldiffusemap.frag b/src/render/shaders/es2/normaldiffusemap.frag deleted file mode 100644 index c69aa8b81..000000000 --- a/src/render/shaders/es2/normaldiffusemap.frag +++ /dev/null @@ -1,31 +0,0 @@ -#define FP highp - -varying FP vec3 worldPosition; -varying FP vec2 texCoord; -varying FP mat3 tangentMatrix; - -uniform sampler2D diffuseTexture; -uniform sampler2D normalTexture; - -// TODO: Replace with a struct -uniform FP vec3 ka; // Ambient reflectivity -uniform FP vec3 ks; // Specular reflectivity -uniform FP float shininess; // Specular shininess factor - -uniform FP vec3 eyePosition; - -#pragma include light.inc.frag - -void main() -{ - // Sample the textures at the interpolated texCoords - FP vec4 diffuseTextureColor = texture2D( diffuseTexture, texCoord ); - FP vec3 normal = 2.0 * texture2D( normalTexture, texCoord ).rgb - vec3( 1.0 ); - - // Calculate the lighting model, keeping the specular component separate - FP vec3 diffuseColor, specularColor; - adsModelNormalMapped(worldPosition, normal, eyePosition, shininess, tangentMatrix, diffuseColor, specularColor); - - // Combine spec with ambient+diffuse for final fragment color - gl_FragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + ks * specularColor, 1.0 ); -} diff --git a/src/render/shaders/es2/normaldiffusemap.vert b/src/render/shaders/es2/normaldiffusemap.vert deleted file mode 100644 index ecc689f69..000000000 --- a/src/render/shaders/es2/normaldiffusemap.vert +++ /dev/null @@ -1,38 +0,0 @@ -attribute vec3 vertexPosition; -attribute vec3 vertexNormal; -attribute vec2 vertexTexCoord; -attribute vec4 vertexTangent; - -varying vec3 worldPosition; -varying vec2 texCoord; -varying mat3 tangentMatrix; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 projectionMatrix; -uniform mat4 mvp; - -uniform float texCoordScale; - -void main() -{ - // Pass through texture coordinates - texCoord = vertexTexCoord * texCoordScale; - - // Transform position, normal, and tangent to world coords - vec3 normal = normalize( modelNormalMatrix * vertexNormal ); - vec3 tangent = normalize( modelNormalMatrix * vertexTangent.xyz ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - - // Calculate binormal vector - vec3 binormal = normalize( cross( normal, tangent ) ); - - // Construct matrix to transform from eye coords to tangent space - tangentMatrix = mat3 ( - tangent.x, binormal.x, normal.x, - tangent.y, binormal.y, normal.y, - tangent.z, binormal.z, normal.z ); - - // Calculate vertex position in clip coordinates - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/es2/normaldiffusemapalpha.frag b/src/render/shaders/es2/normaldiffusemapalpha.frag deleted file mode 100644 index 98acbf01d..000000000 --- a/src/render/shaders/es2/normaldiffusemapalpha.frag +++ /dev/null @@ -1,32 +0,0 @@ -#define FP highp - -varying FP vec3 worldPosition; -varying FP vec2 texCoord; -varying FP mat3 tangentMatrix; - -uniform sampler2D diffuseTexture; -uniform sampler2D normalTexture; - -// TODO: Replace with a struct -uniform FP vec3 ka; // Ambient reflectivity -uniform FP vec3 ks; // Specular reflectivity -uniform FP float shininess; // Specular shininess factor - -uniform FP vec3 eyePosition; - -#pragma include light.inc.frag - -void main() -{ - // Sample the textures at the interpolated texCoords - FP vec4 diffuseTextureColor = texture2D( diffuseTexture, texCoord ); - FP vec3 normal = 2.0 * texture2D( normalTexture, texCoord ).rgb - vec3( 1.0 ); - - // Calculate the lighting model, keeping the specular component separate - FP vec3 diffuseColor, specularColor; - adsModelNormalMapped(worldPosition, normal, eyePosition, shininess, tangentMatrix, diffuseColor, specularColor); - - // Combine spec with ambient+diffuse for final fragment color - // Use the alpha from the diffuse texture (for alpha to coverage) - gl_FragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + ks * specularColor, diffuseTextureColor.a ); -} diff --git a/src/render/shaders/es2/normaldiffusespecularmap.frag b/src/render/shaders/es2/normaldiffusespecularmap.frag deleted file mode 100644 index b30c1bd5f..000000000 --- a/src/render/shaders/es2/normaldiffusespecularmap.frag +++ /dev/null @@ -1,32 +0,0 @@ -#define FP highp - -varying FP vec3 worldPosition; -varying FP vec2 texCoord; -varying FP mat3 tangentMatrix; - -uniform sampler2D diffuseTexture; -uniform sampler2D specularTexture; -uniform sampler2D normalTexture; - -// TODO: Replace with a struct -uniform FP vec3 ka; // Ambient reflectivity -uniform FP float shininess; // Specular shininess factor - -uniform FP vec3 eyePosition; - -#pragma include light.inc.frag - -void main() -{ - // Sample the textures at the interpolated texCoords - FP vec4 diffuseTextureColor = texture2D( diffuseTexture, texCoord ); - FP vec4 specularTextureColor = texture2D( specularTexture, texCoord ); - FP vec3 normal = 2.0 * texture2D( normalTexture, texCoord ).rgb - vec3( 1.0 ); - - // Calculate the lighting model, keeping the specular component separate - FP vec3 diffuseColor, specularColor; - adsModelNormalMapped(worldPosition, normal, eyePosition, shininess, tangentMatrix, diffuseColor, specularColor); - - // Combine spec with ambient+diffuse for final fragment color - gl_FragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + specularTextureColor.rgb * specularColor, 1.0 ); -} diff --git a/src/render/shaders/es2/pervertexcolor.frag b/src/render/shaders/es2/pervertexcolor.frag deleted file mode 100644 index ab429d942..000000000 --- a/src/render/shaders/es2/pervertexcolor.frag +++ /dev/null @@ -1,14 +0,0 @@ -#define FP highp - -varying FP vec3 worldPosition; -varying FP vec3 worldNormal; -varying FP vec3 color; - -#pragma include light.inc.frag - -void main() -{ - FP vec3 diffuseColor; - adModel(worldPosition, worldNormal, diffuseColor); - gl_FragColor = vec4( color + color * diffuseColor, 1.0 ); -} diff --git a/src/render/shaders/es2/pervertexcolor.vert b/src/render/shaders/es2/pervertexcolor.vert deleted file mode 100644 index 7fc3e649f..000000000 --- a/src/render/shaders/es2/pervertexcolor.vert +++ /dev/null @@ -1,20 +0,0 @@ -attribute vec3 vertexPosition; -attribute vec3 vertexNormal; -attribute vec3 vertexColor; - -varying vec3 worldPosition; -varying vec3 worldNormal; -varying vec3 color; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -void main() -{ - worldNormal = normalize( modelNormalMatrix * vertexNormal ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - color = vertexColor; - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/es2/phongalpha.frag b/src/render/shaders/es2/phongalpha.frag deleted file mode 100644 index c5ec43049..000000000 --- a/src/render/shaders/es2/phongalpha.frag +++ /dev/null @@ -1,22 +0,0 @@ -#define FP highp - -// TODO: Replace with a struct -uniform FP vec3 ka; // Ambient reflectivity -uniform FP vec3 kd; // Diffuse reflectivity -uniform FP vec3 ks; // Specular reflectivity -uniform FP float shininess; // Specular shininess factor -uniform FP float alpha; - -uniform FP vec3 eyePosition; - -varying FP vec3 worldPosition; -varying FP vec3 worldNormal; - -#pragma include light.inc.frag - -void main() -{ - FP vec3 diffuseColor, specularColor; - adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor); - gl_FragColor = vec4( ka + kd * diffuseColor + ks * specularColor, alpha ); -} diff --git a/src/render/shaders/es2/skybox.frag b/src/render/shaders/es2/skybox.frag deleted file mode 100644 index 3de08be44..000000000 --- a/src/render/shaders/es2/skybox.frag +++ /dev/null @@ -1,8 +0,0 @@ -varying highp vec3 texCoord0; -uniform samplerCube skyboxTexture; - -void main() -{ - gl_FragColor = textureCube(skyboxTexture, texCoord0); -} - diff --git a/src/render/shaders/es2/skybox.vert b/src/render/shaders/es2/skybox.vert deleted file mode 100644 index e2de1d88b..000000000 --- a/src/render/shaders/es2/skybox.vert +++ /dev/null @@ -1,12 +0,0 @@ -attribute vec3 vertexPosition; -varying vec3 texCoord0; - -uniform mat4 mvp; -uniform mat4 inverseProjectionMatrix; -uniform mat4 inverseModelView; - -void main() -{ - texCoord0 = vertexPosition.xyz; - gl_Position = vec4(mvp * vec4(vertexPosition, 1.0)).xyww; -} diff --git a/src/render/shaders/es2/unlittexture.frag b/src/render/shaders/es2/unlittexture.frag deleted file mode 100644 index 66752ed32..000000000 --- a/src/render/shaders/es2/unlittexture.frag +++ /dev/null @@ -1,11 +0,0 @@ -#define FP highp - -uniform sampler2D diffuseTexture; - -varying FP vec3 position; -varying FP vec2 texCoord; - -void main() -{ - gl_FragColor = texture2D( diffuseTexture, texCoord ); -} diff --git a/src/render/shaders/es2/unlittexture.vert b/src/render/shaders/es2/unlittexture.vert deleted file mode 100644 index 050b2b7e2..000000000 --- a/src/render/shaders/es2/unlittexture.vert +++ /dev/null @@ -1,17 +0,0 @@ -attribute vec3 vertexPosition; -attribute vec2 vertexTexCoord; - -varying vec3 position; -varying vec2 texCoord; - -uniform mat4 modelView; -uniform mat4 mvp; -uniform vec2 texCoordOffset; - -void main() -{ - texCoord = vertexTexCoord + texCoordOffset; - position = vec3( modelView * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/gl3/diffusemap.frag b/src/render/shaders/gl3/diffusemap.frag deleted file mode 100644 index 7810fdb68..000000000 --- a/src/render/shaders/gl3/diffusemap.frag +++ /dev/null @@ -1,27 +0,0 @@ -#version 150 core - -uniform vec3 ka; // Ambient reflectivity -uniform vec3 ks; // Specular reflectivity -uniform float shininess; // Specular shininess factor - -uniform vec3 eyePosition; - -uniform sampler2D diffuseTexture; - -in vec3 worldPosition; -in vec3 worldNormal; -in vec2 texCoord; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - vec3 diffuseTextureColor = texture( diffuseTexture, texCoord ).rgb; - - vec3 diffuseColor, specularColor; - adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor); - - fragColor = vec4( diffuseTextureColor * ( ka + diffuseColor ) + ks * specularColor, 1.0 ); -} diff --git a/src/render/shaders/gl3/diffusemap.vert b/src/render/shaders/gl3/diffusemap.vert deleted file mode 100644 index 439be6e99..000000000 --- a/src/render/shaders/gl3/diffusemap.vert +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 core - -in vec3 vertexPosition; -in vec3 vertexNormal; -in vec2 vertexTexCoord; - -out vec3 worldPosition; -out vec3 worldNormal; -out vec2 texCoord; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -uniform float texCoordScale; - -void main() -{ - texCoord = vertexTexCoord * texCoordScale; - worldNormal = normalize( modelNormalMatrix * vertexNormal ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/gl3/diffusespecularmap.frag b/src/render/shaders/gl3/diffusespecularmap.frag deleted file mode 100644 index fb809393a..000000000 --- a/src/render/shaders/gl3/diffusespecularmap.frag +++ /dev/null @@ -1,29 +0,0 @@ -#version 150 core - -// TODO: Replace with a struct -uniform vec3 ka; // Ambient reflectivity -uniform float shininess; // Specular shininess factor - -uniform vec3 eyePosition; - -uniform sampler2D diffuseTexture; -uniform sampler2D specularTexture; - -in vec3 worldPosition; -in vec3 worldNormal; -in vec2 texCoord; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - vec3 diffuseTextureColor = texture( diffuseTexture, texCoord ).rgb; - vec3 specularTextureColor = texture( specularTexture, texCoord ).rgb; - - vec3 diffuseColor, specularColor; - adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor); - - fragColor = vec4( diffuseTextureColor * ( ka + diffuseColor ) + specularTextureColor * specularColor, 1.0 ); -} diff --git a/src/render/shaders/gl3/gooch.frag b/src/render/shaders/gl3/gooch.frag deleted file mode 100644 index 1beab1c01..000000000 --- a/src/render/shaders/gl3/gooch.frag +++ /dev/null @@ -1,64 +0,0 @@ -#version 150 core - -// TODO: Replace with a struct -uniform vec3 kd; // Diffuse reflectivity -uniform vec3 ks; // Specular reflectivity -uniform vec3 kblue; // Cool color -uniform vec3 kyellow; // Warm color -uniform float alpha; // Fraction of diffuse added to kblue -uniform float beta; // Fraction of diffuse added to kyellow -uniform float shininess; // Specular shininess factor - -uniform vec3 eyePosition; - -in vec3 worldPosition; -in vec3 worldNormal; - -out vec4 fragColor; - -#pragma include light.inc.frag - -vec3 goochModel( const in vec3 pos, const in vec3 n ) -{ - // Based upon the original Gooch lighting model paper at: - // http://www.cs.northwestern.edu/~ago820/SIG98/abstract.html - - // Calculate kcool and kwarm from equation (3) - vec3 kcool = clamp(kblue + alpha * kd, 0.0, 1.0); - vec3 kwarm = clamp(kyellow + beta * kd, 0.0, 1.0); - - vec3 result = vec3(0.0); - int i; - for (i = 0; i < lightCount; ++i) { - // Calculate the vector from the light to the fragment - vec3 s = normalize( vec3( lights[i].position ) - pos ); - - // Calculate the cos theta factor mapped onto the range [0,1] - float sDotNFactor = ( 1.0 + dot( s, n ) ) / 2.0; - - // Calculate the tone by blending the kcool and kwarm contributions - // as per equation (2) - vec3 intensity = mix( kcool, kwarm, sDotNFactor ); - - // Calculate the vector from the fragment to the eye position - vec3 v = normalize( eyePosition - pos ); - - // Reflect the light beam using the normal at this fragment - vec3 r = reflect( -s, n ); - - // Calculate the specular component - float specular = 0.0; - if ( dot( s, n ) > 0.0 ) - specular = pow( max( dot( r, v ), 0.0 ), shininess ); - - // Sum the blended tone and specular highlight - result += intensity + ks * specular; - } - - return result; -} - -void main() -{ - fragColor = vec4( goochModel( worldPosition, normalize( worldNormal ) ), 1.0 ); -} diff --git a/src/render/shaders/gl3/gooch.vert b/src/render/shaders/gl3/gooch.vert deleted file mode 100644 index 5230fb70e..000000000 --- a/src/render/shaders/gl3/gooch.vert +++ /dev/null @@ -1,19 +0,0 @@ -#version 150 core - -in vec3 vertexPosition; -in vec3 vertexNormal; - -out vec3 worldPosition; -out vec3 worldNormal; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -void main() -{ - worldNormal = normalize( modelNormalMatrix * vertexNormal ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/gl3/light.inc.frag b/src/render/shaders/gl3/light.inc.frag deleted file mode 100644 index 8cee315c1..000000000 --- a/src/render/shaders/gl3/light.inc.frag +++ /dev/null @@ -1,131 +0,0 @@ -const int MAX_LIGHTS = 8; -const int TYPE_POINT = 0; -const int TYPE_DIRECTIONAL = 1; -const int TYPE_SPOT = 2; -struct Light { - int type; - vec3 position; - vec3 color; - float intensity; - vec3 direction; - vec3 attenuation; - float cutOffAngle; -}; -uniform Light lights[MAX_LIGHTS]; -uniform int lightCount; - -void adsModelNormalMapped(const in vec3 vpos, const in vec3 vnormal, const in vec3 eye, const in float shininess, - const in mat3 tangentMatrix, - out vec3 diffuseColor, out vec3 specularColor) -{ - diffuseColor = vec3(0.0); - specularColor = vec3(0.0); - - vec3 n = normalize( vnormal ); - - int i; - vec3 s; - for (i = 0; i < lightCount; ++i) { - float att = 1.0; - if ( lights[i].type != TYPE_DIRECTIONAL ) { - s = tangentMatrix * ( lights[i].position - vpos ); - if (length( lights[i].attenuation ) != 0.0) { - float dist = length(s); - att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[i].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( tangentMatrix * -lights[i].direction ); - } - - float diffuse = max( dot( s, n ), 0.0 ); - - float specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - vec3 r = reflect( -s, n ); - vec3 v = normalize( tangentMatrix * ( eye - vpos ) ); - float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[i].intensity * diffuse * lights[i].color; - specularColor += att * lights[i].intensity * specular * lights[i].color; - } -} - -void adsModel(const in vec3 vpos, const in vec3 vnormal, const in vec3 eye, const in float shininess, - out vec3 diffuseColor, out vec3 specularColor) -{ - diffuseColor = vec3(0.0); - specularColor = vec3(0.0); - - vec3 n = normalize( vnormal ); - - int i; - vec3 s; - for (i = 0; i < lightCount; ++i) { - float att = 1.0; - if ( lights[i].type != TYPE_DIRECTIONAL ) { - s = lights[i].position - vpos; - if (length( lights[i].attenuation ) != 0.0) { - float dist = length(s); - att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[i].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[i].direction ); - } - - float diffuse = max( dot( s, n ), 0.0 ); - - float specular = 0.0; - if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) { - vec3 r = reflect( -s, n ); - vec3 v = normalize( eye - vpos ); - float normFactor = ( shininess + 2.0 ) / 2.0; - specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess ); - } - - diffuseColor += att * lights[i].intensity * diffuse * lights[i].color; - specularColor += att * lights[i].intensity * specular * lights[i].color; - } -} - -void adModel(const in vec3 vpos, const in vec3 vnormal, out vec3 diffuseColor) -{ - diffuseColor = vec3(0.0); - - vec3 n = normalize( vnormal ); - - int i; - vec3 s; - for (i = 0; i < lightCount; ++i) { - float att = 1.0; - if ( lights[i].type != TYPE_DIRECTIONAL ) { - s = lights[i].position - vpos; - if (length( lights[i].attenuation ) != 0.0) { - float dist = length(s); - att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist); - } - s = normalize( s ); - if ( lights[i].type == TYPE_SPOT ) { - if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle) - att = 0.0; - } - } else { - s = normalize( -lights[i].direction ); - } - - float diffuse = max( dot( s, n ), 0.0 ); - - diffuseColor += att * lights[i].intensity * diffuse * lights[i].color; - } -} diff --git a/src/render/shaders/gl3/normaldiffusemap.frag b/src/render/shaders/gl3/normaldiffusemap.frag deleted file mode 100644 index a99a7ed73..000000000 --- a/src/render/shaders/gl3/normaldiffusemap.frag +++ /dev/null @@ -1,33 +0,0 @@ -#version 150 core - -in vec3 worldPosition; -in vec2 texCoord; -in mat3 tangentMatrix; - -uniform sampler2D diffuseTexture; -uniform sampler2D normalTexture; - -// TODO: Replace with a struct -uniform vec3 ka; // Ambient reflectivity -uniform vec3 ks; // Specular reflectivity -uniform float shininess; // Specular shininess factor - -uniform vec3 eyePosition; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - // Sample the textures at the interpolated texCoords - vec4 diffuseTextureColor = texture( diffuseTexture, texCoord ); - vec3 normal = 2.0 * texture( normalTexture, texCoord ).rgb - vec3( 1.0 ); - - // Calculate the lighting model, keeping the specular component separate - vec3 diffuseColor, specularColor; - adsModelNormalMapped(worldPosition, normal, eyePosition, shininess, tangentMatrix, diffuseColor, specularColor); - - // Combine spec with ambient+diffuse for final fragment color - fragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + ks * specularColor, 1.0 ); -} diff --git a/src/render/shaders/gl3/normaldiffusemap.vert b/src/render/shaders/gl3/normaldiffusemap.vert deleted file mode 100644 index 306a562fb..000000000 --- a/src/render/shaders/gl3/normaldiffusemap.vert +++ /dev/null @@ -1,39 +0,0 @@ -#version 150 core - -in vec3 vertexPosition; -in vec3 vertexNormal; -in vec2 vertexTexCoord; -in vec4 vertexTangent; - -out vec3 worldPosition; -out vec2 texCoord; -out mat3 tangentMatrix; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -uniform float texCoordScale; - -void main() -{ - // Pass through texture coordinates - texCoord = vertexTexCoord * texCoordScale; - - // Transform position, normal, and tangent to world coords - vec3 normal = normalize( modelNormalMatrix * vertexNormal ); - vec3 tangent = normalize( modelNormalMatrix * vertexTangent.xyz ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - - // Calculate binormal vector - vec3 binormal = normalize( cross( normal, tangent ) ); - - // Construct matrix to transform from eye coords to tangent space - tangentMatrix = mat3 ( - tangent.x, binormal.x, normal.x, - tangent.y, binormal.y, normal.y, - tangent.z, binormal.z, normal.z ); - - // Calculate vertex position in clip coordinates - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/gl3/normaldiffusemapalpha.frag b/src/render/shaders/gl3/normaldiffusemapalpha.frag deleted file mode 100644 index ce5cf0e90..000000000 --- a/src/render/shaders/gl3/normaldiffusemapalpha.frag +++ /dev/null @@ -1,34 +0,0 @@ -#version 150 core - -in vec3 worldPosition; -in vec2 texCoord; -in mat3 tangentMatrix; - -uniform sampler2D diffuseTexture; -uniform sampler2D normalTexture; - -// TODO: Replace with a struct -uniform vec3 ka; // Ambient reflectivity -uniform vec3 ks; // Specular reflectivity -uniform float shininess; // Specular shininess factor - -uniform vec3 eyePosition; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - // Sample the textures at the interpolated texCoords - vec4 diffuseTextureColor = texture( diffuseTexture, texCoord ); - vec3 normal = 2.0 * texture( normalTexture, texCoord ).rgb - vec3( 1.0 ); - - // Calculate the lighting model, keeping the specular component separate - vec3 diffuseColor, specularColor; - adsModelNormalMapped(worldPosition, normal, eyePosition, shininess, tangentMatrix, diffuseColor, specularColor); - - // Combine spec with ambient+diffuse for final fragment color - // Use the alpha from the diffuse texture (for alpha to coverage) - fragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + ks * specularColor, diffuseTextureColor.a ); -} diff --git a/src/render/shaders/gl3/normaldiffusespecularmap.frag b/src/render/shaders/gl3/normaldiffusespecularmap.frag deleted file mode 100644 index b62932ffd..000000000 --- a/src/render/shaders/gl3/normaldiffusespecularmap.frag +++ /dev/null @@ -1,34 +0,0 @@ -#version 150 core - -in vec3 worldPosition; -in vec2 texCoord; -in mat3 tangentMatrix; - -uniform sampler2D diffuseTexture; -uniform sampler2D specularTexture; -uniform sampler2D normalTexture; - -// TODO: Replace with a struct -uniform vec3 ka; // Ambient reflectivity -uniform float shininess; // Specular shininess factor - -uniform vec3 eyePosition; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - // Sample the textures at the interpolated texCoords - vec4 diffuseTextureColor = texture( diffuseTexture, texCoord ); - vec4 specularTextureColor = texture( specularTexture, texCoord ); - vec3 normal = 2.0 * texture( normalTexture, texCoord ).rgb - vec3( 1.0 ); - - // Calculate the lighting model, keeping the specular component separate - vec3 diffuseColor, specularColor; - adsModelNormalMapped(worldPosition, normal, eyePosition, shininess, tangentMatrix, diffuseColor, specularColor); - - // Combine spec with ambient+diffuse for final fragment color - fragColor = vec4( ka + diffuseTextureColor.rgb * diffuseColor + specularTextureColor.rgb * specularColor, 1.0 ); -} diff --git a/src/render/shaders/gl3/pervertexcolor.frag b/src/render/shaders/gl3/pervertexcolor.frag deleted file mode 100644 index b5ed5a33d..000000000 --- a/src/render/shaders/gl3/pervertexcolor.frag +++ /dev/null @@ -1,16 +0,0 @@ -#version 150 core - -in vec3 worldPosition; -in vec3 worldNormal; -in vec3 color; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - vec3 diffuseColor; - adModel(worldPosition, worldNormal, diffuseColor); - fragColor = vec4( color + color * diffuseColor, 1.0 ); -} diff --git a/src/render/shaders/gl3/pervertexcolor.vert b/src/render/shaders/gl3/pervertexcolor.vert deleted file mode 100644 index 87713a520..000000000 --- a/src/render/shaders/gl3/pervertexcolor.vert +++ /dev/null @@ -1,22 +0,0 @@ -#version 150 core - -in vec3 vertexPosition; -in vec3 vertexNormal; -in vec3 vertexColor; - -out vec3 worldPosition; -out vec3 worldNormal; -out vec3 color; - -uniform mat4 modelMatrix; -uniform mat3 modelNormalMatrix; -uniform mat4 mvp; - -void main() -{ - worldNormal = normalize( modelNormalMatrix * vertexNormal ); - worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) ); - color = vertexColor; - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} diff --git a/src/render/shaders/gl3/phongalpha.frag b/src/render/shaders/gl3/phongalpha.frag deleted file mode 100644 index cb019e9aa..000000000 --- a/src/render/shaders/gl3/phongalpha.frag +++ /dev/null @@ -1,24 +0,0 @@ -#version 150 core - -// TODO: Replace with a struct -uniform vec3 ka; // Ambient reflectivity -uniform vec3 kd; // Diffuse reflectivity -uniform vec3 ks; // Specular reflectivity -uniform float shininess; // Specular shininess factor -uniform float alpha; - -uniform vec3 eyePosition; - -in vec3 worldPosition; -in vec3 worldNormal; - -out vec4 fragColor; - -#pragma include light.inc.frag - -void main() -{ - vec3 diffuseColor, specularColor; - adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor); - fragColor = vec4( ka + kd * diffuseColor + ks * specularColor, alpha ); -} diff --git a/src/render/shaders/gl3/skybox.frag b/src/render/shaders/gl3/skybox.frag deleted file mode 100644 index 99c8f111b..000000000 --- a/src/render/shaders/gl3/skybox.frag +++ /dev/null @@ -1,10 +0,0 @@ -#version 140 - -in vec3 texCoord0; -out vec4 fragColor; -uniform samplerCube skyboxTexture; - -void main() -{ - fragColor = texture(skyboxTexture, texCoord0); -} diff --git a/src/render/shaders/gl3/skybox.vert b/src/render/shaders/gl3/skybox.vert deleted file mode 100644 index 17bb2b00b..000000000 --- a/src/render/shaders/gl3/skybox.vert +++ /dev/null @@ -1,14 +0,0 @@ -#version 140 - -in vec3 vertexPosition; -out vec3 texCoord0; - -uniform mat4 mvp; -uniform mat4 inverseProjectionMatrix; -uniform mat4 inverseModelView; - -void main() -{ - texCoord0 = vertexPosition.xyz; - gl_Position = vec4(mvp * vec4(vertexPosition, 1.0)).xyww; -} diff --git a/src/render/shaders/gl3/unlittexture.frag b/src/render/shaders/gl3/unlittexture.frag deleted file mode 100644 index 8abbeee8f..000000000 --- a/src/render/shaders/gl3/unlittexture.frag +++ /dev/null @@ -1,13 +0,0 @@ -#version 150 core - -uniform sampler2D diffuseTexture; - -in vec3 position; -in vec2 texCoord; - -out vec4 fragColor; - -void main() -{ - fragColor = texture( diffuseTexture, texCoord ); -} diff --git a/src/render/shaders/gl3/unlittexture.vert b/src/render/shaders/gl3/unlittexture.vert deleted file mode 100644 index 4aaa10a8f..000000000 --- a/src/render/shaders/gl3/unlittexture.vert +++ /dev/null @@ -1,19 +0,0 @@ -#version 150 core - -in vec3 vertexPosition; -in vec2 vertexTexCoord; - -out vec3 position; -out vec2 texCoord; - -uniform mat4 modelView; -uniform mat4 mvp; -uniform vec2 texCoordOffset; - -void main() -{ - texCoord = vertexTexCoord + texCoordOffset; - position = vec3( modelView * vec4( vertexPosition, 1.0 ) ); - - gl_Position = mvp * vec4( vertexPosition, 1.0 ); -} |