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 |
|
|
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 |
} |
} |
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= |
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; |
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 |