Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/egg/eggAttributes.h

Go to the documentation of this file.
00001 // Filename: eggAttributes.h
00002 // Created by:  drose (16Jan99)
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 EGGATTRIBUTES_H
00020 #define EGGATTRIBUTES_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "eggMorphList.h"
00025 
00026 #include <typedObject.h>
00027 #include <luse.h>
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : EggAttributes
00031 // Description : The set of attributes that may be applied to vertices
00032 //               as well as polygons, such as surface normal and
00033 //               color.
00034 //
00035 //               This class cannot inherit from EggObject, because it
00036 //               causes problems at the EggPolygon level with multiple
00037 //               appearances of the EggObject base class.  And making
00038 //               EggObject a virtual base class is just no fun.
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDAEGG EggAttributes {
00041 public:
00042   EggAttributes();
00043   EggAttributes(const EggAttributes &copy);
00044   EggAttributes &operator = (const EggAttributes &copy);
00045   virtual ~EggAttributes();
00046 
00047   INLINE bool has_normal() const;
00048   INLINE const Normald &get_normal() const;
00049   INLINE void set_normal(const Normald &normal);
00050   INLINE void clear_normal();
00051 
00052   INLINE bool has_uv() const;
00053   INLINE const TexCoordd &get_uv() const;
00054   INLINE void set_uv(const TexCoordd &texCoord);
00055   INLINE void clear_uv();
00056 
00057   INLINE bool has_color() const;
00058   INLINE Colorf get_color() const;
00059   INLINE void set_color(const Colorf &Color);
00060   INLINE void clear_color();
00061 
00062   void write(ostream &out, int indent_level) const;
00063   bool sorts_less_than(const EggAttributes &other) const;
00064 
00065   void transform(const LMatrix4d &mat);
00066 
00067   EggMorphNormalList _dnormals;
00068   EggMorphTexCoordList _duvs;
00069   EggMorphColorList _drgbas;
00070 
00071 private:
00072   enum Flags {
00073     F_has_normal = 0x001,
00074     F_has_uv     = 0x002,
00075     F_has_color  = 0x004,
00076   };
00077 
00078   int _flags;
00079   Normald _normal;
00080   TexCoordd _uv;
00081   Colorf _color;
00082 
00083 
00084 public:
00085   static TypeHandle get_class_type() {
00086     return _type_handle;
00087   }
00088   static void init_type() {
00089     register_type(_type_handle, "EggAttributes");
00090   }
00091 
00092 private:
00093   static TypeHandle _type_handle;
00094 };
00095 
00096 #include "eggAttributes.I"
00097 
00098 #endif
00099 

Generated on Fri May 2 00:37:27 2003 for Panda by doxygen1.3