|
From: <axl...@us...> - 2008-12-04 02:01:20
|
Revision: 39
http://hgengine.svn.sourceforge.net/hgengine/?rev=39&view=rev
Author: axlecrusher
Date: 2008-12-04 02:01:18 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
load from xml
Modified Paths:
--------------
Mercury2/src/RenderableNode.cpp
Mercury2/src/RenderableNode.h
Modified: Mercury2/src/RenderableNode.cpp
===================================================================
--- Mercury2/src/RenderableNode.cpp 2008-12-04 01:59:28 UTC (rev 38)
+++ Mercury2/src/RenderableNode.cpp 2008-12-04 02:01:18 UTC (rev 39)
@@ -3,6 +3,8 @@
#include <GL/gl.h>
#include <TransformNode.h>
+#include <Quad.h>
+
using namespace std;
REGISTER_NODE_TYPE(RenderableNode);
@@ -17,7 +19,7 @@
void RenderableNode::Render()
{
list< MercuryAsset* >::iterator i;
-
+
MercuryNode* n = Parent();
TransformNode* tn;
for (; n; n = n->Parent())
@@ -94,6 +96,25 @@
RenderableNode::RecursiveRender( *i );
}
+void RenderableNode::LoadFromXML(const XMLNode& node)
+{
+ for (XMLNode child = node.Child(); child.IsValid(); child = child.NextNode())
+ {
+ if ( child.Name() == "asset" )
+ {
+ MAutoPtr< MercuryAsset > asset( AssetFactory::GetInstance().Generate(child.Attribute("type") ) );
+ if ( asset.IsValid() )
+ {
+ asset->LoadFromXML( child );
+ this->AddAsset( asset );
+ this->AddRender( asset );
+ }
+ }
+ }
+
+ MercuryNode::LoadFromXML( node );
+}
+
/***************************************************************************
* Copyright (C) 2008 by Joshua Allen *
* *
Modified: Mercury2/src/RenderableNode.h
===================================================================
--- Mercury2/src/RenderableNode.h 2008-12-04 01:59:28 UTC (rev 38)
+++ Mercury2/src/RenderableNode.h 2008-12-04 02:01:18 UTC (rev 39)
@@ -25,7 +25,8 @@
void AddPostRender(MercuryAsset* asset);
static void RecursiveRender( const MercuryNode* n );
-
+ virtual void LoadFromXML(const XMLNode& node);
+
GENRTTI(RenderableNode);
private:
bool IsInAssetList(MercuryAsset* asset) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|