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:
@@ -28,12 +28,16 @@ std::string KRDirectionalLight::getElementName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
KRVector3 KRDirectionalLight::getWorldLightDirection() {
|
KRVector3 KRDirectionalLight::getWorldLightDirection() {
|
||||||
|
const GLfloat PI = 3.14159265;
|
||||||
|
const GLfloat d2r = PI * 2 / 360;
|
||||||
|
|
||||||
KRVector3 world_rotation = getLocalRotation();
|
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;
|
KRMat4 m;
|
||||||
m.rotate(world_rotation.x, X_AXIS);
|
m.rotate(world_rotation.x, X_AXIS);
|
||||||
m.rotate(world_rotation.y, Y_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);
|
KRVector3 light_direction = m.dot(light_rotation);
|
||||||
return light_direction;
|
return light_direction;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1225,13 +1225,13 @@ double const PI = 3.141592653589793f;
|
|||||||
|
|
||||||
-(double)getParameterMinWithIndex: (int)i
|
-(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];
|
return minValues[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(double)getParameterMaxWithIndex: (int)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];
|
return maxValues[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
class KRLight : public KRNode {
|
class KRLight : public KRNode {
|
||||||
public:
|
public:
|
||||||
static const float KRLIGHT_MIN_INFLUENCE = 0.10f;
|
static const float KRLIGHT_MIN_INFLUENCE = 0.05f;
|
||||||
|
|
||||||
virtual ~KRLight();
|
virtual ~KRLight();
|
||||||
virtual std::string getElementName() = 0;
|
virtual std::string getElementName() = 0;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void main()
|
|||||||
|
|
||||||
#if GBUFFER_PASS == 3
|
#if GBUFFER_PASS == 3
|
||||||
lowp vec4 gbuffer_sample = texture2D(gbuffer_frame, gbuffer_uv);
|
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;
|
lowp float gbuffer_specular_factor = gbuffer_sample.a;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -57,5 +57,5 @@ void main()
|
|||||||
specularFactor = clamp(pow(dot(halfVec,normalize(gbuffer_normal)), gbuffer_specular_exponent), 0.0, 1.0);
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,5 @@ void main()
|
|||||||
specularFactor = clamp(pow(dot(halfVec,normalize(gbuffer_normal)), gbuffer_specular_exponent), 0.0, 1.0);
|
specularFactor = clamp(pow(dot(halfVec,normalize(gbuffer_normal)), gbuffer_specular_exponent), 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gl_FragColor = vec4(light_color * lamberFactor * 0.2, specularFactor) * light_attenuation;
|
||||||
gl_FragColor = vec4(light_color * lamberFactor, specularFactor) * light_attenuation;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
[renderEngine loadResource: path];
|
[renderEngine loadResource: path];
|
||||||
}
|
}
|
||||||
|
|
||||||
[renderEngine setNearZ: 100.0];
|
[renderEngine setNearZ: 150.0];
|
||||||
[renderEngine setFarZ: 3000.0];
|
[renderEngine setFarZ: 3000.0];
|
||||||
//[renderEngine setNearZ: 1.0];
|
//[renderEngine setNearZ: 1.0];
|
||||||
//[renderEngine setFarZ: 3000.0];
|
//[renderEngine setFarZ: 3000.0];
|
||||||
|
|||||||
Reference in New Issue
Block a user