//in vec3 lightPosition
in vec2 aUV;
-out vec3 worldNormal, worldLightPoint1;
+out vec3 worldNormal, worldLightPoint1, DirectionalLightDirection1, cameraVec;
out vec2 fUVs;
-out float SpecularCosPoint1, SpecularCosDirection1;
+//out float SpecularCosPoint1, SpecularCosDirection1;
uniform mat4 uProjection, uView, uModel;
+uniform vec3 cameraPos;
uniform int uEnableBloom = 1;
uniform int uEnableTransp = 1;
//everything else is in the Fragment Shader
vec3 PointLightPosition1 = vec3(0.0f, 5.0f, 0.0f);
- vec3 DirectionalLightDirection1 = normalize(vec3(-2.0f, -2.0f, -2.0f));
+ vec3 DirectionalLightDirection1 = normalize(vec3(-0.0f, -1.0f, -0.0f));
fUVs = aUV;
gl_Position = uProjection * uView * world_Position;
worldNormal = (uModel * vec4(aNormal, 0.0f)).xyz;
- SpecularCosPoint1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((uProjection * uView * vec4(reflect(-PointLightPosition1, worldNormal), 0.0f)).xyz)), 0, 1);
- SpecularCosDirection1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((uProjection * uView * vec4(reflect(-DirectionalLightDirection1, worldNormal), 0.0f)).xyz)), 0, 1);
+ //SpecularCosPoint1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((uProjection * uView * vec4(reflect(-PointLightPosition1, worldNormal), 0.0f)).xyz)), 0, 1);
+ //SpecularCosDirection1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((uProjection * uView * vec4(reflect(-DirectionalLightDirection1, worldNormal), 0.0f)).xyz)), 0, 1);
+ cameraVec = cameraPos - world_Position.xyz;
//worldnormal = vec3(SpecularCos, SpecularCos, SpecularCos);
//Fragment Shader
#version 330
-in vec3 worldNormal, worldLightPoint1;
+in vec3 worldNormal, worldLightPoint1, DirectionalLightDirection1, cameraVec;
in vec2 fUVs;
in float visNormal, SpecularCosPoint1, SpecularCosDirection1;
vec4 uvColor = texture(uColorTexture, fUVs);
- vec3 AmbientLightColor = vec3(0.2f, 0.2f, 0.2f);
+ vec3 AmbientLightColor = 0 * vec3(0.2f, 0.2f, 0.2f);
vec3 PointLightDirection1 = normalize(worldLightPoint1);
- vec3 PointLightColor1 = vec3(30.0f, 30.0f, 30.0f);
+ vec3 PointLightColor1 = 0 * vec3(30.0f, 30.0f, 30.0f);
- vec3 DirectionalLightDirection1 = normalize(vec3(-2.0f, -2.0f, -2.0f));
- vec3 DirectionalLightColor1 = vec3(0.6f, 0.6f, 0.6f);
+ vec3 DirectionalLightColor1 = vec3(5.6f, 5.6f, 5.6f);
- float cosThetaPoint1 = clamp(dot(normal, PointLightDirection1), 0, 1);
- float cosThetaDirection1 = clamp(dot(normal, DirectionalLightDirection1), 0, 1);
+ //float cosThetaPoint1 = clamp(dot(normal, PointLightDirection1), 0, 1);
+ //float cosThetaDirection1 = clamp(dot(normal, DirectionalLightDirection1), 0, 1);
+ float cosThetaPoint1 = clamp(dot(cameraVec, PointLightDirection1), 0, 1);
+ float cosThetaDirection1 = clamp(dot(cameraVec, DirectionalLightDirection1), 0, 1);
float squaredist1 = worldLightPoint1.x * worldLightPoint1.x + worldLightPoint1.y * worldLightPoint1.y + worldLightPoint1.z * worldLightPoint1.z;
FragmentColor = vec4(uvColor.rgb * (AmbientLightColor * material[0]
- + PointLightColor1 * material[1] * (cosThetaPoint1 + pow(SpecularCosPoint1, specularConst)) / squaredist1
- + DirectionalLightColor1 * material[2] * (cosThetaDirection1 + pow(SpecularCosDirection1, specularConst))
+ //+ PointLightColor1 * material[1] * (cosThetaPoint1 + pow(SpecularCosPoint1, specularConst)) / squaredist1
+ + PointLightColor1 * material[1] * (pow(cosThetaPoint1, specularConst)) / squaredist1
+ //+ DirectionalLightColor1 * material[2] * (cosThetaDirection1 + pow(SpecularCosDirection1, specularConst))
+ + DirectionalLightColor1 * material[2] * (pow(cosThetaDirection1, specularConst))
), uvColor.a);