Go to the documentation of this file.
5 #ifndef GLVERTEX_NODES_H
6 #define GLVERTEX_NODES_H
43 children_(node.children_),
49 for (
unsigned int i=0; i<children_.size(); i++)
50 children_[i]->refcount_++;
73 for (
unsigned int i=0; i<children_.size(); i++)
75 children_[i]->refcount_--;
76 if (children_[i]->refcount_ == 0)
77 if (!children_[i]->visited_)
delete children_[i];
81 lglError(
"deleting node with non-zero reference count");
94 void setId(
const std::string &
id =
"")
102 if (id_ !=
"")
return(id_);
115 return(children_.size());
121 return(children_.size()==0);
139 if (i < children_.size())
140 return(children_[i]);
150 children_.push_back(node);
173 unsigned int n = children_.size();
177 children_[i]->refcount_--;
178 if (children_[i]->refcount_ == 0)
delete children_[i];
181 children_[i] = children_[n];
190 if (i < children_.size())
192 children_[i]->refcount_--;
193 if (children_[i]->refcount_ == 0)
delete children_[i];
204 unsigned int n = children_.size();
208 children_[i]->refcount_--;
209 if (children_[i]->refcount_ == 0) node = children_[i];
212 children_[i] = children_[n];
223 for (
unsigned int i=0; i<node->
children(); i++)
230 for (
unsigned int i=0; i<children_.size(); i++)
232 children_[i]->refcount_--;
233 if (children_[i]->refcount_ == 0)
delete children_[i];
247 for (
unsigned int i=0; i<children_.size(); i++)
287 enabled_ = !enabled_;
320 for (
unsigned int i=0; i<children_.size(); i++)
332 if (T *node=
dynamic_cast<T*
>(
this))
335 for (
unsigned int i=0; i<children_.size(); i++)
337 if (T *node=children_[i]->find<T>())
347 return(
dynamic_cast<T*
>(
find(
id)));
421 vec3 bbmin(DBL_MAX), bbmax(-DBL_MAX);
425 for (
unsigned int i=0; i<children_.size(); i++)
429 children_[i]->getBoundingBox(bmin, bmax);
431 if (bmin.x <= bmax.x &&
435 growBoundingBox(bbmin, bbmax, bmin);
436 growBoundingBox(bbmin, bbmax, bmax);
440 updateBoundingBox(bbmin, bbmax);
449 static void growBoundingBox(
vec3 &bboxmin,
vec3 &bboxmax,
const vec3 &p)
451 if (p.x < bboxmin.x) bboxmin.x = p.x;
452 if (p.x > bboxmax.x) bboxmax.x = p.x;
453 if (p.y < bboxmin.y) bboxmin.y = p.y;
454 if (p.y > bboxmax.y) bboxmax.y = p.y;
455 if (p.z < bboxmin.z) bboxmin.z = p.z;
456 if (p.z > bboxmax.z) bboxmax.z = p.z;
459 virtual void updateBoundingBox(
vec3 &bboxmin,
vec3 &bboxmax)
const {}
471 if (bbmin.x <= bbmax.x &&
472 bbmin.y <= bbmax.y &&
475 center = 0.5*(bbmax+bbmin);
476 return((0.5*(bbmax-bbmin)).length());
488 if (bbmin.x <= bbmax.x &&
489 bbmin.y <= bbmax.y &&
491 return(0.5*(bbmax+bbmin));
502 if (bbmin.x <= bbmax.x &&
503 bbmin.y <= bbmax.y &&
517 if (bbmin.x <= bbmax.x &&
518 bbmin.y <= bbmax.y &&
520 return((0.5*(bbmax-bbmin)).
length());
532 if (bbmin.x <= bbmax.x &&
533 bbmin.y <= bbmax.y &&
535 return((0.5*(bbmax-bbmin)).
norm());
546 std::vector<vec4> geometry = get_vertices();
548 trans = update_transform(trans);
550 for (
unsigned int i=0; i<geometry.size(); i++)
551 geometry[i] = trans * geometry[i];
553 for (
unsigned int i=0; i<children_.size(); i++)
556 std::vector<vec4> geo = children_[i]->getVertexCoordinates(trans);
557 geometry.insert(geometry.end(), geo.begin(), geo.end());
567 vec3 bbmin(DBL_MAX), bbmax(-DBL_MAX);
571 for (
unsigned int i=0; i<geometry.size(); i++)
572 growBoundingBox(bbmin, bbmax, geometry[i]);
579 virtual bool saveSceneGraph(
vec4 color,
mat4 trans, FILE *file,
int &index,
int &nindex,
int &tindex)
587 color = update_color(color);
588 trans = update_transform(trans);
599 if (vbo->
getName() !=
"") fprintf(file,
" name=%s", vbo->
getName().c_str());
603 if (!
lglSaveObjInto(©, file, index, nindex, tindex)) ok =
false;
606 for (
unsigned int i=0; i<children_.size(); i++)
608 if (!children_[i]->saveSceneGraph(color, trans, file, index, nindex, tindex)) ok =
false;
630 if (transparency())
return(
true);
632 for (
unsigned int i=0; i<children_.size(); i++)
643 unsigned int count = 1;
645 for (
unsigned int i=0; i<children_.size(); i++)
647 count += children_[i]->countAll();
668 unsigned int count = 0;
670 if (
lglVBO *vbo = get_vbo())
673 for (
unsigned int i=0; i<children_.size(); i++)
675 count += children_[i]->countAllPrimitives();
685 unsigned int count = 0;
687 if (
lglVBO *vbo = get_vbo())
690 for (
unsigned int i=0; i<children_.size(); i++)
692 count += children_[i]->countAllVertices();
699 virtual void cleanAll()
703 for (
unsigned int i=0; i<children_.size(); i++)
705 children_[i]->cleanAll();
708 virtual unsigned int countOnce()
715 unsigned int count = 1;
717 for (
unsigned int i=0; i<children_.size(); i++)
719 count += children_[i]->countOnce();
761 virtual lgl_Node *convert() {
return(NULL);}
762 virtual lgl_Node *clone() {
return(NULL);}
763 virtual bool optimize() {
return(
false);}
764 virtual bool swappable() {
return(
false);}
771 for (
unsigned int i=0; i<children_.size(); i++)
773 children_[i]->restartAll(animation);
779 for (
unsigned int i=0; i<children_.size(); i++)
781 children_[i]->pauseAll(yes);
787 for (
unsigned int i=0; i<children_.size(); i++)
789 children_[i]->speedupAll(speedup);
797 for (
unsigned int i=0; i<children_.size(); i++)
799 children_[i]->finishAll();
834 FILE *file = fopen(filename.c_str(),
"wb");
838 fprintf(file,
"# glVertex OBJ File\n\n");
844 if (saveSceneGraph(
vec4(1,1,1),
mat4(), file, index, nindex, tindex)) ok =
true;
854 std::string id_, alt_;
855 bool enabled_, hidden_;
857 std::vector<lgl_Node*> children_;
858 unsigned int refcount_;
859 bool init_, updated_;
861 virtual bool follow(
unsigned int i)
const
863 return(i < children_.size());
866 virtual void init() {}
868 virtual void pre_init()
877 virtual void pre_update(
double dt)
885 for (
unsigned int i=0; i<children_.size(); i++)
887 children_[i]->pre_update(dt);
892 virtual void pre_render()
900 for (
unsigned int i=0; i<children_.size(); i++)
902 children_[i]->pre_render();
910 for (
unsigned int i=0; i<children_.size(); i++)
912 children_[i]->render();
915 virtual void render(
unsigned int i)
920 children_[i]->render();
923 virtual void post_render()
925 for (
unsigned int i=0; i<children_.size(); i++)
927 children_[i]->post_render();
933 for (
unsigned int i=0; i<children_.size(); i++)
935 if (!children_[i]->updated_)
936 children_[i]->update(dt);
941 virtual void update(
unsigned int i,
double dt)
944 if (!children_[i]->updated_)
945 children_[i]->update(dt);
950 virtual void finish() {}
952 virtual std::vector<vec4> get_vertices()
954 return(std::vector<vec4>());
957 virtual lglVBO *get_vbo() {
return(NULL);}
958 virtual vec4 update_color(
vec4 c) {
return(c);}
959 virtual mat4 update_transform(
mat4 m) {
return(m);}
961 virtual void pre_pick()
969 for (
unsigned int i=0; i<children_.size(); i++)
971 children_[i]->pre_pick();
979 for (
unsigned int i=0; i<children_.size(); i++)
981 children_[i]->pick();
984 virtual void pick(
unsigned int i)
989 children_[i]->pick();
992 virtual void post_pick()
994 for (
unsigned int i=0; i<children_.size(); i++)
996 children_[i]->post_pick();
999 virtual bool transparency()
1006 virtual std::string to_id(
const std::string &classid,
bool classname =
true)
const
1008 std::stringstream s;
1011 s <<
"lgl_" << classid <<
"Node";
1021 s <<
"\"" <<
getId() <<
"\"";
1045 virtual std::string to_string(
bool classname =
true)
const
1050 virtual std::string to_label()
const
1062 std::string export_to_string(
int indentation,
int increment,
lgl_export_enum mode);
1071 #ifndef LGL_DO_NOT_OPTIMIZE
1074 for (
unsigned int i=0; i<children_.size(); i++)
1076 children_[i]->optimizeAll();
1079 for (
unsigned int i=0; i<children_.size(); i++)
1086 if (
lgl_Node *converted = node->convert())
1088 converted->setId(node->
getId());
1096 if (
lgl_Node *cloned = node->clone())
1102 for (
unsigned int i=0; i<children_.size(); i++)
1109 if (node->optimize())
1118 for (
unsigned int i=0; i<children_.size(); i++)
1123 if (node->swappable())
1141 for (
unsigned int i=0; i<children_.size(); i++)
1152 std::vector<lgl_Node*> trail;
1155 while (i < children_.size())
1163 trail.push_back(
take(i));
1171 if (trail.size() > 0)
1174 while (trail.size() > 0)
1193 {
return(out << node.to_string());}
1215 LGL_CONTROL_DISABLE,
1220 LGL_CONTROL_RESTART_ALL,
1221 LGL_CONTROL_PAUSE_ALL
1228 control_mode_(LGL_CONTROL_NONE),
1229 delayed_signal_(false),
1230 delayed_override_(false)
1242 case LGL_CONTROL_NONE:
break;
1243 case LGL_CONTROL_ON:
enable();
break;
1244 case LGL_CONTROL_OFF:
disable();
break;
1245 case LGL_CONTROL_ENABLE:
enable(
override);
break;
1246 case LGL_CONTROL_DISABLE:
disable(
override);
break;
1247 case LGL_CONTROL_INVERT:
if (
override)
disable(
enabled());
break;
1248 case LGL_CONTROL_HIDE:
hide(
override);
break;
1249 case LGL_CONTROL_SHOW:
show(
override);
break;
1250 case LGL_CONTROL_TOGGLE:
if (
override)
hide(
shown());
break;
1251 case LGL_CONTROL_RESTART_ALL:
if (
override)
restartAll();
break;
1252 case LGL_CONTROL_PAUSE_ALL:
pauseAll(
override);
break;
1259 return(control_mode_);
1265 control_mode_ = mode;
1277 bool delayed_signal_;
1278 bool delayed_override_;
1280 virtual void pre_update(
double dt)
1283 if (delayed_signal_)
1285 signal(delayed_override_);
1286 delayed_signal_ =
false;
1289 lgl_Node::pre_update(dt);
1292 virtual void signal(
bool override =
true);
1294 void signal_delayed(
bool override =
true)
1296 delayed_signal_ =
true;
1297 delayed_override_ =
override;
1302 virtual std::string to_id(
const std::string &classid,
bool classname =
true)
const
1304 std::stringstream s;
1307 s << lgl_Node::to_id(classid, classname);
1311 s << lgl_Node::to_id(classid, classname);
1321 case LGL_CONTROL_NONE: s <<
"none";
break;
1322 case LGL_CONTROL_ON: s <<
"on";
break;
1323 case LGL_CONTROL_OFF: s <<
"off";
break;
1324 case LGL_CONTROL_ENABLE: s <<
"enable";
break;
1325 case LGL_CONTROL_DISABLE: s <<
"disable";
break;
1326 case LGL_CONTROL_INVERT: s <<
"invert";
break;
1327 case LGL_CONTROL_HIDE: s <<
"hide";
break;
1328 case LGL_CONTROL_SHOW: s <<
"show";
break;
1329 case LGL_CONTROL_TOGGLE: s <<
"toggle";
break;
1330 case LGL_CONTROL_RESTART_ALL: s <<
"restart-all";
break;
1331 case LGL_CONTROL_PAUSE_ALL: s <<
"pause-all";
break;
1340 virtual std::string to_label()
const
1346 case LGL_CONTROL_ON: label +=
"\\non";
break;
1347 case LGL_CONTROL_OFF: label +=
"\\noff";
break;
1348 case LGL_CONTROL_ENABLE: label +=
"\\nenable";
break;
1349 case LGL_CONTROL_DISABLE: label +=
"\\ndisable";
break;
1350 case LGL_CONTROL_INVERT: label +=
"\\ninvert";
break;
1351 case LGL_CONTROL_HIDE: label +=
"\\nhide";
break;
1352 case LGL_CONTROL_SHOW: label +=
"\\nshow";
break;
1353 case LGL_CONTROL_TOGGLE: label +=
"\\ntoggle";
break;
1354 case LGL_CONTROL_RESTART_ALL: label +=
"\\nrestart-all";
break;
1355 case LGL_CONTROL_PAUSE_ALL: label +=
"\\npause-all";
break;
1359 return(label.
strip(
"\\n"));
1386 LGL_ACTION_DIRECTION
1402 trigger_children(
override);
1408 return(action_mode_);
1414 action_mode_ = mode;
1421 virtual bool follow(
unsigned int i)
const
1426 virtual void trigger_children(
bool override =
true);
1430 virtual std::string to_string(
bool classname =
true)
const
1432 std::stringstream s;
1434 s << lgl_ControllableNode::to_string(classname);
1443 case LGL_ACTION_NONE: s <<
"none";
break;
1444 case LGL_ACTION_ON: s <<
"on";
break;
1445 case LGL_ACTION_OFF: s <<
"off";
break;
1446 case LGL_ACTION_ENABLE: s <<
"enable";
break;
1447 case LGL_ACTION_DISABLE: s <<
"disable";
break;
1448 case LGL_ACTION_HIDE: s <<
"hide";
break;
1449 case LGL_ACTION_SHOW: s <<
"show";
break;
1450 case LGL_ACTION_PAUSE: s <<
"pause";
break;
1451 case LGL_ACTION_RESUME: s <<
"resume";
break;
1452 case LGL_ACTION_DIRECTION: s <<
"direction";
break;
1461 virtual std::string to_label()
const
1463 lgl_string label = lgl_ControllableNode::to_label();
1467 case LGL_ACTION_ON: label +=
"\\non";
break;
1468 case LGL_ACTION_OFF: label +=
"\\noff";
break;
1469 case LGL_ACTION_ENABLE: label +=
"\\nenable";
break;
1470 case LGL_ACTION_DISABLE: label +=
"\\ndisable";
break;
1471 case LGL_ACTION_HIDE: label +=
"\\nhide";
break;
1472 case LGL_ACTION_SHOW: label +=
"\\nshow";
break;
1473 case LGL_ACTION_PAUSE: label +=
"\\npause";
break;
1474 case LGL_ACTION_RESUME: label +=
"\\nresume";
break;
1475 case LGL_ACTION_DIRECTION: label +=
"\\ndirection";
break;
1479 return(label.
strip(
"\\n"));
1503 delay_(0), countdown_(0),
1516 countdown_ = delay_;
1517 override_ =
override;
1520 control_children(
override);
1541 control_children(override_);
1551 virtual bool follow(
unsigned int i)
const
1553 if (i >= children_.size())
return(
false);
1559 virtual void control_children(
bool override =
true)
1565 case LGL_CONTROL_NONE:
break;
1566 case LGL_CONTROL_ON:
override =
true;
break;
1567 case LGL_CONTROL_OFF:
override =
false;
break;
1568 case LGL_CONTROL_ENABLE:
override =
true;
break;
1569 case LGL_CONTROL_DISABLE:
override =
false;
break;
1570 case LGL_CONTROL_INVERT:
override = !
override;
break;
1574 for (
unsigned int i=0; i<children_.size(); i++)
1577 ctrl->control(
override);
1590 virtual void pre_update(
double dt)
1595 lgl_Node::pre_update(dt);
1604 if (countdown_ <= 0)
1605 control_children(override_);
1613 virtual std::string to_string(
bool classname =
true)
const
1615 std::stringstream s;
1617 s << lgl_ControllableNode::to_string(classname);
1626 virtual std::string to_label()
const
1628 lgl_string label = lgl_ControllableNode::to_label();
1633 return(label.
strip(
"\\n"));
1638 inline void lgl_ControllableNode::signal(
bool override)
1640 for (
unsigned int i=0; i<children_.size(); i++)
1642 ctrl->control(
override);
1657 restart_all_barrier_(false),
1658 pause_all_barrier_(false),
1659 resume_all_barrier_(false),
1660 speedup_all_barrier_(false)
1670 return(restart_all_barrier_);
1676 restart_all_barrier_ = yes;
1682 return(pause_all_barrier_);
1688 pause_all_barrier_ = yes;
1694 return(resume_all_barrier_);
1700 resume_all_barrier_ = yes;
1706 return(speedup_all_barrier_);
1712 speedup_all_barrier_ = yes;
1717 if (!enabled_ || !restart_all_barrier_)
1725 if (!enabled_ || !pause_all_barrier_)
1730 if (!enabled_ || !resume_all_barrier_)
1737 if (!enabled_ || !speedup_all_barrier_)
1743 bool restart_all_barrier_;
1744 bool pause_all_barrier_;
1745 bool resume_all_barrier_;
1746 bool speedup_all_barrier_;
1750 virtual std::string to_string(
bool classname =
true)
const
1752 std::stringstream s;
1756 s << lgl_ControllableNode::to_string(classname);
1768 s << lgl_ControllableNode::to_string(classname);
1774 virtual std::string to_label()
const
1776 lgl_string label = lgl_ControllableNode::to_label();
1783 std::string barrier =
"\\nblock:";
1791 return(label.
strip(
"\\n"));
1815 virtual void steer(
double level,
bool override =
true) {}
1817 virtual std::string to_id(
const std::string &classid,
bool classname =
true)
const
1819 std::stringstream s;
1822 s << lgl_ControllableNode::to_id(classid, classname);
1826 s << lgl_ControllableNode::to_id(classid, classname);
1875 if (node) node->
steer(level_,
override);
1880 virtual std::string to_string(
bool classname =
true)
const
1882 std::stringstream s;
1884 s << lgl_ControlNode::to_string(classname);
1893 virtual std::string to_label()
const
1895 lgl_string label = lgl_ControlNode::to_label();
1898 label +=
"\\nlevel=" + glslmath::to_string(
getSteerLevel());
1900 return(label.
strip(
"\\n"));
1930 virtual void pre_render()
1932 lgl_Node::pre_render();
1933 if (enabled_)
begin();
1936 virtual void post_render()
1938 if (enabled_)
end();
1939 lgl_Node::post_render();
1942 virtual void pre_pick()
1944 lgl_Node::pre_pick();
1945 if (enabled_)
begin();
1948 virtual void post_pick()
1950 if (enabled_)
end();
1951 lgl_Node::post_pick();
1956 virtual std::string to_string(
bool classname =
true)
const
1964 std::stringstream s;
1966 s << lgl_ControllableNode::to_string(classname);
1967 s <<
"(mat4" << p <<
", mat4" << m <<
")";
1984 const std::string &
id =
"",
1987 vbo_(vbo), managed_(false)
1993 if (vbo_)
delete vbo_;
2008 if (vbo_)
delete vbo_;
2048 if (hidden_)
return;
2050 if (vbo_ && enabled_)
2060 virtual void updateBoundingBox(
vec3 &bboxmin,
vec3 &bboxmax)
const
2062 if (vbo_ && enabled_)
2067 growBoundingBox(bboxmin, bboxmax, bmin);
2068 growBoundingBox(bboxmin, bboxmax, bmax);
2072 virtual std::vector<vec4> get_vertices()
2074 if (vbo_ && enabled_)
2077 return(std::vector<vec4>());
2080 virtual lglVBO *get_vbo()
2082 if (vbo_ && enabled_)
return(vbo_);
2088 if (hidden_)
return;
2090 if (vbo_ && enabled_)
2101 virtual std::string to_string(
bool classname =
true)
const
2103 std::stringstream s;
2105 s << lgl_ControllableNode::to_string(classname);
2108 s <<
"(\"" <<
getName() <<
"\")";
2113 virtual std::string to_label()
const
2115 lgl_string label = lgl_ControllableNode::to_label();
2124 label +=
"\\n" + name;
2137 return(label.
strip(
"\\n"));
2152 const std::string &
id =
"",
2184 virtual bool optimize();
2190 if (hidden_)
return;
2202 virtual void updateBoundingBox(
vec3 &bboxmin,
vec3 &bboxmax)
const
2209 growBoundingBox(bboxmin, bboxmax, bmin);
2210 growBoundingBox(bboxmin, bboxmax, bmax);
2214 virtual std::vector<vec4> get_vertices()
2219 return(std::vector<vec4>());
2222 virtual lglVBO *get_vbo()
2224 if (enabled_)
return(
this);
2230 if (hidden_)
return;
2240 virtual std::string to_string(
bool classname =
true)
const
2242 std::stringstream s;
2244 s << lgl_ControllableNode::to_string(classname);
2247 s <<
"(\"" <<
getName() <<
"\")";
2252 virtual std::string to_label()
const
2254 lgl_string label = lgl_ControllableNode::to_label();
2263 label +=
"\\n" + name;
2273 return(label.
strip(
"\\n"));
2278 inline lgl_Node *lgl_GeometryNode::convert()
2283 inline lgl_Node *lgl_GeometryNode::clone()
2296 inline bool lgl_VBONode::optimize()
2300 for (
unsigned int i=0; i<children_.size(); i++)
2311 for (
unsigned int i=0; i<children_.size(); i++)
2334 const std::string &
id =
"",
2337 color_(
vec4(r,g,b,a))
2342 const std::string &
id =
"",
2350 const std::string &
id =
"",
2375 if (!enabled_)
return(
false);
2376 return(color_.a < 1);
2385 if (hidden_)
return;
2405 if (enabled_)
return(color_);
2409 virtual bool optimize();
2410 virtual bool swappable();
2414 virtual std::string to_string(
bool classname =
true)
const
2416 std::stringstream s;
2418 s << lgl_ControllableNode::to_string(classname);
2426 inline bool lgl_ColorNode::optimize()
2430 for (
unsigned int i=0; i<children_.size(); i++)
2444 for (
unsigned int i=0; i<children_.size(); i++)
2478 const std::string &
id =
"",
2487 const std::string &
id =
"",
2491 identity_(v==
vec3(0))
2496 const std::string &
id =
"",
2505 const std::string &
id =
"",
2514 virtual std::string
getClassId()
const {
return(
"Transformation");}
2519 if (identity_)
return(p);
2520 return(transformation_ *
vec4(p));
2526 if (identity_)
return(p);
2527 return(transformation_ * p);
2533 return(transformation_);
2539 transformation_ = m;
2540 identity_ = m==
mat4(1);
2547 identity_ = v==
vec3(0);
2555 identity_ = v==
vec3(0);
2562 identity_ = angle==0;
2567 double x,
double y,
double z)
2571 identity_ = angle==0;
2582 void scale(
double x,
double y,
double z,
double w=1)
2586 identity_ = c==
vec4(1);
2593 identity_ = c==
vec4(1);
2598 mat4 transformation_;
2603 if (hidden_)
return;
2605 if (!identity_ && enabled_)
2613 if (!identity_ && enabled_)
2619 virtual void updateBoundingBox(
vec3 &bboxmin,
vec3 &bboxmax)
const
2623 if (bboxmin.x <= bboxmax.x &&
2624 bboxmin.y <= bboxmax.y &&
2625 bboxmin.z <= bboxmax.z)
2627 vec3 p1(bboxmin.x, bboxmin.y, bboxmin.z);
2628 vec3 p2(bboxmax.x, bboxmin.y, bboxmin.z);
2629 vec3 p3(bboxmin.x, bboxmax.y, bboxmin.z);
2630 vec3 p4(bboxmax.x, bboxmax.y, bboxmin.z);
2631 vec3 p5(bboxmin.x, bboxmin.y, bboxmax.z);
2632 vec3 p6(bboxmax.x, bboxmin.y, bboxmax.z);
2633 vec3 p7(bboxmin.x, bboxmax.y, bboxmax.z);
2634 vec3 p8(bboxmax.x, bboxmax.y, bboxmax.z);
2636 bboxmin =
vec3(DBL_MAX);
2637 bboxmax =
vec3(-DBL_MAX);
2639 growBoundingBox(bboxmin, bboxmax,
transform(p1));
2640 growBoundingBox(bboxmin, bboxmax,
transform(p2));
2641 growBoundingBox(bboxmin, bboxmax,
transform(p3));
2642 growBoundingBox(bboxmin, bboxmax,
transform(p4));
2643 growBoundingBox(bboxmin, bboxmax,
transform(p5));
2644 growBoundingBox(bboxmin, bboxmax,
transform(p6));
2645 growBoundingBox(bboxmin, bboxmax,
transform(p7));
2646 growBoundingBox(bboxmin, bboxmax,
transform(p8));
2651 virtual mat4 update_transform(
mat4 m)
2659 if (hidden_)
return;
2661 if (!identity_ && enabled_)
2669 if (!identity_ && enabled_)
2675 virtual bool optimize();
2676 virtual bool swappable();
2680 virtual std::string to_string(
bool classname =
true)
const
2682 std::stringstream s;
2684 s << lgl_SteerableNode::to_string(classname);
2702 const std::string &
id =
"",
2712 const std::string &
id =
"",
2715 translation_(
vec3(x,y,z))
2725 return(translation_);
2734 virtual std::string to_string(
bool classname =
true)
const
2736 std::stringstream s;
2738 s << lgl_SteerableNode::to_string(classname);
2744 virtual std::string to_label()
const
2746 return(
lgl_string(lgl_TransformationNode::to_label() +
"\\nT").strip(
"\\n"));
2761 const std::string &
id =
"",
2764 rotation_angle_(angle),
2765 rotation_axis_(axis)
2772 double x,
double y,
double z,
2773 const std::string &
id =
"",
2776 rotation_angle_(angle),
2777 rotation_axis_(
vec3(x,y,z))
2787 return(rotation_angle_);
2793 return(rotation_axis_);
2798 double rotation_angle_;
2799 vec3 rotation_axis_;
2803 virtual std::string to_string(
bool classname =
true)
const
2805 std::stringstream s;
2807 s << lgl_SteerableNode::to_string(classname);
2813 virtual std::string to_label()
const
2815 return(
lgl_string(lgl_TransformationNode::to_label() +
"\\nR").strip(
"\\n"));
2830 const std::string &
id =
"",
2840 const std::string &
id =
"",
2843 scale_(
vec4(x,y,z,w))
2850 const std::string &
id =
"",
2872 virtual std::string to_string(
bool classname =
true)
const
2874 std::stringstream s;
2876 s << lgl_SteerableNode::to_string(classname);
2882 virtual std::string to_label()
const
2884 return(
lgl_string(lgl_TransformationNode::to_label() +
"\\nS").strip(
"\\n"));
2905 const std::string &
id =
"",
2912 const std::string &
id =
"",
2919 const std::string &
id =
"",
2926 const std::string &
id =
"",
2931 virtual std::string
getClassId()
const {
return(
"TextureTransformation");}
2937 if (hidden_)
return;
2939 if (!identity_ && enabled_)
2949 if (!identity_ && enabled_)
2957 virtual mat4 update_transform(
mat4 m) {
return(m);}
2964 virtual std::string to_label()
const
2966 return(
lgl_string(lgl_TransformationNode::to_label() +
"\\nTM").strip(
"\\n"));
2988 LGL_STEER_RESTART_RESUME,
2990 LGL_STEER_REWIND_RESUME,
2992 LGL_STEER_DIRECTION,
2993 LGL_STEER_REWIND_REVERSE,
2994 LGL_STEER_REWIND_REVERSE_RESUME,
2995 LGL_STEER_REWIND_DIRECTION,
2996 LGL_STEER_REWIND_DIRECTION_RESUME,
2999 LGL_STEER_RESTART_ALL,
3000 LGL_STEER_PAUSE_ALL,
3001 LGL_STEER_SPEEDUP_ALL
3006 const std::string &
id =
"",
3011 acceleration_(accel),
3016 limit_(fabs(limit)),
3097 acceleration_ = accel_;
3100 if (fabs(animation_) >= limit_)
3102 if (animation_ >= 0)
3104 animation_ = limit_;
3105 velocity_ = -fabs(delta_);
3109 animation_ = -limit_;
3110 velocity_ = fabs(delta_);
3114 transformation_ =
animate(animation_, vector_);
3123 transformation_ =
animate(animation_, vector_);
3137 velocity_ = -velocity_;
3144 animation_ += delta;
3146 animation_ -= delta;
3148 transformation_ =
animate(animation_, vector_);
3156 animation_ -= delta;
3158 animation_ += delta;
3160 transformation_ =
animate(animation_, vector_);
3197 return(steer_mode_);
3207 virtual void steer(
double level,
bool override =
true)
3211 case LGL_STEER_NONE:
break;
3212 case LGL_STEER_PAUSE:
pause(
override);
break;
3213 case LGL_STEER_RESUME:
resume(
override);
break;
3214 case LGL_STEER_SPEEDUP:
if (
override)
setSpeedup(level);
break;
3215 case LGL_STEER_RESTART:
if (
override)
restart(level);
break;
3216 case LGL_STEER_RESTART_RESUME:
restart(level);
resume(
override);
break;
3217 case LGL_STEER_REWIND:
if (
override)
rewind(level);
break;
3218 case LGL_STEER_REWIND_RESUME:
rewind(level);
resume(
override);
break;
3219 case LGL_STEER_REVERSE:
if (
override)
reverse();
break;
3220 case LGL_STEER_DIRECTION:
direction(
override);
break;
3221 case LGL_STEER_REWIND_REVERSE:
if (
override) {
rewind(level);
reverse();}
break;
3223 case LGL_STEER_REWIND_DIRECTION:
rewind(level);
direction(
override);
break;
3225 case LGL_STEER_FORWARD:
if (
override)
forward(level);
break;
3226 case LGL_STEER_BACKWARD:
if (
override)
backward(level);
break;
3227 case LGL_STEER_RESTART_ALL:
if (
override)
restartAll(level);
break;
3228 case LGL_STEER_PAUSE_ALL:
pauseAll(
override);
break;
3229 case LGL_STEER_SPEEDUP_ALL:
if (
override)
speedupAll(level);
break;
3237 double acceleration_;
3257 if (velocity_!=0 || acceleration_!=0)
3259 velocity_ += acceleration_*dt;
3260 animation_ += velocity_*speedup_*dt;
3266 if (fabs(animation_) > limit_)
3268 if (animation_ >= 0)
3269 animation_ = limit_;
3271 animation_ = -limit_;
3282 if (fabs(animation_) > limit_)
3284 if (animation_ >= 0) animation_ -= animation_ - limit_;
3285 else animation_ += -animation_ - limit_;
3286 velocity_ = -velocity_;
3291 if (fabs(animation_) > limit_)
3295 if (animation_ <= 0)
3307 if (acceleration_ >= 0)
3308 velocity_ = fabs(delta_);
3310 velocity_ = -fabs(delta_);
3319 transformation_ =
animate(animation_, vector_);
3350 virtual std::string to_string(
bool classname =
true)
const
3352 std::stringstream s;
3356 s << lgl_SteerableNode::to_string(classname);
3380 case LGL_STEER_NONE: s <<
"none";
break;
3381 case LGL_STEER_PAUSE: s <<
"pause";
break;
3382 case LGL_STEER_RESUME: s <<
"resume";
break;
3383 case LGL_STEER_SPEEDUP: s <<
"speedup";
break;
3384 case LGL_STEER_RESTART: s <<
"restart";
break;
3385 case LGL_STEER_RESTART_RESUME: s <<
"restart-resume";
break;
3386 case LGL_STEER_REWIND: s <<
"rewind";
break;
3387 case LGL_STEER_REWIND_RESUME: s <<
"rewind-resume";
break;
3388 case LGL_STEER_REVERSE: s <<
"reverse";
break;
3389 case LGL_STEER_DIRECTION: s <<
"direction";
break;
3390 case LGL_STEER_REWIND_REVERSE: s <<
"rewind-reverse";
break;
3391 case LGL_STEER_REWIND_REVERSE_RESUME: s <<
"rewind-reverse-resume";
break;
3392 case LGL_STEER_REWIND_DIRECTION: s <<
"rewind-direction";
break;
3393 case LGL_STEER_REWIND_DIRECTION_RESUME: s <<
"rewind-direction-resume";
break;
3394 case LGL_STEER_FORWARD: s <<
"forward";
break;
3395 case LGL_STEER_BACKWARD: s <<
"backward";
break;
3396 case LGL_STEER_RESTART_ALL: s <<
"restart-all";
break;
3397 case LGL_STEER_PAUSE_ALL: s <<
"pause-all";
break;
3398 case LGL_STEER_SPEEDUP_ALL: s <<
"speedup-all";
break;
3406 s << lgl_SteerableNode::to_id(
"Transformation", classname);
3413 virtual std::string to_label()
const
3415 lgl_string label = lgl_SteerableNode::to_label();
3419 case LGL_STEER_PAUSE: label +=
"\\npause";
break;
3420 case LGL_STEER_RESUME: label +=
"\\nresume";
break;
3421 case LGL_STEER_SPEEDUP: label +=
"\\nspeedup";
break;
3422 case LGL_STEER_RESTART: label +=
"\\nrestart";
break;
3423 case LGL_STEER_RESTART_RESUME: label +=
"\\nrestart-resume";
break;
3424 case LGL_STEER_REWIND: label +=
"\\nrewind";
break;
3425 case LGL_STEER_REWIND_RESUME: label +=
"\\nrewind-resume";
break;
3426 case LGL_STEER_REVERSE: label +=
"\\nreverse";
break;
3427 case LGL_STEER_DIRECTION: label +=
"\\ndirection";
break;
3428 case LGL_STEER_REWIND_REVERSE: label +=
"\\nrewind-reverse";
break;
3429 case LGL_STEER_REWIND_REVERSE_RESUME: label +=
"\\nrewind-reverse-resume";
break;
3430 case LGL_STEER_REWIND_DIRECTION: label +=
"\\nrewind-direction";
break;
3431 case LGL_STEER_REWIND_DIRECTION_RESUME: label +=
"\\nrewind-direction-resume";
break;
3432 case LGL_STEER_FORWARD: label +=
"\\nforward";
break;
3433 case LGL_STEER_BACKWARD: label +=
"\\nbackward";
break;
3434 case LGL_STEER_RESTART_ALL: label +=
"\\nrestart-all";
break;
3435 case LGL_STEER_PAUSE_ALL: label +=
"\\npause-all";
break;
3436 case LGL_STEER_SPEEDUP_ALL: label +=
"\\nspeedup-all";
break;
3440 return(label.
strip(
"\\n"));
3454 const std::string &
id =
"",
3459 virtual std::string
getClassId()
const {
return(
"TranslationAnimation");}
3468 virtual std::string to_label()
const
3470 return(
lgl_string(lgl_AnimationNode::to_label() +
"\\nT").strip(
"\\n"));
3484 const std::string &
id =
"",
3489 virtual std::string
getClassId()
const {
return(
"RotationAnimation");}
3498 virtual std::string to_label()
const
3500 return(
lgl_string(lgl_AnimationNode::to_label() +
"\\nR").strip(
"\\n"));
3516 LGL_TRANSITION_NEAREST,
3517 LGL_TRANSITION_LINEAR,
3524 const std::string &
id =
"",
3527 style_(LGL_TRANSITION_LINEAR)
3604 virtual void steer(
double level,
bool override =
true)
3634 transformation_ =
animate(animation_, vector_);
3646 double transition(
double w)
const
3648 static const double c = 2;
3652 case LGL_TRANSITION_NEAREST:
return(w<0.5?0:1);
3653 case LGL_TRANSITION_LINEAR:
return(w);
3654 case LGL_TRANSITION_COS:
return(0.5-0.5*cos(w*PI));
3655 case LGL_TRANSITION_ATAN:
return(0.5*atan(c*(w-0.5))/atan(c*0.5)+0.5);
3661 virtual void pre_update(
double dt)
3666 lgl_AnimationNode::pre_update(dt);
3671 virtual std::string to_string(
bool classname =
true)
const
3673 std::stringstream s;
3675 s << lgl_AnimationNode::to_string(classname);
3683 case LGL_TRANSITION_NEAREST: s <<
"nearest";
break;
3684 case LGL_TRANSITION_LINEAR: s <<
"linear";
break;
3685 case LGL_TRANSITION_COS: s <<
"cos-lerp";
break;
3686 case LGL_TRANSITION_ATAN: s <<
"atan-lerp";
break;
3695 virtual std::string to_label()
const
3697 lgl_string label = lgl_AnimationNode::to_label();
3701 case LGL_TRANSITION_NEAREST: label +=
"\\nnearest";
break;
3702 case LGL_TRANSITION_LINEAR: label +=
"\\nlinear";
break;
3703 case LGL_TRANSITION_COS: label +=
"\\ncos-lerp";
break;
3704 case LGL_TRANSITION_ATAN: label +=
"\\natan-lerp";
break;
3707 return(label.
strip(
"\\n"));
3721 const std::string &
id =
"",
3726 virtual std::string
getClassId()
const {
return(
"TranslationTransition");}
3738 virtual std::string to_label()
const
3740 return(
lgl_string(lgl_TransitionNode::to_label() +
"\\nT").strip(
"\\n"));
3754 const std::string &
id =
"",
3760 virtual std::string
getClassId()
const {
return(
"RotationTransition");}
3774 virtual std::string to_label()
const
3776 return(
lgl_string(lgl_TransitionNode::to_label() +
"\\nR").strip(
"\\n"));
3791 const std::string &
id =
"",
3794 from_(1), to_(
scale)
3800 const std::string &
id =
"",
3803 from_(from), to_(to)
3806 virtual std::string
getClassId()
const {
return(
"ScaleTransition");}
3815 double s = (1-w)*from_ + w*to_;
3821 virtual std::string to_label()
const
3823 return(
lgl_string(lgl_TransitionNode::to_label() +
"\\nS").strip(
"\\n"));
3840 const std::string &
id =
"",
3846 virtual std::string
getClassId()
const {
return(
"WarpAnimation");}
3866 virtual std::string to_label()
const
3868 return(
lgl_string(lgl_AnimationNode::to_label() +
"\\nW").strip(
"\\n"));
3876 inline bool lgl_TransformationNode::optimize()
3883 bool textrans =
false;
3888 for (
unsigned int i=0; i<children_.size(); i++)
3916 for (
unsigned int i=0; i<children_.size(); i++)
3946 inline void lgl_ActionNode::trigger_children(
bool override)
3950 for (
unsigned int i=0; i<children_.size(); i++)
3955 case LGL_ACTION_PAUSE: anim->pause(
override);
break;
3956 case LGL_ACTION_RESUME: anim->resume(
override);
break;
3957 case LGL_ACTION_DIRECTION: anim->direction(
override);
break;
3963 case LGL_ACTION_ON: ctrl->enable();
break;
3964 case LGL_ACTION_OFF: ctrl->disable();
break;
3965 case LGL_ACTION_ENABLE: ctrl->enable(
override);
break;
3966 case LGL_ACTION_DISABLE: ctrl->disable(
override);
break;
3967 case LGL_ACTION_HIDE: ctrl->hide(
override);
break;
3968 case LGL_ACTION_SHOW: ctrl->show(
override);
break;
3987 float exponent = 30,
vec3f falloff =
vec3f(1,0,0),
3988 const std::string &
id =
"",
3992 camera_light_(camera_light),
3993 ka_(ka), kd_(kd), ks_(ks),
3994 Ia_(Ia), Id_(Id), Is_(Is),
3995 exponent_(exponent),
4018 light_ =
vec4f(light, 0);
4024 light_ =
vec4f(light, 1);
4030 return(camera_light_);
4036 float &exponent,
vec3f &falloff)
const
4046 exponent = exponent_;
4053 float exponent = 30,
vec3f falloff =
vec3f(1,0,0))
4063 exponent_ = exponent;
4071 vec3f ka_, kd_, ks_;
4072 vec3f Ia_, Id_, Is_;
4078 if (hidden_)
return;
4082 bool lighting(
false);
4084 vec3f ka(0), kd(0), ks(0);
4085 vec3f Ia(0), Id(0), Is(0);
4112 virtual std::string to_string(
bool classname =
true)
const
4114 std::stringstream s;
4116 s << lgl_ControllableNode::to_string(classname);
4120 s <<
"vec3" << ka_ <<
", " <<
"vec3" << kd_ <<
"vec3" << ks_ <<
", ";
4121 s <<
"vec3" << Ia_ <<
", " <<
"vec3" << Id_ <<
"vec3" << Is_ <<
", ";
4122 s << exponent_ <<
", " <<
"vec3" << falloff_;
4128 virtual std::string to_label()
const
4146 const std::string &
id =
"",
4162 if (hidden_)
return;
4166 bool lighting(
false);
4168 vec3f Ia(0), Id(0), Is(0);
4194 virtual std::string to_string(
bool classname =
true)
const
4196 std::stringstream s;
4198 s << lgl_ControllableNode::to_string(classname);
4202 s <<
"vec3" << Ia_ <<
", " <<
"vec3" << Id_ <<
"vec3" << Is_ <<
", ";
4203 s <<
"vec3" << falloff_;
4209 virtual std::string to_label()
const
4225 float exponent = 30,
4226 const std::string &
id =
"",
4241 if (hidden_)
return;
4245 vec3f ka(0), kd(0), ks(0);
4264 virtual std::string to_string(
bool classname =
true)
const
4266 std::stringstream s;
4268 s << lgl_ControllableNode::to_string(classname);
4271 s <<
"vec3" << ka_ <<
", " <<
"vec3" << kd_ <<
"vec3" << ks_ <<
", ";
4278 virtual std::string to_label()
const
4294 const std::string &
id =
"",
4304 GLuint getTexId()
const
4309 void setTexId(GLuint texid)
4320 if (hidden_)
return;
4324 bool texturing =
false;
4328 if (texid_!=0 && enabled_)
4340 if (texid_!=0 && enabled_)
4350 virtual std::string to_string(
bool classname =
true)
const
4352 std::stringstream s;
4354 s << lgl_ControllableNode::to_string(classname);
4356 if (getTexId() != 0)
4357 s <<
"(" << getTexId() <<
")";
4362 virtual std::string to_label()
const
4378 const std::string &
id =
"",
4388 GLuint getTexId()
const
4393 void setTexId(GLuint texid)
4404 if (hidden_)
return;
4408 bool texturing =
false;
4412 if (texid_!=0 && enabled_)
4424 if (texid_!=0 && enabled_)
4434 virtual std::string to_string(
bool classname =
true)
const
4436 std::stringstream s;
4438 s << lgl_ControllableNode::to_string(classname);
4440 if (getTexId() != 0)
4441 s <<
"(" << getTexId() <<
")";
4446 virtual std::string to_label()
const
4461 const std::string &
id =
"",
4476 void change(
bool state)
4487 if (hidden_)
return;
4493 state = saveState();
4501 restoreState(state);
4505 virtual bool getState()
const = 0;
4506 virtual void setState(
bool state) = 0;
4508 virtual bool saveState() {
return(getState());}
4509 virtual void restoreState(
bool state) {setState(state);}
4513 virtual std::string to_string(
bool classname =
true)
const
4515 std::stringstream s;
4517 s << lgl_ControllableNode::to_string(classname);
4518 s <<
"(" << (state()?
"on":
"off") <<
")";
4523 virtual std::string to_label()
const
4538 const std::string &
id =
"",
4547 virtual bool getState()
const
4552 virtual void setState(
bool state)
4567 const std::string &
id =
"",
4576 virtual bool getState()
const
4581 virtual void setState(
bool state)
4596 const std::string &
id =
"",
4601 virtual std::string
getClassId()
const {
return(
"BackFaceCulling");}
4605 virtual bool getState()
const
4610 virtual void setState(
bool state)
4626 const std::string &
id =
"",
4637 return(blend_mode_);
4644 virtual bool getState()
const
4649 virtual void setState(
bool state)
4654 virtual bool saveState()
4660 virtual void restoreState(
bool state)
4669 virtual std::string to_string(
bool classname =
true)
const
4671 std::stringstream s;
4677 case LGL_BLEND_NONE : mode =
"none";
break;
4678 case LGL_BLEND_MULT : mode =
"mult";
break;
4679 case LGL_BLEND_ALPHA : mode =
"alpha";
break;
4680 case LGL_BLEND_ADD : mode =
"add";
break;
4681 case LGL_BLEND_SUB : mode =
"sub";
break;
4682 case LGL_BLEND_MAX : mode =
"max";
break;
4683 case LGL_BLEND_MIN : mode =
"min";
break;
4686 s << lgl_ControllableNode::to_string(classname);
4687 s <<
"(" << mode <<
")";
4703 bool greater =
true,
4705 const std::string &
id =
"",
4708 alpha_value_(alpha_value),
4709 alpha_greater_(greater),
4718 return(alpha_value_);
4724 return(alpha_greater_);
4730 return(alpha_equal_);
4736 bool alpha_greater_;
4739 virtual bool getState()
const
4744 virtual void setState(
bool state)
4746 lglAlphaTest(state, alpha_value_, alpha_greater_, alpha_equal_);
4749 virtual bool saveState()
4757 virtual void restoreState(
bool state)
4759 lglAlphaTest(state, saved_alpha_value_, saved_alpha_greater_, saved_alpha_equal_);
4762 float saved_alpha_value_;
4763 bool saved_alpha_greater_;
4764 bool saved_alpha_equal_;
4768 virtual std::string to_string(
bool classname =
true)
const
4770 std::stringstream s;
4772 s << lgl_StateNode::to_string(classname);
4794 const std::string &
id =
"",
4797 fog_density_(fog_density),
4798 fog_color_(fog_color)
4806 return(fog_density_);
4820 virtual bool getState()
const
4825 virtual void setState(
bool state)
4828 lglFog(fog_density_, fog_color_);
4833 virtual bool saveState()
4840 virtual void restoreState(
bool state)
4842 lglFog(saved_fog_density_, saved_fog_color_);
4845 float saved_fog_density_;
4846 vec4f saved_fog_color_;
4850 virtual std::string to_string(
bool classname =
true)
const
4852 std::stringstream s;
4854 s << lgl_StateNode::to_string(classname);
4872 const std::string &
id =
"",
4883 return(line_width_);
4890 virtual bool getState()
const
4895 virtual void setState(
bool state)
4898 virtual bool saveState()
4904 virtual void restoreState(
bool state)
4909 float saved_line_width_;
4913 virtual std::string to_string(
bool classname =
true)
const
4915 std::stringstream s;
4917 s << lgl_ControllableNode::to_string(classname);
4933 const std::string &
id =
"",
4942 virtual bool getState()
const
4949 virtual void setState(
bool state)
4966 const std::string &
id =
"",
4975 virtual bool getState()
const
4982 virtual void setState(
bool state)
4999 const std::string &
id =
"",
5008 virtual bool getState()
const
5015 virtual void setState(
bool state)
5035 const std::string &
id =
"",
5038 clipplane_(equation),
5045 const std::string &
id =
"",
5054 const std::string &
id =
"",
5057 clipplane_(
vec4(0,0,0,0)),
5074 clipplane_ = equation;
5096 if (hidden_)
return;
5098 vec4 equation(0,0,0,0);
5116 virtual std::string to_string(
bool classname =
true)
const
5118 std::stringstream s;
5120 s << lgl_ControllableNode::to_string(classname);
5130 virtual std::string to_label()
const
5137 inline bool lgl_ColorNode::swappable()
5139 bool swappable =
false;
5149 inline bool lgl_TransformationNode::swappable()
5151 bool swappable =
false;
5193 unsigned int n = children_.size();
5196 switch_ = (switch_+n+delta)%n;
5206 unsigned int switch_;
5210 if (hidden_)
return;
5228 if (hidden_)
return;
5238 virtual std::string to_string(
bool classname =
true)
const
5240 std::stringstream s;
5242 s << lgl_ControllableNode::to_string(classname);
5250 virtual std::string to_label()
const
5266 const std::string &
id =
"",
5274 virtual std::string
getClassId()
const {
return(
"LevelOfDetail");}
5276 double getDistance()
const
5281 void setDistance(
double distance)
5283 distance_ = distance;
5292 if (hidden_)
return;
5295 unsigned int n = children_.size();
5298 if (distance_>0 && n>0)
5300 static const double log2 = 1.0/log(2.0);
5306 double l = ceil(log(d/distance_)*log2);
5308 i = (
unsigned int)l;
5309 if (i >= n) i = n-1;
5318 virtual std::string to_string(
bool classname =
true)
const
5320 std::stringstream s;
5322 s << lgl_ControllableNode::to_string(classname);
5325 s <<
"(" << distance_ <<
")";
5356 graph_ = createSubgraph();
5372 graph_ = createSubgraph();
5384 graph_ = createSubgraph();
5396 graph_ = createSubgraph();
5400 if (graph_ && enabled_)
5405 growBoundingBox(bboxmin, bboxmax, bbmin);
5406 growBoundingBox(bboxmin, bboxmax, bbmax);
5413 graph_ = createSubgraph();
5417 if (graph_ && enabled_)
5420 geometry.insert(geometry.begin(), geo.begin(), geo.end());
5426 virtual bool saveSceneGraph(
vec4 color,
mat4 trans, FILE *file,
int &index,
int &nindex,
int &tindex)
5429 graph_ = createSubgraph();
5431 bool ok = lgl_ControllableNode::saveSceneGraph(color, trans, file, index, nindex, tindex);
5433 if (graph_ && enabled_)
5434 if (!graph_->saveSceneGraph(color, trans, file, index, nindex, tindex)) ok =
false;
5441 unsigned int count = 0;
5444 graph_ = createSubgraph();
5456 unsigned int count = 0;
5459 graph_ = createSubgraph();
5471 unsigned int count = 0;
5474 graph_ = createSubgraph();
5484 virtual unsigned int countAllVertices()
5486 unsigned int count = 0;
5489 graph_ = createSubgraph();
5501 virtual void cleanAll()
5504 graph_ = createSubgraph();
5509 lgl_ControllableNode::cleanAll();
5512 virtual unsigned int countOnce()
5514 unsigned int count = 0;
5517 graph_ = createSubgraph();
5520 count += graph_->countOnce();
5522 count += lgl_ControllableNode::countOnce();
5532 graph_ = createSubgraph();
5543 graph_ = createSubgraph();
5554 graph_ = createSubgraph();
5565 graph_ = createSubgraph();
5576 graph_ = createSubgraph();
5591 graph_ = createSubgraph();
5594 virtual void pre_update(
double dt)
5597 graph_->pre_update(dt);
5599 lgl_ControllableNode::pre_update(dt);
5602 virtual void pre_render()
5605 graph_->pre_render();
5607 lgl_ControllableNode::pre_render();
5612 if (hidden_)
return;
5614 if (graph_ && enabled_)
5620 virtual void post_render()
5623 graph_->post_render();
5625 lgl_ControllableNode::post_render();
5638 if (hidden_)
return;
5640 if (graph_ && enabled_)
5646 virtual bool transparency()
5649 graph_ = createSubgraph();
5651 if (graph_ && enabled_)
5658 virtual lgl_Node *createSubgraph() {
return(NULL);}
5677 virtual std::string
getClassId()
const {
return(
"OptimizingSubgraph");}
5683 lgl_Node *graph = lgl_SubgraphNode::createSubgraph();
5704 unsigned int id = 0;
5706 bool tagged =
false;
5717 scan_export(
id, mode);
5721 s += pre_export(mode);
5725 s += export_to_string(indentation, increment, mode);
5729 s += post_export(mode);
5741 inline void lgl_Node::init_export(lgl_export_enum mode)
5743 if (mode != LGL_EXPORT_COMMANDS)
5747 inline void lgl_Node::scan_export(
unsigned int &
id, lgl_export_enum mode)
5749 if (mode != LGL_EXPORT_COMMANDS)
5751 std::string prefix =
"node-";
5752 if (mode == LGL_EXPORT_GRAPH) prefix =
"#";
5759 setAltId(prefix+glslmath::to_string(
id));
5766 if (mode == LGL_EXPORT_GRAPH)
5771 setAltId(prefix+glslmath::to_string(
id));
5775 for (
unsigned int i=0; i<children_.size(); i++)
5777 get(i)->scan_export(
id, mode);
5790 inline std::string lgl_Node::pre_export(lgl_export_enum mode)
5792 std::stringstream s;
5794 if (mode == LGL_EXPORT_COMMANDS)
5798 for (
unsigned int i=0; i<children_.size(); i++)
5800 s <<
get(i)->pre_export(mode);
5804 std::string node = camera->to_string(mode != LGL_EXPORT_COMMANDS);
5807 s << node << std::endl;
5810 else if (mode == LGL_EXPORT_GRAPH)
5812 s <<
"digraph" << std::endl;
5813 s <<
"{" << std::endl;
5814 s <<
"node[shape=oval]" << std::endl;
5815 s <<
"edge[color=\"#000070\"]" << std::endl;
5821 inline std::string lgl_Node::export_to_string(
int indentation,
int increment, lgl_export_enum mode)
5823 std::stringstream s;
5825 if (visited_ && mode!=LGL_EXPORT_COMMANDS)
5827 if (mode != LGL_EXPORT_GRAPH)
5828 s << glslmath::to_space(indentation) <<
"link(\"" <<
getAltId() <<
"\")" << std::endl;
5832 if (mode != LGL_EXPORT_COMMANDS)
5856 std::string node = to_string(mode != LGL_EXPORT_COMMANDS);
5857 bool empty = node.empty();
5862 if (mode == LGL_EXPORT_NODES)
5867 s << glslmath::to_space(indentation) << node <<
" ->" << std::endl;
5869 s << glslmath::to_space(indentation) << node << std::endl;
5873 s << glslmath::to_space(indentation) <<
"{" << std::endl;
5875 for (
unsigned int i=c; i<n; i++)
5877 s <<
get(i)->export_to_string(indentation+increment, increment, mode);
5879 s << glslmath::to_space(indentation+increment) <<
"link(\"" <<
get(i)->
getAltId() <<
"\")" << std::endl;
5882 s << glslmath::to_space(indentation) <<
"}" << std::endl;
5884 else if (mode == LGL_EXPORT_GRAPH)
5887 if (
lgl_string(name).replaceNonAlphaNumeric() != name) name =
"\"" + name +
"\"";
5890 std::string label = to_label();
5892 if (camera) shape =
"star";
5893 else if (geo || vbo) shape =
"triangle";
5894 else if (animation) shape =
"doublecircle";
5895 else if (textransformation) shape =
"circle,label=\"\",width=0.25";
5896 else if (transformation) shape =
"circle,width=0.25";
5899 shape =
"circle,style=filled,fillcolor=";
5901 snprintf(buf, 10,
"\"#%02x%02x%02x\"",
int(255*color->
getColor().r),
int(255*color->
getColor().g),
int(255*color->
getColor().b));
5904 else if (state) shape =
"box";
5905 else if (lod) shape =
"tripleoctagon";
5906 else if (switcher) shape =
"doubleoctagon";
5907 else if (steer) shape =
"hexagon";
5908 else if (control) shape =
"diamond";
5909 else if (barrier) shape =
"octagon";
5910 else if (action) shape =
"diamond";
5912 s << glslmath::to_space(indentation) << name;
5913 s <<
"[label=\"" << label <<
"\"";
5914 if (shape !=
"") s <<
",shape=" << shape;
5915 s <<
"]" << std::endl;
5919 s << glslmath::to_space(indentation) << name <<
" -> ";
5921 if (n > 1) s <<
"{ ";
5923 for (
unsigned int i=c; i<n; i++)
5929 if (i < n-1) s <<
" ";
5932 if (n > 1) s <<
" }";
5934 if (control || action) s <<
" [style=dashed]";
5939 for (
unsigned int i=c; i<n; i++)
5941 s <<
get(i)->export_to_string(indentation+increment, increment, mode);
5965 else if (control || action)
5971 int inc = increment;
5972 if (n<=1 && !transformation && !state) inc = 0;
5977 if (textransformation)
5978 s << glslmath::to_space(indentation) <<
"push_tex_matrix" << std::endl;
5979 else if (transformation)
5980 s << glslmath::to_space(indentation) <<
"push_matrix" << std::endl;
5982 s << glslmath::to_space(indentation) <<
"push_state" << std::endl;
5986 s << glslmath::to_space(indentation+inc) << node << std::endl;
5988 for (
unsigned int i=c; i<n; i++)
5990 s <<
get(i)->export_to_string(indentation+inc, increment, mode);
5994 if (textransformation)
5995 s << glslmath::to_space(indentation) <<
"pop_tex_matrix" << std::endl;
5996 else if (transformation)
5997 s << glslmath::to_space(indentation) <<
"pop_matrix" << std::endl;
5999 s << glslmath::to_space(indentation) <<
"pop_state" << std::endl;
6007 inline std::string lgl_Node::post_export(lgl_export_enum mode)
6009 std::stringstream s;
6011 if (mode == LGL_EXPORT_GRAPH)
6013 s <<
"}" << std::endl;
6019 inline void lgl_Node::clean_export(lgl_export_enum mode)
6021 if (mode != LGL_EXPORT_COMMANDS)
6028 for (
unsigned int i=0; i<children_.size(); i++)
6030 get(i)->clean_export(mode);
6042 std::string suffix = fn.
suffix(
".");
6043 fn = fn.
chop(
"."+suffix) +
".lgl";
6045 lglWriteTextFile(fn, graph);
6051 std::string suffix = fn.
suffix(
".");
6052 fn = fn.
chop(
"."+suffix) +
".dot";
6053 std::string graph =
exportAll(lgl_Node::LGL_EXPORT_GRAPH, 0, 1);
6054 lglWriteTextFile(fn, graph);
6060 std::string suffix = fn.
suffix(
".");
6061 fn = fn.
chop(
"."+suffix) +
".gl";
6062 std::string graph =
exportAll(lgl_Node::LGL_EXPORT_COMMANDS, 0, 1);
6063 lglWriteTextFile(fn, graph);
3D texture node
Definition: glvertex_nodes.h:4372
state change node (blending)
Definition: glvertex_nodes.h:4620
void hide(bool yes=true)
hide the node and its children
Definition: glvertex_nodes.h:309
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1926
3D float vector
Definition: glslmath.h:584
void lglMaterialParameters(vec3f ka=vec3f(0.1f), vec3f kd=vec3f(0.7f), vec3f ks=vec3f(0.2f), float exponent=30)
set the material parameters
Definition: glvertex_core.h:4244
lgl_control_mode_enum
control mode enum
Definition: glvertex_nodes.h:1209
lgl_string strip(const std::string &match) const
strip match from begin
Definition: glvertex_string.h:75
void lglBlendMode(lgl_blendmode_enum mode)
change OpenGL state (blending)
Definition: glvertex_api.h:404
lgl_MaterialNode(vec3f ka=vec3f(0.1f), vec3f kd=vec3f(0.7f), vec3f ks=vec3f(0.2f), float exponent=30, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:4224
void enable(bool yes=true)
enable the node
Definition: glvertex_nodes.h:3554
void lglAlphaTest(bool on=false, float value=0.0f, bool greater=true, bool equal=false)
change OpenGL state (alpha test)
Definition: glvertex_api.h:416
std::vector< vec4 > lglGetVertexCoordinates() const
return a copy of the vertex coordinates in vbo
Definition: glvertex_core.h:1893
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:4076
void disable(bool yes=true)
disable the node
Definition: glvertex_nodes.h:279
void restart(double animation=0)
restart the animation
Definition: glvertex_nodes.h:3093
bool enabled() const
is the node enabled?
Definition: glvertex_nodes.h:261
2D texture node
Definition: glvertex_nodes.h:4288
void enable(bool yes=true)
enable the node
Definition: glvertex_nodes.h:273
void renderSceneGraph(double dt=0)
render and update the entire scene subgraph
Definition: glvertex_nodes.h:351
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1397
void setId(const std::string &id="")
set the node identifier
Definition: glvertex_nodes.h:94
bool shared() const
is the node shared?
Definition: glvertex_nodes.h:131
light node
Definition: glvertex_nodes.h:3979
Blinn-Phong material.
Definition: glvertex_light.h:155
vec3 getVector() const
get the animation vector
Definition: glvertex_nodes.h:3033
vec4 getColor() const
get the color
Definition: glvertex_nodes.h:2361
lgl_LightNode(vec4f light=vec4f(0, 0, 1, 0), bool camera_light=true, vec3f ka=vec3f(0.1f), vec3f kd=vec3f(0.7f), vec3f ks=vec3f(0.2f), vec3f Ia=vec3f(1), vec3f Id=vec3f(1), vec3f Is=vec3f(1), float exponent=30, vec3f falloff=vec3f(1, 0, 0), const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3984
void lglTex()
reset the vbo texturing matrix
Definition: glvertex_core.h:2577
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1996
void stopOnLimit()
stop on animation limit
Definition: glvertex_nodes.h:3051
void preupdateSceneGraph(double dt)
pre-update the entire scene subgraph
Definition: glvertex_nodes.h:404
vec4 lglGetLightVector() const
get the light vector (in camera coordinates)
Definition: glvertex_core.h:4176
int lglGetPrimitiveCount() const
get the number of primitives contained in vbo
Definition: glvertex_core.h:1796
vec4f getFogColor() const
get the fog color
Definition: glvertex_nodes.h:4810
lgl_Cam()
ctor
Definition: glvertex_cam.h:16
state change node (back-face culling)
Definition: glvertex_nodes.h:4591
virtual std::vector< vec4 > getVertexCoordinates(mat4 trans=mat4())
Definition: glvertex_nodes.h:5410
void lglLineWidth(float width=1.0f)
specify line width (as defined by OpenGL 1.2)
Definition: glvertex_api.h:164
lgl_GeometryNode(lglVBO *vbo=NULL, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1983
void end() const
pop viewing and projection matrix
Definition: glvertex_cam.h:288
virtual void optimizeAll()
optimize all nodes
Definition: glvertex_nodes.h:1069
virtual void restartAll(double animation=0)
restart all animations
Definition: glvertex_nodes.h:5540
bool lglGetFog()
get OpenGL state (fog)
Definition: glvertex_api.h:448
bool lglGetBackFaceCulling()
get OpenGL state (back-face culling)
Definition: glvertex_api.h:400
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3489
void setSteerMode(lgl_animation_steer_mode_enum mode)
set the steer mode
Definition: glvertex_nodes.h:3201
void setLightDirection(vec3f light)
set the light direction
Definition: glvertex_nodes.h:4016
scene graph node (base class)
Definition: glvertex_nodes.h:22
state change node (coloring)
Definition: glvertex_nodes.h:4928
void link(lgl_Node *node)
add the links of a node
Definition: glvertex_nodes.h:221
virtual void getBoundingBox(vec3 &bboxmin, vec3 &bboxmax)
get the bounding box of the entire subgraph
Definition: glvertex_nodes.h:5393
void lglClipPlane(vec4 equation=vec4(0, 0, 0, 0), unsigned int n=0, bool camera_plane=false)
specify clip plane (as defined by OpenGL 1.2)
Definition: glvertex_api.h:148
bool disabled() const
is the node disabled?
Definition: glvertex_nodes.h:3548
lgl_TranslationTransitionNode(const vec3 &translation, double seconds, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3720
virtual mat4 animate(double animation, const vec3 &axis)
to be implemented for a particular type of animation
Definition: glvertex_nodes.h:3493
lgl_string chop(const std::string &match) const
chop match from end
Definition: glvertex_string.h:82
bool lglGetTexturing() const
check for texturing
Definition: glvertex_core.h:3410
steer node
Definition: glvertex_nodes.h:1839
bool lglIsManipApplied()
is the manipulator matrix applied?
Definition: glvertex_api.h:328
bool hidden() const
is the node hidden?
Definition: glvertex_nodes.h:297
bool cloneable() const
is the node cloneable?
Definition: glvertex_nodes.h:745
virtual unsigned int countAllPrimitives()
count all primitives
Definition: glvertex_nodes.h:664
void setRestartBarrier(bool yes=false)
set restart barrier
Definition: glvertex_nodes.h:1674
float getAlphaTestValue() const
get the alpha test value
Definition: glvertex_nodes.h:4716
void setLightParameters(vec3f ka=vec3f(0.1f), vec3f kd=vec3f(0.7f), vec3f ks=vec3f(0.2f), vec3f Ia=vec3f(1), vec3f Id=vec3f(1), vec3f Is=vec3f(1), float exponent=30, vec3f falloff=vec3f(1, 0, 0))
set the light parameters
Definition: glvertex_nodes.h:4051
texture transformation node
Definition: glvertex_nodes.h:2893
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4878
virtual void finishAll()
finish all transitions
Definition: glvertex_nodes.h:5573
lgl_ScaleNode(double c, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2829
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4632
virtual void update(double dt)
reimplement this method to update a node
Definition: glvertex_nodes.h:931
bool leaf() const
is the node a leaf?
Definition: glvertex_nodes.h:119
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4386
void setLightSourceParameters(vec3f Ia=vec3f(1), vec3f Id=vec3f(1), vec3f Is=vec3f(1), vec3f falloff=vec3f(1, 0, 0))
set the light source parameters
Definition: glvertex_light.h:104
steerable node (base class)
Definition: glvertex_nodes.h:1800
mat4 lglGetManip()
get the manipulator matrix
Definition: glvertex_api.h:324
vec4f lglGetFogColor()
get OpenGL state (fog color)
Definition: glvertex_api.h:456
lgl_TextureTransformationNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2898
std::ostream & operator<<(std::ostream &out, const lgl_Node &node)
output operator
Definition: glvertex_nodes.h:1192
std::string suffix(const std::string &match) const
get suffix after last substring match
Definition: glvertex_string.h:39
lgl_ClippingNode(vec4 equation=vec4(0, 0, 0, 0), unsigned int n=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:5033
static void lglRayCast(lgl *vbo)
cast a ray and intersect it with the transformed triangles contained in the vbo
Definition: glvertex_core.h:4963
virtual void control(lgl_ControllableNode *ctrl, bool override)
reimplement to change control effect
Definition: glvertex_nodes.h:1585
void forward(double delta)
move the animation forward
Definition: glvertex_nodes.h:3141
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:906
light material node
Definition: glvertex_nodes.h:4219
void lglGetLightSourceParameters(vec3f &Ia, vec3f &Id, vec3f &Is, vec3f &falloff) const
get the light source parameters
Definition: glvertex_core.h:4233
double getSteerLevel() const
get the steer level
Definition: glvertex_nodes.h:1855
lgl_ClippingNode(vec3 point, vec3 normal, unsigned int n=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:5043
float getFogDensity() const
get the fog density
Definition: glvertex_nodes.h:4804
virtual lgl_Node * find(const std::string &id)
find a node with a specific identifier
Definition: glvertex_nodes.h:315
void setPauseBarrier(bool yes=false)
set pause barrier
Definition: glvertex_nodes.h:1686
virtual void pick()
reimplement this method to pick a node
Definition: glvertex_nodes.h:975
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3539
virtual void speedupAll(double speedup=1)
speedup all animations
Definition: glvertex_nodes.h:3344
LGL_VBO_TYPE * lglEndRayCast()
end ray casting
Definition: glvertex_api.h:868
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4156
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2782
lgl_ColorNode(double r, double g, double b, double a=1, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2333
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2931
void setColor(const vec4 &c)
set the color
Definition: glvertex_nodes.h:2367
level-of-detail node
Definition: glvertex_nodes.h:5260
T * find(const std::string &id)
find a node with a specific identifier and type
Definition: glvertex_nodes.h:345
T * find()
find a node with a specific type
Definition: glvertex_nodes.h:330
vec3f getLightVector() const
get light vector
Definition: glvertex_light.h:44
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3846
T * add(T *node)
add a child node with a specific type
Definition: glvertex_nodes.h:159
bool shown() const
is the node shown?
Definition: glvertex_nodes.h:291
void manage(bool yes=true)
manage the vbo
Definition: glvertex_nodes.h:2020
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2858
void lglBeginRayCast(vec3 origin, vec3 direction, double mindist=0)
begin ray casting in view coordinates
Definition: glvertex_api.h:860
void unlink()
remove the links of the node
Definition: glvertex_nodes.h:228
LGL API: immediate mode class definition.
Definition: glvertex_core.h:5820
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4235
float lglGetFogDensity()
get OpenGL state (fog density)
Definition: glvertex_api.h:452
4D double vector
Definition: glslmath.h:713
void setSpeedupBarrier(bool yes=false)
set speedup barrier
Definition: glvertex_nodes.h:1710
lgl_WarpAnimationNode(double omega, bool scale=true, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3838
lgl_TranslationNode(const vec3 &v, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2701
void lglGetLightParameters(vec3f &ka, vec3f &kd, vec3f &ks, vec3f &Ia, vec3f &Id, vec3f &Is, float &exponent, vec3f &falloff) const
get the light parameters
Definition: glvertex_core.h:4202
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:5176
static mat4 rotate(double angle, double vx, double vy, double vz)
create rotation matrix
Definition: glslmath.h:2446
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:5290
virtual unsigned int countAll()
count all nodes (count multiply linked nodes)
Definition: glvertex_nodes.h:641
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2159
void setTransitionStyle(lgl_transition_enum style)
set transition style
Definition: glvertex_nodes.h:3621
virtual void resume(bool yes=true)
resume the animation
Definition: glvertex_nodes.h:3177
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:5004
virtual bool checkForCycles()
check for graph cycles
Definition: glvertex_nodes.h:5369
void lglTexture3D(GLuint texid, bool owner=false)
bind a 3D texture for the default GLSL program
Definition: glvertex_core.h:4282
bool saveObj(std::string filename)
save into OBJ file
Definition: glvertex_nodes.h:830
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1852
vec3 getCenter()
get the bounding box center of the entire subgraph
Definition: glvertex_nodes.h:483
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4469
optimizing subgraph node
Definition: glvertex_nodes.h:5666
double norm(const vec2 &v)
get squared vector length
Definition: glslmath.h:225
static GL * getGL()
get the scene graph GL singleton
Definition: glvertex_nodes.h:803
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4572
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:5610
void lglGetBoundingBox(vec3 &bboxmin, vec3 &bboxmax) const
get the bounding box of the contained vertices in vbo
Definition: glvertex_core.h:1803
state change node (lighting)
Definition: glvertex_nodes.h:4961
lgl_Node(const std::string &id="")
default ctor
Definition: glvertex_nodes.h:27
bool lglAppliedColoring() const
check for applied vertex color attributes
Definition: glvertex_core.h:3322
void backward(double delta)
move the animation backward
Definition: glvertex_nodes.h:3153
double getRadius()
get the bounding sphere radius of the entire subgraph
Definition: glvertex_nodes.h:512
mat4 getProjectionMatrix() const
get projection matrix
Definition: glvertex_cam.h:237
GLuint lglGetTexture2D() const
get the bound 2D texture
Definition: glvertex_core.h:4276
GLuint lglGetTexture3D() const
get the bound 3D texture
Definition: glvertex_core.h:4292
void reverse()
reverse the animation
Definition: glvertex_nodes.h:3135
void disable(bool yes=true)
disable the node
Definition: glvertex_nodes.h:3564
void lglLightVector(vec4f light=vec4f(0, 0, 1, 0), bool camera_light=true)
set the light vector
Definition: glvertex_core.h:4151
void lglPopMatrix()
pop matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:78
void setEquation(vec4 equation)
set the clip plane equation
Definition: glvertex_nodes.h:5072
state change node (depth write)
Definition: glvertex_nodes.h:4533
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2358
void direction(bool forward)
set the direction of the animation
Definition: glvertex_nodes.h:3128
lgl_animation_steer_mode_enum
animation steer mode enum
Definition: glvertex_nodes.h:2981
void lglColor(const vec4f &c)
specify vertex color attribute (as defined by OpenGL 1.2)
Definition: glvertex_api.h:30
lgl_ScaleNode(double x, double y, double z, double w=1, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2839
lgl_AnimationNode(double delta=0, vec3 vector=vec3(0), double limit=0, double accel=0, double reverse=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3005
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4543
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2177
void lglLightSourceParameters(vec3f Ia=vec3f(1), vec3f Id=vec3f(1), vec3f Is=vec3f(1), vec3f falloff=vec3f(1, 0, 0))
set the light source parameters
Definition: glvertex_core.h:4219
bool managed()
is the vbo managed?
Definition: glvertex_nodes.h:2014
void lglFog(float density=0.0f, vec4f color=vec4f(1))
specify fog (as defined by OpenGL 1.2)
Definition: glvertex_api.h:160
void lglApplyColor(const vec4f &c)
add a color channel to the vbo
Definition: glvertex_core.h:2626
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3726
geometry node
Definition: glvertex_nodes.h:1978
virtual lgl_Node * find(const std::string &id)
find a node with a specific identifier
Definition: glvertex_nodes.h:5381
lgl_TranslationAnimationNode(double delta, const vec3 &vector, double limit=0, double accel=0, double reverse=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3453
void lglMultMatrix(const mat4 &matrix)
multiply with matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:70
bool disabled() const
is the node disabled?
Definition: glvertex_nodes.h:267
virtual void restartAll(double animation=0)
restart all animations
Definition: glvertex_nodes.h:3332
double getDelta() const
get the animation delta
Definition: glvertex_nodes.h:3027
void setActionMode(lgl_action_mode_enum mode)
set the action mode
Definition: glvertex_nodes.h:1412
double getAcceleration() const
get the animation acceleration
Definition: glvertex_nodes.h:3075
virtual void steer(double level, bool override=true)
apply the steer level as specified by the steer mode
Definition: glvertex_nodes.h:3207
virtual void pick()
reimplement this method to pick a node
Definition: glvertex_nodes.h:5226
scale node
Definition: glvertex_nodes.h:2824
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:5063
double length(const vec2 &v)
get vector length
Definition: glslmath.h:221
lgl_ScaleTransitionNode(double from, double to, double seconds, const vec3 &axis=vec3(1), const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3798
vec4 getScale() const
get the scale vector
Definition: glvertex_nodes.h:2861
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:5351
std::string getAltId() const
get the alternate node identifier
Definition: glvertex_nodes.h:100
lgl_Node(const lgl_Node &node)
copy ctor
Definition: glvertex_nodes.h:39
lgl_TextureTransformationNode(const vec3 &v, const std::string &id="", lgl_Node *node=NULL)
ctor (translation)
Definition: glvertex_nodes.h:2911
virtual void setSpeedup(double speedup=1)
set the animation speedup
Definition: glvertex_nodes.h:3588
mat4 getViewMatrix(bool left=true) const
get viewing matrix
Definition: glvertex_cam.h:246
vec3f getLightVector() const
get the light vector
Definition: glvertex_nodes.h:4004
animation node (warp)
Definition: glvertex_nodes.h:3833
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:4160
void setResumeBarrier(bool yes=false)
set resume barrier
Definition: glvertex_nodes.h:1698
light source node
Definition: glvertex_nodes.h:4138
void setMaterialParameters(vec3f ka=vec3f(0.1f), vec3f kd=vec3f(0.7f), vec3f ks=vec3f(0.2f), float exponent=30)
set the material parameters
Definition: glvertex_light.h:213
virtual void control(bool override=true)
control the node as specified by the control mode
Definition: glvertex_nodes.h:3591
lgl_transition_enum getTransitionStyle() const
get transition style
Definition: glvertex_nodes.h:3615
void lglColoring(bool on)
enable or disable the vertex color attributes contained in vbo
Definition: glvertex_core.h:3353
camera node
Definition: glvertex_nodes.h:1914
lgl_BarrierNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1654
LGL string class that extends std::string.
Definition: glvertex_string.h:12
lgl_ScaleTransitionNode(double scale, double seconds, const vec3 &axis=vec3(1), const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3789
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4713
mat4 lglGetTexMatrix()
get the vbo texturing matrix
Definition: glvertex_api.h:356
virtual void control(bool override=true)
trigger the controllable child nodes
Definition: glvertex_nodes.h:1400
void lglDepthTest(bool on=false)
change OpenGL state (depth test)
Definition: glvertex_api.h:388
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:4402
virtual mat4 animate(double animation, const vec3 &axis)
to be implemented for a particular type of animation
Definition: glvertex_nodes.h:3857
void exportNodes(std::string filename)
export graph nodes
Definition: glvertex_nodes.h:6039
void lglLightParameters(vec3f ka=vec3f(0.1f), vec3f kd=vec3f(0.7f), vec3f ks=vec3f(0.2f), vec3f Ia=vec3f(1), vec3f Id=vec3f(1), vec3f Is=vec3f(1), float exponent=30, vec3f falloff=vec3f(1, 0, 0))
set the light parameters
Definition: glvertex_core.h:4182
void setClipPlane(vec3 point, vec3 normal)
set the clip plane
Definition: glvertex_nodes.h:5078
void exportCommands(std::string filename)
export graphics commands
Definition: glvertex_nodes.h:6057
bool lglGetBlending()
get OpenGL state (blending)
Definition: glvertex_api.h:408
lgl_RotationNode(double angle, double x, double y, double z, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2771
lgl_string remove(const std::string &start, const std::string &stop)
remove fragment between start and stop delimiters
Definition: glvertex_string.h:89
transition node (base class)
Definition: glvertex_nodes.h:3509
subgraph node
Definition: glvertex_nodes.h:5335
void setLightVector(vec4f light, bool camera_light=true)
set light vector
Definition: glvertex_light.h:37
virtual void finish()
finish ongoing transition
Definition: glvertex_nodes.h:3627
virtual void update(double dt)
reimplement this method to update a node
Definition: glvertex_nodes.h:5218
3D double vector
Definition: glslmath.h:372
action node
Definition: glvertex_nodes.h:1370
lgl_TextureTransformationNode(const mat4 &m, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2904
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:4239
void updateSceneGraph(double dt)
update the entire scene subgraph
Definition: glvertex_nodes.h:410
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3459
bool getResumeBarrier() const
get resume barrier
Definition: glvertex_nodes.h:1692
4x4 double matrix
Definition: glslmath.h:2116
virtual unsigned int countAllOnce()
count all nodes (count multiply linked nodes once)
Definition: glvertex_nodes.h:653
void setLightVector(vec4f light)
set the light vector
Definition: glvertex_nodes.h:4010
bool optimizable() const
is the node optimizable?
Definition: glvertex_nodes.h:751
void lglBackFaceCulling(bool on=true)
change OpenGL state (back-face culling)
Definition: glvertex_api.h:396
bool lglGetLighting() const
check for lighting
Definition: glvertex_core.h:3389
virtual void control(bool override=true)
override the controllable child nodes
Definition: glvertex_nodes.h:1512
state change node (alpha testing)
Definition: glvertex_nodes.h:4697
virtual bool ordered() const
is the node ordered?
Definition: glvertex_nodes.h:5199
switcher node
Definition: glvertex_nodes.h:5164
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4302
void lglError(std::string e)
generate an error message
Definition: glvertex_api.h:928
lgl_TransitionNode(double delta, const vec3 &vector, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3523
lglVBO * pickSceneGraph(vec3 origin, vec3 direction, double mindist=0)
pick the entire scene subgraph
Definition: glvertex_nodes.h:614
lgl_LightSourceNode(vec4f light=vec4f(0, 0, 1, 0), bool camera_light=true, vec3f Ia=vec3f(1), vec3f Id=vec3f(1), vec3f Is=vec3f(1), vec3f falloff=vec3f(1, 0, 0), const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:4143
virtual mat4 animate(double animation, const vec3 &vector)
to be implemented for a particular type of animation
Definition: glvertex_nodes.h:3463
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1665
float getLineWidth() const
get the line width
Definition: glvertex_nodes.h:4881
virtual void pick()
reimplement this method to pick a node
Definition: glvertex_nodes.h:5636
lgl_Texture2DNode(GLuint texid=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:4293
lgl_RotationTransitionNode(double angle, const vec3 &axis, double seconds, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3753
std::string getName() const
get the vbo name
Definition: glvertex_core.h:203
bool lglGetAlphaTest()
get OpenGL state (alpha test)
Definition: glvertex_api.h:420
4D float vector
Definition: glslmath.h:961
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3806
void lglGetMaterialParameters(vec3f &ka, vec3f &kd, vec3f &ks, float &exponent) const
get the material parameters
Definition: glvertex_core.h:4255
lgl_ClippingNode(unsigned int n, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:5053
bool lglGetColoring() const
check for coloring
Definition: glvertex_core.h:3368
vec4 getEquation() const
get the clip plane equation
Definition: glvertex_nodes.h:5066
lgl_control_mode_enum getControlMode() const
get the control mode
Definition: glvertex_nodes.h:1257
void setSteerLevel(double level)
set the steer level
Definition: glvertex_nodes.h:1861
double getReverse() const
get the reverse acceleration after limit has been reached
Definition: glvertex_nodes.h:3081
virtual void optimizeAll()
optimize all nodes
Definition: glvertex_nodes.h:5529
std::string exportAll(lgl_export_enum mode=LGL_EXPORT_NODES, int indentation=0, int increment=3)
export all nodes
Definition: glvertex_nodes.h:5701
void getLightParameters(vec3f &ka, vec3f &kd, vec3f &ks, vec3f &Ia, vec3f &Id, vec3f &Is, float &exponent, vec3f &falloff) const
get the light parameters
Definition: glvertex_nodes.h:4034
bool isCameraLight() const
is the light source a camera light?
Definition: glvertex_nodes.h:4028
lgl_ActionNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1390
lgl_action_mode_enum getActionMode() const
get the action mode
Definition: glvertex_nodes.h:1406
lgl_ControllableNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1225
void lglMatrixMode(lgl_matrixmode_enum mode=LGL_MODELVIEW)
specify matrix mode (as defined by OpenGL 1.2)
Definition: glvertex_api.h:58
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:2188
void begin(bool left=true) const
push viewing and projection matrix
Definition: glvertex_cam.h:273
lgl_LevelOfDetailNode(double distance=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:5265
virtual void steer(double level, bool override=true)
apply the steer level as specified by the steer mode
Definition: glvertex_nodes.h:3604
unsigned int references() const
get the number of references to the node
Definition: glvertex_nodes.h:125
virtual void steer(double level, bool override=true)
apply the steer level
Definition: glvertex_nodes.h:1815
lgl_ControlNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1500
bool getPauseBarrier() const
get pause barrier
Definition: glvertex_nodes.h:1680
lgl_blendmode_enum
blend mode enum
Definition: glvertex_core.h:70
vec3 getTranslation() const
get the translation vector
Definition: glvertex_nodes.h:2723
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3760
virtual void pick()
reimplement this method to pick a node
Definition: glvertex_nodes.h:2959
void setVBO(lglVBO *vbo)
set the vbo
Definition: glvertex_nodes.h:2005
virtual void update(double dt)
reimplement this method to update a node
Definition: glvertex_nodes.h:1598
lgl_RotationAnimationNode(double omega, const vec3 &axis, double limit=0, double accel=0, double reverse=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:3483
virtual bool stateless() const
is the node stateless?
Definition: glvertex_nodes.h:2179
rotation node
Definition: glvertex_nodes.h:2755
bool lglGetAlphaTestGreater()
get OpenGL state (alpha test comparison mode)
Definition: glvertex_api.h:428
vbo node
Definition: glvertex_nodes.h:2165
std::string getId() const
get the node identifier
Definition: glvertex_nodes.h:88
virtual bool ordered() const
is the node ordered?
Definition: glvertex_nodes.h:733
void replace(lgl_Node *node, unsigned int i=0)
replace a child of the node
Definition: glvertex_nodes.h:188
double getNorm()
get the bounding sphere norm of the entire subgraph
Definition: glvertex_nodes.h:527
bool lglGetAlphaTestEqual()
get OpenGL state (alpha test equality mode)
Definition: glvertex_api.h:432
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:2383
lgl_ColorNode(const vec4 &color=vec4(1, 1, 1), const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2349
virtual mat4 animate(double animation, const vec3 &vector)
to be implemented for a particular type of animation
Definition: glvertex_nodes.h:3730
vec3 getRotationAxis() const
get the rotation axis
Definition: glvertex_nodes.h:2791
clipping node
Definition: glvertex_nodes.h:5028
virtual bool hasTransparency()
check for transparency
Definition: glvertex_nodes.h:2373
void lglApplyTexMatrix()
apply the vbo texturing matrix to the vbo and reset the matrix
Definition: glvertex_core.h:2603
virtual void lglRender(const lgl *vbo=NULL)
render the series of vertices contained in vbo
Definition: glvertex_core.h:1079
bool getRestartBarrier() const
get restart barrier
Definition: glvertex_nodes.h:1668
lgl_RotationNode(double angle, const vec3 &axis, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2760
void drawSceneGraph(const mat4 &m)
draw the entire scene subgraph without updating
Definition: glvertex_nodes.h:381
virtual void setSpeedup(double speedup=1)
set the animation speedup
Definition: glvertex_nodes.h:3189
virtual bool paused() const
is the animation paused?
Definition: glvertex_nodes.h:3165
lgl_blendmode_enum getBlendMode() const
get the blend mode
Definition: glvertex_nodes.h:4635
virtual ~lgl_Node()
dtor
Definition: glvertex_nodes.h:69
double getBoundingSphere(vec3 ¢er)
get the bounding sphere of the entire subgraph
Definition: glvertex_nodes.h:466
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1235
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:4485
virtual bool stateless() const
is the node stateless?
Definition: glvertex_nodes.h:2036
virtual void pauseAll(bool yes=true)
pause all animations
Definition: glvertex_nodes.h:1721
double length() const
get vector length
Definition: glslmath.h:420
void show(bool yes=true)
show the node and its children
Definition: glvertex_nodes.h:303
void lglLighting(bool on)
enable or disable the vertex normal attributes contained in vbo
Definition: glvertex_core.h:3374
state change node (base class)
Definition: glvertex_nodes.h:4456
state change node (line width)
Definition: glvertex_nodes.h:4867
virtual std::vector< vec4 > getVertexCoordinates(mat4 trans=mat4())
Definition: glvertex_nodes.h:542
lgl_TextureTransformationNode(double scale, const std::string &id="", lgl_Node *node=NULL)
ctor (scale)
Definition: glvertex_nodes.h:2925
static mat4 scale(double s, double t, double r, double w=1.0)
create scaling matrix
Definition: glslmath.h:2409
void setSwitch(unsigned int i)
set the switch index
Definition: glvertex_nodes.h:5185
void setAltId(const std::string &id="")
set the alternate node identifier
Definition: glvertex_nodes.h:107
geometry container node
Definition: glvertex_nodes.h:2146
void signalOnStop()
signal on stop
Definition: glvertex_nodes.h:3063
virtual mat4 animate(double animation, const vec3 &axis)
to be implemented for a particular type of animation
Definition: glvertex_nodes.h:3812
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4938
void lglTexture2D(GLuint texid, bool owner=false)
bind a 2D texture for the default GLSL program
Definition: glvertex_core.h:4266
LGL API: vbo class definition.
Definition: glvertex_core.h:5827
virtual void pick()
reimplement this method to pick a node
Definition: glvertex_nodes.h:2086
unsigned int getSwitch() const
get the switch index
Definition: glvertex_nodes.h:5179
state change node (texturing)
Definition: glvertex_nodes.h:4994
lglVBO * getVBO() const
get the vbo
Definition: glvertex_nodes.h:1999
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:4318
virtual void finish()
finish pending control signal
Definition: glvertex_nodes.h:1536
lgl_animation_steer_mode_enum getSteerMode() const
get the steer mode
Definition: glvertex_nodes.h:3195
lgl_blendmode_enum lglGetBlendMode()
get OpenGL state (blend mode)
Definition: glvertex_api.h:412
double animation() const
get the actual animation state
Definition: glvertex_nodes.h:3087
virtual double speedup()
get the animation speedup
Definition: glvertex_nodes.h:3183
camera convenience class
Definition: glvertex_cam.h:11
void remove(unsigned int i=0)
remove a child from the node
Definition: glvertex_nodes.h:171
bool getSpeedupBarrier() const
get speedup barrier
Definition: glvertex_nodes.h:1704
virtual void pick()
reimplement this method to pick a node
Definition: glvertex_nodes.h:2228
translation node
Definition: glvertex_nodes.h:2696
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:2720
virtual mat4 animate(double animation, const vec3 &axis)
to be implemented for a particular type of animation
Definition: glvertex_nodes.h:3766
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:3024
virtual void pauseAll(bool yes=true)
pause all animations
Definition: glvertex_nodes.h:5551
void toggle()
toggle the node
Definition: glvertex_nodes.h:3574
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:85
animation node (base class)
Definition: glvertex_nodes.h:2976
lgl_Node * take(unsigned int i=0)
unlink a child and take ownership
Definition: glvertex_nodes.h:201
vec3 getExtent()
get the bounding box extent of the entire subgraph
Definition: glvertex_nodes.h:497
bool isCameraLight() const
is the light source a camera light?
Definition: glvertex_light.h:50
lgl_SteerableNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1805
virtual void pauseAll(bool yes=true)
pause all animations
Definition: glvertex_nodes.h:777
bool getAlphaTestGreater() const
get the alpha test comparison mode
Definition: glvertex_nodes.h:4722
double getRotationAngle() const
get the rotation angle
Definition: glvertex_nodes.h:2785
lgl_Node * get(unsigned int i=0) const
get a child node
Definition: glvertex_nodes.h:137
void setControlMode(lgl_control_mode_enum mode)
set the control mode
Definition: glvertex_nodes.h:1263
void lglZWrite(bool on=true)
change OpenGL state (depth write)
Definition: glvertex_api.h:380
state change node (depth test)
Definition: glvertex_nodes.h:4562
vec4 lglGetClipPlaneEquation(unsigned int n=0)
get OpenGL state (clip plane equation)
Definition: glvertex_api.h:440
void lglPushMatrix()
push matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:74
bool hasTransparency()
check the entire subgraph whether or not it contains semi-transparent geometry
Definition: glvertex_nodes.h:628
virtual void pause(bool yes=true)
pause the animation
Definition: glvertex_nodes.h:3582
float lglGetAlphaTestValue()
get OpenGL state (alpha test value)
Definition: glvertex_api.h:424
virtual void update(double dt)
reimplement this method to update a node
Definition: glvertex_nodes.h:5628
void lglModel()
reset the vbo modeling matrix
Definition: glvertex_core.h:2525
animation node (translation)
Definition: glvertex_nodes.h:3448
unsigned int countAllVertices()
count all vertices
Definition: glvertex_nodes.h:681
lgl_Texture3DNode(GLuint texid=0, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:4377
animation node (translation transition)
Definition: glvertex_nodes.h:3715
bool getStopOnLimit() const
get stop on animation limit
Definition: glvertex_nodes.h:3057
bool enabled() const
is the node enabled?
Definition: glvertex_nodes.h:3542
void exportGraph(std::string filename)
export link graph
Definition: glvertex_nodes.h:6048
void lglApplyModelMatrix()
apply the vbo modeling matrix to the vbo and reset the matrix
Definition: glvertex_core.h:2551
virtual void speedupAll(double speedup=1)
speedup all animations
Definition: glvertex_nodes.h:785
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4971
int lglGetVertexCount() const
get the number of vertices contained in vbo
Definition: glvertex_core.h:1790
bool lglGetZWrite()
get OpenGL state (depth write)
Definition: glvertex_api.h:384
unsigned int children() const
get the number of children of the node
Definition: glvertex_nodes.h:113
bool lglGetDepthTest()
get OpenGL state (depth test)
Definition: glvertex_api.h:392
virtual void update(double dt)
reimplement this method to update a node
Definition: glvertex_nodes.h:3253
void advance(int delta=1)
advance the switch index
Definition: glvertex_nodes.h:5191
float lglGetLineWidth()
get OpenGL state (line width)
Definition: glvertex_api.h:460
virtual bool stateless() const
is the node stateless?
Definition: glvertex_nodes.h:1268
virtual bool checkForCycles()
check for graph cycles
Definition: glvertex_nodes.h:240
lgl_action_mode_enum
action mode enum
Definition: glvertex_nodes.h:1375
lgl_SteerNode(const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:1844
virtual void pause(bool yes=true)
pause the animation
Definition: glvertex_nodes.h:3171
double getVelocity() const
get the animation velocity
Definition: glvertex_nodes.h:3039
lgl_primitive_enum lglGetVertexMode() const
get the primitive mode of vertices contained in vbo
Definition: glvertex_core.h:1784
lgl_string toLower(char separator='\0') const
convert to lower case
Definition: glvertex_string.h:107
virtual void resume(bool yes=true)
resume the animation
Definition: glvertex_nodes.h:3585
virtual void pauseAll(bool yes=true)
pause all animations
Definition: glvertex_nodes.h:3338
void lglAppendVerticesTo(lgl *vbo) const
append a copy of the vertices and attributes in vbo to another vbo
Definition: glvertex_core.h:1928
lgl_ScaleNode(const vec4 &c, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2849
static mat4 translate(double x, double y, double z)
create translation matrix
Definition: glslmath.h:2427
bool getSignalOnStop() const
get signal on stop
Definition: glvertex_nodes.h:3069
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1812
void toggle()
toggle the node
Definition: glvertex_nodes.h:285
lgl_TextureTransformationNode(double angle, const vec3 &v, const std::string &id="", lgl_Node *node=NULL)
ctor (rotation)
Definition: glvertex_nodes.h:2918
double getLimit() const
get the animation limit
Definition: glvertex_nodes.h:3045
color node
Definition: glvertex_nodes.h:2328
animation node (scale transition)
Definition: glvertex_nodes.h:3784
lgl_export_enum
scene graph export modes
Definition: glvertex_nodes.h:810
lgl_transition_enum
transition style
Definition: glvertex_nodes.h:3514
virtual mat4 animate(double animation, const vec3 &vector)=0
to be implemented for a particular type of animation
virtual void finishAll()
finish all transitions
Definition: glvertex_nodes.h:793
void drawSceneGraph(vec4 color=vec4(1))
draw the entire scene subgraph without updating
Definition: glvertex_nodes.h:359
bool getAlphaTestEqual() const
get the alpha test equality mode
Definition: glvertex_nodes.h:4728
void setLightPosition(vec3f light)
set the light position
Definition: glvertex_nodes.h:4022
void rewind(double animation=0)
rewind the animation
Definition: glvertex_nodes.h:3119
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4001
controllable node (base class)
Definition: glvertex_nodes.h:1204
void lglTexturing(bool on)
enable or disable the vertex texture coordinate attributes contained in vbo
Definition: glvertex_core.h:3395
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:1509
lgl_ContainerNode(lglVBO *vbo, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2151
virtual void speedupAll(double speedup=1)
speedup all animations
Definition: glvertex_nodes.h:5562
virtual unsigned int countAll()
count all nodes (count multiply linked nodes)
Definition: glvertex_nodes.h:5439
std::string getName() const
get the vbo name
Definition: glvertex_nodes.h:2026
Blinn-Phong light source.
Definition: glvertex_light.h:11
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4601
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:5208
void lglRayCast(lglVBO *vbo)
cast a ray and intersect it with the transformed triangles contained in the vbo
Definition: glvertex_api.h:864
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:2935
virtual unsigned int countAllPrimitives()
count all primitives
Definition: glvertex_nodes.h:5469
control barrier node
Definition: glvertex_nodes.h:1649
animation node (rotation transition)
Definition: glvertex_nodes.h:3748
void setControlDelay(double delay)
set the control delay
Definition: glvertex_nodes.h:1524
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:2046
state change node (fogging)
Definition: glvertex_nodes.h:4787
virtual void restartAll(double animation=0)
restart all animations
Definition: glvertex_nodes.h:769
vec4 lglGetColor()
get actual color
Definition: glvertex_api.h:178
virtual void control(bool override=true)
control the node as specified by the control mode
Definition: glvertex_nodes.h:1238
void setName(std::string name="")
set the vbo name
Definition: glvertex_core.h:209
unsigned int getClipPlaneNumber() const
get the clip plane number
Definition: glvertex_nodes.h:5084
lgl_TranslationNode(double x, double y, double z, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2711
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:4801
static mat4 transform(const mat3 &m, const vec3 &v)
create affine (resp.
Definition: glslmath.h:2647
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:5274
control node
Definition: glvertex_nodes.h:1495
animation node (rotation)
Definition: glvertex_nodes.h:3478
virtual void getBoundingBox(vec3 &bboxmin, vec3 &bboxmax)
get the bounding box of the entire subgraph
Definition: glvertex_nodes.h:417
lgl_Node * add_node(lgl_Node *node)
add a child to the node
Definition: glvertex_nodes.h:148
lgl_Node(lgl_Node *node, const std::string &id="")
custom ctor
Definition: glvertex_nodes.h:54
virtual void control(lgl_ControllableNode *ctrl, bool override)
reimplement to change control effect
Definition: glvertex_nodes.h:1870
virtual std::string getClassId() const
get the class id
Definition: glvertex_nodes.h:5677
virtual unsigned int countAllOnce()
count all nodes (count multiply linked nodes once)
Definition: glvertex_nodes.h:5454
void getExactBoundingBox(vec3 &bboxmin, vec3 &bboxmax)
get the exact bounding box of the entire subgraph
Definition: glvertex_nodes.h:565
virtual void restartAll(double animation=0)
restart all animations
Definition: glvertex_nodes.h:1715
virtual bool stateless() const
is the node stateless?
Definition: glvertex_nodes.h:727
lgl_ColorNode(double color, const std::string &id="", lgl_Node *node=NULL)
ctor
Definition: glvertex_nodes.h:2341
virtual void speedupAll(double speedup=1)
speedup all animations
Definition: glvertex_nodes.h:1735
double getControlDelay() const
get the control delay
Definition: glvertex_nodes.h:1530
virtual void render()
reimplement this method to render a node
Definition: glvertex_nodes.h:5094
bool convertable() const
is the node convertable?
Definition: glvertex_nodes.h:739
mat4 lglGetModelViewMatrix()
get actual modelview matrix
Definition: glvertex_api.h:202