usata-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Usata-commits] Changes to usata2/src/scene-loader.cpp


From: David Lau
Subject: [Usata-commits] Changes to usata2/src/scene-loader.cpp
Date: Fri, 25 Feb 2005 13:08:01 -0500

Index: usata2/src/scene-loader.cpp
diff -u usata2/src/scene-loader.cpp:1.1 usata2/src/scene-loader.cpp:1.2
--- usata2/src/scene-loader.cpp:1.1     Wed Feb 23 16:52:07 2005
+++ usata2/src/scene-loader.cpp Fri Feb 25 18:08:01 2005
@@ -10,7 +10,7 @@
 // included in the software distribution, or visit
 // http://www.fsf.org/licenses/gpl.html.
 //
-// $Id: scene-loader.cpp,v 1.1 2005/02/23 16:52:07 skunix Exp $
+// $Id: scene-loader.cpp,v 1.2 2005/02/25 18:08:01 skunix Exp $
 
 #include <memory>
 #include <fstream>
@@ -56,6 +56,7 @@
        }
                
        ObjectVector loading;
+       std::auto_ptr <ObjectVector> LoadedObjects(new ObjectVector);
        std::string native_path = file.native_file_string();
        
        std::ifstream is(native_path.c_str());
@@ -85,7 +86,7 @@
                if (no_gci)
                {
                        no_gci->construct(odp->props);
-                       loading.push_back(Object_sp(no));
+                       LoadedObjects->push_back(Object_sp(no));
                        ls << "successfully loaded and initialized " << 
odp->type
                                <<log::commit;
                }
@@ -96,6 +97,11 @@
                        
        }
 
+       if (success)
+       {
+               boost::mutex::scoped_lock lockit(mRealizeQueueM);
+               mRealizeQueue.push(LoadedObjects.release());
+       }
        is.close();
        return;
 }
@@ -126,10 +132,34 @@
        }
 }
 
+//     virtual void    realize(Usata&, const Object_sp& );
 void
-SceneLoader::update()
+SceneLoader::update(Usata& us)
 {
+       boost::mutex::scoped_lock lock1(mRealizeQueueM);
+
+       log::BufferedStream ls;
 
+       while (!mRealizeQueue.empty())
+       {
+               ObjectVector* ovp;
+               ovp = mRealizeQueue.front();
+               mRealizeQueue.pop();
+       
+               ObjectVector::iterator it = ovp->begin(), ite=ovp->end();
+               for (; it!= ite; ++it)
+               {
+                       GCInterface * gci_object = 
+                               dynamic_cast<GCInterface*>(it->get());
+                       if (!gci_object)
+                               continue;
+                       
+                       gci_object->realize(us, *it);
+               }
+                                               
+
+               delete ovp;
+       }
 }
 
 void




reply via email to

[Prev in Thread] Current Thread [Next in Thread]