|
From: <cn...@us...> - 2010-02-23 02:19:24
|
Revision: 673
http://hgengine.svn.sourceforge.net/hgengine/?rev=673&view=rev
Author: cnlohr
Date: 2010-02-23 02:19:18 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
tweak passes and add endurance mode to the assets, so that you can have things that just /stay/ on.
Modified Paths:
--------------
Mercury2/src/MercuryNode.cpp
Mercury2/src/StateChanger.cpp
Mercury2/src/StateChanger.h
Modified: Mercury2/src/MercuryNode.cpp
===================================================================
--- Mercury2/src/MercuryNode.cpp 2010-02-23 01:08:42 UTC (rev 672)
+++ Mercury2/src/MercuryNode.cpp 2010-02-23 02:19:18 UTC (rev 673)
@@ -223,7 +223,7 @@
{
#ifdef WRITE_OUT_RENDERGARPH
static int depth;
- if ( IsHidden() || IsCulled() || (! (m_iPasses & (1<<g_iPass))) )
+ if ( IsHidden() || IsCulled() || ((! (m_iPasses & (1<<g_iPass))) && m_iForcePasses ) )
{
printf( "x%*c %p:%s (%d %d %d)\n", depth, 0, this, GetName().c_str(), IsHidden(), IsCulled(), (! (m_iPasses & (1<<g_iPass))) );
return;
@@ -231,7 +231,7 @@
printf( "1%*c %p:%s\n", depth, 0, this, GetName().c_str() );
depth++;
#else
- if ( IsHidden() || IsCulled() || (! (m_iPasses & (1<<g_iPass))) )
+ if ( IsHidden() || IsCulled() || ((! (m_iPasses & (1<<g_iPass))) && m_iForcePasses ) )
return;
#endif
Modified: Mercury2/src/StateChanger.cpp
===================================================================
--- Mercury2/src/StateChanger.cpp 2010-02-23 01:08:42 UTC (rev 672)
+++ Mercury2/src/StateChanger.cpp 2010-02-23 02:19:18 UTC (rev 673)
@@ -285,27 +285,29 @@
{
MAutoPtr< StateChange > & k = m_vStates[i];
k->Activate();
- m_StateSet[k->sID].push_back( k );
+ if( !m_isEnduring )
+ m_StateSet[k->sID].push_back( k );
}
}
void StateChanger::PostRender(const MercuryNode* node)
{
- for( unsigned i = 0; i < m_vStates.size(); i++ )
- {
- MAutoPtr< StateChange > & k = m_vStates[i];
- MVector< MAutoPtr< StateChange > > & l = m_StateSet[k->sID];
+ if( !m_isEnduring )
+ for( unsigned i = 0; i < m_vStates.size(); i++ )
+ {
+ MAutoPtr< StateChange > & k = m_vStates[i];
+ MVector< MAutoPtr< StateChange > > & l = m_StateSet[k->sID];
- unsigned ilpos = l.size() - 1;
+ unsigned ilpos = l.size() - 1;
- if( ilpos <= 0 )
- continue;
+ if( ilpos <= 0 )
+ continue;
- l.resize( ilpos-- );
+ l.resize( ilpos-- );
- if( ilpos >= 0 )
- l[ilpos]->Activate();
- }
+ if( ilpos >= 0 )
+ l[ilpos]->Activate();
+ }
}
bool StateChanger::ChangeKey( const MString & sFile )
@@ -353,6 +355,8 @@
MString sFile = node.Attribute("file");
ChangeKey( sFile );
}
+
+ LOAD_FROM_XML( "enduring", m_isEnduring, StrToBool );
}
void StateChanger::SaveToXMLTag( MString & sXMLStream )
@@ -364,6 +368,9 @@
sXMLStream += "file=\"" + sStr + "\" ";
}
+ if( m_isEnduring )
+ sXMLStream += "enduring=\"1\" ";
+
MercuryAsset::SaveToXMLTag( sXMLStream );
}
Modified: Mercury2/src/StateChanger.h
===================================================================
--- Mercury2/src/StateChanger.h 2010-02-23 01:08:42 UTC (rev 672)
+++ Mercury2/src/StateChanger.h 2010-02-23 02:19:18 UTC (rev 673)
@@ -69,6 +69,7 @@
virtual bool CheckForNewer() { return false; }
virtual void Reload() {};
private:
+ bool m_isEnduring; //If set, then, it does not get "undone" when going back up stack. 90% of all assets should set this to 0
MVector< MAutoPtr< StateChange > > m_vStates;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|