00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef INTERNALNAME_H
00016 #define INTERNALNAME_H
00017
00018 #include "pandabase.h"
00019
00020 #include "typedWritableReferenceCount.h"
00021 #include "pointerTo.h"
00022 #include "pmap.h"
00023 #include "lightMutex.h"
00024
00025 class FactoryParams;
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 class EXPCL_PANDA_GOBJ InternalName : public TypedWritableReferenceCount {
00043 private:
00044 InternalName(InternalName *parent, const string &basename);
00045
00046 PUBLISHED:
00047 virtual ~InternalName();
00048 virtual bool unref() const;
00049
00050 INLINE static PT(InternalName) make(const string &name);
00051 static PT(InternalName) make(const string &name, int index);
00052 PT(InternalName) append(const string &basename);
00053
00054 INLINE InternalName *get_parent() const;
00055 string get_name() const;
00056 INLINE const string &get_basename() const;
00057
00058 int find_ancestor(const string &basename) const;
00059 const InternalName *get_ancestor(int n) const;
00060 const InternalName *get_top() const;
00061 string get_net_basename(int n) const;
00062
00063 void output(ostream &out) const;
00064
00065
00066 INLINE static PT(InternalName) get_root();
00067 INLINE static PT(InternalName) get_error();
00068 INLINE static PT(InternalName) get_vertex();
00069 INLINE static PT(InternalName) get_normal();
00070 INLINE static PT(InternalName) get_tangent();
00071 INLINE static PT(InternalName) get_tangent_name(const string &name);
00072 INLINE static PT(InternalName) get_binormal();
00073 INLINE static PT(InternalName) get_binormal_name(const string &name);
00074 INLINE static PT(InternalName) get_texcoord();
00075 INLINE static PT(InternalName) get_texcoord_name(const string &name);
00076 INLINE static PT(InternalName) get_color();
00077 INLINE static PT(InternalName) get_rotate();
00078 INLINE static PT(InternalName) get_size();
00079 INLINE static PT(InternalName) get_aspect_ratio();
00080 INLINE static PT(InternalName) get_transform_blend();
00081 INLINE static PT(InternalName) get_transform_weight();
00082 INLINE static PT(InternalName) get_transform_index();
00083 INLINE static PT(InternalName) get_morph(InternalName *column, const string &slider);
00084 INLINE static PT(InternalName) get_index();
00085 INLINE static PT(InternalName) get_world();
00086 INLINE static PT(InternalName) get_camera();
00087 INLINE static PT(InternalName) get_model();
00088 INLINE static PT(InternalName) get_view();
00089
00090 private:
00091 PT(InternalName) _parent;
00092 string _basename;
00093
00094 typedef phash_map<string, InternalName *, string_hash> NameTable;
00095 NameTable _name_table;
00096 LightMutex _name_table_lock;
00097
00098 static PT(InternalName) _root;
00099 static PT(InternalName) _error;
00100 static PT(InternalName) _default;
00101 static PT(InternalName) _vertex;
00102 static PT(InternalName) _normal;
00103 static PT(InternalName) _tangent;
00104 static PT(InternalName) _binormal;
00105 static PT(InternalName) _texcoord;
00106 static PT(InternalName) _color;
00107 static PT(InternalName) _rotate;
00108 static PT(InternalName) _size;
00109 static PT(InternalName) _aspect_ratio;
00110 static PT(InternalName) _transform_blend;
00111 static PT(InternalName) _transform_weight;
00112 static PT(InternalName) _transform_index;
00113 static PT(InternalName) _index;
00114 static PT(InternalName) _world;
00115 static PT(InternalName) _camera;
00116 static PT(InternalName) _model;
00117 static PT(InternalName) _view;
00118
00119 public:
00120
00121 static void register_with_read_factory();
00122 virtual void write_datagram(BamWriter *manager, Datagram &me);
00123
00124 virtual void finalize(BamReader *manager);
00125
00126 protected:
00127 static TypedWritable *make_from_bam(const FactoryParams ¶ms);
00128 static TypedWritable *make_texcoord_from_bam(const FactoryParams ¶ms);
00129
00130 public:
00131 static TypeHandle get_class_type() {
00132 return _type_handle;
00133 }
00134 static void init_type() {
00135 TypedWritableReferenceCount::init_type();
00136 register_type(_type_handle, "InternalName",
00137 TypedWritableReferenceCount::get_class_type());
00138
00139
00140 register_type(_texcoord_type_handle, "TexCoordName",
00141 TypedWritableReferenceCount::get_class_type());
00142 }
00143 virtual TypeHandle get_type() const {
00144 return get_class_type();
00145 }
00146 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00147
00148 private:
00149 static TypeHandle _type_handle;
00150 static TypeHandle _texcoord_type_handle;
00151 };
00152
00153 INLINE ostream &operator << (ostream &out, const InternalName &tcn);
00154
00155 #include "internalName.I"
00156
00157 #endif
00158
00159
00160