|
From: <axl...@us...> - 2009-08-14 03:22:25
|
Revision: 477
http://hgengine.svn.sourceforge.net/hgengine/?rev=477&view=rev
Author: axlecrusher
Date: 2009-08-14 01:56:19 +0000 (Fri, 14 Aug 2009)
Log Message:
-----------
try a different attenuation
Modified Paths:
--------------
Mercury2/Themes/default/Graphic/pointLight.frag
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Modified: Mercury2/Themes/default/Graphic/pointLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-12 03:42:02 UTC (rev 476)
+++ Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-14 01:56:19 UTC (rev 477)
@@ -41,9 +41,11 @@
if( dist > HG_LightAtten.w ) discard;
- float att = HG_LightColor.a / (HG_LightAtten.x + HG_LightAtten.y * dist +
- HG_LightAtten.z * dist * dist);
+// float att = HG_LightColor.a / (HG_LightAtten.x + HG_LightAtten.y * dist+
+// HG_LightAtten.z * dist * dist);
+ float att = ((HG_LightAtten.w - (HG_LightAtten.y * dist) - (HG_LightAtten.z * dist * dist))/HG_LightAtten.w) * HG_LightColor.a;
+
vec3 diffuse = texture2D(HG_Texture1, coord).rgb;
vec3 R = reflect(-lightDir, norm);
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-12 03:42:02 UTC (rev 476)
+++ Mercury2/src/Light.cpp 2009-08-14 01:56:19 UTC (rev 477)
@@ -33,6 +33,7 @@
m_worldPosition = FindModelViewMatrix();
m_worldPosition2 = FindGlobalMatrix();
CURRENTRENDERGRAPH->AddDifferedLight( this );
+// m_boundingVolume->Render();
// m_parent = node;
}
@@ -40,6 +41,8 @@
{
if ( !node.Attribute("atten").empty() )
StrTo3Float(node.Attribute("atten"), m_atten);
+
+ ComputeRadius();
if ( !node.Attribute("power").empty() )
m_power = StrToFloat(node.Attribute("power"), 1.0);
@@ -47,6 +50,9 @@
if ( !node.Attribute("fullscreen").empty() )
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+ if ( !node.Attribute("radius").empty() )
+ m_radius = StrToFloat(node.Attribute("radius"), 1.0);
+
if ( !node.Attribute("shader").empty() )
{
MString key = node.Attribute("shader");
@@ -63,8 +69,8 @@
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
}
- ComputeRadius();
-
+ BuildBoundingBox();
+
MercuryNode::LoadFromXML( node );
}
@@ -116,7 +122,10 @@
m_radius = Clamp<float>(0.0f, 1000.0f, d);
printf("light radius %f\n", m_radius);
+}
+void Light::BuildBoundingBox()
+{
SAFE_DELETE( m_boundingVolume );
m_boundingVolume = new BoundingBox(MercuryVertex(0,0,0), MercuryVertex(m_radius,m_radius,m_radius) );
}
Modified: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h 2009-08-12 03:42:02 UTC (rev 476)
+++ Mercury2/src/Light.h 2009-08-14 01:56:19 UTC (rev 477)
@@ -30,6 +30,7 @@
private:
void StrTo3Float(const MString& s, float* a);
void ComputeRadius();
+ void BuildBoundingBox();
float m_atten[3];
float m_color[3];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|