Panda3D
 All Classes Functions Variables Enumerations
eggVertexUV.h
1 // Filename: eggVertexUV.h
2 // Created by: drose (20Jul04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGGVERTEXUV_H
16 #define EGGVERTEXUV_H
17 
18 #include "pandabase.h"
19 
20 #include "eggMorphList.h"
21 #include "eggNamedObject.h"
22 
23 #include "luse.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : EggVertexUV
27 // Description : The set of UV's that may or may not be assigned to a
28 // vertex. To support multitexturing, there may be
29 // multiple sets of UV's on a particular vertex, each
30 // with its own name.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDAEGG EggVertexUV : public EggNamedObject {
33 PUBLISHED:
34  EggVertexUV(const string &name, const LTexCoordd &uv);
35  EggVertexUV(const string &name, const LTexCoord3d &uvw);
36  EggVertexUV(const EggVertexUV &copy);
37  EggVertexUV &operator = (const EggVertexUV &copy);
38  virtual ~EggVertexUV();
39 
40  INLINE static string filter_name(const string &name);
41  INLINE void set_name(const string &name);
42 
43  INLINE int get_num_dimensions() const;
44  INLINE bool has_w() const;
45  INLINE LTexCoordd get_uv() const;
46  INLINE const LTexCoord3d &get_uvw() const;
47  INLINE void set_uv(const LTexCoordd &texCoord);
48  INLINE void set_uvw(const LTexCoord3d &texCoord);
49 
50  INLINE bool has_tangent() const;
51  INLINE const LNormald &get_tangent() const;
52  INLINE void set_tangent(const LNormald &tangent);
53  INLINE void clear_tangent();
54 
55  INLINE bool has_binormal() const;
56  INLINE const LNormald &get_binormal() const;
57  INLINE void set_binormal(const LNormald &binormal);
58  INLINE void clear_binormal();
59 
60  static PT(EggVertexUV) make_average(const EggVertexUV *first,
61  const EggVertexUV *second);
62 
63  void transform(const LMatrix4d &mat);
64 
65  void write(ostream &out, int indent_level) const;
66  int compare_to(const EggVertexUV &other) const;
67 
69 
70 private:
71  enum Flags {
72  F_has_tangent = 0x001,
73  F_has_binormal = 0x002,
74  F_has_w = 0x004,
75  };
76 
77  int _flags;
78  LNormald _tangent;
79  LNormald _binormal;
80  LTexCoord3d _uvw;
81 
82 public:
83  static TypeHandle get_class_type() {
84  return _type_handle;
85  }
86  static void init_type() {
87  EggNamedObject::init_type();
88  register_type(_type_handle, "EggVertexUV",
89  EggNamedObject::get_class_type());
90  }
91  virtual TypeHandle get_type() const {
92  return get_class_type();
93  }
94  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
95 
96 private:
97  static TypeHandle _type_handle;
98 };
99 
100 #include "eggVertexUV.I"
101 
102 #endif
103 
The set of UV's that may or may not be assigned to a vertex.
Definition: eggVertexUV.h:32
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
This is a two-component point in space.
Definition: lpoint2.h:411
This is a fairly low-level base class–any egg object that has a name.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:746
An STL function object class, this is intended to be used on any ordered collection of class objects ...
Definition: stl_compares.h:79
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:531
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85