Panda3D
|
00001 // Filename: eggVertexUV.h 00002 // Created by: drose (20Jul04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef EGGVERTEXUV_H 00016 #define EGGVERTEXUV_H 00017 00018 #include "pandabase.h" 00019 00020 #include "eggMorphList.h" 00021 #include "eggNamedObject.h" 00022 00023 #include "luse.h" 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : EggVertexUV 00027 // Description : The set of UV's that may or may not be assigned to a 00028 // vertex. To support multitexturing, there may be 00029 // multiple sets of UV's on a particular vertex, each 00030 // with its own name. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDAEGG EggVertexUV : public EggNamedObject { 00033 PUBLISHED: 00034 EggVertexUV(const string &name, const LTexCoordd &uv); 00035 EggVertexUV(const string &name, const LTexCoord3d &uvw); 00036 EggVertexUV(const EggVertexUV ©); 00037 EggVertexUV &operator = (const EggVertexUV ©); 00038 virtual ~EggVertexUV(); 00039 00040 INLINE static string filter_name(const string &name); 00041 INLINE void set_name(const string &name); 00042 00043 INLINE int get_num_dimensions() const; 00044 INLINE bool has_w() const; 00045 INLINE LTexCoordd get_uv() const; 00046 INLINE const LTexCoord3d &get_uvw() const; 00047 INLINE void set_uv(const LTexCoordd &texCoord); 00048 INLINE void set_uvw(const LTexCoord3d &texCoord); 00049 00050 INLINE bool has_tangent() const; 00051 INLINE const LNormald &get_tangent() const; 00052 INLINE void set_tangent(const LNormald &tangent); 00053 INLINE void clear_tangent(); 00054 00055 INLINE bool has_binormal() const; 00056 INLINE const LNormald &get_binormal() const; 00057 INLINE void set_binormal(const LNormald &binormal); 00058 INLINE void clear_binormal(); 00059 00060 void transform(const LMatrix4d &mat); 00061 00062 void write(ostream &out, int indent_level) const; 00063 int compare_to(const EggVertexUV &other) const; 00064 00065 EggMorphTexCoordList _duvs; 00066 00067 private: 00068 enum Flags { 00069 F_has_tangent = 0x001, 00070 F_has_binormal = 0x002, 00071 F_has_w = 0x004, 00072 }; 00073 00074 int _flags; 00075 LNormald _tangent; 00076 LNormald _binormal; 00077 LTexCoord3d _uvw; 00078 00079 public: 00080 static TypeHandle get_class_type() { 00081 return _type_handle; 00082 } 00083 static void init_type() { 00084 EggNamedObject::init_type(); 00085 register_type(_type_handle, "EggVertexUV", 00086 EggNamedObject::get_class_type()); 00087 } 00088 virtual TypeHandle get_type() const { 00089 return get_class_type(); 00090 } 00091 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00092 00093 private: 00094 static TypeHandle _type_handle; 00095 }; 00096 00097 #include "eggVertexUV.I" 00098 00099 #endif 00100