00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef EGGVERTEX_H
00020 #define EGGVERTEX_H
00021
00022 #include <pandabase.h>
00023
00024 #include "eggObject.h"
00025 #include "eggAttributes.h"
00026 #include "eggMorphList.h"
00027
00028 #include <referenceCount.h>
00029 #include <luse.h>
00030 #include "pset.h"
00031
00032 class EggVertexPool;
00033 class EggGroup;
00034 class EggPrimitive;
00035
00036
00037
00038
00039
00040
00041
00042 class EXPCL_PANDAEGG EggVertex : public EggObject, public EggAttributes {
00043 public:
00044 typedef pset<EggGroup *> GroupRef;
00045 typedef pmultiset<EggPrimitive *> PrimitiveRef;
00046
00047 EggVertex();
00048 EggVertex(const EggVertex ©);
00049 EggVertex &operator = (const EggVertex ©);
00050 virtual ~EggVertex();
00051
00052 INLINE EggVertexPool *get_pool() const;
00053
00054
00055
00056 INLINE void set_pos(double pos);
00057 INLINE void set_pos(const LPoint2d &pos);
00058 INLINE void set_pos(const LPoint3d &pos);
00059 INLINE void set_pos(const LPoint4d &pos);
00060 INLINE void set_pos4(const LPoint4d &pos);
00061
00062
00063
00064
00065
00066
00067
00068 INLINE int get_num_dimensions() const;
00069 INLINE double get_pos1() const;
00070 INLINE LPoint2d get_pos2() const;
00071 INLINE Vertexd get_pos3() const;
00072 INLINE LPoint4d get_pos4() const;
00073
00074 INLINE int get_index() const;
00075
00076 INLINE void set_external_index(int external_index);
00077 INLINE int get_external_index() const;
00078
00079 void write(ostream &out, int indent_level) const;
00080 bool sorts_less_than(const EggVertex &other) const;
00081
00082 int get_num_local_coord() const;
00083 int get_num_global_coord() const;
00084
00085 void transform(const LMatrix4d &mat);
00086
00087 INLINE GroupRef::const_iterator gref_begin() const;
00088 INLINE GroupRef::const_iterator gref_end() const;
00089 INLINE GroupRef::size_type gref_size() const;
00090 bool has_gref(const EggGroup *group) const;
00091
00092 void copy_grefs_from(const EggVertex &other);
00093 void clear_grefs();
00094
00095 INLINE PrimitiveRef::const_iterator pref_begin() const;
00096 INLINE PrimitiveRef::const_iterator pref_end() const;
00097 INLINE PrimitiveRef::size_type pref_size() const;
00098 int has_pref(const EggPrimitive *prim) const;
00099
00100 #ifndef NDEBUG
00101 void test_gref_integrity() const;
00102 void test_pref_integrity() const;
00103 #else
00104 void test_gref_integrity() const { }
00105 void test_pref_integrity() const { }
00106 #endif // NDEBUG
00107
00108 void output(ostream &out) const;
00109
00110 EggMorphVertexList _dxyzs;
00111
00112 private:
00113 EggVertexPool *_pool;
00114 int _index;
00115 int _external_index;
00116 LPoint4d _pos;
00117 short _num_dimensions;
00118 GroupRef _gref;
00119 PrimitiveRef _pref;
00120
00121 public:
00122 static TypeHandle get_class_type() {
00123 return _type_handle;
00124 }
00125 static void init_type() {
00126 EggObject::init_type();
00127 EggAttributes::init_type();
00128 register_type(_type_handle, "EggVertex",
00129 EggObject::get_class_type(),
00130 EggAttributes::get_class_type());
00131 }
00132 virtual TypeHandle get_type() const {
00133 return get_class_type();
00134 }
00135 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00136
00137 private:
00138 static TypeHandle _type_handle;
00139
00140 friend class EggVertexPool;
00141 friend class EggGroup;
00142 friend class EggPrimitive;
00143 };
00144
00145 INLINE ostream &operator << (ostream &out, const EggVertex &vert) {
00146 vert.output(out);
00147 return out;
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157 class EXPCL_PANDAEGG UniqueEggVertices {
00158 public:
00159 INLINE bool operator ()(const EggVertex *v1, const EggVertex *v2) const;
00160 };
00161
00162 #include "eggVertex.I"
00163
00164 #endif
00165
00166
00167