#include "AmbientLight.h"
+#include "../Shader.h"
AmbientLight::AmbientLight(const vec3 & _color) :
Light(_color)
{
+ Shader::getShader(SH_LIGHTING)->useShader();
+ Shader::getShader(SH_ACTIVE)->setUniformLocation("AmbientLightColor", color);
}
AmbientLight::~AmbientLight()
{
+
}
\ No newline at end of file
direction(normalize(_direction))
{
lightview = lookAt(direction, vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f));
- proj = scale(vec3(size));
- invproj = scale(vec3(1 / size));
+ proj = scale(vec3(1 / size));
+ invproj = scale(vec3(size));
Shader::getShader(SH_LIGHTING)->useShader();
Shader::getShader(SH_ACTIVE)->setUniformLocation("DirectionalLightDirection", direction);
{
size = _size;
- proj = scale(vec3(size));
- invproj = scale(vec3(1 / size));
+ proj = scale(vec3(1 / size));
+ invproj = scale(vec3(size));
}
void DirectionalLight::changeDirection(const vec3& _direction)
lookat(_lookat)
{
//Lights
- dirLight = new DirectionalLight(vec3(1.2f), 0.2f, vec3(-1.f, -0.5f, -0.5f));
+ ambLight = new AmbientLight(vec3(0.25f));
+ dirLight = new DirectionalLight(vec3(0.4f), 30.0f, vec3(1.f, -0.5f, -0.5f));
//dirLight = new DirectionalLight(vec3(1.2f), 0.2f, vec3(0.0f, 0.0f, -1.0f));
fBufferObject* shadowdir;
DirectionalLight* dirLight;
+ AmbientLight* ambLight;
};
uniform sampler2D uPointLightXP;
uniform vec4 material; //vec4 in the form (ambient, point, directional, glossyness); so far it was (1, 1, 1, 3)
uniform vec3 dirLightColor;
+uniform vec3 AmbientLightColor;
float DirLightCalcShadowFactor(vec4 LightSpacePos)
{
float z = 0.5f * ProjCoords.z + 0.5f;
if (UVCoords.x < 0 || UVCoords.x > 1 || UVCoords.y < 0 || UVCoords.y > 1 || z < 0 || z > 1)
- return 0.0f;
+ return 1.0f;
float Depth = texture(uPointLightXP, UVCoords).x;
if (Depth < (z + 0.00001f))
float specularConst = material[3];
vec4 uvColor = texture(uColorTexture, fUVs);
- vec3 AmbientLightColor = .5f * vec3(0.1f, 0.1f, 0.1f);
- vec3 PointLightColor1 = 2 * vec3(1.0f, 1.0f, 1.0f);
+ vec3 PointLightColor1 = vec3(2.0f, 2.0f, 2.0f);
vec3 cameraVec = normalize(eyePosition);
vec3 worldPointLightDir1 = PointLightPosition1 - eyePosition;