Panda3D
|
00001 // Filename: vrmlNode.h 00002 // Created by: drose (23Jun99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // PANDA 3D SOFTWARE 00006 // Copyright (c) Carnegie Mellon University. All rights reserved. 00007 // 00008 // All use of this software is subject to the terms of the revised BSD 00009 // license. You should have received a copy of this license along 00010 // with this source code in a file named "LICENSE." 00011 //////////////////////////////////////////////////////////////////// 00012 00013 #ifndef VRMLNODE_H 00014 #define VRMLNODE_H 00015 00016 #include "pandatoolbase.h" 00017 00018 #include "vrmlNodeType.h" 00019 #include "pvector.h" 00020 #include "pmap.h" 00021 00022 class VrmlNode { 00023 public: 00024 VrmlNode(const VrmlNodeType *type); 00025 ~VrmlNode(); 00026 00027 const VrmlFieldValue &get_value(const char *field_name) const; 00028 00029 void output(ostream &out, int indent) const; 00030 00031 class Field { 00032 public: 00033 Field() { } 00034 Field(const VrmlNodeType::NameTypeRec *type, const VrmlFieldValue &value) : 00035 _type(type), _value(value) { } 00036 const VrmlNodeType::NameTypeRec *_type; 00037 VrmlFieldValue _value; 00038 }; 00039 00040 typedef vector<Field> Fields; 00041 Fields _fields; 00042 00043 int _use_count; 00044 00045 const VrmlNodeType *_type; 00046 }; 00047 00048 inline ostream &operator << (ostream &out, const VrmlNode &node) { 00049 node.output(out, 0); 00050 return out; 00051 } 00052 00053 class Declaration { 00054 public: 00055 SFNodeRef _node; 00056 00057 void output(ostream &out, int indent) const; 00058 }; 00059 00060 inline ostream &operator << (ostream &out, const Declaration &dec) { 00061 dec.output(out, 0); 00062 return out; 00063 } 00064 00065 typedef pvector<Declaration> VrmlScene; 00066 00067 ostream &operator << (ostream &out, const VrmlScene &scene); 00068 00069 #endif