projects
/
laserbrain_demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bugs in the resource manager and removed the hardcoded textures
[laserbrain_demo]
/
src
/
snode.cc
diff --git
a/src/snode.cc
b/src/snode.cc
index
fac6c65
..
101fe62
100644
(file)
--- a/
src/snode.cc
+++ b/
src/snode.cc
@@
-37,6
+37,8
@@
const char *SceneNode::get_name() const
void SceneNode::add_child(SceneNode *node)
{
void SceneNode::add_child(SceneNode *node)
{
+ if(!node) return;
+
if(node->parent) {
if(node->parent == this) {
return;
if(node->parent) {
if(node->parent == this) {
return;
@@
-50,6
+52,8
@@
void SceneNode::add_child(SceneNode *node)
bool SceneNode::remove_child(SceneNode *node)
{
bool SceneNode::remove_child(SceneNode *node)
{
+ if(!node) return false;
+
auto it = std::find(children.begin(), children.end(), node);
if(it != children.end()) {
assert(node->parent == this);
auto it = std::find(children.begin(), children.end(), node);
if(it != children.end()) {
assert(node->parent == this);
@@
-177,7
+181,7
@@
void SceneNode::update_node(float dt)
xform.pre_scale(scale);
if(parent) {
xform.pre_scale(scale);
if(parent) {
- xform = parent->xform * xform;
+ xform = xform * parent->xform;
}
inv_xform = inverse(xform);
}
}
inv_xform = inverse(xform);
}