You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(46) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(185) |
Feb
(242) |
Mar
(237) |
Apr
(180) |
May
(102) |
Jun
(278) |
Jul
(114) |
Aug
(92) |
Sep
(246) |
Oct
(212) |
Nov
(279) |
Dec
(99) |
| 2007 |
Jan
(130) |
Feb
(194) |
Mar
(22) |
Apr
(72) |
May
(40) |
Jun
(111) |
Jul
(114) |
Aug
(154) |
Sep
(114) |
Oct
(2) |
Nov
(1) |
Dec
(5) |
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(51) |
Nov
(34) |
Dec
(130) |
| 2009 |
Jan
(22) |
Feb
(20) |
Mar
(41) |
Apr
(45) |
May
(82) |
Jun
(96) |
Jul
(48) |
Aug
(90) |
Sep
(13) |
Oct
(49) |
Nov
(31) |
Dec
(21) |
| 2010 |
Jan
(25) |
Feb
(9) |
Mar
(7) |
Apr
(28) |
May
(27) |
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(13) |
Dec
(2) |
| 2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <axl...@us...> - 2009-08-10 00:49:43
|
Revision: 469
http://hgengine.svn.sourceforge.net/hgengine/?rev=469&view=rev
Author: axlecrusher
Date: 2009-08-10 00:49:35 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
assets can't be culled because they are instanced
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Mercury2/src/HGMDLModel.cpp
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-10 00:49:35 UTC (rev 469)
@@ -17,8 +17,8 @@
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
<asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <node type="light" atten="0.7,0,30" power="4.0" shader="GRAPHIC:pointLight" />
</node>
+ <node type="light" atten="0.7,0,30" power="4.0" shader="GRAPHIC:pointLight" />
<node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
<node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
<asset type="texture" file="GRAPHIC:flame.png"/>
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/HGMDLModel.cpp 2009-08-10 00:49:35 UTC (rev 469)
@@ -69,7 +69,6 @@
for(uint16_t i = 0; i < m_meshes.size(); ++i)
culled = culled && m_meshes[i]->DoCullingTests(n, matrix);
}
- m_culled = culled;
return culled;
}
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-10 00:49:35 UTC (rev 469)
@@ -6,7 +6,7 @@
extern bool DOOCCLUSIONCULL;
MercuryAsset::MercuryAsset()
- :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE), m_culled(false)
+ :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE)
{
}
@@ -48,7 +48,6 @@
if ( !culled && DOOCCLUSIONCULL)
m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
}
- m_culled = culled;
return culled;
}
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/MercuryAsset.h 2009-08-10 00:49:35 UTC (rev 469)
@@ -57,8 +57,6 @@
inline void SetExcludeFromCull(bool t) { m_excludeFromCull = t; }
inline bool ExcludeFromCull() const { return m_excludeFromCull; }
-
- inline bool IsCulled() const { return m_culled; }
protected:
void SetLoadState(LoadState ls); //thread safe
LoadState GetLoadState(); //thread safe
@@ -66,7 +64,6 @@
bool m_isInstanced;
BoundingVolume* m_boundingVolume;
MString m_path;
- bool m_culled;
private:
LoadState m_loadState;
MSemaphore m_lock;
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-10 00:39:17 UTC (rev 468)
+++ Mercury2/src/MercuryNode.cpp 2009-08-10 00:49:35 UTC (rev 469)
@@ -250,10 +250,7 @@
{
list< MercuryAsset* >::iterator i;
for (i = m_render.begin(); i != m_render.end(); ++i )
- {
- if ( !(*i)->IsCulled() )
- (*i)->Render(this);
- }
+ (*i)->Render(this);
}
void MercuryNode::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-10 00:39:30
|
Revision: 468
http://hgengine.svn.sourceforge.net/hgengine/?rev=468&view=rev
Author: axlecrusher
Date: 2009-08-10 00:39:17 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
updates
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Mercury2/Themes/default/Graphic/globalLight.frag
Mercury2/Themes/default/Graphic/pointLight.frag
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-10 00:38:39 UTC (rev 467)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-10 00:39:17 UTC (rev 468)
@@ -1,6 +1,8 @@
<SceneGraph name="root">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
+ <asset type="texture" file="screenFBO_0" dynamic="true"/>
+ <asset type="texture" file="screenFBO_1" dynamic="true"/>
<node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
<asset type="shader" file="GRAPHIC:differedStep1"/>
<node type="transformnode" movz="0" movx="0" movy="2">
@@ -15,7 +17,7 @@
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
<asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <node type="light" atten="0.7,5,0" shader="GRAPHIC:pointLight" />
+ <node type="light" atten="0.7,0,30" power="4.0" shader="GRAPHIC:pointLight" />
</node>
<node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
<node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
@@ -35,8 +37,6 @@
</node>
</node>
- <asset type="texture" file="screenFBO_0" dynamic="true"/>
- <asset type="texture" file="screenFBO_1" dynamic="true"/>
<asset type="renderdifferedlights"/>
</node>
</node>
Modified: Mercury2/Themes/default/Graphic/globalLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/globalLight.frag 2009-08-10 00:38:39 UTC (rev 467)
+++ Mercury2/Themes/default/Graphic/globalLight.frag 2009-08-10 00:39:17 UTC (rev 468)
@@ -47,7 +47,7 @@
if( dist > HG_LightAtten.w ) discard;
- float att = 1.0 / (HG_LightAtten.x + HG_LightAtten.y * dist +
+ float att = HG_LightColor.a / (HG_LightAtten.x + HG_LightAtten.y * dist +
HG_LightAtten.z * dist * dist);
vec3 diffuse = texture2D(HG_Texture1, coord).rgb;
@@ -59,7 +59,7 @@
vec3 color = diffuse;
- color += specular;
+ color += specular*float(NdotL>0.0); //no speculat on back faces
color *= att;
gl_FragColor.rgb = clamp(color, 0.0, 1.0);
Modified: Mercury2/Themes/default/Graphic/pointLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-10 00:38:39 UTC (rev 467)
+++ Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-10 00:39:17 UTC (rev 468)
@@ -41,7 +41,7 @@
if( dist > HG_LightAtten.w ) discard;
- float att = 1.0 / (HG_LightAtten.x + HG_LightAtten.y * dist +
+ float att = HG_LightColor.a / (HG_LightAtten.x + HG_LightAtten.y * dist +
HG_LightAtten.z * dist * dist);
vec3 diffuse = texture2D(HG_Texture1, coord).rgb;
@@ -53,7 +53,7 @@
vec3 color = diffuse;
- color += specular;
+ color += specular*float(NdotL>0.0); //no speculat on back faces
color *= att;
gl_FragColor.rgb = clamp(color, 0.0, 1.0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-10 00:38:46
|
Revision: 467
http://hgengine.svn.sourceforge.net/hgengine/?rev=467&view=rev
Author: axlecrusher
Date: 2009-08-10 00:38:39 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
updates
Modified Paths:
--------------
Mercury2/src/HGMDLModel.cpp
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryFBO.h
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/HGMDLModel.cpp 2009-08-10 00:38:39 UTC (rev 467)
@@ -69,6 +69,7 @@
for(uint16_t i = 0; i < m_meshes.size(); ++i)
culled = culled && m_meshes[i]->DoCullingTests(n, matrix);
}
+ m_culled = culled;
return culled;
}
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/Light.cpp 2009-08-10 00:38:39 UTC (rev 467)
@@ -16,15 +16,20 @@
m_color[0] = m_color[1] = m_color[2] = 1.0f;
m_radius = 0.0f;
m_fullscreen = false;
+ m_power = 1.0f;
}
Light::~Light()
{
}
+void Light::PreRender(const MercuryMatrix& matrix)
+{
+ SetCulled( m_boundingVolume->DoFrustumTest( matrix ) );
+}
+
void Light::Render(const MercuryMatrix& matrix)
{
-// printf("render!\n");
m_worldPosition = FindModelViewMatrix();
m_worldPosition2 = FindGlobalMatrix();
CURRENTRENDERGRAPH->AddDifferedLight( this );
@@ -36,6 +41,9 @@
if ( !node.Attribute("atten").empty() )
StrTo3Float(node.Attribute("atten"), m_atten);
+ if ( !node.Attribute("power").empty() )
+ m_power = StrToFloat(node.Attribute("power"), 1.0);
+
if ( !node.Attribute("fullscreen").empty() )
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
@@ -74,7 +82,7 @@
{
//300 ensures that RGB of 255 reaches 0
//at 50, 255 is about 5. Close enough for me
- const float maxDenom = 50;//300;
+ const float maxDenom = 50;
float a = m_atten[2]; //quadratic
float b = m_atten[1]; //linear
float c = m_atten[0]; //constant
@@ -99,11 +107,16 @@
float s = SQRT((b*b)-(4*a*c));
float x1 = ((-b) - s)/bottom;
float x2 = ((-b) + s)/bottom;
+ x1 = x1>=0?x1:-x1;
+ x2 = x2>=0?x2:-x2;
d = MAX<float>(x1,x2);
}
+ d = m_power * d;
m_radius = Clamp<float>(0.0f, 1000.0f, d);
+ printf("light radius %f\n", m_radius);
+
SAFE_DELETE( m_boundingVolume );
m_boundingVolume = new BoundingBox(MercuryVertex(0,0,0), MercuryVertex(m_radius,m_radius,m_radius) );
}
@@ -143,6 +156,7 @@
sa.value.fFloatV4[0] = m_color[0];
sa.value.fFloatV4[1] = m_color[1];
sa.value.fFloatV4[2] = m_color[2];
+ sa.value.fFloatV4[3] = m_power;
Shader::SetAttribute("HG_LightColor", sa);
if (m_fullscreen)
Modified: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/Light.h 2009-08-10 00:38:39 UTC (rev 467)
@@ -16,8 +16,7 @@
/** PreRender should be called before any real openGL render commands.
It is used to handles things like frustum culling, and occlusion culling.
Currently only occlusion culling test is run here.**/
-// virtual void PreRender(const MercuryNode* node);
-
+ virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
// virtual void PostRender(const MercuryNode* node) {};
@@ -35,6 +34,7 @@
float m_atten[3];
float m_color[3];
float m_radius;
+ float m_power;
MercuryMatrix m_worldPosition;
MercuryMatrix m_worldPosition2;
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-10 00:38:39 UTC (rev 467)
@@ -6,7 +6,7 @@
extern bool DOOCCLUSIONCULL;
MercuryAsset::MercuryAsset()
- :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE)
+ :m_isInstanced(false), m_boundingVolume(NULL), m_loadState(NONE), m_culled(false)
{
}
@@ -48,6 +48,7 @@
if ( !culled && DOOCCLUSIONCULL)
m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
}
+ m_culled = culled;
return culled;
}
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/MercuryAsset.h 2009-08-10 00:38:39 UTC (rev 467)
@@ -57,6 +57,8 @@
inline void SetExcludeFromCull(bool t) { m_excludeFromCull = t; }
inline bool ExcludeFromCull() const { return m_excludeFromCull; }
+
+ inline bool IsCulled() const { return m_culled; }
protected:
void SetLoadState(LoadState ls); //thread safe
LoadState GetLoadState(); //thread safe
@@ -64,6 +66,7 @@
bool m_isInstanced;
BoundingVolume* m_boundingVolume;
MString m_path;
+ bool m_culled;
private:
LoadState m_loadState;
MSemaphore m_lock;
Modified: Mercury2/src/MercuryFBO.h
===================================================================
--- Mercury2/src/MercuryFBO.h 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/MercuryFBO.h 2009-08-10 00:38:39 UTC (rev 467)
@@ -34,18 +34,10 @@
uint32_t m_fboID, m_depthBufferID;
bool m_initiated, m_useDepth, m_useScreenSize;
uint16_t m_width, m_height;
-// uint32_t m_textureID[4];
MAutoPtr< Texture > m_textures[4];
uint8_t m_numTextures;
ColorByteType m_cbt[4];
-
-// static uint32_t m_lastRendered;
-
-// uint32_t m_lastInStask;
-
protected:
-// AlignedBuffer<float> m_vertexData;
-// AlignedBuffer<uint16_t> m_indexData;
};
#endif
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-09 01:14:31 UTC (rev 466)
+++ Mercury2/src/MercuryNode.cpp 2009-08-10 00:38:39 UTC (rev 467)
@@ -146,7 +146,10 @@
PreRender( matrix ); //calls on children assets
for (MercuryNode* child = FirstChild(); child != NULL; child = NextChild(child))
+ {
child->RecursivePreRender();
+ m_culled = m_culled && child->IsCulled();
+ }
}
void MercuryNode::RecursiveRender()
@@ -247,7 +250,10 @@
{
list< MercuryAsset* >::iterator i;
for (i = m_render.begin(); i != m_render.end(); ++i )
- (*i)->Render(this);
+ {
+ if ( !(*i)->IsCulled() )
+ (*i)->Render(this);
+ }
}
void MercuryNode::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-09 01:14:38
|
Revision: 466
http://hgengine.svn.sourceforge.net/hgengine/?rev=466&view=rev
Author: axlecrusher
Date: 2009-08-09 01:14:31 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
updates
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Mercury2/Themes/default/Graphic/differedStep1.frag
Mercury2/Themes/default/Graphic/differedStep1.vert
Mercury2/Themes/default/Graphic/globalLight.frag
Mercury2/Themes/default/Graphic/pointLight.frag
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-09 01:13:57 UTC (rev 465)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-09 01:14:31 UTC (rev 466)
@@ -1,41 +1,38 @@
<SceneGraph name="root">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
<asset type="shader" file="GRAPHIC:differedStep1"/>
- <node type="light" atten="10,0,0" fullscreen="true" shader="GRAPHIC:globalLight" />
- <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
+ <node type="transformnode" movz="0" movx="0" movy="2">
+ <node type="light" atten="8,0,0" fullscreen="true" shader="GRAPHIC:globalLight" />
+ </node>
+ <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-1">
<asset type="texture" file="MODEL:map.png"/>
<asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
</node>
- <node type="mercurynode" name="lampForest" >
- <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
- <node type="mercurynode" name="lamp">
- <node type="transformnode" rotx="-90" >
- <asset type="texture" file="MODEL:lamp.png"/>
- <asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <node type="light" atten="0.7,50,0.0" shader="GRAPHIC:pointLight" />
+ <node type="transformnode" movz="-8" movx="-1" name="lamps">
+ <node type="mercurynode" name="lamp">
+ <node type="transformnode" rotx="-90" >
+ <asset type="texture" file="MODEL:lamp.png"/>
+ <asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
+ <node type="light" atten="0.7,5,0" shader="GRAPHIC:pointLight" />
+ </node>
+ <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
+ <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
+ <asset type="texture" file="GRAPHIC:flame.png"/>
+ <asset type="quad" />
</node>
- <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
- <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
- <asset type="texture" file="GRAPHIC:flame.png"/>
- <asset type="quad" />
- </node>
- </node>
</node>
- <node type="transformnode" movx="1" fallback="lamprow.lamp" />
- <node type="transformnode" movx="2" fallback="lamprow.lamp" />
- <node type="transformnode" movx="3" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-1" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-2" fallback="lamprow.lamp" />
- <node type="transformnode" movx="-3" fallback="lamprow.lamp" />
</node>
- <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
- <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
+ <node type="transformnode" fallback="lamps.lamp" movz="3"/>
+ <node type="transformnode" fallback="lamps.lamp" movz="6"/>
+ <node type="transformnode" fallback="lamps.lamp" movz="-4"/>
+ <node type="transformnode" fallback="lamps.lamp" movz="-7"/>
+
+ <node type="transformnode" fallback="lamps.lamp" movx="2" movz="4.5"/>
+ <node type="transformnode" fallback="lamps.lamp" movx="2" movz="1.5"/>
+ <node type="transformnode" fallback="lamps.lamp" movx="2" movz="-2.5"/>
+
</node>
</node>
<asset type="texture" file="screenFBO_0" dynamic="true"/>
Modified: Mercury2/Themes/default/Graphic/differedStep1.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-09 01:13:57 UTC (rev 465)
+++ Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-09 01:14:31 UTC (rev 466)
@@ -1,14 +1,15 @@
+uniform vec4 HG_DepthRange;
+uniform sampler2D HG_Texture2;
+
varying vec3 normal;
varying vec3 pos;
varying float dist;
-uniform vec4 HG_DepthRange;
-uniform vec4 HG_EyePos;
vec2 CartesianToSpherical(vec3 cartesian)
{
vec2 spherical;
- spherical.x = atan2(cartesian.y, cartesian.x) / 3.14159;
+ spherical.x = atan2(cartesian.y, cartesian.x) * 0.318310155;
spherical.y = cartesian.z;
return spherical * 0.5 + 0.5;
@@ -24,6 +25,6 @@
n.xy = CartesianToSpherical( n );
gl_FragData[0] = vec4( n.xy, d, 1.0);
-// gl_FragData[1] = vec4(pos, 1.0);
+ gl_FragData[1] = texture2D(HG_Texture2, gl_TexCoord[0].st);
}
Modified: Mercury2/Themes/default/Graphic/differedStep1.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-09 01:13:57 UTC (rev 465)
+++ Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-09 01:14:31 UTC (rev 466)
@@ -7,7 +7,7 @@
void main()
{
-// gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
vec4 n = vec4(gl_Normal, 0);
Modified: Mercury2/Themes/default/Graphic/globalLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/globalLight.frag 2009-08-09 01:13:57 UTC (rev 465)
+++ Mercury2/Themes/default/Graphic/globalLight.frag 2009-08-09 01:14:31 UTC (rev 466)
@@ -1,4 +1,6 @@
uniform sampler2D HG_Texture0;
+uniform sampler2D HG_Texture1;
+
uniform vec4 HG_EyePos;
uniform ivec4 HG_ViewPort;
uniform vec4 HG_LightPos;
@@ -7,7 +9,9 @@
uniform mat4 HG_ModelMatrix;
uniform vec4 HG_DepthRange;
+uniform vec4 HG_LookVector;
+
varying vec3 ecEye;
varying vec3 ecLight;
varying vec3 ecFrag;
@@ -38,29 +42,25 @@
float dist = length(lightDir);
lightDir /= dist; //normalize
-// gl_FragColor = vec4(vec3(mod(pos,0.998)), 1.0);
-// gl_FragColor = vec4((ray+1.0)*0.5, 1.0);
float NdotL = max(dot(norm, lightDir),0.0);
- if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
+ if( dist > HG_LightAtten.w ) discard;
- vec3 materialSpec = vec3(1.0,1.0,1.0);
- vec3 lightSpec = vec3(1.0,1.0,1.0);
-
- //x = constant, y = linear, z = quad
- float att = 1.0 / (HG_LightAtten.x +
- HG_LightAtten.y * dist +
+ float att = 1.0 / (HG_LightAtten.x + HG_LightAtten.y * dist +
HG_LightAtten.z * dist * dist);
- vec3 color = att * (HG_LightColor.rgb * NdotL);
+ vec3 diffuse = texture2D(HG_Texture1, coord).rgb;
- vec3 hv = normalize( lightDir+(ecEye-pos) );
- float NdotHV = max(dot(norm,hv),0.0);
+ vec3 R = reflect(-lightDir, norm);
+ vec3 specular = diffuse * pow( max(dot(R,HG_LookVector.xyz), 0.0), 10.0 );
- //pow(max(dot(H, normal.xyz), 0.0)
+ diffuse *= HG_LightColor.rgb * NdotL;
- color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 3.0);
- color = clamp(color, 0.0, 1.0);
- gl_FragColor = vec4(color, 1.0);
+ vec3 color = diffuse;
+
+ color += specular;
+ color *= att;
+
+ gl_FragColor.rgb = clamp(color, 0.0, 1.0);
}
Modified: Mercury2/Themes/default/Graphic/pointLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-09 01:13:57 UTC (rev 465)
+++ Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-09 01:14:31 UTC (rev 466)
@@ -1,11 +1,10 @@
uniform sampler2D HG_Texture0;
-uniform vec4 HG_EyePos;
+uniform sampler2D HG_Texture1;
+
uniform ivec4 HG_ViewPort;
-uniform vec4 HG_LightPos;
uniform vec4 HG_LightAtten;
uniform vec4 HG_LightColor;
-
-uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_LookVector;
uniform vec4 HG_DepthRange;
varying vec3 ecEye;
@@ -27,40 +26,35 @@
{
vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw - HG_ViewPort.xy);
vec4 t1 = texture2D(HG_Texture0, coord);
-// vec3 norm = texture2D(HG_Texture1, coord).rgb;
vec3 norm = SphericalToCartesian( t1.rg );
+ vec3 mDiffuse = texture2D(HG_Texture1, coord).rgb;
float depth = t1.b;
vec3 ray = ecFrag * (HG_DepthRange.y/-ecFrag.z);
vec3 pos = ray * depth;
- vec3 eyeVec = normalize(ecEye - pos);
vec3 lightDir = ecLight - pos;
float dist = length(lightDir);
lightDir /= dist; //normalize
-// gl_FragColor = vec4((norm+1.0)*0.5, 1.0);
-
float NdotL = max(dot(norm, lightDir),0.0);
- if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
+ if( dist > HG_LightAtten.w ) discard;
- vec3 materialSpec = vec3(1.0,1.0,1.0);
- vec3 lightSpec = vec3(1.0,1.0,1.0);
-
- //x = constant, y = linear, z = quad
- float att = 1.0 / (HG_LightAtten.x +
- HG_LightAtten.y * dist +
+ float att = 1.0 / (HG_LightAtten.x + HG_LightAtten.y * dist +
HG_LightAtten.z * dist * dist);
- vec3 color = att * (HG_LightColor.rgb * NdotL);
+ vec3 diffuse = texture2D(HG_Texture1, coord).rgb;
- vec3 hv = normalize( lightDir+(ecEye-pos) );
- float NdotHV = max(dot(norm,hv),0.0);
+ vec3 R = reflect(-lightDir, norm);
+ vec3 specular = diffuse * pow( max(dot(R,HG_LookVector.xyz), 0.0), 10.0 );
- //pow(max(dot(H, normal.xyz), 0.0)
+ diffuse *= HG_LightColor.rgb * NdotL;
- color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 100.0);
- color = clamp(color, 0.0, 1.0);
- gl_FragColor = vec4(color, 1.0);
+ vec3 color = diffuse;
+
+ color += specular;
+ color *= att;
+
+ gl_FragColor.rgb = clamp(color, 0.0, 1.0);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-09 01:14:05
|
Revision: 465
http://hgengine.svn.sourceforge.net/hgengine/?rev=465&view=rev
Author: axlecrusher
Date: 2009-08-09 01:13:57 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/src/Light.cpp
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-08 23:20:38 UTC (rev 464)
+++ Mercury2/src/Light.cpp 2009-08-09 01:13:57 UTC (rev 465)
@@ -14,7 +14,7 @@
{
m_atten[0] = m_atten[1] = m_atten[2] = 0.0f;
m_color[0] = m_color[1] = m_color[2] = 1.0f;
- m_radius = 1.0f;
+ m_radius = 0.0f;
m_fullscreen = false;
}
@@ -113,7 +113,8 @@
glLoadMatrix( m_worldPosition );
if ( !m_boundingVolume ) return;
- m_shader->Render( this );
+ if ( m_shader.IsValid() )
+ m_shader->Render( this );
BoundingBox* bb = (BoundingBox*)m_boundingVolume;
// bb->Render();
@@ -153,8 +154,8 @@
else
bb->RenderFaces();
- m_shader->PostRender( this);
-
+ if ( m_shader.IsValid() )
+ m_shader->PostRender( this);
}
/****************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-08 23:20:45
|
Revision: 464
http://hgengine.svn.sourceforge.net/hgengine/?rev=464&view=rev
Author: axlecrusher
Date: 2009-08-08 23:20:38 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
update
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-08 23:19:07 UTC (rev 463)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-08 23:20:38 UTC (rev 464)
@@ -3,8 +3,7 @@
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
<node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
<asset type="shader" file="GRAPHIC:differedStep1"/>
-<!-- <asset type="light" atten="10,0,0" fullscreen="true"/>
- <asset type="shader" file="GRAPHIC:test"/> -->
+ <node type="light" atten="10,0,0" fullscreen="true" shader="GRAPHIC:globalLight" />
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<asset type="texture" file="MODEL:map.png"/>
<asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
@@ -15,7 +14,7 @@
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
<asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <node type="light" atten="0.7,100,0.0" shader="GRAPHIC:differedStep2" />
+ <node type="light" atten="0.7,50,0.0" shader="GRAPHIC:pointLight" />
</node>
<node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
<node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-08 23:19:15
|
Revision: 463
http://hgengine.svn.sourceforge.net/hgengine/?rev=463&view=rev
Author: axlecrusher
Date: 2009-08-08 23:19:07 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
light shader updates
Modified Paths:
--------------
Mercury2/Themes/default/Graphic/differedStep1.frag
Added Paths:
-----------
Mercury2/Themes/default/Graphic/globalLight.frag
Mercury2/Themes/default/Graphic/globalLight.vert
Mercury2/Themes/default/Graphic/pointLight.frag
Mercury2/Themes/default/Graphic/pointLight.vert
Removed Paths:
-------------
Mercury2/Themes/default/Graphic/differedStep2.frag
Mercury2/Themes/default/Graphic/differedStep2.vert
Modified: Mercury2/Themes/default/Graphic/differedStep1.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-08 23:08:31 UTC (rev 462)
+++ Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-08 23:19:07 UTC (rev 463)
@@ -23,5 +23,7 @@
vec3 n = normalize(normal);
n.xy = CartesianToSpherical( n );
gl_FragData[0] = vec4( n.xy, d, 1.0);
+
+// gl_FragData[1] = vec4(pos, 1.0);
}
Deleted: Mercury2/Themes/default/Graphic/differedStep2.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-08 23:08:31 UTC (rev 462)
+++ Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-08 23:19:07 UTC (rev 463)
@@ -1,67 +0,0 @@
-uniform sampler2D HG_Texture0;
-uniform vec4 HG_EyePos;
-uniform ivec4 HG_ViewPort;
-uniform vec4 HG_LightPos;
-uniform vec4 HG_LightAtten;
-uniform vec4 HG_LightColor;
-
-uniform mat4 HG_ModelMatrix;
-uniform vec4 HG_DepthRange;
-
-varying vec3 ecEye;
-varying vec3 ecLight;
-varying vec3 ecFrag;
-
-vec3 SphericalToCartesian(vec2 spherical)
-{
- vec2 sinCosTheta, sinCosPhi;
-
- spherical = spherical * 2.0 - 1.0;
- sincos(spherical.x * 3.14159, sinCosTheta.x, sinCosTheta.y);
- sinCosPhi = vec2(sqrt(1.0 - spherical.y * spherical.y), spherical.y);
-
- return vec3(sinCosTheta.y * sinCosPhi.x, sinCosTheta.x * sinCosPhi.x, sinCosPhi.y);
-}
-
-void main()
-{
- vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw - HG_ViewPort.xy);
- vec4 t1 = texture2D(HG_Texture0, coord);
-// vec3 norm = texture2D(HG_Texture1, coord).rgb;
- vec3 norm = SphericalToCartesian( t1.rg );
- float depth = t1.b;
-
- vec3 ray = ecFrag * (HG_DepthRange.y/-ecFrag.z);
- vec3 pos = ray * depth;
-
- vec3 eyeVec = normalize(ecEye - pos);
- vec3 lightDir = ecLight - pos;
-
- float dist = length(lightDir);
- lightDir /= dist; //normalize
-// gl_FragColor = vec4(vec3(mod(depth,0.998)), 1.0);
-// gl_FragColor = vec4((norm+1.0)*0.5, 1.0);
-
- float NdotL = max(dot(norm, lightDir),0.0);
-
- if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
-
- vec3 materialSpec = vec3(1.0,1.0,1.0);
- vec3 lightSpec = vec3(1.0,1.0,1.0);
-
- //x = constant, y = linear, z = quad
- float att = 1.0 / (HG_LightAtten.x +
- HG_LightAtten.y * dist +
- HG_LightAtten.z * dist * dist);
-
- vec3 color = att * (HG_LightColor.rgb * NdotL);
-
- vec3 hv = normalize( lightDir+(ecEye-pos) );
- float NdotHV = max(dot(norm,hv),0.0);
-
- //pow(max(dot(H, normal.xyz), 0.0)
-
- color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 100.0);
- color = clamp(color, 0.0, 1.0);
- gl_FragColor = vec4(color, 1.0);
-}
Deleted: Mercury2/Themes/default/Graphic/differedStep2.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-08 23:08:31 UTC (rev 462)
+++ Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-08 23:19:07 UTC (rev 463)
@@ -1,20 +0,0 @@
-uniform mat4 HG_ModelMatrix;
-uniform vec4 HG_EyePos;
-uniform vec4 HG_LightPos;
-
-//uniform vec4 HG_NearClip;
-uniform vec4 HG_FarClip;
-//uniform vec4 HG_ClipExtends;
-
-varying vec3 ecEye;
-varying vec3 ecLight;
-varying vec3 ecFrag;
-
-void main()
-{
- gl_Position = ftransform();
- ecFrag = (gl_ModelViewMatrix * gl_Vertex).xyz; //world position
-
- ecEye = (gl_ModelViewMatrix * HG_EyePos).xyz;
- ecLight = (gl_ModelViewMatrix * vec4(0,0,0,1)).xyz;
-}
Added: Mercury2/Themes/default/Graphic/globalLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/globalLight.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/globalLight.frag 2009-08-08 23:19:07 UTC (rev 463)
@@ -0,0 +1,66 @@
+uniform sampler2D HG_Texture0;
+uniform vec4 HG_EyePos;
+uniform ivec4 HG_ViewPort;
+uniform vec4 HG_LightPos;
+uniform vec4 HG_LightAtten;
+uniform vec4 HG_LightColor;
+
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_DepthRange;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
+vec3 SphericalToCartesian(vec2 spherical)
+{
+ vec2 sinCosTheta, sinCosPhi;
+
+ spherical = spherical * 2.0 - 1.0;
+ sincos(spherical.x * 3.14159, sinCosTheta.x, sinCosTheta.y);
+ sinCosPhi = vec2(sqrt(1.0 - spherical.y * spherical.y), spherical.y);
+
+ return vec3(sinCosTheta.y * sinCosPhi.x, sinCosTheta.x * sinCosPhi.x, sinCosPhi.y);
+}
+
+void main()
+{
+ vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw - HG_ViewPort.xy);
+ vec4 t1 = texture2D(HG_Texture0, coord);
+ vec3 norm = SphericalToCartesian( t1.rg );
+ float depth = t1.b;
+
+ vec3 ray = ecFrag * (HG_DepthRange.y/-ecFrag.z);
+ vec3 pos = ray * depth;
+
+ vec3 eyeVec = normalize(ecEye - pos);
+ vec3 lightDir = ecLight - pos;
+
+ float dist = length(lightDir);
+ lightDir /= dist; //normalize
+// gl_FragColor = vec4(vec3(mod(pos,0.998)), 1.0);
+// gl_FragColor = vec4((ray+1.0)*0.5, 1.0);
+
+ float NdotL = max(dot(norm, lightDir),0.0);
+
+ if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
+
+ vec3 materialSpec = vec3(1.0,1.0,1.0);
+ vec3 lightSpec = vec3(1.0,1.0,1.0);
+
+ //x = constant, y = linear, z = quad
+ float att = 1.0 / (HG_LightAtten.x +
+ HG_LightAtten.y * dist +
+ HG_LightAtten.z * dist * dist);
+
+ vec3 color = att * (HG_LightColor.rgb * NdotL);
+
+ vec3 hv = normalize( lightDir+(ecEye-pos) );
+ float NdotHV = max(dot(norm,hv),0.0);
+
+ //pow(max(dot(H, normal.xyz), 0.0)
+
+ color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 3.0);
+ color = clamp(color, 0.0, 1.0);
+ gl_FragColor = vec4(color, 1.0);
+}
Added: Mercury2/Themes/default/Graphic/globalLight.vert
===================================================================
--- Mercury2/Themes/default/Graphic/globalLight.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/globalLight.vert 2009-08-08 23:19:07 UTC (rev 463)
@@ -0,0 +1,21 @@
+uniform mat4 HG_ModelMatrix;
+uniform mat4 HG_ViewMatrix;
+uniform vec4 HG_EyePos;
+uniform vec4 HG_LightPos;
+
+//uniform vec4 HG_NearClip;
+uniform vec4 HG_FarClip;
+//uniform vec4 HG_ClipExtends;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
+void main()
+{
+ gl_Position = ftransform();
+ ecFrag = (gl_ModelViewMatrix * gl_Vertex).xyz; //world position
+
+ ecEye = (gl_ModelViewMatrix * HG_EyePos).xyz;
+ ecLight = (HG_ViewMatrix * HG_ModelMatrix * HG_LightPos).xyz;
+}
Added: Mercury2/Themes/default/Graphic/pointLight.frag
===================================================================
--- Mercury2/Themes/default/Graphic/pointLight.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/pointLight.frag 2009-08-08 23:19:07 UTC (rev 463)
@@ -0,0 +1,66 @@
+uniform sampler2D HG_Texture0;
+uniform vec4 HG_EyePos;
+uniform ivec4 HG_ViewPort;
+uniform vec4 HG_LightPos;
+uniform vec4 HG_LightAtten;
+uniform vec4 HG_LightColor;
+
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_DepthRange;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
+vec3 SphericalToCartesian(vec2 spherical)
+{
+ vec2 sinCosTheta, sinCosPhi;
+
+ spherical = spherical * 2.0 - 1.0;
+ sincos(spherical.x * 3.14159, sinCosTheta.x, sinCosTheta.y);
+ sinCosPhi = vec2(sqrt(1.0 - spherical.y * spherical.y), spherical.y);
+
+ return vec3(sinCosTheta.y * sinCosPhi.x, sinCosTheta.x * sinCosPhi.x, sinCosPhi.y);
+}
+
+void main()
+{
+ vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw - HG_ViewPort.xy);
+ vec4 t1 = texture2D(HG_Texture0, coord);
+// vec3 norm = texture2D(HG_Texture1, coord).rgb;
+ vec3 norm = SphericalToCartesian( t1.rg );
+ float depth = t1.b;
+
+ vec3 ray = ecFrag * (HG_DepthRange.y/-ecFrag.z);
+ vec3 pos = ray * depth;
+
+ vec3 eyeVec = normalize(ecEye - pos);
+ vec3 lightDir = ecLight - pos;
+
+ float dist = length(lightDir);
+ lightDir /= dist; //normalize
+// gl_FragColor = vec4((norm+1.0)*0.5, 1.0);
+
+ float NdotL = max(dot(norm, lightDir),0.0);
+
+ if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
+
+ vec3 materialSpec = vec3(1.0,1.0,1.0);
+ vec3 lightSpec = vec3(1.0,1.0,1.0);
+
+ //x = constant, y = linear, z = quad
+ float att = 1.0 / (HG_LightAtten.x +
+ HG_LightAtten.y * dist +
+ HG_LightAtten.z * dist * dist);
+
+ vec3 color = att * (HG_LightColor.rgb * NdotL);
+
+ vec3 hv = normalize( lightDir+(ecEye-pos) );
+ float NdotHV = max(dot(norm,hv),0.0);
+
+ //pow(max(dot(H, normal.xyz), 0.0)
+
+ color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 100.0);
+ color = clamp(color, 0.0, 1.0);
+ gl_FragColor = vec4(color, 1.0);
+}
Added: Mercury2/Themes/default/Graphic/pointLight.vert
===================================================================
--- Mercury2/Themes/default/Graphic/pointLight.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/pointLight.vert 2009-08-08 23:19:07 UTC (rev 463)
@@ -0,0 +1,20 @@
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_EyePos;
+uniform vec4 HG_LightPos;
+
+//uniform vec4 HG_NearClip;
+uniform vec4 HG_FarClip;
+//uniform vec4 HG_ClipExtends;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
+void main()
+{
+ gl_Position = ftransform();
+ ecFrag = (gl_ModelViewMatrix * gl_Vertex).xyz; //world position
+
+ ecEye = (gl_ModelViewMatrix * HG_EyePos).xyz;
+ ecLight = (gl_ModelViewMatrix * vec4(0,0,0,1)).xyz;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-08 23:08:42
|
Revision: 462
http://hgengine.svn.sourceforge.net/hgengine/?rev=462&view=rev
Author: axlecrusher
Date: 2009-08-08 23:08:31 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
remove debugging
Modified Paths:
--------------
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryNode.cpp
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-08 23:07:49 UTC (rev 461)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-08 23:08:31 UTC (rev 462)
@@ -67,10 +67,8 @@
void MercuryAsset::LoadFromXML(const XMLNode& node)
{
- printf("asset xml\n");
if ( !node.Attribute("nocull").empty() )
{
- printf("NO CULL!!!!!!!!!!\n");
SetExcludeFromCull( node.Attribute("nocull")=="true" );
}
}
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-08 23:07:49 UTC (rev 461)
+++ Mercury2/src/MercuryNode.cpp 2009-08-08 23:08:31 UTC (rev 462)
@@ -220,7 +220,6 @@
MAutoPtr< MercuryAsset > asset( AssetFactory::GetInstance().Generate( child.Attribute("type"), key ) );
if ( asset.IsValid() )
{
- printf("new asset %s\n", child.Attribute("type").c_str());
asset->LoadFromXML( child );
this->AddAsset( asset );
asset->Init( this );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-08 23:07:57
|
Revision: 461
http://hgengine.svn.sourceforge.net/hgengine/?rev=461&view=rev
Author: axlecrusher
Date: 2009-08-08 23:07:49 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
temporary fix for full screen quad and lighting
Modified Paths:
--------------
Mercury2/src/FullscreenQuad.cpp
Modified: Mercury2/src/FullscreenQuad.cpp
===================================================================
--- Mercury2/src/FullscreenQuad.cpp 2009-08-08 13:00:20 UTC (rev 460)
+++ Mercury2/src/FullscreenQuad.cpp 2009-08-08 23:07:49 UTC (rev 461)
@@ -6,7 +6,8 @@
FullscreenQuad::FullscreenQuad()
{
m_matrix = MercuryMatrix::Identity();
- m_matrix.Scale(2,2,1);
+ m_matrix.Transotale(0,0,-1,0,0,0,2,2,0.01);
+// m_matrix.Scale(2,2,1);
m_matrix.Transpose();
}
@@ -14,16 +15,18 @@
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
+// glLoadIdentity();
glLoadMatrixf( m_matrix.Ptr() ); //this is OK
glMatrixMode(GL_PROJECTION);
glPushMatrix();
- glLoadIdentity();
+// glLoadIdentity();
Quad::Render( node );
glPopMatrix();
- glMatrixMode(GL_MODELVIEW); glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
}
FullscreenQuad* FullscreenQuad::Generate()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-08 13:00:29
|
Revision: 460
http://hgengine.svn.sourceforge.net/hgengine/?rev=460&view=rev
Author: axlecrusher
Date: 2009-08-08 13:00:20 +0000 (Sat, 08 Aug 2009)
Log Message:
-----------
more improvements for lights
Modified Paths:
--------------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Mercury2/Themes/default/Graphic/differedStep1.frag
Mercury2/Themes/default/Graphic/differedStep1.vert
Mercury2/Themes/default/Graphic/differedStep2.frag
Mercury2/Themes/default/Graphic/differedStep2.vert
Mercury2/src/Camera.cpp
Mercury2/src/Frustum.cpp
Mercury2/src/Frustum.h
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Mercury2/src/RenderDifferedLights.cpp
Mercury2/src/Shader.h
Mercury2/src/Viewport.cpp
Modified: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,10 +1,10 @@
<SceneGraph name="root">
<node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
<node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
- <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="1" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
<asset type="shader" file="GRAPHIC:differedStep1"/>
- <asset type="light" atten="10,0,0" fullscreen="true"/>
-<!-- <asset type="shader" file="GRAPHIC:test"/> -->
+<!-- <asset type="light" atten="10,0,0" fullscreen="true"/>
+ <asset type="shader" file="GRAPHIC:test"/> -->
<node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
<asset type="texture" file="MODEL:map.png"/>
<asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
@@ -15,7 +15,7 @@
<node type="transformnode" rotx="-90" >
<asset type="texture" file="MODEL:lamp.png"/>
<asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
- <asset type="light" atten="0.7,50,0.0" />
+ <node type="light" atten="0.7,100,0.0" shader="GRAPHIC:differedStep2" />
</node>
<node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
<node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
@@ -41,7 +41,6 @@
</node>
<asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="texture" file="screenFBO_1" dynamic="true"/>
- <asset type="shader" file="GRAPHIC:differedStep2"/>
<asset type="renderdifferedlights"/>
</node>
</node>
Modified: Mercury2/Themes/default/Graphic/differedStep1.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,12 +1,27 @@
varying vec3 normal;
varying vec3 pos;
+varying float dist;
+uniform vec4 HG_DepthRange;
+uniform vec4 HG_EyePos;
+vec2 CartesianToSpherical(vec3 cartesian)
+{
+ vec2 spherical;
+
+ spherical.x = atan2(cartesian.y, cartesian.x) / 3.14159;
+ spherical.y = cartesian.z;
+
+ return spherical * 0.5 + 0.5;
+}
+
void main()
{
- //store position
- gl_FragData[0] = vec4(pos, 1.0);
+ //linear clip space depth
+ float d = -dist/HG_DepthRange.z;
//store normal, a unused
- gl_FragData[1] = vec4( normalize(normal), 1.0);
+ vec3 n = normalize(normal);
+ n.xy = CartesianToSpherical( n );
+ gl_FragData[0] = vec4( n.xy, d, 1.0);
}
Modified: Mercury2/Themes/default/Graphic/differedStep1.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,7 +1,9 @@
+uniform vec4 HG_EyePos;
uniform mat4 HG_ModelMatrix;
-
+uniform vec4 HG_DepthRange;
varying vec3 normal;
varying vec3 pos;
+varying float dist;
void main()
{
@@ -10,8 +12,10 @@
vec4 n = vec4(gl_Normal, 0);
- //normalize in fragment
- normal = (HG_ModelMatrix * n).xyz;
+ //viewspace normal
+ normal = (gl_ModelViewMatrix * n).xyz;
- pos = (HG_ModelMatrix * gl_Vertex).xyz;
+ //clip space depth
+ pos = (gl_ModelViewMatrix * gl_Vertex).xyz;
+ dist = pos.z;
}
Modified: Mercury2/Themes/default/Graphic/differedStep2.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,25 +1,47 @@
uniform sampler2D HG_Texture0;
-uniform sampler2D HG_Texture1;
-uniform sampler2D HG_Texture2;
uniform vec4 HG_EyePos;
uniform ivec4 HG_ViewPort;
uniform vec4 HG_LightPos;
uniform vec4 HG_LightAtten;
uniform vec4 HG_LightColor;
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_DepthRange;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
+vec3 SphericalToCartesian(vec2 spherical)
+{
+ vec2 sinCosTheta, sinCosPhi;
+
+ spherical = spherical * 2.0 - 1.0;
+ sincos(spherical.x * 3.14159, sinCosTheta.x, sinCosTheta.y);
+ sinCosPhi = vec2(sqrt(1.0 - spherical.y * spherical.y), spherical.y);
+
+ return vec3(sinCosTheta.y * sinCosPhi.x, sinCosTheta.x * sinCosPhi.x, sinCosPhi.y);
+}
+
void main()
{
- vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw);
- vec3 pos = texture2D(HG_Texture0, coord).xyz;
- vec3 norm = texture2D(HG_Texture1, coord).rgb;
+ vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw - HG_ViewPort.xy);
+ vec4 t1 = texture2D(HG_Texture0, coord);
+// vec3 norm = texture2D(HG_Texture1, coord).rgb;
+ vec3 norm = SphericalToCartesian( t1.rg );
+ float depth = t1.b;
-// norm = normalize(norm);
+ vec3 ray = ecFrag * (HG_DepthRange.y/-ecFrag.z);
+ vec3 pos = ray * depth;
- vec3 eyeVec = normalize(HG_EyePos.xyz - pos);
- vec3 lightDir = HG_LightPos.xyz - pos;
+ vec3 eyeVec = normalize(ecEye - pos);
+ vec3 lightDir = ecLight - pos;
float dist = length(lightDir);
lightDir /= dist; //normalize
+// gl_FragColor = vec4(vec3(mod(depth,0.998)), 1.0);
+// gl_FragColor = vec4((norm+1.0)*0.5, 1.0);
+
float NdotL = max(dot(norm, lightDir),0.0);
if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
@@ -34,12 +56,12 @@
vec3 color = att * (HG_LightColor.rgb * NdotL);
- vec3 hv = normalize( lightDir+(HG_EyePos.xyz-pos) );
+ vec3 hv = normalize( lightDir+(ecEye-pos) );
float NdotHV = max(dot(norm,hv),0.0);
//pow(max(dot(H, normal.xyz), 0.0)
color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 100.0);
- gl_FragColor.rgb = clamp(color, 0.0, 1.0);
+ color = clamp(color, 0.0, 1.0);
+ gl_FragColor = vec4(color, 1.0);
}
-
Modified: Mercury2/Themes/default/Graphic/differedStep2.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,9 +1,20 @@
-uniform mat4 HG_WorldMatrix;
-//vec3 lightPos;
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_EyePos;
+uniform vec4 HG_LightPos;
+//uniform vec4 HG_NearClip;
+uniform vec4 HG_FarClip;
+//uniform vec4 HG_ClipExtends;
+
+varying vec3 ecEye;
+varying vec3 ecLight;
+varying vec3 ecFrag;
+
void main()
{
-// gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
-// lightPos = (HG_WorldMatrix * vec4(0,0,0,1)).xyz;
+ ecFrag = (gl_ModelViewMatrix * gl_Vertex).xyz; //world position
+
+ ecEye = (gl_ModelViewMatrix * HG_EyePos).xyz;
+ ecLight = (gl_ModelViewMatrix * vec4(0,0,0,1)).xyz;
}
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Camera.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -23,6 +23,12 @@
void CameraNode::Render(const MercuryMatrix& matrix)
{
VIEWMATRIX = m_viewMatrix;
+
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_MATRIX;
+ sa.value.matrix = m_viewMatrix.Ptr();
+ Shader::SetAttribute("HG_ViewMatrix", sa);
+
TransformNode::Render(matrix);
}
@@ -66,6 +72,7 @@
sa.value.fFloatV4[0] = EYE.GetX();
sa.value.fFloatV4[1] = EYE.GetY();
sa.value.fFloatV4[2] = EYE.GetZ();
+ sa.value.fFloatV4[3] = 1.0f;
Shader::SetAttribute("HG_EyePos", sa);
// EYE.Print();
Modified: Mercury2/src/Frustum.cpp
===================================================================
--- Mercury2/src/Frustum.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Frustum.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -89,6 +89,15 @@
aux.NormalizeSelf();
normal = Y.CrossProduct(aux);
m_planes[PRIGHT].Setup(m_nc+X*m_nw,normal);
+
+
+ //near frustum points
+ m_ntl = m_planes[PNEAR].GetCenter() + (Y * m_nh/2.0f) - (X * m_nw/2.0f);
+ m_nbr = m_planes[PNEAR].GetCenter() - (Y * m_nh/2.0f) + (X * m_nw/2.0f);
+
+ //far frustum points
+ m_ftl = m_planes[PFAR].GetCenter() + (Y * m_fh/2.0f) - (X * m_fw/2.0f);
+ m_fbr = m_planes[PFAR].GetCenter() - (Y * m_fh/2.0f) + (X * m_fw/2.0f);
}
void Frustum::Ortho(float left, float right, float bottom, float top, float near, float far)
Modified: Mercury2/src/Frustum.h
===================================================================
--- Mercury2/src/Frustum.h 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Frustum.h 2009-08-08 13:00:20 UTC (rev 460)
@@ -28,6 +28,11 @@
inline float ZNear() const { return m_zNear; }
inline float ZFar() const { return m_zFar; }
inline float DepthRange() const { return m_zFar - m_zNear; }
+
+ inline float NearWidth() const { return m_nw; }
+ inline float NearHeight() const { return m_nh; }
+ inline float FarWidth() const { return m_fw; }
+ inline float FarHeight() const { return m_fh; }
private:
MercuryPlane m_planes[6];
@@ -37,6 +42,7 @@
float m_nh, m_nw, m_fh, m_fw;
MercuryVector m_nc, m_fc;
+ MercuryVertex m_ntl, m_nbr, m_ftl, m_fbr;
};
extern const Frustum* FRUSTUM;
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Light.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -7,10 +7,10 @@
#include <Shader.h>
-REGISTER_ASSET_TYPE(Light);
+REGISTER_NODE_TYPE(Light);
Light::Light()
- :MercuryAsset()
+ :MercuryNode(), m_boundingVolume( NULL )
{
m_atten[0] = m_atten[1] = m_atten[2] = 0.0f;
m_color[0] = m_color[1] = m_color[2] = 1.0f;
@@ -22,12 +22,13 @@
{
}
-void Light::Render(const MercuryNode* node)
+void Light::Render(const MercuryMatrix& matrix)
{
- m_worldPosition = glGetMatrix(GL_MODELVIEW_MATRIX);
- m_worldPosition2 = node->FindGlobalMatrix();
+// printf("render!\n");
+ m_worldPosition = FindModelViewMatrix();
+ m_worldPosition2 = FindGlobalMatrix();
CURRENTRENDERGRAPH->AddDifferedLight( this );
- m_parent = node;
+// m_parent = node;
}
void Light::LoadFromXML(const XMLNode& node)
@@ -38,9 +39,25 @@
if ( !node.Attribute("fullscreen").empty() )
m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+ if ( !node.Attribute("shader").empty() )
+ {
+ MString key = node.Attribute("shader");
+ MAutoPtr< MercuryAsset > asset( AssetFactory::GetInstance().Generate( "shader", key ) );
+ if ( asset.IsValid() )
+ {
+ Shader* shader = dynamic_cast<Shader*>( asset.Ptr() );
+// shader->LoadFromXML( node );
+ shader->LoadShader(key, 0);
+ SetShader( shader );
+// shader->Init( this );
+ }
+
+ m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+ }
+
ComputeRadius();
- MercuryAsset::LoadFromXML( node );
+ MercuryNode::LoadFromXML( node );
}
void Light::StrTo3Float(const MString& s, float* a)
@@ -96,19 +113,24 @@
glLoadMatrix( m_worldPosition );
if ( !m_boundingVolume ) return;
+ m_shader->Render( this );
+
BoundingBox* bb = (BoundingBox*)m_boundingVolume;
// bb->Render();
MercuryVertex p(0,0,0,1);
p = m_worldPosition2 * p;
-// p.Print();
-
ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_MATRIX;
+ sa.value.matrix = m_worldPosition2.Ptr();
+ Shader::SetAttribute("HG_ModelMatrix", sa);
+
sa.type = ShaderAttribute::TYPE_FLOATV4;
sa.value.fFloatV4[0] = p.GetX();
sa.value.fFloatV4[1] = p.GetY();
sa.value.fFloatV4[2] = p.GetZ();
+ sa.value.fFloatV4[3] = 1.0f;
Shader::SetAttribute("HG_LightPos", sa);
sa.value.fFloatV4[0] = m_atten[0];
@@ -125,11 +147,14 @@
if (m_fullscreen)
{
glCullFace(GL_BACK);
- m_fullScreenQuad.Render( m_parent );
+ m_fullScreenQuad.Render( this );
glCullFace(GL_FRONT);
}
else
bb->RenderFaces();
+
+ m_shader->PostRender( this);
+
}
/****************************************************************************
Modified: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Light.h 2009-08-08 13:00:20 UTC (rev 460)
@@ -1,10 +1,11 @@
-#include <MercuryAsset.h>
-#include <FullscreenQuad.h>
-
#ifndef MLIGHT_H
#define MLIGHT_H
-class Light : public MercuryAsset
+#include <MercuryNode.h>
+#include <FullscreenQuad.h>
+#include <Shader.h>
+
+class Light : public MercuryNode
{
public:
Light();
@@ -17,7 +18,7 @@
Currently only occlusion culling test is run here.**/
// virtual void PreRender(const MercuryNode* node);
- virtual void Render(const MercuryNode* node);
+ virtual void Render(const MercuryMatrix& matrix);
// virtual void PostRender(const MercuryNode* node) {};
///Loads an asset from an XMLAsset representing itself
@@ -26,6 +27,7 @@
static Light* Generate();
void DifferedRender();
+ inline void SetShader( Shader* shader) { m_shader = shader; }
private:
void StrTo3Float(const MString& s, float* a);
void ComputeRadius();
@@ -37,9 +39,13 @@
MercuryMatrix m_worldPosition2;
bool m_fullscreen;
- const MercuryNode* m_parent;
+// const MercuryNode* m_parent;
FullscreenQuad m_fullScreenQuad;
+
+ MAutoPtr< Shader > m_shader;
+
+ BoundingVolume* m_boundingVolume;
};
#endif
Modified: Mercury2/src/RenderDifferedLights.cpp
===================================================================
--- Mercury2/src/RenderDifferedLights.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/RenderDifferedLights.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -29,9 +29,8 @@
}
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_POLYGON_BIT);
-// glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
-
+
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glBlendFunc(GL_ONE, GL_ONE);
@@ -39,7 +38,6 @@
CURRENTRENDERGRAPH->DoDifferedLightPass();
glPopAttrib( );
-// glCullFace(GL_BACK);
}
RenderDifferedLights* RenderDifferedLights::Generate()
Modified: Mercury2/src/Shader.h
===================================================================
--- Mercury2/src/Shader.h 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Shader.h 2009-08-08 13:00:20 UTC (rev 460)
@@ -89,8 +89,8 @@
///Explicitly get the OpenGL ProgramID in the event you need it for advanced techniques
unsigned int GetProgramID() { return iProgramID; }
inline static Shader* GetCurrentShader() { return CurrentShader; }
+ void LoadShader( const MString& path, float priority );
private:
- void LoadShader( const MString& path, float priority );
int32_t GetUniformLocation(const MString& n);
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-05 11:16:57 UTC (rev 459)
+++ Mercury2/src/Viewport.cpp 2009-08-08 13:00:20 UTC (rev 460)
@@ -60,6 +60,28 @@
sa.value.fFloatV4[2] = m_frustum.DepthRange();
sa.value.fFloatV4[3] = 1.0f/m_frustum.DepthRange();
Shader::SetAttribute("HG_DepthRange", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = m_frustum.ZNear();
+ sa.value.fFloatV4[1] = m_frustum.ZFar();
+ sa.value.fFloatV4[2] = m_frustum.DepthRange();
+ sa.value.fFloatV4[3] = 1.0f/m_frustum.DepthRange();
+ Shader::SetAttribute("HG_DepthRange", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ m_frustum.GetPlane(PNEAR).GetCenter().ConvertToVector3( sa.value.fFloatV4 );
+ Shader::SetAttribute("HG_NearClip", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ m_frustum.GetPlane(PFAR).GetCenter().ConvertToVector3( sa.value.fFloatV4 );
+ Shader::SetAttribute("HG_FarClip", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = m_frustum.NearWidth()*0.5f;
+ sa.value.fFloatV4[1] = m_frustum.NearHeight()*0.5f;
+ sa.value.fFloatV4[2] = m_frustum.FarWidth()*0.5f;
+ sa.value.fFloatV4[3] = m_frustum.FarHeight()*0.5f;
+ Shader::SetAttribute("HG_ClipExtends", sa);
}
void Viewport::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 11:17:07
|
Revision: 459
http://hgengine.svn.sourceforge.net/hgengine/?rev=459&view=rev
Author: axlecrusher
Date: 2009-08-05 11:16:57 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
fix normals
Modified Paths:
--------------
Mercury2/Themes/default/Graphic/differedStep1.frag
Mercury2/Themes/default/Graphic/differedStep2.frag
Modified: Mercury2/Themes/default/Graphic/differedStep1.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-05 02:01:40 UTC (rev 458)
+++ Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-05 11:16:57 UTC (rev 459)
@@ -7,6 +7,6 @@
gl_FragData[0] = vec4(pos, 1.0);
//store normal, a unused
- gl_FragData[1] = vec4( (normalize(normal)+1.0)*0.5, 1.0);
+ gl_FragData[1] = vec4( normalize(normal), 1.0);
}
Modified: Mercury2/Themes/default/Graphic/differedStep2.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 02:01:40 UTC (rev 458)
+++ Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 11:16:57 UTC (rev 459)
@@ -11,9 +11,9 @@
{
vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw);
vec3 pos = texture2D(HG_Texture0, coord).xyz;
- vec3 norm = texture2D(HG_Texture1, coord).xyz;
+ vec3 norm = texture2D(HG_Texture1, coord).rgb;
- norm = normalize(norm);
+// norm = normalize(norm);
vec3 eyeVec = normalize(HG_EyePos.xyz - pos);
vec3 lightDir = HG_LightPos.xyz - pos;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 02:01:49
|
Revision: 458
http://hgengine.svn.sourceforge.net/hgengine/?rev=458&view=rev
Author: axlecrusher
Date: 2009-08-05 02:01:40 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
much improved look to lighting
Modified Paths:
--------------
Mercury2/Themes/default/Graphic/differedStep2.frag
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Modified: Mercury2/Themes/default/Graphic/differedStep2.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 00:46:35 UTC (rev 457)
+++ Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 02:01:40 UTC (rev 458)
@@ -5,52 +5,41 @@
uniform ivec4 HG_ViewPort;
uniform vec4 HG_LightPos;
uniform vec4 HG_LightAtten;
+uniform vec4 HG_LightColor;
void main()
{
vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw);
vec3 pos = texture2D(HG_Texture0, coord).xyz;
vec3 norm = texture2D(HG_Texture1, coord).xyz;
- float att;
- vec3 color, hv, diffuse, ambient;
- diffuse = vec3(1.0);
- ambient = vec3(0.0);
+
norm = normalize(norm);
vec3 eyeVec = normalize(HG_EyePos.xyz - pos);
vec3 lightDir = HG_LightPos.xyz - pos;
- float dist = length(lightDir);
- if(dist > HG_LightAtten.w) discard;
-
- lightDir = normalize(lightDir);
-
+ float dist = length(lightDir);
+ lightDir /= dist; //normalize
float NdotL = max(dot(norm, lightDir),0.0);
- color = vec3(0.0);
- hv = normalize(eyeVec - lightDir);
- float NdotHV;
+ if((dist > HG_LightAtten.w) || (NdotL <= 0.0)) discard;
vec3 materialSpec = vec3(1.0,1.0,1.0);
vec3 lightSpec = vec3(1.0,1.0,1.0);
- float shine = 0.0;
//x = constant, y = linear, z = quad
- att = 1.0 / (HG_LightAtten.x +
+ float att = 1.0 / (HG_LightAtten.x +
HG_LightAtten.y * dist +
HG_LightAtten.z * dist * dist);
- vec3 c = att * (diffuse * NdotL + ambient);
- color += att * (diffuse * NdotL + ambient);
+ vec3 color = att * (HG_LightColor.rgb * NdotL);
- NdotHV = max(dot(norm,hv),0.0);
+ vec3 hv = normalize( lightDir+(HG_EyePos.xyz-pos) );
+ float NdotHV = max(dot(norm,hv),0.0);
- color += att * materialSpec * lightSpec * pow(NdotHV, shine);
+ //pow(max(dot(H, normal.xyz), 0.0)
- color *= float(NdotL > 0.0);
- gl_FragColor = vec4(color, 1.0);
-
-// gl_FragColor = vec4(1.0);
-// gl_FragColor = vec4(lightDir,1.0);
+ color += att * materialSpec * lightSpec * pow(max(NdotHV, 0.0), 100.0);
+ gl_FragColor.rgb = clamp(color, 0.0, 1.0);
}
Modified: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp 2009-08-05 00:46:35 UTC (rev 457)
+++ Mercury2/src/Light.cpp 2009-08-05 02:01:40 UTC (rev 458)
@@ -13,6 +13,7 @@
:MercuryAsset()
{
m_atten[0] = m_atten[1] = m_atten[2] = 0.0f;
+ m_color[0] = m_color[1] = m_color[2] = 1.0f;
m_radius = 1.0f;
m_fullscreen = false;
}
@@ -116,6 +117,11 @@
sa.value.fFloatV4[3] = m_radius;
Shader::SetAttribute("HG_LightAtten", sa);
+ sa.value.fFloatV4[0] = m_color[0];
+ sa.value.fFloatV4[1] = m_color[1];
+ sa.value.fFloatV4[2] = m_color[2];
+ Shader::SetAttribute("HG_LightColor", sa);
+
if (m_fullscreen)
{
glCullFace(GL_BACK);
Modified: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h 2009-08-05 00:46:35 UTC (rev 457)
+++ Mercury2/src/Light.h 2009-08-05 02:01:40 UTC (rev 458)
@@ -31,6 +31,7 @@
void ComputeRadius();
float m_atten[3];
+ float m_color[3];
float m_radius;
MercuryMatrix m_worldPosition;
MercuryMatrix m_worldPosition2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 00:46:47
|
Revision: 457
http://hgengine.svn.sourceforge.net/hgengine/?rev=457&view=rev
Author: axlecrusher
Date: 2009-08-05 00:46:35 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
lights
Modified Paths:
--------------
Mercury2/adv_set.c
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-08-05 00:45:52 UTC (rev 456)
+++ Mercury2/adv_set.c 2009-08-05 00:46:35 UTC (rev 457)
@@ -13,7 +13,7 @@
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp \
- src/MercuryTheme.cpp src/Orthographic.cpp"
+ src/MercuryTheme.cpp src/Orthographic.cpp src/Light.cpp src/RenderDifferedLights.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 00:45:59
|
Revision: 456
http://hgengine.svn.sourceforge.net/hgengine/?rev=456&view=rev
Author: axlecrusher
Date: 2009-08-05 00:45:52 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
light shaders
Modified Paths:
--------------
Mercury2/Themes/default/Graphic/shaderTips.txt
Added Paths:
-----------
Mercury2/Themes/default/Graphic/differedStep1.frag
Mercury2/Themes/default/Graphic/differedStep1.vert
Mercury2/Themes/default/Graphic/differedStep2.frag
Mercury2/Themes/default/Graphic/differedStep2.vert
Added: Mercury2/Themes/default/Graphic/differedStep1.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/differedStep1.frag 2009-08-05 00:45:52 UTC (rev 456)
@@ -0,0 +1,12 @@
+varying vec3 normal;
+varying vec3 pos;
+
+void main()
+{
+ //store position
+ gl_FragData[0] = vec4(pos, 1.0);
+
+ //store normal, a unused
+ gl_FragData[1] = vec4( (normalize(normal)+1.0)*0.5, 1.0);
+}
+
Added: Mercury2/Themes/default/Graphic/differedStep1.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep1.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/differedStep1.vert 2009-08-05 00:45:52 UTC (rev 456)
@@ -0,0 +1,17 @@
+uniform mat4 HG_ModelMatrix;
+
+varying vec3 normal;
+varying vec3 pos;
+
+void main()
+{
+// gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = ftransform();
+
+ vec4 n = vec4(gl_Normal, 0);
+
+ //normalize in fragment
+ normal = (HG_ModelMatrix * n).xyz;
+
+ pos = (HG_ModelMatrix * gl_Vertex).xyz;
+}
Added: Mercury2/Themes/default/Graphic/differedStep2.frag
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.frag (rev 0)
+++ Mercury2/Themes/default/Graphic/differedStep2.frag 2009-08-05 00:45:52 UTC (rev 456)
@@ -0,0 +1,56 @@
+uniform sampler2D HG_Texture0;
+uniform sampler2D HG_Texture1;
+uniform sampler2D HG_Texture2;
+uniform vec4 HG_EyePos;
+uniform ivec4 HG_ViewPort;
+uniform vec4 HG_LightPos;
+uniform vec4 HG_LightAtten;
+
+void main()
+{
+ vec2 coord = gl_FragCoord.xy / vec2(HG_ViewPort.zw);
+ vec3 pos = texture2D(HG_Texture0, coord).xyz;
+ vec3 norm = texture2D(HG_Texture1, coord).xyz;
+ float att;
+ vec3 color, hv, diffuse, ambient;
+ diffuse = vec3(1.0);
+ ambient = vec3(0.0);
+ norm = normalize(norm);
+
+ vec3 eyeVec = normalize(HG_EyePos.xyz - pos);
+ vec3 lightDir = HG_LightPos.xyz - pos;
+ float dist = length(lightDir);
+
+ if(dist > HG_LightAtten.w) discard;
+
+ lightDir = normalize(lightDir);
+
+ float NdotL = max(dot(norm, lightDir),0.0);
+
+ color = vec3(0.0);
+ hv = normalize(eyeVec - lightDir);
+ float NdotHV;
+
+ vec3 materialSpec = vec3(1.0,1.0,1.0);
+ vec3 lightSpec = vec3(1.0,1.0,1.0);
+ float shine = 0.0;
+
+ //x = constant, y = linear, z = quad
+ att = 1.0 / (HG_LightAtten.x +
+ HG_LightAtten.y * dist +
+ HG_LightAtten.z * dist * dist);
+
+ vec3 c = att * (diffuse * NdotL + ambient);
+ color += att * (diffuse * NdotL + ambient);
+
+ NdotHV = max(dot(norm,hv),0.0);
+
+ color += att * materialSpec * lightSpec * pow(NdotHV, shine);
+
+ color *= float(NdotL > 0.0);
+ gl_FragColor = vec4(color, 1.0);
+
+// gl_FragColor = vec4(1.0);
+// gl_FragColor = vec4(lightDir,1.0);
+}
+
Added: Mercury2/Themes/default/Graphic/differedStep2.vert
===================================================================
--- Mercury2/Themes/default/Graphic/differedStep2.vert (rev 0)
+++ Mercury2/Themes/default/Graphic/differedStep2.vert 2009-08-05 00:45:52 UTC (rev 456)
@@ -0,0 +1,9 @@
+uniform mat4 HG_WorldMatrix;
+//vec3 lightPos;
+
+void main()
+{
+// gl_TexCoord[0] = gl_MultiTexCoord0;
+ gl_Position = ftransform();
+// lightPos = (HG_WorldMatrix * vec4(0,0,0,1)).xyz;
+}
Modified: Mercury2/Themes/default/Graphic/shaderTips.txt
===================================================================
--- Mercury2/Themes/default/Graphic/shaderTips.txt 2009-08-05 00:44:56 UTC (rev 455)
+++ Mercury2/Themes/default/Graphic/shaderTips.txt 2009-08-05 00:45:52 UTC (rev 456)
@@ -8,3 +8,13 @@
//(gl_Position.z - zNear) * (1/depthRange);
linearDepth = (gl_Position.z - HG_DepthRange.x) * HG_DepthRange.w;
+//normal to RGB
+rgb = (normal.xyz + 1.0) * 0.5;
+
+//rgb to normal
+normal.xyz = (c.rgb*2.0) - 1.0;
+
+//recompute normal z
+//WARNING this can cause incorrect sign on z
+Normal.z = sqrt(1.0 - n.x*n.x - ny*ny);
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 00:45:07
|
Revision: 455
http://hgengine.svn.sourceforge.net/hgengine/?rev=455&view=rev
Author: axlecrusher
Date: 2009-08-05 00:44:56 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
deferred
Added Paths:
-----------
Mercury2/Themes/default/File/scenegraphDeferred.xml
Added: Mercury2/Themes/default/File/scenegraphDeferred.xml
===================================================================
--- Mercury2/Themes/default/File/scenegraphDeferred.xml (rev 0)
+++ Mercury2/Themes/default/File/scenegraphDeferred.xml 2009-08-05 00:44:56 UTC (rev 455)
@@ -0,0 +1,48 @@
+<SceneGraph name="root">
+ <node type="viewport" fov="45" aspect="1.3333" near="0.01" far="100" name="vp">
+ <node type="cameranode" movx="0" movz="0" movy="0" rotx="0" roty="0" rotz="0" name="camera">
+ <node type="mercuryfbo" width="640" height="480" depth="true" tnum="2" name="screenFBO" usescreensize="true" colorbyte0="RGBA16F" colorbyte1="RGBA16F">
+ <asset type="shader" file="GRAPHIC:differedStep1"/>
+ <asset type="light" atten="10,0,0" fullscreen="true"/>
+<!-- <asset type="shader" file="GRAPHIC:test"/> -->
+ <node type="transformnode" rotx="-90" movz="-10" movx="0" movy="-5">
+ <asset type="texture" file="MODEL:map.png"/>
+ <asset type="hgmdlmodel" file="MODEL:map.hgmdl" />
+ </node>
+ <node type="mercurynode" name="lampForest" >
+ <node type="transformnode" movz="-5" movx="0" movy="0" name="lamprow" >
+ <node type="mercurynode" name="lamp">
+ <node type="transformnode" rotx="-90" >
+ <asset type="texture" file="MODEL:lamp.png"/>
+ <asset type="hgmdlmodel" file="MODEL:lampN.hgmdl" />
+ <asset type="light" atten="0.7,50,0.0" />
+ </node>
+ <node type="billboardnode" billboardaxis="0,1,0" spheremode="true" >
+ <node type="transformnode" roty="180" scalex="0.1" scaley="0.1" alphaPath="true">
+ <asset type="texture" file="GRAPHIC:flame.png"/>
+ <asset type="quad" />
+ </node>
+ </node>
+ </node>
+ <node type="transformnode" movx="1" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="2" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="3" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-1" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-2" fallback="lamprow.lamp" />
+ <node type="transformnode" movx="-3" fallback="lamprow.lamp" />
+ </node>
+ <node type="transformnode" movz="-6" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-7" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-8" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-9" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-4" fallback="lampForest.lamprow"/>
+ <node type="transformnode" movz="-3" fallback="lampForest.lamprow"/>
+ </node>
+ </node>
+ <asset type="texture" file="screenFBO_0" dynamic="true"/>
+ <asset type="texture" file="screenFBO_1" dynamic="true"/>
+ <asset type="shader" file="GRAPHIC:differedStep2"/>
+ <asset type="renderdifferedlights"/>
+ </node>
+ </node>
+</SceneGraph>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 00:44:15
|
Revision: 454
http://hgengine.svn.sourceforge.net/hgengine/?rev=454&view=rev
Author: axlecrusher
Date: 2009-08-05 00:44:07 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
lights
Added Paths:
-----------
Mercury2/src/Light.cpp
Mercury2/src/Light.h
Mercury2/src/RenderDifferedLights.cpp
Mercury2/src/RenderDifferedLights.h
Added: Mercury2/src/Light.cpp
===================================================================
--- Mercury2/src/Light.cpp (rev 0)
+++ Mercury2/src/Light.cpp 2009-08-05 00:44:07 UTC (rev 454)
@@ -0,0 +1,159 @@
+#include <Light.h>
+#include <BoundingBox.h>
+#include <MercuryNode.h>
+
+#include <RenderGraph.h>
+#include <GLHeaders.h>
+
+#include <Shader.h>
+
+REGISTER_ASSET_TYPE(Light);
+
+Light::Light()
+ :MercuryAsset()
+{
+ m_atten[0] = m_atten[1] = m_atten[2] = 0.0f;
+ m_radius = 1.0f;
+ m_fullscreen = false;
+}
+
+Light::~Light()
+{
+}
+
+void Light::Render(const MercuryNode* node)
+{
+ m_worldPosition = glGetMatrix(GL_MODELVIEW_MATRIX);
+ m_worldPosition2 = node->FindGlobalMatrix();
+ CURRENTRENDERGRAPH->AddDifferedLight( this );
+ m_parent = node;
+}
+
+void Light::LoadFromXML(const XMLNode& node)
+{
+ if ( !node.Attribute("atten").empty() )
+ StrTo3Float(node.Attribute("atten"), m_atten);
+
+ if ( !node.Attribute("fullscreen").empty() )
+ m_fullscreen = node.Attribute("fullscreen")=="true"?true:false;
+
+ ComputeRadius();
+
+ MercuryAsset::LoadFromXML( node );
+}
+
+void Light::StrTo3Float(const MString& s, float* a)
+{
+ sscanf(s.c_str(), "%f,%f,%f", &a[0], &a[1], &a[2]);
+}
+
+Light* Light::Generate()
+{
+ return new Light();
+}
+
+void Light::ComputeRadius()
+{
+ //300 ensures that RGB of 255 reaches 0
+ //at 50, 255 is about 5. Close enough for me
+ const float maxDenom = 50;//300;
+ float a = m_atten[2]; //quadratic
+ float b = m_atten[1]; //linear
+ float c = m_atten[0]; //constant
+ float d = 0;
+
+ if ((a == 0)&&(b == 0))
+ {
+ d = 1000.0;
+ }
+ else if (a == 0)
+ {
+ d = (maxDenom - c)/b;
+ }
+ else if (b == 0)
+ {
+ d = SQRT((maxDenom - c)/a);
+ }
+ else
+ {
+ //reciprocal of the quadratic equation
+ float bottom = 2*a;
+ float s = SQRT((b*b)-(4*a*c));
+ float x1 = ((-b) - s)/bottom;
+ float x2 = ((-b) + s)/bottom;
+ d = MAX<float>(x1,x2);
+ }
+
+ m_radius = Clamp<float>(0.0f, 1000.0f, d);
+
+ SAFE_DELETE( m_boundingVolume );
+ m_boundingVolume = new BoundingBox(MercuryVertex(0,0,0), MercuryVertex(m_radius,m_radius,m_radius) );
+}
+
+void Light::DifferedRender()
+{
+ glLoadMatrix( m_worldPosition );
+ if ( !m_boundingVolume ) return;
+
+ BoundingBox* bb = (BoundingBox*)m_boundingVolume;
+// bb->Render();
+
+ MercuryVertex p(0,0,0,1);
+ p = m_worldPosition2 * p;
+
+// p.Print();
+
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = p.GetX();
+ sa.value.fFloatV4[1] = p.GetY();
+ sa.value.fFloatV4[2] = p.GetZ();
+ Shader::SetAttribute("HG_LightPos", sa);
+
+ sa.value.fFloatV4[0] = m_atten[0];
+ sa.value.fFloatV4[1] = m_atten[1];
+ sa.value.fFloatV4[2] = m_atten[2];
+ sa.value.fFloatV4[3] = m_radius;
+ Shader::SetAttribute("HG_LightAtten", sa);
+
+ if (m_fullscreen)
+ {
+ glCullFace(GL_BACK);
+ m_fullScreenQuad.Render( m_parent );
+ glCullFace(GL_FRONT);
+ }
+ else
+ bb->RenderFaces();
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/Light.h
===================================================================
--- Mercury2/src/Light.h (rev 0)
+++ Mercury2/src/Light.h 2009-08-05 00:44:07 UTC (rev 454)
@@ -0,0 +1,75 @@
+#include <MercuryAsset.h>
+#include <FullscreenQuad.h>
+
+#ifndef MLIGHT_H
+#define MLIGHT_H
+
+class Light : public MercuryAsset
+{
+ public:
+ Light();
+ virtual ~Light();
+
+// virtual void Init(MercuryNode* node);
+
+ /** PreRender should be called before any real openGL render commands.
+ It is used to handles things like frustum culling, and occlusion culling.
+ Currently only occlusion culling test is run here.**/
+// virtual void PreRender(const MercuryNode* node);
+
+ virtual void Render(const MercuryNode* node);
+// virtual void PostRender(const MercuryNode* node) {};
+
+ ///Loads an asset from an XMLAsset representing itself
+ virtual void LoadFromXML(const XMLNode& node);
+
+ static Light* Generate();
+
+ void DifferedRender();
+ private:
+ void StrTo3Float(const MString& s, float* a);
+ void ComputeRadius();
+
+ float m_atten[3];
+ float m_radius;
+ MercuryMatrix m_worldPosition;
+ MercuryMatrix m_worldPosition2;
+
+ bool m_fullscreen;
+ const MercuryNode* m_parent;
+
+ FullscreenQuad m_fullScreenQuad;
+};
+
+#endif
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/RenderDifferedLights.cpp
===================================================================
--- Mercury2/src/RenderDifferedLights.cpp (rev 0)
+++ Mercury2/src/RenderDifferedLights.cpp 2009-08-05 00:44:07 UTC (rev 454)
@@ -0,0 +1,81 @@
+#include <RenderDifferedLights.h>
+#include <RenderGraph.h>
+
+#include <Texture.h>
+#include <GLHeaders.h>
+
+REGISTER_ASSET_TYPE(RenderDifferedLights);
+#define BUFFER_OFFSET(i) ((char*)NULL + (i))
+
+RenderDifferedLights::RenderDifferedLights()
+{
+}
+
+RenderDifferedLights::~RenderDifferedLights()
+{
+}
+
+void RenderDifferedLights::Render(const MercuryNode* node)
+{
+ uint8_t numTextures = Texture::NumberActiveTextures();
+ uint16_t stride = sizeof(float)*8;
+
+ //apply all the active Textures
+ for (uint8_t i = 0; i < numTextures; ++i)
+ {
+ glActiveTexture( GL_TEXTURE0+i );
+ glClientActiveTextureARB(GL_TEXTURE0+i);
+ glTexCoordPointer(2, GL_FLOAT, stride, BUFFER_OFFSET(sizeof(float)*0));
+ }
+
+ glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_POLYGON_BIT);
+// glEnable(GL_CULL_FACE);
+ glCullFace(GL_FRONT);
+
+ glDisable(GL_DEPTH_TEST);
+ glDepthMask(false);
+ glBlendFunc(GL_ONE, GL_ONE);
+
+ CURRENTRENDERGRAPH->DoDifferedLightPass();
+
+ glPopAttrib( );
+// glCullFace(GL_BACK);
+}
+
+RenderDifferedLights* RenderDifferedLights::Generate()
+{
+ return new RenderDifferedLights();
+}
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/RenderDifferedLights.h
===================================================================
--- Mercury2/src/RenderDifferedLights.h (rev 0)
+++ Mercury2/src/RenderDifferedLights.h 2009-08-05 00:44:07 UTC (rev 454)
@@ -0,0 +1,49 @@
+#ifndef RENDERDIFFEREDLIGHTS_H
+#define RENDERDIFFEREDLIGHTS_H
+
+#include <MercuryAsset.h>
+
+class RenderDifferedLights : public MercuryAsset
+{
+ public:
+ RenderDifferedLights();
+ virtual ~RenderDifferedLights();
+
+ virtual void Render(const MercuryNode* node);
+ static RenderDifferedLights* Generate();
+
+};
+
+#endif
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 00:38:05
|
Revision: 453
http://hgengine.svn.sourceforge.net/hgengine/?rev=453&view=rev
Author: axlecrusher
Date: 2009-08-05 00:37:56 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
updates for deferred shading
Modified Paths:
--------------
Mercury2/src/BoundingBox.cpp
Mercury2/src/BoundingBox.h
Mercury2/src/FullscreenQuad.h
Mercury2/src/GLHelpers.h
Mercury2/src/HGMDLModel.cpp
Mercury2/src/HGMDLModel.h
Mercury2/src/MercuryAsset.cpp
Mercury2/src/MercuryAsset.h
Mercury2/src/MercuryFBO.cpp
Mercury2/src/MercuryNode.cpp
Mercury2/src/Quad.cpp
Mercury2/src/RenderGraph.cpp
Mercury2/src/RenderGraph.h
Mercury2/src/Texture.cpp
Modified: Mercury2/src/BoundingBox.cpp
===================================================================
--- Mercury2/src/BoundingBox.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/BoundingBox.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -28,14 +28,14 @@
}
BoundingBox::BoundingBox(const MercuryVertex& center, const MercuryVertex& extend)
- :m_center(center), m_extend(extend)
+ :BoundingVolume(), m_center(center), m_extend(extend)
{
PopulateVertices();
ComputeNormals();
}
BoundingBox::BoundingBox(const BoundingBox& bb)
- :m_center(bb.m_center), m_extend(bb.m_extend)
+ :BoundingVolume(), m_center(bb.m_center), m_extend(bb.m_extend)
{
PopulateVertices();
for (uint8_t i = 0; i < 3; ++i)
@@ -172,7 +172,30 @@
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
// glGetQueryObjectuivARB(q, GL_QUERY_RESULT_ARB, &samples);
+ glPopMatrix();
glPopAttrib( );
+}
+
+void BoundingBox::RenderFaces() const
+{
+ const float* center = GetCenter();
+ const float* extend = GetExtend();
+
+ glPushMatrix();
+ glTranslatef(center[0], center[1], center[2]);
+ glScalef(extend[0],extend[1],extend[2]);
+
+ if (m_vboID == 0) InitVBO();
+
+// if ( MercuryVBO::m_lastVBOrendered != &m_vboID )
+ {
+ MercuryVBO::m_lastVBOrendered = &m_vboID;
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vboID); // once
+ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); // once
+ glVertexPointer(3, GL_FLOAT, 0, 0); // once
+ }
+
+ glDrawArrays(GL_QUADS, 0, 24);
glPopMatrix();
}
@@ -275,10 +298,10 @@
uint32_t i = 0;
//back
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f;
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
+ m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f;
- m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f;
//front
m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f;
@@ -293,10 +316,10 @@
m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f;
//right
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f;
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f;
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f;
//top
m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f;
@@ -305,10 +328,10 @@
m_vertexData[i++] = 1.0f; m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f;
//bottom
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
+ m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f;
+ m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f;
m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
- m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = 1.0f;
- m_vertexData[i++] = 1.0f; m_vertexData[i++] = -1.0f; m_vertexData[i++] = -1.0f;
}
void BoundingBox::InitVBO()
Modified: Mercury2/src/BoundingBox.h
===================================================================
--- Mercury2/src/BoundingBox.h 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/BoundingBox.h 2009-08-05 00:37:56 UTC (rev 453)
@@ -79,6 +79,7 @@
const MercuryVector& Normal(uint8_t i) const { return m_normals[i]; }
virtual void Render();
+ void RenderFaces() const;
virtual BoundingVolume* SpawnClone() const;
virtual bool Clip( const MercuryPlane& p );
Modified: Mercury2/src/FullscreenQuad.h
===================================================================
--- Mercury2/src/FullscreenQuad.h 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/FullscreenQuad.h 2009-08-05 00:37:56 UTC (rev 453)
@@ -1,5 +1,9 @@
+#ifndef FULLSCREENQUAD_H
+#define FULLSCREENQUAD_H
+
#include <Quad.h>
+
class FullscreenQuad : public Quad
{
public:
@@ -13,6 +17,8 @@
MercuryMatrix m_matrix;
};
+#endif
+
/****************************************************************************
* Copyright (C) 2009 by Joshua Allen *
* *
Modified: Mercury2/src/GLHelpers.h
===================================================================
--- Mercury2/src/GLHelpers.h 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/GLHelpers.h 2009-08-05 00:37:56 UTC (rev 453)
@@ -7,7 +7,7 @@
MString GlError2String(uint32_t e);
void glLoadMatrix(const MercuryMatrix& m);
-MercuryMatrix glGetMatrix(int m);
+MercuryMatrix glGetMatrix(GLenum m);
MercuryVertex pointFromScreenLoc(int screen_x, int screen_y);
GLenum ToGLColorType(ColorByteType cbt);
Modified: Mercury2/src/HGMDLModel.cpp
===================================================================
--- Mercury2/src/HGMDLModel.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/HGMDLModel.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -19,6 +19,8 @@
{
MString path = node.Attribute("file");
LoadHGMDL( path );
+
+ MercuryAsset::LoadFromXML( node );
}
void HGMDLModel::LoadModel(MercuryFile* hgmdl, HGMDLModel* model)
@@ -58,11 +60,16 @@
}
}
-void HGMDLModel::DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix)
+bool HGMDLModel::DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix)
{
+ bool culled = false;
if ( GetLoadState() != LOADING )
+ {
+ culled = true;
for(uint16_t i = 0; i < m_meshes.size(); ++i)
- m_meshes[i]->DoCullingTests(n, matrix);
+ culled = culled && m_meshes[i]->DoCullingTests(n, matrix);
+ }
+ return culled;
}
void HGMDLModel::PreRender(const MercuryNode* node)
Modified: Mercury2/src/HGMDLModel.h
===================================================================
--- Mercury2/src/HGMDLModel.h 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/HGMDLModel.h 2009-08-05 00:37:56 UTC (rev 453)
@@ -19,7 +19,7 @@
static HGMDLModel* Generate();
- virtual void DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix);
+ virtual bool DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix);
virtual void PreRender(const MercuryNode* node);
virtual void Render(const MercuryNode* node);
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/MercuryAsset.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -39,14 +39,16 @@
SetLoadState( LOADED );
}
-void MercuryAsset::DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix)
+bool MercuryAsset::DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix)
{
+ bool culled = false;
if ( m_boundingVolume )
{
- n->SetCulled( m_boundingVolume->DoFrustumTest(matrix) );
- if ( !n->IsCulled() && DOOCCLUSIONCULL)
+ culled = m_boundingVolume->DoFrustumTest(matrix);
+ if ( !culled && DOOCCLUSIONCULL)
m_boundingVolume->DoOcclusionTest( n->GetOcclusionResult() );
}
+ return culled;
}
void MercuryAsset::PreRender(const MercuryNode* node)
@@ -62,6 +64,17 @@
*/
}
+void MercuryAsset::LoadFromXML(const XMLNode& node)
+{
+
+ printf("asset xml\n");
+ if ( !node.Attribute("nocull").empty() )
+ {
+ printf("NO CULL!!!!!!!!!!\n");
+ SetExcludeFromCull( node.Attribute("nocull")=="true" );
+ }
+}
+
void MercuryAsset::DrawAxes()
{
glBegin(GL_LINES);
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/MercuryAsset.h 2009-08-05 00:37:56 UTC (rev 453)
@@ -42,7 +42,7 @@
virtual void PostRender(const MercuryNode* node) {};
///Loads an asset from an XMLAsset representing itself
- virtual void LoadFromXML(const XMLNode& node) {};
+ virtual void LoadFromXML(const XMLNode& node);
virtual void LoadedCallback(); //thread safe
@@ -51,8 +51,12 @@
inline BoundingVolume* GetBoundingVolume() const { return m_boundingVolume; }
inline const MString& Path() const { return m_path; }
- virtual void DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix);
+ ///Retuns true if culled, also will initiate occlusion test
+ virtual bool DoCullingTests(MercuryNode* n, const MercuryMatrix& matrix);
void DrawAxes();
+
+ inline void SetExcludeFromCull(bool t) { m_excludeFromCull = t; }
+ inline bool ExcludeFromCull() const { return m_excludeFromCull; }
protected:
void SetLoadState(LoadState ls); //thread safe
LoadState GetLoadState(); //thread safe
@@ -63,6 +67,7 @@
private:
LoadState m_loadState;
MSemaphore m_lock;
+ bool m_excludeFromCull;
};
class LoaderThreadData
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/MercuryFBO.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -3,6 +3,8 @@
#include <MercuryWindow.h>
#include <assert.h>
+#include <RenderGraph.h>
+
REGISTER_NODE_TYPE(MercuryFBO);
MercuryFBO::MercuryFBO()
@@ -134,8 +136,10 @@
// glActiveTextureARB( GL_TEXTURE0_ARB + i );
// glDisable( GL_TEXTURE_2D );
// }
+// CURRENTRENDERGRAPH->DoDifferedLightPass();
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
// glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 );
+// CURRENTRENDERGRAPH->DoDifferedLightPass();
CHECKFBO;
GLERRORCHECK;
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/MercuryNode.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -220,6 +220,7 @@
MAutoPtr< MercuryAsset > asset( AssetFactory::GetInstance().Generate( child.Attribute("type"), key ) );
if ( asset.IsValid() )
{
+ printf("new asset %s\n", child.Attribute("type").c_str());
asset->LoadFromXML( child );
this->AddAsset( asset );
asset->Init( this );
@@ -231,11 +232,15 @@
void MercuryNode::PreRender(const MercuryMatrix& matrix)
{
+ SetCulled( false );
+ bool culled = true;
list< MercuryAsset* >::iterator i;
for (i = m_prerender.begin(); i != m_prerender.end(); ++i )
{
- (*i)->DoCullingTests( this, matrix );
+ if ( !(*i)->ExcludeFromCull() )
+ culled = culled && (*i)->DoCullingTests( this, matrix );
(*i)->PreRender(this);
+ SetCulled( culled );
}
}
Modified: Mercury2/src/Quad.cpp
===================================================================
--- Mercury2/src/Quad.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/Quad.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -36,6 +36,8 @@
m_indexData[1] = 1;
m_indexData[3] = m_indexData[2] = 2;
m_indexData[4] = 3;
+
+ SetExcludeFromCull( true );
}
Quad::~Quad()
Modified: Mercury2/src/RenderGraph.cpp
===================================================================
--- Mercury2/src/RenderGraph.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/RenderGraph.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -104,6 +104,20 @@
}
}
+void RenderGraph::AddDifferedLight( Light* l )
+{
+ m_lights.push_back( l );
+}
+
+void RenderGraph::DoDifferedLightPass()
+{
+ std::list< Light* >::iterator i;
+ for (i = m_lights.begin();i != m_lights.end(); ++i)
+ (*i)->DifferedRender();
+
+ m_lights.clear();
+}
+
StoreRenderState::StoreRenderState()
:Node(NULL)
{
Modified: Mercury2/src/RenderGraph.h
===================================================================
--- Mercury2/src/RenderGraph.h 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/RenderGraph.h 2009-08-05 00:37:56 UTC (rev 453)
@@ -5,6 +5,8 @@
//#include <RenderableNode.h>
#include <PriorityQueue.h>
+#include <Light.h>
+
class RenderGraphEntry
{
friend class RenderGraph;
@@ -49,12 +51,16 @@
void AddAlphaNode( MercuryNode* node );
void RenderAlpha();
+
+ void AddDifferedLight( Light* l );
+ void DoDifferedLightPass();
private:
void Build( MercuryNode* node, RenderGraphEntry& entry );
RenderGraphEntry m_root;
//nodes that use alpha, ordered from farthest to nearest from the camera
PriorityQueue<float, StoreRenderState > m_alphaNodesQueue;
+ std::list< Light* > m_lights;
};
extern RenderGraph* CURRENTRENDERGRAPH;
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-08-05 00:34:44 UTC (rev 452)
+++ Mercury2/src/Texture.cpp 2009-08-05 00:37:56 UTC (rev 453)
@@ -18,6 +18,8 @@
m_initTextureSuccess = true;
m_numActiveTextures = 0;
}
+
+ SetExcludeFromCull( true );
}
Texture::~Texture()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-05 00:34:52
|
Revision: 452
http://hgengine.svn.sourceforge.net/hgengine/?rev=452&view=rev
Author: axlecrusher
Date: 2009-08-05 00:34:44 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
eye position in shaders
Modified Paths:
--------------
Mercury2/src/Camera.cpp
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-08-02 02:20:50 UTC (rev 451)
+++ Mercury2/src/Camera.cpp 2009-08-05 00:34:44 UTC (rev 452)
@@ -61,6 +61,13 @@
local = MercuryMatrix::Identity();
local.Translate( GetPosition() );
EYE = (parent * local) * MercuryVertex(0,0,0,1);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = EYE.GetX();
+ sa.value.fFloatV4[1] = EYE.GetY();
+ sa.value.fFloatV4[2] = EYE.GetZ();
+ Shader::SetAttribute("HG_EyePos", sa);
+
// EYE.Print();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-02 02:21:00
|
Revision: 451
http://hgengine.svn.sourceforge.net/hgengine/?rev=451&view=rev
Author: axlecrusher
Date: 2009-08-02 02:20:50 +0000 (Sun, 02 Aug 2009)
Log Message:
-----------
more fixes and uniforms for shaders
Modified Paths:
--------------
Mercury2/src/Camera.cpp
Mercury2/src/GLHelpers.cpp
Mercury2/src/MercuryFBO.cpp
Mercury2/src/RawImageData.cpp
Mercury2/src/RawImageData.h
Modified: Mercury2/src/Camera.cpp
===================================================================
--- Mercury2/src/Camera.cpp 2009-08-01 17:48:06 UTC (rev 450)
+++ Mercury2/src/Camera.cpp 2009-08-02 02:20:50 UTC (rev 451)
@@ -3,6 +3,8 @@
#include <MercuryInput.h>
#include <Viewport.h>
+#include <Shader.h>
+
REGISTER_NODE_TYPE(CameraNode);
CameraNode::CameraNode()
@@ -37,6 +39,14 @@
m_lookAt = m_lookAt.Rotate( r );
m_lookAt.NormalizeSelf();
LOOKAT = m_lookAt;
+
+ ShaderAttribute sa;
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = LOOKAT.GetX();
+ sa.value.fFloatV4[1] = LOOKAT.GetY();
+ sa.value.fFloatV4[2] = LOOKAT.GetZ();
+ sa.value.fFloatV4[3] = 0;
+ Shader::SetAttribute("HG_LookVector", sa);
r.W() *= -1; //reverse angle for camera
Modified: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp 2009-08-01 17:48:06 UTC (rev 450)
+++ Mercury2/src/GLHelpers.cpp 2009-08-02 02:20:50 UTC (rev 451)
@@ -91,10 +91,14 @@
case RGBA:
return GL_RGBA;
case RGB16:
- return GL_RGBA16;
+ return GL_RGB16;
case RGBA16:
return GL_RGBA16;
- break;
+ case RGBA16F:
+ return GL_RGBA16F_ARB;
+ case RGBA32F:
+ printf( "GL_RGBA32F_ARB unsupported using GL_RGBA16F_ARB\n" );
+ return GL_RGBA16F_ARB;
default:
printf( "Unsupported color byte type (%d)\n", cbt );
return GL_RGB;
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-08-01 17:48:06 UTC (rev 450)
+++ Mercury2/src/MercuryFBO.cpp 2009-08-02 02:20:50 UTC (rev 451)
@@ -11,7 +11,7 @@
for (uint8_t i = 0; i < 4; ++i)
{
m_textures[i] = NULL;
- m_cbt[i] = RGB;
+ m_cbt[i] = RGBA;
}
}
Modified: Mercury2/src/RawImageData.cpp
===================================================================
--- Mercury2/src/RawImageData.cpp 2009-08-01 17:48:06 UTC (rev 450)
+++ Mercury2/src/RawImageData.cpp 2009-08-02 02:20:50 UTC (rev 451)
@@ -21,7 +21,11 @@
return RGB16;
else if (s == "RGBA16")
return RGBA16;
-
+ else if (s == "RGBA16F")
+ return RGBA16F;
+ else if (s == "RGBA32F")
+ return RGBA32F;
+ printf("Color Byte Type %s unknown\n", s.c_str());
return RGB;
}
Modified: Mercury2/src/RawImageData.h
===================================================================
--- Mercury2/src/RawImageData.h 2009-08-01 17:48:06 UTC (rev 450)
+++ Mercury2/src/RawImageData.h 2009-08-02 02:20:50 UTC (rev 451)
@@ -11,6 +11,8 @@
RGBA,
RGB16,
RGBA16,
+ RGBA16F,
+ RGBA32F
};
ColorByteType ToColorByteType(const MString& s);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 17:48:17
|
Revision: 450
http://hgengine.svn.sourceforge.net/hgengine/?rev=450&view=rev
Author: axlecrusher
Date: 2009-08-01 17:48:06 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
fix texture binding to shader
Modified Paths:
--------------
Mercury2/src/Texture.cpp
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-08-01 14:20:20 UTC (rev 449)
+++ Mercury2/src/Texture.cpp 2009-08-01 17:48:06 UTC (rev 450)
@@ -120,7 +120,7 @@
ShaderAttribute sa;
sa.type = ShaderAttribute::TYPE_SAMPLER;
- sa.value.iSampler = m_textureResource;
+ sa.value.iSampler = m_numActiveTextures;
Shader::SetAttribute( ssprintf("HG_Texture%d", m_numActiveTextures), sa);
m_activeTextures.push_back(this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 14:20:27
|
Revision: 449
http://hgengine.svn.sourceforge.net/hgengine/?rev=449&view=rev
Author: axlecrusher
Date: 2009-08-01 14:20:20 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
some tips for shaders in HG2
Added Paths:
-----------
Mercury2/Themes/default/Graphic/shaderTips.txt
Added: Mercury2/Themes/default/Graphic/shaderTips.txt
===================================================================
--- Mercury2/Themes/default/Graphic/shaderTips.txt (rev 0)
+++ Mercury2/Themes/default/Graphic/shaderTips.txt 2009-08-01 14:20:20 UTC (rev 449)
@@ -0,0 +1,10 @@
+//Uniforms available from HG2
+uniform mat4 HG_ModelMatrix;
+uniform vec4 HG_DepthRange; //x=zNear, //y=zFar, z=(zFar-zNear), w=1/z
+uniform ivec4 HG_ViewPort; //values for the current viewport
+
+
+//compute linear depth
+//(gl_Position.z - zNear) * (1/depthRange);
+linearDepth = (gl_Position.z - HG_DepthRange.x) * HG_DepthRange.w;
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 14:14:38
|
Revision: 448
http://hgengine.svn.sourceforge.net/hgengine/?rev=448&view=rev
Author: axlecrusher
Date: 2009-08-01 14:14:27 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
add depth range uniform for shaders
Modified Paths:
--------------
Mercury2/src/Frustum.h
Mercury2/src/Viewport.cpp
Modified: Mercury2/src/Frustum.h
===================================================================
--- Mercury2/src/Frustum.h 2009-08-01 02:46:05 UTC (rev 447)
+++ Mercury2/src/Frustum.h 2009-08-01 14:14:27 UTC (rev 448)
@@ -25,6 +25,9 @@
void Ortho(float left, float right, float bottom, float top, float near, float far);
inline const MercuryPlane& GetPlane(int i) const { return m_planes[i]; }
+ inline float ZNear() const { return m_zNear; }
+ inline float ZFar() const { return m_zFar; }
+ inline float DepthRange() const { return m_zFar - m_zNear; }
private:
MercuryPlane m_planes[6];
Modified: Mercury2/src/Viewport.cpp
===================================================================
--- Mercury2/src/Viewport.cpp 2009-08-01 02:46:05 UTC (rev 447)
+++ Mercury2/src/Viewport.cpp 2009-08-01 14:14:27 UTC (rev 448)
@@ -53,6 +53,13 @@
sa.type = ShaderAttribute::TYPE_INT4;
glGetIntegerv(GL_VIEWPORT, sa.value.iInts);
Shader::SetAttribute("HG_ViewPort", sa);
+
+ sa.type = ShaderAttribute::TYPE_FLOATV4;
+ sa.value.fFloatV4[0] = m_frustum.ZNear();
+ sa.value.fFloatV4[1] = m_frustum.ZFar();
+ sa.value.fFloatV4[2] = m_frustum.DepthRange();
+ sa.value.fFloatV4[3] = 1.0f/m_frustum.DepthRange();
+ Shader::SetAttribute("HG_DepthRange", sa);
}
void Viewport::PostRender(const MercuryMatrix& matrix)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 02:46:11
|
Revision: 447
http://hgengine.svn.sourceforge.net/hgengine/?rev=447&view=rev
Author: axlecrusher
Date: 2009-08-01 02:46:05 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
fix and update vbos
Modified Paths:
--------------
Mercury2/src/MercuryFBO.cpp
Mercury2/src/MercuryFBO.h
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-08-01 02:45:23 UTC (rev 446)
+++ Mercury2/src/MercuryFBO.cpp 2009-08-01 02:46:05 UTC (rev 447)
@@ -8,7 +8,11 @@
MercuryFBO::MercuryFBO()
:m_fboID(0), m_depthBufferID(0), m_initiated(false), m_useDepth(false),m_useScreenSize(false), m_width(0),m_height(0), m_numTextures(0)
{
- for (uint8_t i = 0; i < 4; ++i) m_textures[i] = NULL;
+ for (uint8_t i = 0; i < 4; ++i)
+ {
+ m_textures[i] = NULL;
+ m_cbt[i] = RGB;
+ }
}
MercuryFBO::~MercuryFBO()
@@ -46,7 +50,7 @@
{
MString n = ssprintf("%s_%d", m_name.c_str(), i);
m_textures[i] = Texture::LoadDynamicTexture(n);
- m_textures[i]->MakeDynamic(m_width, m_height, RGBA, n);
+ m_textures[i]->MakeDynamic(m_width, m_height, m_cbt[i], n);
}
}
@@ -76,7 +80,8 @@
GLERRORCHECK;
}
*/
-void MercuryFBO::PreRender(const MercuryMatrix& matrix)
+
+void MercuryFBO::Render(const MercuryMatrix& matrix)
{
if ( !m_initiated ) Setup();
@@ -90,19 +95,14 @@
for (uint8_t i = 0; i < m_numTextures; ++i)
{
MString n = ssprintf("%s_%d", m_name.c_str(), i);
- m_textures[i]->MakeDynamic(m_width, m_height, RGBA, n);
+ m_textures[i]->MakeDynamic(m_width, m_height, m_cbt[i], n);
}
}
Bind();
CHECKFBO; //Incomplete FBO
GLERRORCHECK;
}
-
- MercuryNode::PreRender(matrix);
-}
-
-void MercuryFBO::Render(const MercuryMatrix& matrix)
-{
+
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fboID);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GLERRORCHECK;
@@ -160,6 +160,13 @@
if ( !node.Attribute("usescreensize").empty() )
m_useScreenSize = node.Attribute("usescreensize") == "true"?true:false;
+ for (uint8_t i = 0; i < m_numTextures; ++i)
+ {
+ MString aname = ssprintf("colorbyte%d", i);
+ if ( !node.Attribute(aname).empty() )
+ m_cbt[i] = ToColorByteType( ToUpper( node.Attribute(aname) ) );
+ }
+
MercuryNode::LoadFromXML(node);
}
Modified: Mercury2/src/MercuryFBO.h
===================================================================
--- Mercury2/src/MercuryFBO.h 2009-08-01 02:45:23 UTC (rev 446)
+++ Mercury2/src/MercuryFBO.h 2009-08-01 02:46:05 UTC (rev 447)
@@ -3,6 +3,7 @@
#include <MercuryNode.h>
#include <Texture.h>
+#include <RawImageData.h>
class MercuryFBO : public MercuryNode
{
@@ -10,7 +11,6 @@
MercuryFBO();
virtual ~MercuryFBO();
- virtual void PreRender(const MercuryMatrix& matrix);
virtual void Render(const MercuryMatrix& matrix);
virtual void PostRender(const MercuryMatrix& matrix);
@@ -19,7 +19,7 @@
inline void SetWidth(uint16_t width) { m_width = width; }
inline void SetHeight(uint16_t height) { m_height = height; }
inline void SetUseDepth(bool toggle) { m_useDepth = toggle; }
- inline void SetNumTextures(uint8_t x) { m_numTextures = x; }
+ inline void SetNumTextures(uint8_t x) { m_numTextures = MIN<uint8_t>(x,4); }
GENRTTI(MercuryFBO);
@@ -37,6 +37,7 @@
// uint32_t m_textureID[4];
MAutoPtr< Texture > m_textures[4];
uint8_t m_numTextures;
+ ColorByteType m_cbt[4];
// static uint32_t m_lastRendered;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 02:45:31
|
Revision: 446
http://hgengine.svn.sourceforge.net/hgengine/?rev=446&view=rev
Author: axlecrusher
Date: 2009-08-01 02:45:23 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
string to color byte type
Modified Paths:
--------------
Mercury2/src/RawImageData.cpp
Mercury2/src/RawImageData.h
Modified: Mercury2/src/RawImageData.cpp
===================================================================
--- Mercury2/src/RawImageData.cpp 2009-08-01 02:44:35 UTC (rev 445)
+++ Mercury2/src/RawImageData.cpp 2009-08-01 02:45:23 UTC (rev 446)
@@ -11,6 +11,20 @@
SAFE_DELETE_ARRAY(m_data);
}
+ColorByteType ToColorByteType(const MString& s)
+{
+ if (s == "RGB")
+ return RGB;
+ else if (s == "RGBA")
+ return RGBA;
+ else if (s == "RGB16")
+ return RGB16;
+ else if (s == "RGBA16")
+ return RGBA16;
+
+ return RGB;
+}
+
/****************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/RawImageData.h
===================================================================
--- Mercury2/src/RawImageData.h 2009-08-01 02:44:35 UTC (rev 445)
+++ Mercury2/src/RawImageData.h 2009-08-01 02:45:23 UTC (rev 446)
@@ -1,6 +1,8 @@
#ifndef RAWIMAGEDATA_H
#define RAWIMAGEDATA_H
+#include <MercuryUtil.h>
+
enum ColorByteType
{
WHITE,
@@ -11,6 +13,8 @@
RGBA16,
};
+ColorByteType ToColorByteType(const MString& s);
+
class RawImageData
{
public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-08-01 02:44:42
|
Revision: 445
http://hgengine.svn.sourceforge.net/hgengine/?rev=445&view=rev
Author: axlecrusher
Date: 2009-08-01 02:44:35 +0000 (Sat, 01 Aug 2009)
Log Message:
-----------
int4 (ivec4)
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Mercury2/src/Shader.h
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-08-01 02:43:14 UTC (rev 444)
+++ Mercury2/src/Shader.cpp 2009-08-01 02:44:35 UTC (rev 445)
@@ -485,10 +485,14 @@
break;
case ShaderAttribute::TYPE_FLOAT:
case ShaderAttribute::TYPE_FLOATV4:
- glUniform4fvARB( location, 4, &x.value.fFloatV4[0] );
+ glUniform4fvARB( location, 1, &x.value.fFloatV4[0] );
break;
case ShaderAttribute::TYPE_MATRIX:
glUniformMatrix4fvARB(location, 1, 1, x.value.matrix); //transpase too
+ break;
+ case ShaderAttribute::TYPE_INT4:
+ glUniform4ivARB( location, 1, x.value.iInts );
+ break;
};
GLERRORCHECK;
}
Modified: Mercury2/src/Shader.h
===================================================================
--- Mercury2/src/Shader.h 2009-08-01 02:43:14 UTC (rev 444)
+++ Mercury2/src/Shader.h 2009-08-01 02:44:35 UTC (rev 445)
@@ -17,6 +17,7 @@
enum ShaderAttributeTyp
{
TYPE_INT, ///Synonomous to 'int' when passing into a shader
+ TYPE_INT4, ///Synonomous to 'ivec4' when passing into a shader
TYPE_SAMPLER, ///Synonomous to 'sampler2D' when passing into a shader
TYPE_FLOAT, ///Synonomous to 'float' when passing into a shader
TYPE_FLOATV4, ///Synonomous to 'vec4' when passing into a shader
@@ -31,6 +32,7 @@
float fFloat; ///Synonomous to 'float'
float fFloatV4[4]; ///Synonomous to 'vec4'
const float* matrix; ///Synonomous to 'mat4'
+ int iInts[4]; ///Synonomous to 'int4'
} value;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|