source: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCKdTreeClusterSerializer.cpp @ 699

Revision 699, 1.5 KB checked in by igarcia, 19 years ago (diff)
Line 
1
2#include "LBBCKdTreeClusterSerializer.h"
3
4namespace LBBC {
5
6KdTreeClusterSerializer::KdTreeClusterSerializer() {
7}
8
9KdTreeClusterSerializer::~KdTreeClusterSerializer() {
10}
11
12void KdTreeClusterSerializer::writeBillboardCloud(TiXmlDocument *document)
13{
14        TiXmlNode *billboardCloudNode = document->InsertEndChild(TiXmlElement("billboardCloud"))->ToElement();
15
16        unsigned int numSerializedBillboards = 0;
17        unsigned int numSerializedEntities = 0;
18        for (unsigned int iBillboard = 0; iBillboard < mBillboardCloud->getNumBillboards(); iBillboard++)
19        {
20                BBC::Billboard *billboard = mBillboardCloud->getBillboard(iBillboard);
21                BBC::EntityCluster *entityCluster = billboard->getBillboardClusterData()->getEntityCluster();
22
23                // If the Billboard has Entities...
24                if (entityCluster->getNumEntitiesClusterData() > 0)
25                {
26                        BillboardKdTreeClusterData *billboardKdTreeClusterData = (BillboardKdTreeClusterData*)billboard->getBillboardClusterData();
27                        billboardKdTreeClusterData->writeBillboardClusterData(billboardCloudNode);     
28                        numSerializedBillboards++;
29                        numSerializedEntities = numSerializedEntities + entityCluster->getNumEntitiesClusterData();
30                }
31        }
32        billboardCloudNode->ToElement()->SetAttribute("count",Ogre::StringConverter::toString(numSerializedBillboards));
33       
34        Ogre::LogManager::getSingleton().logMessage("Num.Serialized Billboards:" + Ogre::StringConverter::toString(numSerializedBillboards) + " with " + Ogre::StringConverter::toString(numSerializedEntities) + " Entities");
35}
36
37}
Note: See TracBrowser for help on using the repository browser.