nuclear@54: /* nuclear@54: goat3d - 3D scene, character, and animation file format library. nuclear@54: Copyright (C) 2013-2014 John Tsiombikas nuclear@54: nuclear@54: This program is free software: you can redistribute it and/or modify nuclear@54: it under the terms of the GNU Lesser General Public License as published by nuclear@54: the Free Software Foundation, either version 3 of the License, or nuclear@54: (at your option) any later version. nuclear@54: nuclear@54: This program is distributed in the hope that it will be useful, nuclear@54: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@54: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@54: GNU Lesser General Public License for more details. nuclear@54: nuclear@54: You should have received a copy of the GNU Lesser General Public License nuclear@54: along with this program. If not, see . nuclear@54: */ nuclear@0: #include nuclear@0: #include nuclear@0: #include "node.h" nuclear@0: nuclear@47: using namespace g3dimpl; nuclear@47: nuclear@0: Node::Node() nuclear@0: { nuclear@8: obj = 0; nuclear@75: bbox_valid = false; nuclear@0: } nuclear@0: nuclear@8: void Node::set_object(Object *obj) nuclear@0: { nuclear@8: this->obj = obj; nuclear@75: bbox_valid = false; nuclear@0: } nuclear@0: nuclear@8: Object *Node::get_object() nuclear@0: { nuclear@75: bbox_valid = false; nuclear@8: return obj; nuclear@0: } nuclear@0: nuclear@8: const Object *Node::get_object() const nuclear@0: { nuclear@8: return obj; nuclear@0: } nuclear@0: nuclear@75: const AABox &Node::get_bounds() const nuclear@75: { nuclear@75: if(!bbox_valid) { nuclear@76: Matrix4x4 xform; nuclear@76: get_xform(0, &xform); nuclear@76: bbox = obj ? obj->get_bounds(xform) : AABox(); nuclear@75: nuclear@75: for(int i=0; iget_bounds()); nuclear@75: } nuclear@75: bbox_valid = true; nuclear@75: } nuclear@75: nuclear@75: return bbox; nuclear@75: } nuclear@75: nuclear@47: void g3dimpl::delete_node_tree(Node *n) nuclear@0: { nuclear@56: if(!n) return; nuclear@56: nuclear@8: for(int i=0; iget_children_count(); i++) { nuclear@8: delete_node_tree((Node*)n->get_child(i)); nuclear@0: } nuclear@8: delete n; nuclear@0: }