00001 // Filename: modelNode.h 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef MODELNODE_H 00020 #define MODELNODE_H 00021 00022 #include "pandabase.h" 00023 00024 #include "pandaNode.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : ModelNode 00028 // Description : This node is placed at key points within the scene 00029 // graph to indicate the roots of "models": subtrees 00030 // that are conceptually to be treated as a single unit, 00031 // like a car or a room, for instance. It doesn't 00032 // affect rendering or any other operations; it's 00033 // primarily useful as a high-level model indication. 00034 // 00035 // ModelNodes are created in response to a <Model> { 1 } 00036 // flag within an egg file. 00037 //////////////////////////////////////////////////////////////////// 00038 class EXPCL_PANDA ModelNode : public PandaNode { 00039 PUBLISHED: 00040 INLINE ModelNode(const string &name); 00041 00042 protected: 00043 INLINE ModelNode(const ModelNode ©); 00044 00045 public: 00046 virtual PandaNode *make_copy() const; 00047 00048 virtual bool safe_to_flatten() const; 00049 virtual bool safe_to_transform() const; 00050 virtual bool safe_to_modify_transform() const; 00051 virtual bool safe_to_combine() const; 00052 virtual bool preserve_name() const; 00053 00054 PUBLISHED: 00055 enum PreserveTransform { 00056 PT_none, 00057 PT_local, 00058 PT_net 00059 }; 00060 00061 INLINE void set_preserve_transform(PreserveTransform preserve_transform); 00062 INLINE PreserveTransform get_preserve_transform() const; 00063 00064 private: 00065 PreserveTransform _preserve_transform; 00066 00067 public: 00068 static void register_with_read_factory(); 00069 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00070 00071 protected: 00072 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00073 void fillin(DatagramIterator &scan, BamReader *manager); 00074 00075 public: 00076 static TypeHandle get_class_type() { 00077 return _type_handle; 00078 } 00079 static void init_type() { 00080 PandaNode::init_type(); 00081 register_type(_type_handle, "ModelNode", 00082 PandaNode::get_class_type()); 00083 } 00084 virtual TypeHandle get_type(void) const { 00085 return get_class_type(); 00086 } 00087 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00088 00089 private: 00090 static TypeHandle _type_handle; 00091 }; 00092 00093 #include "modelNode.I" 00094 00095 #endif 00096 00097