Adjusted point light cutoff level

Corrected directional light post-rotation
Fixed engine parameter value mapping

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4057
This commit is contained in:
kearwood
2012-05-11 01:06:29 +00:00
parent dfdc8c69b8
commit 0b76fadeef
7 changed files with 13 additions and 10 deletions

View File

@@ -28,12 +28,16 @@ std::string KRDirectionalLight::getElementName() {
}
KRVector3 KRDirectionalLight::getWorldLightDirection() {
const GLfloat PI = 3.14159265;
const GLfloat d2r = PI * 2 / 360;
KRVector3 world_rotation = getLocalRotation();
KRVector3 light_rotation = KRVector3(0.0, 0.0, 1.0);
KRVector3 light_rotation = KRVector3(0.0, 0.0, -1.0);
KRMat4 m;
m.rotate(world_rotation.x, X_AXIS);
m.rotate(world_rotation.y, Y_AXIS);
m.rotate(world_rotation.z, Z_AXIS);
m.rotate(world_rotation.z, X_AXIS);
m.rotate(-90.0 * d2r, Y_AXIS);
KRVector3 light_direction = m.dot(light_rotation);
return light_direction;
}

View File

@@ -1225,13 +1225,13 @@ double const PI = 3.141592653589793f;
-(double)getParameterMinWithIndex: (int)i
{
double minValues[32] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
double minValues[33] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
return minValues[i];
}
-(double)getParameterMaxWithIndex: (int)i
{
double maxValues[32] = {PI, 2.0f * PI, PI, 3.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 2.0f, 1.0f, 1.0f, 1.0f, 5.0f, 1.0f, 0.5f, 1.0f, 2.0f, 2.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
double maxValues[33] = {PI, 2.0f * PI, PI, 3.0f, 1.0f, 1.0, 1.0f, 1.0f, 1.0f, 1.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f, 2.0f, 1.0f, 1.0f, 1.0f, 5.0f, 1.0f, 0.5f, 1.0f, 2.0f, 2.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
return maxValues[i];
}

View File

@@ -14,7 +14,7 @@
class KRLight : public KRNode {
public:
static const float KRLIGHT_MIN_INFLUENCE = 0.10f;
static const float KRLIGHT_MIN_INFLUENCE = 0.05f;
virtual ~KRLight();
virtual std::string getElementName() = 0;

View File

@@ -126,7 +126,7 @@ void main()
#if GBUFFER_PASS == 3
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
lowp vec3 gbuffer_lamber_factor = gbuffer_sample.rgb;
mediump vec3 gbuffer_lamber_factor = gbuffer_sample.rgb * 5.0;
lowp float gbuffer_specular_factor = gbuffer_sample.a;
#endif

View File

@@ -57,5 +57,5 @@ void main()
specularFactor = clamp(pow(dot(halfVec,normalize(gbuffer_normal)), gbuffer_specular_exponent), 0.0, 1.0);
}
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_intensity;
gl_FragColor = vec4(light_color * lamberFactor * 0.2, specularFactor) * light_intensity;
}

View File

@@ -69,6 +69,5 @@ void main()
specularFactor = clamp(pow(dot(halfVec,normalize(gbuffer_normal)), gbuffer_specular_exponent), 0.0, 1.0);
}
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
gl_FragColor = vec4(light_color * lamberFactor * 0.2, specularFactor) * light_attenuation;
}

View File

@@ -108,7 +108,7 @@
[renderEngine loadResource: path];
}
[renderEngine setNearZ: 100.0];
[renderEngine setNearZ: 150.0];
[renderEngine setFarZ: 3000.0];
//[renderEngine setNearZ: 1.0];
//[renderEngine setFarZ: 3000.0];