|
From: <axl...@us...> - 2008-12-13 17:28:38
|
Revision: 76
http://hgengine.svn.sourceforge.net/hgengine/?rev=76&view=rev
Author: axlecrusher
Date: 2008-12-13 17:28:34 +0000 (Sat, 13 Dec 2008)
Log Message:
-----------
thread the update to do concurrent update and render
Modified Paths:
--------------
Mercury2/src/Mercury2.cpp
Modified: Mercury2/src/Mercury2.cpp
===================================================================
--- Mercury2/src/Mercury2.cpp 2008-12-13 17:26:41 UTC (rev 75)
+++ Mercury2/src/Mercury2.cpp 2008-12-13 17:28:34 UTC (rev 76)
@@ -6,6 +6,15 @@
#include <XMLParser.h>
+void* UpdateThread(void* node)
+{
+ while(true)
+ {
+ MercuryNode* n = (MercuryNode*)node;
+ n->RecursiveUpdate(0.01f);
+ }
+}
+
int main()
{
unsigned long m_count = 0;
@@ -21,10 +30,14 @@
SAFE_DELETE(doc);
+ MercuryThread updateThread;
+
m_time = time(NULL);
+ updateThread.Create( UpdateThread, root, false);
do
{
- root->RecursiveUpdate(0.01f);
+// root->RecursiveUpdate(0.01f);
+// updateThread.Create( UpdateThread, root, false);
RenderableNode::RecursiveRender(root);
w->SwapBuffers();
++m_count;
@@ -35,8 +48,12 @@
printf("FPS: %lu\n", m_count);
m_count = 0;
}
+// updateThread.Wait();
}
while ( w->PumpMessages() );
+
+ updateThread.HaltOnDestroy(true);
+ updateThread.Halt();
SAFE_DELETE(root);
SAFE_DELETE(w);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|