00001 00002 00003 00004 00005 // ChangeLog 00006 // May 12, 2005 - Bruno de Oliveira Schneider 00007 // - Removed the "ID" suffix of every TypeID, added some underscores to the IDs. 00008 // - GetDescription now returns by reference. 00009 // Dec 15, 2004 - Bruno de Oliveira Schneider 00010 // - Uncommented TypeID enum, added GetID() to start using ids. 00011 // - This class is now derived from VPMemoryObj. 00012 // - Added AutoDeleteChildren. 00013 // Oct 04, 2004 - Bruno de Oliveira Schneider 00014 // - File created. 00015 00016 #include "vpscenenode.h" 00017 00018 #include <iostream> 00019 using namespace std; 00020 00021 VPSceneNode::VPSceneNode() 00022 { 00023 } 00024 00025 VPSceneNode::~VPSceneNode() 00026 { 00027 //~ cout << "VPSceneNode::~VPSceneNode(): " << GetDescription() << endl; 00028 } 00029 00030 VPSceneNode::VPSceneNode(const VPSceneNode& node) 00031 { 00032 childList = node.childList; 00033 description = node.description; 00034 } 00035 00036 VPSceneNode& VPSceneNode::operator=(const VPSceneNode& node) 00037 { 00038 childList = node.childList; 00039 description = node.description; 00040 return *this; 00041 } 00042 00043 void VPSceneNode::AddChild(const VPSceneNode& child) 00044 { 00045 childList.push_back(&child); 00046 } 00047 00048 bool VPSceneNode::DrawOGL() const 00049 { 00050 bool result; 00051 list<const VPSceneNode*>::const_iterator iter; 00052 00053 result = DrawInstanceOGL(); 00054 for (iter = childList.begin(); iter != childList.end(); ++iter) 00055 result = (result && (*iter)->DrawOGL()); 00056 return result; 00057 } 00058 00059 void VPSceneNode::AutoDeleteChildren() const 00060 { 00061 list<const VPSceneNode*>::const_iterator iter; 00062 for (iter = childList.begin(); iter != childList.end(); ++iter) 00063 { 00064 (*iter)->AutoDeleteChildren(); 00065 if ((*iter)->autoDelete) 00066 delete (*iter); 00067 } 00068 }