usata-commits
[Top][All Lists]
Advanced

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

[Usata-commits] Changes to usata2/src/objects/top-nodes.cpp


From: David Lau
Subject: [Usata-commits] Changes to usata2/src/objects/top-nodes.cpp
Date: Sun, 09 Jan 2005 04:52:34 -0500

Index: usata2/src/objects/top-nodes.cpp
diff -u usata2/src/objects/top-nodes.cpp:1.2 
usata2/src/objects/top-nodes.cpp:1.3
--- usata2/src/objects/top-nodes.cpp:1.2        Fri Jan  7 06:13:11 2005
+++ usata2/src/objects/top-nodes.cpp    Sun Jan  9 08:57:22 2005
@@ -10,7 +10,7 @@
 // included in the software distribution, or visit
 // http://www.fsf.org/licenses/gpl.html.
 //
-// $Id: top-nodes.cpp,v 1.2 2005/01/07 06:13:11 skunix Exp $
+// $Id: top-nodes.cpp,v 1.3 2005/01/09 08:57:22 skunix Exp $
 
 
 #include "top-nodes.hpp"
@@ -18,6 +18,7 @@
 #include <utility>
 #include <algorithm>
 #include <GL/glew.h>
+#include <iostream>
 namespace usata
 {
 
@@ -64,7 +65,7 @@
                std::find_if(children.begin(), children.end(),
                        
boost::bind(std::equal_to<std::string>(),obj->name(),bind(&Child::first,_1)));
        
-       if (it != children.end())
+       if (it == children.end())
        {
                children.push_back(Child(obj->name(), obj));
        }
@@ -78,6 +79,7 @@
        if (path.empty())
        {
                add_child(obj); 
+               return;
        }
        std::string nname = NodePathPop(path);
        ChildV::iterator it=
@@ -88,8 +90,7 @@
        {
                // throw!
        }
-
-       NodeInterface* ni = dynamic_cast<NodeInterface*>(it->second.get());
+       NodeInterface* ni = 
dynamic_cast<NodeInterface*>(obj.get());//it->second.get());
        if (!ni){ }// throw something!
        ni->add_child(obj, path);       
        return;
@@ -106,7 +107,23 @@
 void
 GuiNode::draw()
 {
+       using boost::bind;
+       using std::for_each;
+       // clear depth buffer
+       glClear(GL_DEPTH_BUFFER_BIT);
+       glMatrixMode(GL_PROJECTION);
+       glLoadIdentity();
+       gluPerspective(90, 640/480, 1.0, 10);
+
+       glMatrixMode(GL_MODELVIEW);
+       glLoadIdentity();
 
+
+       for_each(children.begin(), children.end(),
+                               bind(&Object::draw, bind(&Object_sp::get,
+                                       bind(&Child::second, _1))));
+
+       return;
 }
 
 void




reply via email to

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