WIP, falloff things.

# Conflicts:
#	resources/Schema/Components/PointLight.xsd
#	resources/Shaders/ForwardPlus.frag.glsl
This commit is contained in:
Tleety
2016-01-11 16:50:38 +01:00
parent fa6dd2dc67
commit 24ba3ae1f6
4 changed files with 5 additions and 15 deletions
-2
View File
@@ -35,8 +35,6 @@ private:
//----------------------Variables----------------------//
EventBroker* m_EventBroker;
int m_bi = 0;
std::shared_ptr<DebugCameraInputController<Renderer>> m_DebugCameraInputController;
Texture* m_ErrorTexture;
+1 -1
View File
@@ -12,7 +12,7 @@
<xs:element name="Color" type="t:Color" minOccurs="0"/>
<xs:element name="Radius" type="t:double" minOccurs="0"/>
<xs:element name="Intensity" type="t:double" minOccurs="0"/>
<xs:element name="Falloff" type="t:double" minOccurs="0"/>
<xs:element name="Falloff" type="t:double" minOccurs="0" minInclusive="0" maxInclusive="1"/>
<xs:element name="Visible" type="t:bool" minOccurs="0"/>
</xs:all>
</xs:complexType>
+4 -4
View File
@@ -56,7 +56,7 @@ struct LightResult {
vec4 Specular;
};
float CalcAttenuation(float radius, float dist) {
float CalcAttenuation(float radius, float dist, float falloff) {
return 1.0 - smoothstep(radius * 0.3, radius, dist);
}
@@ -71,13 +71,13 @@ vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
return lightColor * power;
}
LightResult CalcPointLight(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal)
LightResult CalcPointLight(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
{
vec4 L = lightPos - position;
float dist = length(L);
L = normalize(L);
float attenuation = CalcAttenuation(lightRadius, dist);
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
LightResult result;
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
@@ -108,7 +108,7 @@ void main()
{
int l = int(LightIndex[i]);
LightResult result = CalcPointLight(V * PointLights.List[l].Position, PointLights.List[l].Radius, PointLights.List[l].Color, PointLights.List[l].Intensity, viewVec, position, normal);
LightResult result = CalcPointLight(V * PointLights.List[l].Position, PointLights.List[l].Radius, PointLights.List[l].Color, PointLights.List[l].Intensity, viewVec, position, normal, PointLights.List[i].Falloff);
totalLighting.Diffuse += result.Diffuse;
totalLighting.Specular += result.Specular;
-8
View File
@@ -91,14 +91,6 @@ void Renderer::Update(double dt)
void Renderer::Draw(RenderQueueCollection& rq)
{
FillDepth(rq);
if (m_bi == 1) {
for (auto i : rq.Forward) {
printf("D: %f| \n", i->Depth);
}
m_bi = 0;
printf("------THE END------");
}
m_bi++;
m_PickingPass->Draw(rq);
//DrawScreenQuad(m_PickingPass->PickingTexture());
m_LightCullingPass->FillLightList(rq);