/[usata]/usata2/src/objects/top-nodes.cpp
ViewVC logotype

Diff of /usata2/src/objects/top-nodes.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by skunix, Fri Jan 7 06:13:11 2005 UTC revision 1.3 by skunix, Sun Jan 9 08:57:22 2005 UTC
# Line 18  Line 18 
18  #include <utility>  #include <utility>
19  #include <algorithm>  #include <algorithm>
20  #include <GL/glew.h>  #include <GL/glew.h>
21    #include <iostream>
22  namespace usata  namespace usata
23  {  {
24    
# Line 64  GenericNode::add_child(const Object_sp&o Line 65  GenericNode::add_child(const Object_sp&o
65                  std::find_if(children.begin(), children.end(),                  std::find_if(children.begin(), children.end(),
66                          boost::bind(std::equal_to<std::string>(),obj->name(),bind(&Child::first,_1)));                          boost::bind(std::equal_to<std::string>(),obj->name(),bind(&Child::first,_1)));
67                    
68          if (it != children.end())          if (it == children.end())
69          {          {
70                  children.push_back(Child(obj->name(), obj));                  children.push_back(Child(obj->name(), obj));
71          }          }
# Line 78  GenericNode::add_child(const Object_sp& Line 79  GenericNode::add_child(const Object_sp&
79          if (path.empty())          if (path.empty())
80          {          {
81                  add_child(obj);                  add_child(obj);
82                    return;
83          }          }
84          std::string nname = NodePathPop(path);          std::string nname = NodePathPop(path);
85          ChildV::iterator it=          ChildV::iterator it=
# Line 88  GenericNode::add_child(const Object_sp& Line 90  GenericNode::add_child(const Object_sp&
90          {          {
91                  // throw!                  // throw!
92          }          }
93            NodeInterface* ni = dynamic_cast<NodeInterface*>(obj.get());//it->second.get());
         NodeInterface* ni = dynamic_cast<NodeInterface*>(it->second.get());  
94          if (!ni){ }// throw something!          if (!ni){ }// throw something!
95          ni->add_child(obj, path);                ni->add_child(obj, path);      
96          return;          return;
# Line 106  GuiNode::create(NodeInterface*XP) Line 107  GuiNode::create(NodeInterface*XP)
107  void  void
108  GuiNode::draw()  GuiNode::draw()
109  {  {
110            using boost::bind;
111            using std::for_each;
112            // clear depth buffer
113            glClear(GL_DEPTH_BUFFER_BIT);
114            glMatrixMode(GL_PROJECTION);
115            glLoadIdentity();
116            gluPerspective(90, 640/480, 1.0, 10);
117    
118            glMatrixMode(GL_MODELVIEW);
119            glLoadIdentity();
120    
121    
122            for_each(children.begin(), children.end(),
123                                    bind(&Object::draw, bind(&Object_sp::get,
124                                            bind(&Child::second, _1))));
125    
126            return;
127  }  }
128    
129  void  void

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26